Skip to content

Commit

Permalink
Fix missing property exception when using plugin in conjunction with …
Browse files Browse the repository at this point in the history
…Node 6.x.x on Windows (fixes #167)
  • Loading branch information
Sten Roger Sandvik committed Dec 2, 2016
2 parents 1d79f5a + 56ac010 commit 79c3efa
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ class VariantBuilder
def tokens = version.tokenize( '.' );
def majorVersion = tokens[0].toInteger()
def minorVersion = tokens[1].toInteger()
def microVersion = tokens[2].toInteger()
if (
( majorVersion == 4 && minorVersion >= 5 ) // >= 4.5.0
|| ( majorVersion == 6 && (minorVersion > 2 || (minorVersion == 2 && microVersion >= 1)) ) // >= 6.2.1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,11 +103,13 @@ class VariantBuilderTest
this.props.setProperty("os.arch", osArch)
def ext = new NodeExtension(project)
ext.version = '4.5.0'
ext.version = version
ext.workDir = new File('.gradle/node').absoluteFile
def builder = new VariantBuilder(ext)
def variant = builder.build()
def nodeDir = "node-v${version}-${osArch}".toString()
def depName = "org.nodejs:node:${version}:${osArch}@zip".toString()

expect:
variant != null
Expand All @@ -121,9 +123,13 @@ class VariantBuilderTest
variant.npmDir.toString().endsWith(NODE_BASE_PATH + nodeDir + PS + "node_modules")
variant.npmScriptFile.toString().endsWith(NODE_BASE_PATH + nodeDir + PS + "node_modules${PS}npm${PS}bin${PS}npm-cli.js")
where:
osArch | nodeDir | depName
'x86' | 'node-v4.5.0-win-x86' | 'org.nodejs:node:4.5.0:win-x86@zip'
'x86_64' | 'node-v4.5.0-win-x64' | 'org.nodejs:node:4.5.0:win-x64@zip'
version | osArch
"4.5.0" | "win-x86"
"6.2.1" | "win-x86"
"7.0.0" | "win-x86"
"4.5.0" | "win-x64"
"6.2.1" | "win-x64"
"7.0.0" | "win-x64"
}

@Unroll
Expand Down

0 comments on commit 79c3efa

Please sign in to comment.