diff --git a/java/timebase/commons/build.gradle b/java/timebase/commons/build.gradle index 68c9a648..68bd50fe 100644 --- a/java/timebase/commons/build.gradle +++ b/java/timebase/commons/build.gradle @@ -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. @@ -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 +} \ No newline at end of file diff --git a/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/LogsDownloadHelper.java b/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/LogsDownloadHelper.java index 9f523a12..2223e975 100644 --- a/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/LogsDownloadHelper.java +++ b/java/timebase/commons/src/main/java/com/epam/deltix/qsrv/LogsDownloadHelper.java @@ -63,4 +63,4 @@ public static void store(File output) throws IOException, InterruptedException store (fos); fos.close(); } -} \ No newline at end of file +} diff --git a/java/timebase/commons/src/main/java/com/epam/deltix/util/Version.java b/java/timebase/commons/src/main/java/com/epam/deltix/util/Version.java index fe71c64a..23084720 100644 --- a/java/timebase/commons/src/main/java/com/epam/deltix/util/Version.java +++ b/java/timebase/commons/src/main/java/com/epam/deltix/util/Version.java @@ -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; diff --git a/java/timebase/server/build.gradle b/java/timebase/server/build.gradle index a369e544..c2648cb4 100644 --- a/java/timebase/server/build.gradle +++ b/java/timebase/server/build.gradle @@ -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 +} diff --git a/java/timebase/web/build.gradle b/java/timebase/web/build.gradle index 88dd157f..916f680e 100644 --- a/java/timebase/web/build.gradle +++ b/java/timebase/web/build.gradle @@ -21,16 +21,19 @@ 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) } @@ -38,13 +41,34 @@ task compileJsps { // Merge the generated XML with the original mergedXml.text = webappXml.text.replaceFirst('(?s)()', '$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 \ No newline at end of file +tasks.named('compileJava') { + dependsOn 'compileJsps' +} + +tasks.named('processResources') { + dependsOn 'compileJsps' +} + +tasks.named('jar') { + duplicatesStrategy = "WARN" +} \ No newline at end of file