From 1b2c9afe1cbaafd99c0ceebf31fa16395a32487e Mon Sep 17 00:00:00 2001 From: Michael Hoisie Date: Mon, 29 Nov 2021 12:27:29 -0500 Subject: [PATCH] Improve nativeruntime skipping logic 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. --- nativeruntime/build.gradle | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/nativeruntime/build.gradle b/nativeruntime/build.gradle index 76fc683515b..5914e10c262 100644 --- a/nativeruntime/build.gradle +++ b/nativeruntime/build.gradle @@ -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()}/" } }