Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 19 additions & 11 deletions java/timebase/commons/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ tasks.named('compileJava') {
}
tasks.named('processResources') {
dependsOn 'versionClass'
dependsOn 'copyWebapp'
}
// Note: Right now Gradle caches outputs of "compileJava" even if file "Version.java" was changed.
// TODO: We should explicitly tell Gradle that task "compileJava" depends on outputs of "versionClass" talk.
Expand All @@ -90,27 +91,34 @@ tasks.named('clean') {
dependsOn 'deleteVersionFile'
}

def generatedResources = layout.buildDirectory.dir("generated-resources").get().asFile

tasks.register('copyWebapp', Copy) {
outputs.file(sourceSets.main.output.resourcesDir.absolutePath + '/webapp/timebase-web.war')

inputs.file(project(':java:timebase:web').file("build/libs/timebase-web-$version" + ".war"))
inputs.property("buildVersion", version)

description 'Copy default webapp war file into timebase pub resources'
dependsOn ':java:timebase:web:war'
mustRunAfter clean
mustRunAfter processResources

from (project(':java:timebase:web').file('build/libs')) {
include '*.war'
rename 'timebase-web(.*).war', 'timebase-web.war'
rename "timebase-web-$version" + ".war", 'timebase-web.war'
}
into sourceSets.main.output.resourcesDir.absolutePath + '/webapp'
}

//
//tasks.named('jar') {
// dependsOn 'copyWebapp'
//}
into(new File(generatedResources, "webapp"))

tasks.named('compileTestJava') {
mustRunAfter 'copyWebapp' // build fix
outputs.dir(generatedResources)
.withPropertyName("outputDir")
}

sourceSets.main.resources.srcDirs generatedResources

tasks.named('javadoc', Javadoc) {
// Javadoc only needs compiled classes, not processed resources (webapp war from copyWebapp).
// Default 'classes' dependency pulls in copyWebapp and adds resource outputs to the classpath,
// which prevents incremental javadoc builds.
dependsOn compileJava
classpath = sourceSets.main.compileClasspath + compileJava.outputs.files
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,4 +63,4 @@ public static void store(File output) throws IOException, InterruptedException
store (fos);
fos.close();
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ public abstract class Version {
public static final int MAJOR = 6;
public static final int MINOR = 2;
public static final String NAME = "18-SNAPSHOT";
public static final String BUILD = "3125d9f7";
public static final String BUILD = "2c3be72f";
public static final Integer COMMITS_AFTER_TAG = null;
public static final String BUILD_DATE = "2026-06-25 21:07:57 +0300";
public static final String BUILD_DATE = "2026-06-25 21:23:51 +0300";

public static final String VERSION_STRING;
public static final String MAJOR_VERSION_STRING;
Expand Down
24 changes: 18 additions & 6 deletions java/timebase/server/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -128,19 +128,31 @@ task prepareFilesForDocker {
dependsOn copyTimebaseServerContainerDependensies
}

def generatedResources = layout.buildDirectory.dir("generated-resources").get().asFile

tasks.register('copyMonitorWebapp', Copy) {
outputs.file(sourceSets.main.output.resourcesDir.absolutePath + '/webapp/timebase-webmonitor.war')
outputs.file(sourceSets.main.output.resourcesDir.absolutePath + "/webapp/timebase-webmonitor-$version" + ".war")

description 'Copy timebase monitor webapp war file into timebase server resources'
dependsOn ':java:timebase:webmonitor:war'
mustRunAfter processResources
mustRunAfter clean

from (project(':java:timebase:webmonitor').file('build/libs')) {
include '*.war'
rename 'timebase-webmonitor(.*).war', 'timebase-webmonitor.war'
rename "timebase-webmonitor-$version" + ".war", 'timebase-webmonitor.war'
}
into sourceSets.main.output.resourcesDir.absolutePath + '/webapp'
into(new File(generatedResources, "webapp"))
}

//jar.dependsOn copyMonitorWebapp
sourceSets.main.resources.srcDirs generatedResources

tasks.named('processResources') {
dependsOn 'copyMonitorWebapp'
}

tasks.named('javadoc', Javadoc) {
// Javadoc only needs compiled classes, not processed resources (webapp war from copyWebapp).
// Default 'classes' dependency pulls in copyWebapp and adds resource outputs to the classpath,
// which prevents incremental javadoc builds.
dependsOn compileJava
classpath = sourceSets.main.compileClasspath + compileJava.outputs.files
}
38 changes: 31 additions & 7 deletions java/timebase/web/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -21,30 +21,54 @@ def webappXml = file("$webappDir/WEB-INF/web.xml")
def generatedXml = file("$generatedJsps/generated_web.xml")
def mergedXml = file("$generatedJsps/web.xml")

task compileJsps {
description 'Build java classes from jsp webapp'
tasks.register('compileJsps') {
description = 'Build java classes from jsp webapp'

doFirst {
generatedJsps.deleteDir() // Delete existing files to perform a clean build
generatedJsps.mkdirs()
mergedXml.createNewFile()
}

// Input
def compileClasspath = configurations.compileClasspath.asPath
doLast {
ant.taskdef(classname: 'org.apache.jasper.JspC', name: 'jasper', classpath: configurations.compileOnly.asPath)
ant.taskdef(classname: 'org.apache.jasper.JspC', name: 'jasper', classpath: compileClasspath)
ant.jasper(validateXml: false, uriroot: webappDir, webXmlFragment: generatedXml, outputDir: generatedJsps)
}

doLast {
// Merge the generated XML with the original
mergedXml.text = webappXml.text.replaceFirst('(?s)(<web-app.*?>)', '$1' + generatedXml.text)
}

inputs.file(webappXml).withPropertyName("webappXml")
inputs.dir(webappDir)
.withPropertyName("webappDir")

outputs.file(generatedXml)
.withPropertyName("generatedXml")
outputs.file(mergedXml)
.withPropertyName("mergedXml")
outputs.dir(generatedJsps)
.withPropertyName("generatedJsps")
}

war {
tasks.named('war') {
dependsOn 'compileJsps', 'jar'
duplicatesStrategy = "EXCLUDE"
webXml mergedXml
webXml = mergedXml
}

sourceSets.main.java.srcDirs generatedJsps
compileJava.dependsOn compileJsps
war.dependsOn jar
tasks.named('compileJava') {
dependsOn 'compileJsps'
}

tasks.named('processResources') {
dependsOn 'compileJsps'
}

tasks.named('jar') {
duplicatesStrategy = "WARN"
}
Loading