Migrate to com.github.node-gradle.node plugin

This commit is contained in:
Joshua Gleitze
2020-01-27 11:28:28 +02:00
parent e2e7e24f01
commit def3ca28c5
4 changed files with 20 additions and 41 deletions

View File

@@ -29,7 +29,7 @@ buildscript {
// project setup
tutteli_plugins_version = '0.32.2'
node_plugin_version = '1.3.1'
node_plugin_version = '2.2.0'
// gh-pages.gradle
docProjects = subprojects.findAll {
@@ -113,7 +113,7 @@ buildscript {
classpath "ch.tutteli:tutteli-gradle-project-utils:$tutteli_plugins_version"
classpath "ch.tutteli:tutteli-gradle-publish:$tutteli_plugins_version"
classpath "ch.tutteli:tutteli-gradle-spek:$tutteli_plugins_version"
classpath "com.moowork.gradle:gradle-node-plugin:$node_plugin_version"
classpath "com.github.node-gradle:gradle-node-plugin:$node_plugin_version"
}
}
@@ -412,7 +412,7 @@ List<Project> projectNamesToProject(String[] names) {
def createJsTestTask(String... subprojectNames) {
configure(projectNamesToProject(subprojectNames)) {
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'
compileTestKotlin2Js.configure {
kotlinOptions.moduleKind = "commonjs"
@@ -441,13 +441,8 @@ def createJsTestTask(String... subprojectNames) {
nodeModulesDir = nodeModulesParentDir
}
task installMocha(type: NpmTask) {
args = ['install', 'mocha', '--prefer-offline']
}
task prepareMocha(dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha])
task runMocha(type: NodeTask, dependsOn: [prepareMocha, test]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMocha(type: NpxTask, dependsOn: [compileTestKotlin2Js, populateNodeModules, test]) {
command = "mocha"
args = [compileTestKotlin2Js.outputFile]
}
check.dependsOn runMocha

View File

@@ -122,9 +122,9 @@
},
"dependencies": {
"glob": {
"version": "7.1.4",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.4.tgz",
"integrity": "sha512-hkLPepehmnKk41pUGm3sYxoFs/umurYfYJCerbXEyFIWcAzvpipAgVkBqqT9RBKMGjnq6kMuyYwha6csxbiM1A==",
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",

View File

@@ -8,13 +8,13 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
}
}
apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'
repositories {
jcenter()
@@ -70,14 +70,6 @@ node {
nodeModulesDir = nodeModulesParentDir
}
task installJasmine(type: NpmTask) {
// note, without the '--prefer-offline' it works only if you are online,
// with '--prefer-offline' it works also offline if you have already as well in case you have already downloaded jasmine once
args = ['install', 'jasmine', '--prefer-offline']
}
task prepareJasmine(dependsOn: [compileTestKotlin2Js, populateNodeModules, installJasmine])
//either you use this task or create a testSetup.kt in your src/test with the following content
//
// // adopt to the api you use
@@ -94,8 +86,8 @@ task establishDependencyToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runJasmine(type: NodeTask, group: 'Verification', dependsOn: [prepareJasmine, test, establishDependencyToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/jasmine/bin/jasmine")
task runJasmine(type: NpxTask, group: 'Verification', dependsOn: [populateNodeModules, test, establishDependencyToAtrium]) {
command = "jasmine"
args = [compileTestKotlin2Js.outputFile]
}
check.dependsOn runJasmine
@@ -154,8 +146,8 @@ task establishDependencyFromCurrentToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runJasmineForCurrent(type: NodeTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, installJasmine, establishDependencyFromCurrentToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/jasmine/bin/jasmine")
task runJasmineForCurrent(type: NpxTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, establishDependencyFromCurrentToAtrium]) {
command = "jasmine"
args = [compileCurrentKotlin2Js.outputFile]
}

View File

@@ -8,13 +8,13 @@ buildscript {
maven { url "https://plugins.gradle.org/m2/" }
}
dependencies {
classpath 'com.moowork.gradle:gradle-node-plugin:1.2.0'
classpath 'com.github.node-gradle:gradle-node-plugin:2.2.0'
classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.2.71'
}
}
apply plugin: 'kotlin2js'
apply plugin: 'com.moowork.node'
apply plugin: 'com.github.node-gradle.node'
repositories {
jcenter()
@@ -70,14 +70,6 @@ node {
nodeModulesDir = nodeModulesParentDir
}
task installMocha(type: NpmTask) {
// note, without the '--prefer-offline' it works only if you are online,
// with '--prefer-offline' it works also offline if you have already as well in case you have already downloaded mocha once
args = ['install', 'mocha', '--prefer-offline']
}
task prepareMocha(dependsOn: [compileTestKotlin2Js, populateNodeModules, installMocha])
//either you use this task or create a testSetup.kt in your src/test with the following content
//
// // adopt to the api you use
@@ -94,8 +86,8 @@ task establishDependencyToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runMocha(type: NodeTask, group: 'Verification', dependsOn: [prepareMocha, test, establishDependencyToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMocha(type: NpxTask, group: 'Verification', dependsOn: [compileTestKotlin2Js, populateNodeModules, test, establishDependencyToAtrium]) {
command = "mocha"
args = [compileTestKotlin2Js.outputFile]
}
check.dependsOn runMocha
@@ -154,8 +146,8 @@ task establishDependencyFromCurrentToAtrium(dependsOn: [compileTestKotlin2Js]) {
srcFile.write(newContent, 'UTF-8')
}
}
task runMochaForCurrent(type: NodeTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, installMocha, establishDependencyFromCurrentToAtrium]) {
script = file("$nodeModulesParentDir/node_modules/mocha/bin/mocha")
task runMochaForCurrent(type: NpxTask, group: 'Verification', dependsOn: [compileCurrentKotlin2Js, populateCurrentNodeModules, establishDependencyFromCurrentToAtrium]) {
command = "mocha"
args = [compileCurrentKotlin2Js.outputFile]
}