From 4b4259be8711cc1ed407433ac3bbb32aad7cd278 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 09:13:14 -0600 Subject: [PATCH 1/6] change classpath artifact name to 'classpath-avian' and remove c++ sources from it --- build.gradle | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/build.gradle b/build.gradle index 3d8822efee..e6165730dd 100644 --- a/build.gradle +++ b/build.gradle @@ -74,9 +74,6 @@ sourceSets { java { srcDir 'classpath' } - resources { - srcDir 'classpath' - } } } @@ -92,6 +89,10 @@ task javadocJar(type: Jar) { } } +jar { + baseName "classpath-avian" +} + task install { dependsOn assemble, publish } From 282ebf9d84d6a988a8b3cba9f6dd2d3e30ff8496 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 10:39:36 -0600 Subject: [PATCH 2/6] move binaryToObject to a 'tools' artifact --- build.gradle | 82 ++++++++++++++++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 32 deletions(-) diff --git a/build.gradle b/build.gradle index e6165730dd..682d82983d 100644 --- a/build.gradle +++ b/build.gradle @@ -13,32 +13,43 @@ apply plugin: 'ivy-publish' apply plugin: 'java' apply plugin: 'artifactory-publish' +public String adjustArch(String arch) { + switch(arch) { + case ~/.*64.*/: return 'x86_64' + default: return 'i386' + } +} + +public String adjustPlatform(String platform) { + switch(platform.replaceAll(' ', '').toLowerCase()) { + case ~/.*linux.*/: return 'linux' + case ~/.*darwin.*/: return 'macosx' + case ~/.*osx.*/: return 'macosx' + case ~/.*win.*/: return 'windows' + default: return platform + } +} + +ext { + currentPlatform = adjustPlatform(System.properties['os.name']) + currentArch = adjustArch(System.properties['os.arch']) + currentPlatformArch = "${currentPlatform}-${currentArch}" + + platform = project.hasProperty('platform') ? platform : currentPlatform + arch = project.hasProperty('arch') ? arch : currentArch + platformArch = "${platform}-${arch}" +} + model { platforms { - if(project.hasProperty("platform") && project.hasProperty("arch")) { - create("${platform}-${arch}") { - operatingSystem "${platform}" - architecture "${arch}" - } - } else { - create("linux-x86_64") { - operatingSystem "linux" - architecture "x86_64" - } - - create("linux-i386") { - operatingSystem "linux" - architecture "i386" - } - - create("windows-x86_64") { - operatingSystem "windows" - architecture "x86_64" - } - - create("windows-i386") { - operatingSystem "windows" - architecture "i386" + create(platformArch) { + operatingSystem "${platform}" + architecture "${arch}" + } + if(platformArch != currentPlatformArch) { + create(currentPlatformArch) { + operatingSystem "${currentPlatform}" + architecture "${currentArch}" } } } @@ -106,8 +117,6 @@ publishing { } publications { - def binSuffix="" - def publishBinSuffix="bin" ivy(IvyPublication) { from components.java @@ -115,7 +124,22 @@ publishing { artifact(javadocJar) } + create("tools-${currentPlatformArch}", IvyPublication) { + module "avian-tools-${currentPlatformArch}" + + def publishBinSuffix = currentPlatform == "windows" ? "exe" : "bin" + def binSuffix = currentPlatform == "windows" ? ".exe" : "" + artifact("${buildDir}/${currentPlatform}-${currentArch}/binaryToObject/binaryToObject") { + name "binaryToObject" + type publishBinSuffix + extension binSuffix + } + } + platforms.each { platform -> + def binSuffix="" + def publishBinSuffix="bin" + create(platform.name, IvyPublication) { def nativeBuildDir = "${buildDir}/${platform.operatingSystem.name}-${platform.architecture.name}" @@ -132,12 +156,6 @@ publishing { extension publishBinSuffix } - artifact("${nativeBuildDir}/binaryToObject/binaryToObject") { - name "binaryToObject" - type publishBinSuffix - extension publishBinSuffix - } - artifact("${nativeBuildDir}/libavian.a") { name "libavian" type "a" From 978f86b25cfb3897395531c8911f5fcd68f48a8f Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 10:43:58 -0600 Subject: [PATCH 3/6] 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 { From d2809f2c4dbea5ba75ea35b670c2ec854d055b88 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 10:56:58 -0600 Subject: [PATCH 4/6] adjust gradle publish coordinates --- build.gradle | 10 ++++++---- gradle.properties | 2 +- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/build.gradle b/build.gradle index 80faedb983..d2b001c4eb 100644 --- a/build.gradle +++ b/build.gradle @@ -129,10 +129,12 @@ publishing { from components.java artifact(javadocJar) + + module "classpath-avian" } - create("tools-${currentPlatformArch}", IvyPublication) { - module "avian-tools-${currentPlatformArch}" + create("tools-avian-${currentPlatformArch}", IvyPublication) { + module "tools-avian-${currentPlatformArch}" def publishBinSuffix = currentPlatform == "windows" ? "exe" : "bin" def binSuffix = currentPlatform == "windows" ? ".exe" : "" @@ -155,12 +157,12 @@ publishing { binSuffix = ".${publishBinSuffix}" } - module "${project.name}-${platform.name}" + module "runtime-avian-${platform.name}" artifact("${nativeBuildDir}/avian${binSuffix}") { name "avian" type publishBinSuffix - extension publishBinSuffix + extension binSuffix } artifact("${nativeBuildDir}/libavian.a") { diff --git a/gradle.properties b/gradle.properties index c9cd254b82..2afe5bbe98 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,4 +1,4 @@ org.gradle.daemon=true -group=com.readytalk +group=com.readytalk.avian version=1.1.0-SNAPSHOT \ No newline at end of file From 38d67216b5f3636670849f7f5bfdae7ed3c79140 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 19:19:31 -0600 Subject: [PATCH 5/6] fix gradle macosx OperatingSystem naming --- build.gradle | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index d2b001c4eb..50b04cb582 100644 --- a/build.gradle +++ b/build.gradle @@ -13,6 +13,41 @@ apply plugin: 'ivy-publish' apply plugin: 'java' apply plugin: 'artifactory-publish' +enum SupportedOS implements OperatingSystem { + LINUX, WINDOWS, MACOSX; + + public static final SupportedOS CURRENT; + + static { + String p = System.properties['os.name'] + switch(p.replaceAll(' ', '').toLowerCase()) { + case ~/.*linux.*/: CURRENT = LINUX; break; + case ~/.*darwin.*/: CURRENT = MACOSX; break; + case ~/.*osx.*/: CURRENT = MACOSX; break; + case ~/.*win.*/: CURRENT = WINDOWS; break; + default: + String m = "SupportedOS: unrecognized platform: ${p}" + println(m) + throw new IllegalArgumentException(m) + } + } + + public String getName() { + return toString().toLowerCase() + } + + public String getDisplayName() { + return getName() + } + public boolean isCurrent() { return this == CURRENT } + public boolean isFreeBSD() { return false } + public boolean isLinux() { return this == LINUX } + public boolean isMacOsX() { return this == MACOSX } + public boolean isSolaris() { return false } + public boolean isWindows() { return this == WINDOWS } + +} + public String adjustArch(String arch) { switch(arch) { case ~/.*64.*/: return 'x86_64' @@ -20,18 +55,8 @@ public String adjustArch(String arch) { } } -public String adjustPlatform(String platform) { - switch(platform.replaceAll(' ', '').toLowerCase()) { - case ~/.*linux.*/: return 'linux' - case ~/.*darwin.*/: return 'macosx' - case ~/.*osx.*/: return 'macosx' - case ~/.*win.*/: return 'windows' - default: return platform - } -} - ext { - currentPlatform = adjustPlatform(System.properties['os.name']) + currentPlatform = SupportedOS.CURRENT.getName() currentArch = adjustArch(System.properties['os.arch']) currentPlatformArch = "${currentPlatform}-${currentArch}" @@ -50,12 +75,12 @@ ext { model { platforms { create(platformArch) { - operatingSystem "${platform}" + operatingSystem SupportedOS.valueOf(platform.toUpperCase()) architecture "${arch}" } if(platformArch != currentPlatformArch) { create(currentPlatformArch) { - operatingSystem "${currentPlatform}" + operatingSystem SupportedOS.CURRENT architecture "${currentArch}" } } From ea10178a55e57f62614804c1863b19306d2255e5 Mon Sep 17 00:00:00 2001 From: Joshua Warner Date: Thu, 21 Aug 2014 22:03:41 -0600 Subject: [PATCH 6/6] publish vm.pro as part of the classpath artifact --- build.gradle | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.gradle b/build.gradle index 50b04cb582..36686eacb3 100644 --- a/build.gradle +++ b/build.gradle @@ -155,6 +155,12 @@ publishing { artifact(javadocJar) + artifact("vm.pro") { + name "vm" + type "proguard" + extension "pro" + } + module "classpath-avian" }