Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix detection of ppc64le and s390x #279

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions src/main/groovy/com/moowork/gradle/node/util/PlatformHelper.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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" ))
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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:[email protected]'
'Linux' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'Mac OS X' | 'x86' | 'node-v0.11.1-darwin-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'Mac OS X' | 'x86_64' | 'node-v0.11.1-darwin-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'FreeBSD' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'FreeBSD' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'SunOS' | 'x86' | 'node-v0.11.1-sunos-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'SunOS' | 'x86_64' | 'node-v0.11.1-sunos-x64' | 'org.nodejs:node:0.11.1:[email protected]'
osName | osArch | nodeDir | depName
'Linux' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'Linux' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'Mac OS X' | 'x86' | 'node-v0.11.1-darwin-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'Mac OS X' | 'x86_64' | 'node-v0.11.1-darwin-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'FreeBSD' | 'x86' | 'node-v0.11.1-linux-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'FreeBSD' | 'x86_64' | 'node-v0.11.1-linux-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'SunOS' | 'x86' | 'node-v0.11.1-sunos-x86' | 'org.nodejs:node:0.11.1:[email protected]'
'SunOS' | 'x86_64' | 'node-v0.11.1-sunos-x64' | 'org.nodejs:node:0.11.1:[email protected]'
'Linux' | 'ppc64le' | 'node-v0.11.1-linux-ppc64le' | 'org.nodejs:node:0.11.1:[email protected]'
'Linux' | 's390x' | 'node-v0.11.1-linux-s390x' | 'org.nodejs:node:0.11.1:[email protected]'
'AIX' | 'ppc64' | 'node-v0.11.1-aix-ppc64' | 'org.nodejs:node:0.11.1:[email protected]'
}

@Unroll
Expand Down