chg: moved launcher source files into subproject

This commit is contained in:
Tobi Schäfer 2020-03-17 20:47:14 +01:00
parent 94ce6dac49
commit a9163bd66f
5 changed files with 78 additions and 85 deletions

View file

@ -2,81 +2,25 @@ def jettyLogLevel = '-Dorg.eclipse.jetty.LEVEL=WARN'
allprojects { allprojects {
apply plugin: 'java' apply plugin: 'java'
apply plugin: 'application'
compileJava { compileJava {
dependsOn 'processSource'
sourceCompatibility = JavaVersion.VERSION_1_6 sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6 targetCompatibility = JavaVersion.VERSION_1_6
} }
startScripts {
applicationName = 'helma'
classpath = files('../launcher.jar')
mainClassName = 'helma.main.launcher.Main'
defaultJvmOpts = [jettyLogLevel]
doLast {
// Work-around to make the classpath above work (launcher.jar is located outside of `lib` dir)
// See https://discuss.gradle.org/t/classpath-in-application-plugin-is-building-always-relative-to-app-home-lib-directory/2012
def unixScriptFile = file getUnixScript()
def windowsScriptFile = file getWindowsScript()
unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib', '$APP_HOME')
windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib', '%APP_HOME%')
}
}
task processSource(type: Sync) {
def date = new Date().format("MMMM dd, yyyy")
def gitOutput = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe'
standardOutput = gitOutput
errorOutput = new ByteArrayOutputStream()
ignoreExitValue = true
}
def description = date
def tag = gitOutput.toString().trim()
if (tag) description = "$tag; $description"
from 'src'
filter {
line -> line.replaceAll('__builddate__', date)
} into "${project.buildDir}/src"
}
} }
apply plugin: 'application'
version = new Date().format("yyyyMMdd") version = new Date().format("yyyyMMdd")
distributions { tasks.build.dependsOn javadoc
main { tasks.compileJava.dependsOn 'processSource'
contents {
from project(':launcher').jar
}
}
}
applicationDistribution.from(projectDir) {
include 'modules/**'
include 'LICENSE.md'
include 'README.md'
include 'start.*'
}
applicationDistribution.from(javadoc.destinationDir) {
include '**'
into 'docs'
}
sourceSets { sourceSets {
main { main {
java { java {
// Sources in `src` will be available here after processing
srcDirs = ["$buildDir/src/main/java"] srcDirs = ["$buildDir/src/main/java"]
exclude '**/package.html', '**/main/launcher/**'
} }
} }
} }
@ -108,6 +52,42 @@ dependencies {
implementation 'xmlrpc:xmlrpc:2.0.1' implementation 'xmlrpc:xmlrpc:2.0.1'
} }
startScripts {
applicationName = 'helma'
classpath = files('../launcher.jar')
mainClassName = 'helma.main.launcher.Main'
defaultJvmOpts = [jettyLogLevel]
doLast {
// Work-around to make the classpath above work (launcher.jar is located outside of `lib` dir)
// See https://discuss.gradle.org/t/classpath-in-application-plugin-is-building-always-relative-to-app-home-lib-directory/2012
def unixScriptFile = file getUnixScript()
def windowsScriptFile = file getWindowsScript()
unixScriptFile.text = unixScriptFile.text.replace('$APP_HOME/lib', '$APP_HOME')
windowsScriptFile.text = windowsScriptFile.text.replace('%APP_HOME%\\lib', '%APP_HOME%')
}
}
distributions {
main {
contents {
from project(':launcher').jar
}
}
}
applicationDistribution.from(projectDir) {
include 'modules/**'
include 'LICENSE.md'
include 'README.md'
include 'start.*'
}
applicationDistribution.from(javadoc.destinationDir) {
include '**'
into 'docs'
}
distTar { distTar {
compression = Compression.GZIP compression = Compression.GZIP
} }
@ -122,21 +102,28 @@ run {
jvmArgs jettyLogLevel jvmArgs jettyLogLevel
} }
task shell(type: JavaExec) { task processSource(type: Sync) {
def rhinoJar = configurations.library.files.find { f -> def date = new Date().format("MMMM dd, yyyy")
f.name.startsWith('rhino') def gitOutput = new ByteArrayOutputStream()
exec {
commandLine 'git', 'describe'
standardOutput = gitOutput
errorOutput = new ByteArrayOutputStream()
ignoreExitValue = true
} }
classpath = files(rhinoJar) def description = date
main = 'org.mozilla.javascript.tools.shell.Main' def tag = gitOutput.toString().trim()
standardInput = System.in // TODO: Implement extended description in Java code
} if (tag) description = "$tag; $description"
task commandline(type: JavaExec) { from 'src'
classpath = files('launcher.jar')
main = 'helma.main.launcher.Commandline' filter {
args '-h', projectDir, 'manage.getAllApplications' line -> line.replaceAll('__builddate__', date)
} into "${project.buildDir}/src"
} }
task update { task update {
@ -173,3 +160,20 @@ task update {
} }
} }
} }
task shell(type: JavaExec) {
def rhinoJar = configurations.library.files.find { f ->
f.name.startsWith('rhino')
}
classpath = files(rhinoJar)
main = 'org.mozilla.javascript.tools.shell.Main'
standardInput = System.in
}
task commandLine(type: JavaExec) {
classpath = files('launcher.jar')
main = 'helma.main.launcher.Commandline'
args '-h', projectDir, 'manage.getAllApplications'
}

View file

@ -1,18 +1,7 @@
sourceSets {
main {
java {
srcDirs = ["${rootProject.buildDir}/src/main/java"]
include '**/main/launcher/**'
}
}
}
jar { jar {
manifest { manifest {
from "${rootProject.projectDir}/src/main/java/helma/main/launcher/manifest.txt" from 'src/main/java/helma/main/launcher/manifest.txt'
} }
} }
task copyJars(type: Copy) { //startScripts.enabled = false
from jar into "${rootProject.projectDir}"
}