Files
muwire/webui/build.gradle

119 lines
3.8 KiB
Groovy
Raw Normal View History

2019-11-29 16:40:02 +00:00
configurations {
warArtifact
jarArtifact
2019-11-29 16:40:02 +00:00
}
apply plugin : 'war'
dependencies {
providedCompile(project(':core')) {
transitive = false
}
2019-11-29 16:49:44 +00:00
compile fileTree("../i2pjars") { include '*.jar' }
2019-11-29 16:40:02 +00:00
}
war {
2019-12-04 11:27:08 +00:00
from 'src/main/css'
2019-12-04 19:15:07 +00:00
from ('src/main/images', {
into "images"
})
from ('src/main/js', {
into "js"
})
2019-12-10 12:50:38 +00:00
from ('src/main/resources', {
into "WEB-INF/classes/com/muwire/webui"
})
2019-11-29 16:40:02 +00:00
webInf {
from "$buildDir/compiledJsps"
into "classes"
}
excludes = new HashSet(['**/*.jsp', '**/*.jsi'])
2019-11-29 16:40:02 +00:00
webXml = file("$buildDir/tmp_jsp/web.xml")
}
task precompileJsp {
doLast {
ant.taskdef (name : 'jasper',
classname: 'org.apache.jasper.JspC',
classpath: configurations.compile.asPath)
def generated = new File("$buildDir/tmp_jsp")
generated.mkdirs()
ant.jasper(package: 'com.muwire.webui',
2019-11-30 08:28:22 +00:00
classPath : sourceSets.main.runtimeClasspath.asPath,
2019-11-29 16:40:02 +00:00
uriroot: webAppDir,
outputDir: "$buildDir/tmp_jsp",
compilerSourceVM: project.sourceCompatibility,
compilerTargetVM: project.targetCompatibility,
webXmlFragment: "$buildDir/tmp_jsp/web.xml.jasper")
2019-11-29 16:40:02 +00:00
def output = new File("$buildDir/compiledJsps")
output.mkdirs()
ant.javac(srcDir: 'build/tmp_jsp',
2019-11-30 08:28:22 +00:00
classPath : sourceSets.main.runtimeClasspath.asPath,
2019-12-04 19:37:58 +00:00
debug : true,
2019-12-07 12:18:01 +00:00
includeAntRuntime : false,
deprecation : "on",
source: project.sourceCompatibility,
target: project.targetCompatibility,
2019-11-30 08:28:22 +00:00
destDir:file("$buildDir/compiledJsps"))
2019-11-29 16:40:02 +00:00
}
}
task generateWebXML {
doLast {
def template = new File("$projectDir/templates/web.xml.template")
def templateText = template.text
def jasper = new File("$buildDir/tmp_jsp/web.xml.jasper")
templateText = templateText.replaceAll("__JASPER__", jasper.text)
templateText = templateText.replaceAll("__VERSION__", project.version)
2020-03-23 07:59:18 +00:00
templateText = templateText.replaceAll("__BUILD_NUMBER__", project.buildNumber)
def webXml = new File("$buildDir/tmp_jsp/web.xml")
webXml.text = templateText
}
}
// compile the po files and put them in the jar
task bundle {
doLast {
// run bundle-messages.sh
println 'starting bundle-messages'
println "webui/bundle-messages.sh".execute().text
println 'finished bundle-messages'
// compile java files in build/messages-src
ant.mkdir(dir: "$buildDir/compiledMessages")
ant.javac(srcDir: "$buildDir/messages-src",
classPath : sourceSets.main.runtimeClasspath.asPath,
debug : false,
includeAntRuntime : false,
source: project.sourceCompatibility,
target: project.targetCompatibility,
destDir:file("$buildDir/compiledMessages"))
// add resulting classes to build/libs/webui-(version).jar
ant.jar(destfile: "$buildDir/libs/webui-${version}.jar",
basedir: "$buildDir/compiledMessages",
includes: '**/messages_*.class',
update: 'true')
}
}
// rebuild the english po file for uploading to transifex
task poupdate {
doLast {
// run bundle-messages.sh
println 'starting bundle-messages -p'
println "webui/bundle-messages.sh -p".execute().text
println 'finished bundle-messages -p'
}
}
2019-11-30 08:28:22 +00:00
precompileJsp.dependsOn compileJava
generateWebXML.dependsOn precompileJsp
bundle.dependsOn precompileJsp
2019-12-10 12:50:38 +00:00
poupdate.dependsOn precompileJsp
war.dependsOn generateWebXML, bundle
2019-11-29 16:40:02 +00:00
artifacts {
warArtifact war
jarArtifact jar
2019-11-29 16:40:02 +00:00
}