From 789eec717e09e9bbd65312314dc84dee36700c35 Mon Sep 17 00:00:00 2001 From: Dietmar Scheidl Date: Thu, 21 Dec 2017 12:12:32 +0100 Subject: [PATCH 1/4] add detection of ppc64le and s390x --- .../moowork/gradle/node/util/PlatformHelper.groovy | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy b/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy index 981ae12..eb49c75 100644 --- a/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy +++ b/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy @@ -56,10 +56,22 @@ class PlatformHelper public String getOsArch() { final String arch = property( "os.arch" ).toLowerCase() + + if ( arch.equals( "ppc64le" ) ) + { + return "ppc64le" + } + + if ( arch.equals( "s390x" ) ) + { + return "s390x" + } + if ( arch.contains( "64" ) ) { return "x64" } + //as Java just returns "arm" on all ARM variants, we need a system call to determine the exact arch if( arch.equals( "arm" )) { From f48f74aa136884884dffe99c1d2b619a2aff0725 Mon Sep 17 00:00:00 2001 From: Dietmar Scheidl Date: Thu, 21 Dec 2017 12:17:23 +0100 Subject: [PATCH 2/4] extend test for detection of ppc64le and s390x --- .../node/util/PlatformHelperTest.groovy | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy b/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy index 2bb37d3..ebc9f99 100644 --- a/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy +++ b/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy @@ -29,15 +29,17 @@ class PlatformHelperTest this.helper.isWindows() == isWindows where: - osProp | archProp | osName | osArch | isWindows - 'Windows 8' | 'x86' | 'win' | 'x86' | true - 'Windows 8' | 'x86_64' | 'win' | 'x64' | true - 'Mac OS X' | 'x86' | 'darwin' | 'x86' | false - 'Mac OS X' | 'x86_64' | 'darwin' | 'x64' | false - 'Linux' | 'x86' | 'linux' | 'x86' | false - 'Linux' | 'x86_64' | 'linux' | 'x64' | false - 'SunOS' | 'x86' | 'sunos' | 'x86' | false - 'SunOS' | 'x86_64' | 'sunos' | 'x64' | false + osProp | archProp | osName | osArch | isWindows + 'Windows 8' | 'x86' | 'win' | 'x86' | true + 'Windows 8' | 'x86_64' | 'win' | 'x64' | true + 'Mac OS X' | 'x86' | 'darwin' | 'x86' | false + 'Mac OS X' | 'x86_64' | 'darwin' | 'x64' | false + 'Linux' | 'x86' | 'linux' | 'x86' | false + 'Linux' | 'x86_64' | 'linux' | 'x64' | false + 'SunOS' | 'x86' | 'sunos' | 'x86' | false + 'SunOS' | 'x86_64' | 'sunos' | 'x64' | false + 'Linux' | 'ppc64le' | 'linux' | 'ppc64le' | false + 'Linux' | 's390x' | 'linux' | 's390x' | false } def "throw exception if unsupported os"() From c6fba2b627285b9487f2fe4778a28b3844884ba7 Mon Sep 17 00:00:00 2001 From: Dietmar Scheidl Date: Thu, 21 Dec 2017 12:37:04 +0100 Subject: [PATCH 3/4] add detection of aix-ppc64 --- .../com/moowork/gradle/node/util/PlatformHelper.groovy | 10 ++++++++++ .../moowork/gradle/node/util/PlatformHelperTest.groovy | 1 + 2 files changed, 11 insertions(+) diff --git a/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy b/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy index eb49c75..0dd9b81 100644 --- a/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy +++ b/src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy @@ -50,6 +50,11 @@ class PlatformHelper return "sunos" } + if ( name.contains( "aix" ) ) + { + return "aix" + } + throw new IllegalArgumentException( "Unsupported OS: " + name ) } @@ -62,6 +67,11 @@ class PlatformHelper return "ppc64le" } + if ( arch.equals( "ppc64" ) ) + { + return "ppc64" + } + if ( arch.equals( "s390x" ) ) { return "s390x" diff --git a/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy b/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy index ebc9f99..a562484 100644 --- a/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy +++ b/src/test/groovy/com/moowork/gradle/node/util/PlatformHelperTest.groovy @@ -40,6 +40,7 @@ class PlatformHelperTest 'SunOS' | 'x86_64' | 'sunos' | 'x64' | false 'Linux' | 'ppc64le' | 'linux' | 'ppc64le' | false 'Linux' | 's390x' | 'linux' | 's390x' | false + 'AIX' | 'ppc64' | 'aix' | 'ppc64' | false } def "throw exception if unsupported os"() From 68267a24d4c1078d98de292596843e3560154686 Mon Sep 17 00:00:00 2001 From: Dietmar Scheidl Date: Thu, 21 Dec 2017 13:17:06 +0100 Subject: [PATCH 4/4] extend test for detection of aix-ppc64, linux-ppc64le and linux-s390x --- .../node/variant/VariantBuilderTest.groovy | 21 +++++++++++-------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/src/test/groovy/com/moowork/gradle/node/variant/VariantBuilderTest.groovy b/src/test/groovy/com/moowork/gradle/node/variant/VariantBuilderTest.groovy index 7dc1b7a..7216098 100644 --- a/src/test/groovy/com/moowork/gradle/node/variant/VariantBuilderTest.groovy +++ b/src/test/groovy/com/moowork/gradle/node/variant/VariantBuilderTest.groovy @@ -160,15 +160,18 @@ class VariantBuilderTest variant.npmScriptFile.toString().endsWith(NODE_BASE_PATH + nodeDir + PS + "lib${PS}node_modules${PS}npm${PS}bin${PS}npm-cli.js") where: - osName | osArch | nodeDir | depName - 'Linux' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:linux-x86@tar.gz' - 'Linux' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:linux-x64@tar.gz' - 'Mac OS X' | 'x86' | 'node-v0.11.1-darwin-x86' | 'org.nodejs:node:0.11.1:darwin-x86@tar.gz' - 'Mac OS X' | 'x86_64' | 'node-v0.11.1-darwin-x64' | 'org.nodejs:node:0.11.1:darwin-x64@tar.gz' - 'FreeBSD' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:linux-x86@tar.gz' - 'FreeBSD' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:linux-x64@tar.gz' - 'SunOS' | 'x86' | 'node-v0.11.1-sunos-x86' | 'org.nodejs:node:0.11.1:sunos-x86@tar.gz' - 'SunOS' | 'x86_64' | 'node-v0.11.1-sunos-x64' | 'org.nodejs:node:0.11.1:sunos-x64@tar.gz' + osName | osArch | nodeDir | depName + 'Linux' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:linux-x86@tar.gz' + 'Linux' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:linux-x64@tar.gz' + 'Mac OS X' | 'x86' | 'node-v0.11.1-darwin-x86' | 'org.nodejs:node:0.11.1:darwin-x86@tar.gz' + 'Mac OS X' | 'x86_64' | 'node-v0.11.1-darwin-x64' | 'org.nodejs:node:0.11.1:darwin-x64@tar.gz' + 'FreeBSD' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:linux-x86@tar.gz' + 'FreeBSD' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:linux-x64@tar.gz' + 'SunOS' | 'x86' | 'node-v0.11.1-sunos-x86' | 'org.nodejs:node:0.11.1:sunos-x86@tar.gz' + 'SunOS' | 'x86_64' | 'node-v0.11.1-sunos-x64' | 'org.nodejs:node:0.11.1:sunos-x64@tar.gz' + 'Linux' | 'ppc64le' | 'node-v0.11.1-linux-ppc64le' | 'org.nodejs:node:0.11.1:linux-ppc64le@tar.gz' + 'Linux' | 's390x' | 'node-v0.11.1-linux-s390x' | 'org.nodejs:node:0.11.1:linux-s390x@tar.gz' + 'AIX' | 'ppc64' | 'node-v0.11.1-aix-ppc64' | 'org.nodejs:node:0.11.1:aix-ppc64@tar.gz' } @Unroll