Gradle Version: all inc 3.1
Operating System and JVM version:
java version "1.8.0_92"
Java™ SE Runtime Environment (build 1.8.0_92-b14)
Java HotSpot™ 64-Bit Server VM (build 25.92-b14, mixed mode)
SunOS 5.10 Generic_147147-26 sun4v sparc sun4v
Is this a regression? No If yes, which version of Gradle do you know it last worked for?
Default shell on Solaris does not support shell variable export and assignment on a single line. Hence gradle is producing invalid shell scripts e.g.
> #!/bin/sh
> APP_BASE_NAME=`dirname "$0"`
> export DYLD_LIBRARY_PATH="$APP_BASE_NAME/lib"
> export LD_LIBRARY_PATH="$APP_BASE_NAME/lib"
> exec "$APP_BASE_NAME/lib/test" "$@"
Desirable solution would be:
> #!/bin/sh
> APP_BASE_NAME=`dirname "$0"`
> DYLD_LIBRARY_PATH="$APP_BASE_NAME/lib"
> export DYLD_LIBRARY_PATH
> LD_LIBRARY_PATH="$APP_BASE_NAME/lib"
> export LD_LIBRARY_PATH
> exec "$APP_BASE_NAME/lib/test" "$@"
i.e. assignment and export on separate lines.
Patch to this effect:
diff --git a/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/tasks/InstallExecutable.java b/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/tasks/InstallExecutable.java
index 772b13b..b655804 100644
--- a/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/tasks/InstallExecutable.java
+++ b/subprojects/platform-native/src/main/java/org/gradle/nativeplatform/tasks/InstallExecutable.java
@@ -191,8 +191,10 @@ public class InstallExecutable extends DefaultTask {
String runScriptText =
"#!/bin/sh"
+ "\nAPP_BASE_NAME=`dirname \"$0\"`"
- + "\nexport DYLD_LIBRARY_PATH=\"$APP_BASE_NAME/lib\""
- + "\nexport LD_LIBRARY_PATH=\"$APP_BASE_NAME/lib\""
+ + "\nDYLD_LIBRARY_PATH=\"$APP_BASE_NAME/lib\""
+ + "\nexport DYLD_LIBRARY_PATH"
+ + "\nLD_LIBRARY_PATH=\"$APP_BASE_NAME/lib\""
+ + "\nexport LD_LIBRARY_PATH"
+ "\nexec \"$APP_BASE_NAME/lib/" + executable.getName() + "\" \"$@\""
+ "\n";
GFileUtils.writeFile(runScriptText, getRunScript());