Skip to content

Commit

Permalink
Add prepareLocalProperties task for creating file when not exists
Browse files Browse the repository at this point in the history
  • Loading branch information
micbakos-rdx committed Feb 22, 2024
1 parent 9e59fa8 commit 0300028
Showing 1 changed file with 17 additions and 0 deletions.
17 changes: 17 additions & 0 deletions jvm/sargon-android/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,23 @@ publishing {
}
}

// buildCargoNdk(Debug/Release) require for the existence of local.properties file
// Since it is ignored, we have to create it on CI's workflow
tasks.register("prepareLocalProperties") {
onlyIf {
// Will only run when file does not exist. Will not affect local builds.
!File("${rootDir}/local.properties").exists()
}

doLast {
file("${rootDir}/local.properties").writeText(
"local.properties=${System.getenv("ANDROID_HOME")}"
)
}

tasks.getByName("preBuild").dependsOn(this)
}

android.libraryVariants.all {
val buildType = name
val buildTypeUpper = buildType.capitalized()
Expand Down

0 comments on commit 0300028

Please sign in to comment.