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..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,16 +50,38 @@ class PlatformHelper return "sunos" } + if ( name.contains( "aix" ) ) + { + return "aix" + } + throw new IllegalArgumentException( "Unsupported OS: " + name ) } public String getOsArch() { final String arch = property( "os.arch" ).toLowerCase() + + if ( arch.equals( "ppc64le" ) ) + { + return "ppc64le" + } + + if ( arch.equals( "ppc64" ) ) + { + return "ppc64" + } + + 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" )) { 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..a562484 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,18 @@ 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 + 'AIX' | 'ppc64' | 'aix' | 'ppc64' | false } def "throw exception if unsupported os"() 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