Skip to content

Commit

Permalink
Improve nativeruntime skipping logic
Browse files Browse the repository at this point in the history
Previously, the logic to handle SKIP_NATIVERUNTIME_BUILD in
processResources was in a Gradle 'onlyIf' block, which meant that the
'makeNativeRuntime' task still ran.

Update the nativeruntie processResources task to also skip running
`makeNativeRuntime` if SKIP_NATIVERUNTIME_BUILD is set to true.
  • Loading branch information
hoisie committed Nov 29, 2021
1 parent 46ae51f commit e4bb53a
Showing 1 changed file with 12 additions and 7 deletions.
19 changes: 12 additions & 7 deletions nativeruntime/build.gradle
Expand Up @@ -87,14 +87,19 @@ task makeNativeRuntime {

processResources {
def os = osName()
onlyIf { !System.getenv('SKIP_NATIVERUNTIME_BUILD') && (os.contains("linux") || os.contains("mac")) }
dependsOn makeNativeRuntime
from ("$buildDir/cpp") {
include '*libnativeruntime.*'
rename { String fileName ->
fileName.replace("libnativeruntime", "librobolectric-nativeruntime")
if (System.getenv('SKIP_NATIVERUNTIME_BUILD')) {
println("Skipping the nativeruntime build");
} else if (!os.contains("linux") && !os.contains("mac")) {
println("Building the nativeruntime not supported for OS '${System.getProperty("os.name")}'")
} else {
dependsOn makeNativeRuntime
from ("$buildDir/cpp") {
include '*libnativeruntime.*'
rename { String fileName ->
fileName.replace("libnativeruntime", "librobolectric-nativeruntime")
}
into "native/${os}/${arch()}/"
}
into "native/${os}/${arch()}/"
}
}

Expand Down

0 comments on commit e4bb53a

Please sign in to comment.