| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 
 | Description: the CMake build task should be run only once.
 Yet it would be called twice when we run the build and then the tests. We add
 a check to prevent such situation.
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2021-12-24
--- a/build.gradle
+++ b/build.gradle
@@ -44,12 +44,13 @@
 }
 
 task cmakeBuild(type: Exec) {
+    def soCompression = file("$nativeBuildDir/libgkl_compression.so")
     // hide stdout, but print stderr
     standardOutput = new ByteArrayOutputStream()
     workingDir nativeBuildDir
-    commandLine 'make', 'install', '-j', Runtime.runtime.availableProcessors()
-    // always run this task
-    outputs.upToDateWhen {false}
+    //Run only if we never executed copyNativeLib.
+    if (!soCompression.exists()) commandLine 'make', 'install'
+    else commandLine 'true'
 }
 
 task copyNativeLib(type: Copy) {
 |