From 978f86b25cfb3897395531c8911f5fcd68f48a8f Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 10:43:58 -0600 Subject: [PATCH] automagically detect java_home in gradle --- build.gradle | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build.gradle b/build.gradle index 682d82983d..80faedb983 100644 --- a/build.gradle +++ b/build.gradle @@ -38,6 +38,13 @@ ext { platform = project.hasProperty('platform') ? platform : currentPlatform arch = project.hasProperty('arch') ? arch : currentArch platformArch = "${platform}-${arch}" + + java_home = System.properties.'java.home' + if(java_home.endsWith("/jre")) { + java_home = java_home.substring(0, java_home.length() - "/jre".length()) + } + java_home = java_home + } model { @@ -60,7 +67,7 @@ model { executable "make" args "platform=${platform.operatingSystem.name}", "arch=${platform.architecture.name}" - environment JAVA_HOME: "/usr/local/java" + environment JAVA_HOME: java_home } assemble {