mirror of
https://github.com/corda/corda.git
synced 2025-05-20 17:32:52 +00:00
fix build issue on windows
This commit is contained in:
parent
d33f31614c
commit
b2bc411321
196
node/dist/build.gradle
vendored
196
node/dist/build.gradle
vendored
@ -46,114 +46,112 @@ task copyLauncherLibs(type: Copy, dependsOn: [project(':launcher').jar]) {
|
|||||||
into "$buildDir/tmp/launcher-lib"
|
into "$buildDir/tmp/launcher-lib"
|
||||||
}
|
}
|
||||||
|
|
||||||
// The launcher building is done as it depends on application-specific settings which
|
def isLinux = System.properties['os.name'].toLowerCase().contains('linux')
|
||||||
// cannot be overridden later
|
def isMac = System.properties['os.name'].toLowerCase().contains('mac')
|
||||||
task buildLauncher(type: Exec, dependsOn: [copyLauncherLibs]) {
|
if (isLinux || isMac) {
|
||||||
description 'Build Launcher executable'
|
println("Detected *nix system, enabling distribution creation")
|
||||||
|
task buildLauncher(type: Exec, dependsOn: [copyLauncherLibs]) {
|
||||||
|
description 'Build Launcher executable'
|
||||||
|
|
||||||
def isLinux = System.properties['os.name'].toLowerCase().contains('linux')
|
def relativeDir
|
||||||
def isMac = System.properties['os.name'].toLowerCase().contains('mac')
|
if (isLinux)
|
||||||
|
relativeDir = "launcher"
|
||||||
|
else
|
||||||
|
relativeDir = "launcher.app/Contents"
|
||||||
|
|
||||||
if (!isLinux && !isMac)
|
def extraArgs = [
|
||||||
throw new GradleException("Preparing distribution package is currently only supported on Linux/Mac")
|
"-BjvmOptions=-javaagent:../../lib/quasar-core-${quasar_version}-jdk8.jar=${project(':node:capsule').quasarExcludeExpression}",
|
||||||
|
'-BuserJvmOptions=-Xmx=4g',
|
||||||
|
'-BuserJvmOptions=-XX\\:=+UseG1GC',
|
||||||
|
"-BjvmProperties=java.system.class.loader=${project(':launcher').loaderClassName}"
|
||||||
|
]
|
||||||
|
|
||||||
def relativeDir
|
ext {
|
||||||
if (isLinux)
|
launcherBinDir = "${tmpDir}/bundles/$relativeDir"
|
||||||
relativeDir = "launcher"
|
}
|
||||||
else
|
|
||||||
relativeDir = "launcher.app/Contents"
|
|
||||||
|
|
||||||
def extraArgs = [
|
workingDir project.projectDir
|
||||||
"-BjvmOptions=-javaagent:../../lib/quasar-core-${quasar_version}-jdk8.jar=${project(':node:capsule').quasarExcludeExpression}",
|
|
||||||
'-BuserJvmOptions=-Xmx=4g',
|
|
||||||
'-BuserJvmOptions=-XX\\:=+UseG1GC',
|
|
||||||
"-BjvmProperties=java.system.class.loader=${project(':launcher').loaderClassName}"
|
|
||||||
]
|
|
||||||
|
|
||||||
ext {
|
doFirst {
|
||||||
launcherBinDir = "${tmpDir}/bundles/$relativeDir"
|
def launcherLib = copyLauncherLibs.destinationDir
|
||||||
|
def srcfiles = []
|
||||||
|
def launcherClasspath = []
|
||||||
|
|
||||||
|
fileTree(launcherLib).forEach({ file ->
|
||||||
|
srcfiles.add("-srcfiles")
|
||||||
|
srcfiles.add(file.name)
|
||||||
|
launcherClasspath.add(file.name)
|
||||||
|
})
|
||||||
|
|
||||||
|
commandLine = [
|
||||||
|
'javapackager',
|
||||||
|
'-deploy',
|
||||||
|
'-nosign',
|
||||||
|
'-native', 'image',
|
||||||
|
'-outdir', "$tmpDir",
|
||||||
|
'-outfile', 'launcher',
|
||||||
|
'-name', 'launcher',
|
||||||
|
"-BmainJar=${project(':launcher').jar.archiveName}",
|
||||||
|
"-Bclasspath=${launcherClasspath.join(":")}",
|
||||||
|
'-appclass', "${project(':launcher').launcherClassName}",
|
||||||
|
'-srcdir', "$launcherLib"
|
||||||
|
] + srcfiles + extraArgs
|
||||||
|
}
|
||||||
|
|
||||||
|
// Add configuration for running Node application
|
||||||
|
doLast {
|
||||||
|
def nodeClasspath = []
|
||||||
|
def libRelPath = "../lib/"
|
||||||
|
|
||||||
|
project(':node').configurations.runtime.forEach({ file ->
|
||||||
|
nodeClasspath.add(file.getName())
|
||||||
|
})
|
||||||
|
|
||||||
|
nodeClasspath.add(project(':node').jar.archivePath.getName())
|
||||||
|
|
||||||
|
new File("${launcherBinDir}/runtime.properties").text = [
|
||||||
|
"libpath=${libRelPath}",
|
||||||
|
"classpath=${nodeClasspath.join(':')}",
|
||||||
|
"plugins=./drivers:./cordapps"].join("\n")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
workingDir project.projectDir
|
task buildNode(type: Copy, dependsOn: [buildLauncher, project(':docs').tasks['makeDocs'], project(':node').tasks['jar']]) {
|
||||||
|
description 'Build stand-alone Corda Node distribution'
|
||||||
|
|
||||||
doFirst {
|
into(outputDir)
|
||||||
def launcherLib = copyLauncherLibs.destinationDir
|
|
||||||
def srcfiles = []
|
|
||||||
def launcherClasspath = []
|
|
||||||
|
|
||||||
fileTree(launcherLib).forEach({ file ->
|
from(buildLauncher.launcherBinDir) {
|
||||||
srcfiles.add("-srcfiles")
|
into("launcher")
|
||||||
srcfiles.add(file.name)
|
}
|
||||||
launcherClasspath.add(file.name)
|
|
||||||
})
|
|
||||||
|
|
||||||
commandLine = [
|
from(project(':node').configurations.runtime) {
|
||||||
'javapackager',
|
into("lib")
|
||||||
'-deploy',
|
}
|
||||||
'-nosign',
|
|
||||||
'-native', 'image',
|
from(project(':node').jar.archivePath) {
|
||||||
'-outdir', "$tmpDir",
|
into("lib")
|
||||||
'-outfile', 'launcher',
|
}
|
||||||
'-name', 'launcher',
|
|
||||||
"-BmainJar=${project(':launcher').jar.archiveName}",
|
from(sourceSets.binFiles.resources) {
|
||||||
"-Bclasspath=${launcherClasspath.join(":")}",
|
into("bin")
|
||||||
'-appclass', "${project(':launcher').launcherClassName}",
|
}
|
||||||
'-srcdir', "$launcherLib"
|
|
||||||
] + srcfiles + extraArgs
|
from(sourceSets.readmeFiles.resources) {
|
||||||
}
|
into(".")
|
||||||
|
}
|
||||||
// Add configuration for running Node application
|
|
||||||
doLast {
|
from(project(':docs').buildDir) {
|
||||||
def nodeClasspath = []
|
into("docs")
|
||||||
def libRelPath = "../lib/"
|
}
|
||||||
|
|
||||||
project(':node').configurations.runtime.forEach({ file ->
|
doLast {
|
||||||
nodeClasspath.add(file.getName())
|
new File("${outputDir}/cordapps").mkdirs()
|
||||||
})
|
new File("${outputDir}/drivers").mkdirs()
|
||||||
|
println("Stand-alone Corda Node application available at:")
|
||||||
nodeClasspath.add(project(':node').jar.archivePath.getName())
|
println("${outputDir}")
|
||||||
|
}
|
||||||
new File("${launcherBinDir}/runtime.properties").text = [
|
|
||||||
"libpath=${libRelPath}",
|
|
||||||
"classpath=${nodeClasspath.join(':')}",
|
|
||||||
"plugins=./drivers:./cordapps"].join("\n")
|
|
||||||
}
|
}
|
||||||
|
}else{
|
||||||
|
println("Not running on *nix, disabling distribution generation")
|
||||||
}
|
}
|
||||||
|
|
||||||
task buildNode(type: Copy, dependsOn: [buildLauncher, project(':docs').tasks['makeDocs'], project(':node').tasks['jar']]) {
|
|
||||||
description 'Build stand-alone Corda Node distribution'
|
|
||||||
|
|
||||||
into(outputDir)
|
|
||||||
|
|
||||||
from(buildLauncher.launcherBinDir) {
|
|
||||||
into("launcher")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(project(':node').configurations.runtime) {
|
|
||||||
into("lib")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(project(':node').jar.archivePath) {
|
|
||||||
into("lib")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.binFiles.resources) {
|
|
||||||
into("bin")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(sourceSets.readmeFiles.resources) {
|
|
||||||
into(".")
|
|
||||||
}
|
|
||||||
|
|
||||||
from(project(':docs').buildDir) {
|
|
||||||
into("docs")
|
|
||||||
}
|
|
||||||
|
|
||||||
doLast {
|
|
||||||
new File("${outputDir}/cordapps").mkdirs()
|
|
||||||
new File("${outputDir}/drivers").mkdirs()
|
|
||||||
println ("Stand-alone Corda Node application available at:")
|
|
||||||
println ("${outputDir}")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user