diff options
-rw-r--r-- | android/build.gradle | 17 | ||||
-rw-r--r-- | android/gradle/props.gradle | 11 | ||||
-rwxr-xr-x | distribution/makedist.py | 6 | ||||
-rw-r--r-- | distribution/src/common/build.gradle | 13 | ||||
-rw-r--r-- | distribution/src/common/gradle.properties | 12 | ||||
-rw-r--r-- | distribution/src/common/gradle.properties.android | 23 | ||||
-rw-r--r-- | distribution/src/common/ice.gradle | 31 | ||||
-rw-r--r-- | distribution/src/common/props.gradle | 114 | ||||
-rw-r--r-- | java/build.gradle | 6 | ||||
-rw-r--r-- | java/demo/Ice/applet/build.gradle | 49 | ||||
-rw-r--r-- | java/gradle/ice.gradle | 1 | ||||
-rw-r--r-- | java/src/Ice/build.gradle | 7 |
12 files changed, 253 insertions, 37 deletions
diff --git a/android/build.gradle b/android/build.gradle index 93cf317706c..a296f5d504f 100644 --- a/android/build.gradle +++ b/android/build.gradle @@ -21,6 +21,7 @@ subprojects { project.group = "com.zeroc" apply plugin: 'idea' + apply from: "$rootProject.projectDir/gradle/props.gradle" // The Android versions used by subprojects. ext.ice_compileSdkVersion = 17 @@ -29,8 +30,20 @@ subprojects { ext.ice_targetSdkVersion = 17 repositories { - maven { - url 'http://repo.zeroc.com/nexus/content/repositories/thirdparty' + if (distJarDir != null) { + flatDir { + name "local" + dirs distJarDir + } + } + + if (!useLocalOnly) { + maven { + url 'http://repo.zeroc.com/nexus/content/repositories/thirdparty' + } + maven { + url 'http://repo.zeroc.com/nexus/content/repositories/releases' + } } } } diff --git a/android/gradle/props.gradle b/android/gradle/props.gradle new file mode 100644 index 00000000000..40ae5214a92 --- /dev/null +++ b/android/gradle/props.gradle @@ -0,0 +1,11 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +ext.useLocalOnly = false +ext.distJarDir = null diff --git a/distribution/makedist.py b/distribution/makedist.py index dc7bae3f09a..f831568683d 100755 --- a/distribution/makedist.py +++ b/distribution/makedist.py @@ -487,8 +487,9 @@ copy(os.path.join(srcDir, "android", "gradlew"), os.path.join(demoDir, "java", " copy(os.path.join(srcDir, "android", "gradle", "wrapper"), os.path.join(demoDir, "java", "android", "gradle", "wrapper"), False) copy(os.path.join(srcDir, "android", "gradle", "GRADLE_LICENSE"), os.path.join(demoDir, "java", "android", "gradle", "GRADLE_LICENSE"), False) copy(os.path.join(srcDir, "android", "build.gradle"), os.path.join(demoDir, "java", "android"), False) -copy(os.path.join(srcDir, "android", "gradle.properties"), os.path.join(demoDir, "java", "android"), False) +copy(os.path.join(distFilesDir, "src", "common", "gradle.properties.android"), os.path.join(demoDir, "java", "android", "gradle.properties"), False) copy(os.path.join(distFilesDir, "src", "common", "settings.gradle.android"), os.path.join(demoDir, "java", "android", "settings.gradle"), False) +copy(os.path.join(distFilesDir, "src", "common", "props.gradle"), os.path.join(demoDir, "java", "android", "gradle"), False) gradleSubstituteExprs = [(re.compile(re.escape("apply plugin: 'slice'")), "")] for root, dirnames, filesnames in os.walk(os.path.join(demoDir, "java", "android")): @@ -596,8 +597,9 @@ copy(os.path.join(srcDir, "android", "gradlew.bat"), os.path.join(winDemoDir, "j copy(os.path.join(srcDir, "android", "gradle", "wrapper"), os.path.join(winDemoDir, "java", "android", "gradle", "wrapper"), False) copy(os.path.join(srcDir, "android", "gradle", "GRADLE_LICENSE"), os.path.join(winDemoDir, "java", "android", "gradle", "GRADLE_LICENSE"), False) copy(os.path.join(srcDir, "android", "build.gradle"), os.path.join(winDemoDir, "java", "android"), False) -copy(os.path.join(srcDir, "android", "gradle.properties"), os.path.join(winDemoDir, "java", "android"), False) +copy(os.path.join(distFilesDir, "src", "common", "gradle.properties.android"), os.path.join(winDemoDir, "java", "android", "gradle.properties"), False) copy(os.path.join(distFilesDir, "src", "common", "settings.gradle.android"), os.path.join(winDemoDir, "java", "android", "settings.gradle"), False) +copy(os.path.join(distFilesDir, "src", "common", "props.gradle"), os.path.join(winDemoDir, "java", "android", "gradle"), False) gradleSubstituteExprs = [(re.compile(re.escape("apply plugin: 'slice'")), "")] for root, dirnames, filesnames in os.walk(os.path.join(winDemoDir, "java", "android")): diff --git a/distribution/src/common/build.gradle b/distribution/src/common/build.gradle index febc2378edc..5a700b3f07a 100644 --- a/distribution/src/common/build.gradle +++ b/distribution/src/common/build.gradle @@ -21,11 +21,14 @@ subprojects { dirs distJarDir } } - maven { - url 'http://repo.zeroc.com/nexus/content/repositories/thirdparty' - } - maven { - url 'http://repo.zeroc.com/nexus/content/repositories/releases' + + if (!useLocalOnly) { + maven { + url 'http://repo.zeroc.com/nexus/content/repositories/thirdparty' + } + maven { + url 'http://repo.zeroc.com/nexus/content/repositories/releases' + } } } } diff --git a/distribution/src/common/gradle.properties b/distribution/src/common/gradle.properties index 8e1b2fe38ba..95b4df6c5d7 100644 --- a/distribution/src/common/gradle.properties +++ b/distribution/src/common/gradle.properties @@ -20,3 +20,15 @@ dbHome = // false otherwise. // debug = true + +// +// Set iceHome to location of Ice installation if Ice was installed in a +// non-standard location. +// +iceHome = + +// +// Define localOnly to true if build should not get any artifacts remotely. +// If you set localOnly to true you must also set iceHome above. +// +localOnly = false diff --git a/distribution/src/common/gradle.properties.android b/distribution/src/common/gradle.properties.android new file mode 100644 index 00000000000..7c575f3e7f7 --- /dev/null +++ b/distribution/src/common/gradle.properties.android @@ -0,0 +1,23 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +iceVersion = 3.6b + +// +// Set iceHome to location of Ice installation if Ice was installed in a +// non-standard location. +// +iceHome = + +// +// Define localOnly to true if build should not get Ice artifacts remotely. +// Android artifacts will always be downloaded remotely. +// If you set localOnly to true you must also set iceHome above. +// +localOnly = false diff --git a/distribution/src/common/ice.gradle b/distribution/src/common/ice.gradle index 6df1650bf2a..6e3eb96bc2f 100644 --- a/distribution/src/common/ice.gradle +++ b/distribution/src/common/ice.gradle @@ -9,8 +9,15 @@ buildscript { repositories { - maven { - url 'http://repo.zeroc.com/nexus/content/repositories/releases' + if (localOnly == "true") { + flatDir { + name "local" + dirs "${iceHome}/lib" + } + } else { + maven { + url 'http://repo.zeroc.com/nexus/content/repositories/releases' + } } } dependencies { @@ -23,6 +30,7 @@ if (!project.plugins.findPlugin(com.zeroc.gradle.plugins.slice.SlicePlugin)) { } ext.generatedDir = "$project.buildDir/generated" +ext.useLocalOnly = localOnly == "true" def android = false try { @@ -45,10 +53,21 @@ if (System.properties['os.name'].toLowerCase().contains('windows')) slice2freezej = "slice2freezej.exe" } -// First check if ICE_HOME is set and it points at a valid installation +// First check if iceHome was set in +if (iceHome) +{ + def translator = new File("$iceHome/bin/$slice2java") + if (!translator.exists()) + { + throw new GradleException("Unable to find $slice2java in $iceHome, please verify iceHome is " + + "properly configured in gradle.properties and Ice is correctly installed.") + } +} + +// Next check if ICE_HOME is set and it points at a valid installation def env = System.getenv() -def iceHome = env['ICE_HOME'] -if (iceHome != null && iceHome.length() > 0) +iceHome = env['ICE_HOME'] +if (iceHome) { def translator = new File("$iceHome/bin/$slice2java") if (!translator.exists()) @@ -62,7 +81,7 @@ def iceBinDist = true // First check if we are building against source distribution def iceDir -if (iceHome != null && iceHome.length() > 0) +if (iceHome) { iceDir = iceHome } diff --git a/distribution/src/common/props.gradle b/distribution/src/common/props.gradle new file mode 100644 index 00000000000..15aecb22bdb --- /dev/null +++ b/distribution/src/common/props.gradle @@ -0,0 +1,114 @@ +// ********************************************************************** +// +// Copyright (c) 2003-2014 ZeroC, Inc. All rights reserved. +// +// This copy of Ice is licensed to you under the terms described in the +// ICE_LICENSE file included in this distribution. +// +// ********************************************************************** + +ext.useLocalOnly = localOnly == "true" + +// Determine the name of the Slice-to-Java translator +def isWindows = false +def slice2java = "slice2java" +def slice2freezej = "slice2freezej" +if (System.properties['os.name'].toLowerCase().contains('windows')) +{ + isWindows = true + slice2java = "slice2java.exe" + slice2freezej = "slice2freezej.exe" +} + +// First check if iceHome was set in +if (iceHome) +{ + def translator = new File("$iceHome/bin/$slice2java") + if (!translator.exists()) + { + throw new GradleException("Unable to find $slice2java in $iceHome, please verify iceHome is " + + "properly configured in gradle.properties and Ice is correctly installed.") + } +} + +// Next check if ICE_HOME is set and it points at a valid installation +def env = System.getenv() +iceHome = env['ICE_HOME'] +if (iceHome) +{ + def translator = new File("$iceHome/bin/$slice2java") + if (!translator.exists()) + { + throw new GradleException("Unable to find $slice2java in $iceHome, please verify ICE_HOME is " + + "properly configured and Ice is correctly installed.") + } +} + +def iceBinDist = true + +// First check if we are building against source distribution +def iceDir +if (iceHome) +{ + iceDir = iceHome +} + +if (iceDir == null) +{ + def f1 = new File("/usr/bin/$slice2java") + if (f1.exists()) + { + iceDir = "/usr" + } +} + +if (iceDir == null && isWindows) +{ + def progFiles + def arch1 = env['PROCESSOR_ARCHITECTURE'] + def arch2 = env['PROCESSOR_ARCHITEW6432'] + if (arch1 == "AMD64" || arch1 == "IA64" || arch2 == "AMD64" || arch2 == "IA64") + { + progFiles = env['ProgramFiles(x86)'] + } + else + { + progFiles = env['ProgramFiles'] + } + iceDir = "$progFiles\\ZeroC\\Ice-${project.version}" +} + +if (iceDir == null) +{ + def f1 = new File("/Library/Developer/Ice-${project.version}/bin/$slice2java") + if (f1.exists()) + { + iceDir = "/Library/Developer/Ice-${project.version}" + } +} + +if (iceDir == null) +{ + def f1 = new File("/opt/Ice-${project.version}/bin/$slice2java") + if (f1.exists()) + { + iceDir = "/opt/Ice-${project.version}" + } +} + +if (iceDir == null) +{ + throw new GradleException("Unable to find a valid Ice distribution, please verify ICE_HOME is properly " + + "configured and Ice is correctly installed.") +} + +// Set the slice and java jar directory +if (iceDir == "/usr") +{ + ext.distJarDir = "/usr/share/java" +} +else +{ + ext.distJarDir = "$iceDir/lib" +} + diff --git a/java/build.gradle b/java/build.gradle index e4b7b4df3d3..24fed16b6df 100644 --- a/java/build.gradle +++ b/java/build.gradle @@ -53,6 +53,6 @@ apply from: "$rootProject.projectDir/demo/Manual/build.gradle" // Used to build the gradle wrapper to automatically download and install // the version of gradle needed to build Ice. // -//task wrapper(type: Wrapper) { -// gradleVersion = "2.2" -//} +task wrapper(type: Wrapper) { + gradleVersion = "2.2" +} diff --git a/java/demo/Ice/applet/build.gradle b/java/demo/Ice/applet/build.gradle index b4461db7860..930396c981c 100644 --- a/java/demo/Ice/applet/build.gradle +++ b/java/demo/Ice/applet/build.gradle @@ -26,33 +26,44 @@ dependencies { compile localDependency("ice") } -// Don't create the default jar. -jar.enabled = false - buildscript { repositories { maven { url 'http://repo.zeroc.com/nexus/content/repositories/thirdparty' } } - dependencies { - classpath group: 'net.sourceforge', name: 'proguard', version: '5.0' + if (!useLocalOnly) { + dependencies { + classpath group: 'net.sourceforge', name: 'proguard', version: '5.0' + } } } -def libJars = [] -['rt.jar', 'jsse.jar'].each { - libJars << searchFile([{System.env['JAVA_HOME']}, {System.properties['java.home']}], - ["${it}", "lib/${it}", "jre/lib/${it}"]) -} +if (useLocalOnly) { + jar { + archiveName "Hello.jar" + destinationDir = new File("${projectDir}") + from { "${projectDir}/config.applet" } + from { "${rootProject.projectDir}/../certs/client.jks" } + } +} else { + // Don't create the default jar. + jar.enabled = false -task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { - injars configurations.compile.resolve(), filter: '!META-INF/**' - injars "${projectDir}/build/classes/main" - injars "${rootProject.projectDir}/../certs/client.jks" - injars "${projectDir}/config.applet" - outjars "${projectDir}/Hello.jar" - libraryjars libJars - configuration 'applet.pro' + def libJars = [] + ['rt.jar', 'jsse.jar'].each { + libJars << searchFile([{System.env['JAVA_HOME']}, {System.properties['java.home']}], + ["${it}", "lib/${it}", "jre/lib/${it}"]) + } + + task proguardJar(type: proguard.gradle.ProGuardTask, dependsOn: jar) { + injars configurations.compile.resolve(), filter: '!META-INF/**' + injars "${projectDir}/build/classes/main" + injars "${rootProject.projectDir}/../certs/client.jks" + injars "${projectDir}/config.applet" + outjars "${projectDir}/Hello.jar" + libraryjars libJars + configuration 'applet.pro' + } + assemble.dependsOn(proguardJar) } -assemble.dependsOn(proguardJar) diff --git a/java/gradle/ice.gradle b/java/gradle/ice.gradle index 60eb11f9533..dc9fe37b3ed 100644 --- a/java/gradle/ice.gradle +++ b/java/gradle/ice.gradle @@ -10,6 +10,7 @@ apply plugin: 'slice' ext.generatedDir = "$project.buildDir/generated" +ext.useLocalOnly = false def android = false try { diff --git a/java/src/Ice/build.gradle b/java/src/Ice/build.gradle index 59e7aa5e1d0..883615efb92 100644 --- a/java/src/Ice/build.gradle +++ b/java/src/Ice/build.gradle @@ -26,3 +26,10 @@ slice { } apply from: "$rootProject.projectDir/gradle/library.gradle" + +task installSlicePlugin(type: Copy) { + from "${rootProject.projectDir}/buildSrc/build/libs/buildSrc.jar" + into "${DESTDIR}${prefix}/lib" + rename { "slice-1.0.jar" } +} +install.dependsOn(installSlicePlugin) |