Merge pull request #1315 from corda/clint-gradle4

Upgraded to gradle 4.1.
This commit is contained in:
Clinton 2017-08-24 22:55:50 +01:00 committed by GitHub
commit 1750ab07af
21 changed files with 50 additions and 36 deletions

View File

@ -53,7 +53,7 @@ dependencies {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -81,12 +81,12 @@ dependencies {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
task smokeTest(type: Test) {
testClassesDir = sourceSets.smokeTest.output.classesDir
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}

View File

@ -67,7 +67,9 @@ public class StandaloneCordaRPCJavaClientTest {
try {
connection.close();
} finally {
notary.close();
if(notary != null) {
notary.close();
}
}
}

View File

@ -1,4 +1,4 @@
gradlePluginsVersion=0.15.0
gradlePluginsVersion=0.15.1
kotlinVersion=1.1.4
guavaVersion=21.0
bouncycastleVersion=1.57

View File

@ -64,7 +64,7 @@ applicationDistribution.into("bin") {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -3,10 +3,10 @@ package net.corda.plugins
import java.awt.GraphicsEnvironment
import java.io.File
import java.nio.file.Files
import java.nio.file.Path
import java.util.*
private val HEADLESS_FLAG = "--headless"
private val CAPSULE_DEBUG_FLAG = "--capsule-debug"
private val os by lazy {
val osName = System.getProperty("os.name", "generic").toLowerCase(Locale.ENGLISH)
@ -24,13 +24,15 @@ private object debugPortAlloc {
fun main(args: Array<String>) {
val startedProcesses = mutableListOf<Process>()
val headless = GraphicsEnvironment.isHeadless() || (args.isNotEmpty() && args[0] == HEADLESS_FLAG)
val headless = GraphicsEnvironment.isHeadless() || args.contains(HEADLESS_FLAG)
val capsuleDebugMode = args.contains(CAPSULE_DEBUG_FLAG)
val workingDir = File(System.getProperty("user.dir"))
val javaArgs = args.filter { it != HEADLESS_FLAG }
val javaArgs = args.filter { it != HEADLESS_FLAG && it != CAPSULE_DEBUG_FLAG }
val jvmArgs = if (capsuleDebugMode) listOf("-Dcapsule.log=verbose") else emptyList<String>()
println("Starting nodes in $workingDir")
workingDir.listFiles { file -> file.isDirectory }.forEach { dir ->
listOf(NodeJarType, WebJarType).forEach { jarType ->
jarType.acceptDirAndStartProcess(dir, headless, javaArgs)?.let { startedProcesses += it }
jarType.acceptDirAndStartProcess(dir, headless, javaArgs, jvmArgs)?.let { startedProcesses += it }
}
}
println("Started ${startedProcesses.size} processes")
@ -39,7 +41,7 @@ fun main(args: Array<String>) {
private abstract class JarType(private val jarName: String) {
internal abstract fun acceptNodeConf(nodeConf: File): Boolean
internal fun acceptDirAndStartProcess(dir: File, headless: Boolean, javaArgs: List<String>): Process? {
internal fun acceptDirAndStartProcess(dir: File, headless: Boolean, javaArgs: List<String>, jvmArgs: List<String>): Process? {
if (!File(dir, jarName).exists()) {
return null
}
@ -48,7 +50,7 @@ private abstract class JarType(private val jarName: String) {
}
val debugPort = debugPortAlloc.next()
println("Starting $jarName in $dir on debug port $debugPort")
val process = (if (headless) ::HeadlessJavaCommand else ::TerminalWindowJavaCommand)(jarName, dir, debugPort, javaArgs).start()
val process = (if (headless) ::HeadlessJavaCommand else ::TerminalWindowJavaCommand)(jarName, dir, debugPort, javaArgs, jvmArgs).start()
if (os == OS.MACOS) Thread.sleep(1000)
return process
}
@ -63,9 +65,17 @@ private object WebJarType : JarType("corda-webserver.jar") {
override fun acceptNodeConf(nodeConf: File) = Files.lines(nodeConf.toPath()).anyMatch { "webAddress" in it }
}
private abstract class JavaCommand(jarName: String, internal val dir: File, debugPort: Int?, internal val nodeName: String, init: MutableList<String>.() -> Unit, args: List<String>) {
private abstract class JavaCommand(
jarName: String,
internal val dir: File,
debugPort: Int?,
internal val nodeName: String,
init: MutableList<String>.() -> Unit, args: List<String>,
jvmArgs: List<String>
) {
internal val command: List<String> = mutableListOf<String>().apply {
add(getJavaPath())
addAll(jvmArgs)
add("-Dname=$nodeName")
null != debugPort && add("-Dcapsule.jvm.args=-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=$debugPort")
add("-jar")
@ -79,12 +89,14 @@ private abstract class JavaCommand(jarName: String, internal val dir: File, debu
internal abstract fun getJavaPath(): String
}
private class HeadlessJavaCommand(jarName: String, dir: File, debugPort: Int?, args: List<String>) : JavaCommand(jarName, dir, debugPort, dir.name, { add("--no-local-shell") }, args) {
private class HeadlessJavaCommand(jarName: String, dir: File, debugPort: Int?, args: List<String>, jvmArgs: List<String>)
: JavaCommand(jarName, dir, debugPort, dir.name, { add("--no-local-shell") }, args, jvmArgs) {
override fun processBuilder() = ProcessBuilder(command).redirectError(File("error.$nodeName.log")).inheritIO()
override fun getJavaPath() = File(File(System.getProperty("java.home"), "bin"), "java").path
}
private class TerminalWindowJavaCommand(jarName: String, dir: File, debugPort: Int?, args: List<String>) : JavaCommand(jarName, dir, debugPort, "${dir.name}-$jarName", {}, args) {
private class TerminalWindowJavaCommand(jarName: String, dir: File, debugPort: Int?, args: List<String>, jvmArgs: List<String>)
: JavaCommand(jarName, dir, debugPort, "${dir.name}-$jarName", {}, args, jvmArgs) {
override fun processBuilder() = ProcessBuilder(when (os) {
OS.MACOS -> {
listOf("osascript", "-e", """tell app "Terminal"
@ -113,7 +125,7 @@ end tell""")
val path = File(File(System.getProperty("java.home"), "bin"), "java").path
// Replace below is to fix an issue with spaces in paths on Windows.
// Quoting the entire path does not work, only the space or directory within the path.
return if(os == OS.WINDOWS) path.replace(" ", "\" \"") else path
return if (os == OS.WINDOWS) path.replace(" ", "\" \"") else path
}
}

Binary file not shown.

View File

@ -1,6 +1,6 @@
#Tue Mar 21 18:12:23 GMT 2017
#Thu Aug 24 12:32:31 BST 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-3.4.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip

6
gradlew vendored
View File

@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS=""
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn ( ) {
warn () {
echo "$*"
}
die ( ) {
die () {
echo
echo "$*"
echo
@ -155,7 +155,7 @@ if $cygwin ; then
fi
# Escape application args
save ( ) {
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}

View File

@ -189,7 +189,7 @@ dependencies {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}
@ -200,7 +200,7 @@ task smokeTestJar(type: Jar) {
task smokeTest(type: Test) {
dependsOn smokeTestJar
testClassesDir = sourceSets.smokeTest.output.classesDir
testClassesDirs = sourceSets.smokeTest.output.classesDirs
classpath = sourceSets.smokeTest.runtimeClasspath
}

View File

@ -26,8 +26,8 @@ task buildCordaJAR(type: FatCapsule, dependsOn: project(':node').compileJava) {
applicationSource = files(
project(':node').configurations.runtime,
project(':node').jar,
'../build/classes/main/CordaCaplet.class',
'../build/classes/main/CordaCaplet$1.class',
project(':node').sourceSets.main.java.outputDir.toString() + '/CordaCaplet.class',
project(':node').sourceSets.main.java.outputDir.toString() + '/CordaCaplet$1.class',
"$rootDir/config/dev/log4j2.xml"
)
from 'NOTICE' // Copy CDDL notice

View File

@ -66,7 +66,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -89,7 +89,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -81,7 +81,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -94,7 +94,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -85,7 +85,7 @@ task deployNodes(type: net.corda.plugins.Cordform, dependsOn: ['jar']) {
}
task integrationTest(type: Test, dependsOn: []) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -56,7 +56,7 @@ dependencies {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -31,7 +31,7 @@ task buildExplorerJAR(type: FatCapsule, dependsOn: project(':tools:explorer').co
applicationSource = files(
project(':tools:explorer').configurations.runtime,
project(':tools:explorer').jar,
'../build/classes/main/ExplorerCaplet.class'
project(':tools:explorer').sourceSets.main.java.outputDir.toString() + '/ExplorerCaplet.class'
)
classifier 'fat'

View File

@ -64,7 +64,7 @@ task standaloneJar(type: Jar) {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -62,7 +62,7 @@ dependencies {
}
task integrationTest(type: Test) {
testClassesDir = sourceSets.integrationTest.output.classesDir
testClassesDirs = sourceSets.integrationTest.output.classesDirs
classpath = sourceSets.integrationTest.runtimeClasspath
}

View File

@ -26,8 +26,8 @@ task buildWebserverJar(type: FatCapsule, dependsOn: project(':node').compileJava
applicationSource = files(
project(':webserver').configurations.runtime,
project(':webserver').jar,
new File(project(':node').buildDir, 'classes/main/CordaCaplet.class'),
new File(project(':node').buildDir, 'classes/main/CordaCaplet$1.class'),
project(':node').sourceSets.main.java.outputDir.toString() + '/CordaCaplet.class',
project(':node').sourceSets.main.java.outputDir.toString() + '/CordaCaplet$1.class',
"$rootDir/config/dev/log4j2.xml"
)
from 'NOTICE' // Copy CDDL notice