mirror of
https://github.com/Stirling-Tools/Stirling-PDF.git
synced 2026-09-03 05:10:16 +03:00
Bumps `logback` from 1.6.1 to 1.6.3. Updates `ch.qos.logback:logback-core` from 1.6.1 to 1.6.3 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/qos-ch/logback/releases">ch.qos.logback:logback-core's releases</a>.</em></p> <blockquote> <h2>Logback 1.6.3</h2> <h1>2026-08-14 Release of logback version 1.6.3</h1> <ul> <li> <p>In response <a href="https://www.cve.org/cverecord?id=CVE-2026-19880">CVE-2026-19880</a>, <code>MDCBasedDiscriminator</code> (used by <code>SiftingAppender</code>) now strips forward and backward slashes (<code>/</code>, <code>\</code>) from MDC values before they are used as discriminating keys. This prevents path segments from escaping into destinations controlled by an attacker. When sanitisation actually changes a value, a warning is emitted; the warning is rate-limited (a small batch, then a lull of about ten minutes).</p> </li> <li> <p>Colour console support is split out into a dedicated <a href="https://logback.qos.ch/manual/appenders.html#JansiConsoleAppender"><code>JansiConsoleAppender</code></a>. It wraps stdout or stderr with Jansi so ANSI escape sequences (for example coloured patterns) render correctly on terminals that need it, notably Windows. Prefer this class over the older path described next. See the <a href="https://logback.qos.ch/manual/appenders.html#JansiConsoleAppender">appenders documentation</a>.</p> </li> <li> <p>The <code>withJansi</code> property on <code>ConsoleAppender</code> is <strong>deprecated</strong>. Existing configurations that still set <code><withJansi>true</withJansi></code> continue to work for compatibility, but new setups should use <code>JansiConsoleAppender</code> instead.</p> </li> <li> <p><code>ConsoleAppender</code> no longer treats the process console as an exclusive resource: stopping it does not close <code>System.out</code> / <code>System.err</code>. <code>JansiConsoleAppender</code> pairs each <code>AnsiConsole.systemInstall()</code> with <code>systemUninstall()</code> on stop, so repeated start/stop cycles do not leave Jansi installed or tear down streams shared with the rest of the JVM. Related behavior is covered by tests for <a href="https://redirect.github.com/qos-ch/logback/issues/1063">issues/1063</a>.</p> </li> <li> <p>Invocation throttling helpers were reworked: <code>SimpleInvocationGate</code> is renamed <code>FixedIntervalInvocationGate</code>, and <code>BatchedFixedIntervalInvocationGate</code> allows a short burst of invocations before applying a fixed lull. The sanitisation warning above uses the batched gate.</p> </li> <li> <p>The JPMS <code>module-info</code> for logback-core now exports the <code>ch.qos.logback.core.property</code> package, which had been missing from the module descriptor.</p> </li> <li> <p>A bit-wise identical binary of this version can be reproduced by building from <a href="https://github.com/qos-ch/logback">source code</a> at commit <code>e8e824dede022a6d7208b36cfa875b0d1b7772f3</code> associated with the tag <code>v_1.6.3</code>. The release was built using Java "21" 2023-10-17 LTS build 21.0.1.+12-LTS-29 under Linux Debian 11.6.</p> </li> </ul> <p>-- Sponsoring SLF4J/logback/reload4j at <a href="https://github.com/sponsors/qos-ch">https://github.com/sponsors/qos-ch</a></p> <h2>Logback 1.6.2</h2> <p><a href="https://github.com/user-attachments/assets/9ceaf157-b758-4188-815d-edfe4e1b4edd">https://github.com/user-attachments/assets/9ceaf157-b758-4188-815d-edfe4e1b4edd</a></p> <h1>2026-08-10 Release of logback version 1.6.2</h1> <ul> <li> <p>Configuration analysis now detects <em>contradictory caller-data inclusion instructions</em>. For example, an <code>AsyncAppender</code>, <code>SocketAppender</code> or <code>SMTPAppender</code> with <code>includeCallerData</code> left at the default <code>false</code> is incompatible with a layout or encoder pattern that uses a caller-data converter such as <code>%C</code>, <code>%M</code>, <code>%L</code>, <code>%F</code>, <code>%l</code> or <code>%caller</code>. At runtime those converters would print question marks and still incur extraction cost on a worker thread. Logback now emits a configuration-time warning when such instructions disagree. See <a href="https://logback.qos.ch/codes.html#callerContradiction">codes.html#callerContradiction</a> for details. This issue was reported in <a href="https://redirect.github.com/qos-ch/logback/issues/1059">issues/1059</a> by <a href="https://github.com/leeychee">leeychee</a>. The initial analysis was contributed by <a href="https://github.com/seonwooj0810">seonwoo_jung</a>.</p> </li> <li> <p>Caller-contradiction analysis can be turned off by setting the <code>logback.skipCallerContradictionAnalysis</code> variable to <code>true</code>, either as a system property (<code>-Dlogback.skipCallerContradictionAnalysis=true</code>) or as a property in the configuration file:</p> <pre lang="xml"><code><property name="logback.skipCallerContradictionAnalysis" value="true"/> </code></pre> </li> <li> <p><code>SimpleSocketServer</code> and <code>SimpleSSLSocketServer</code> now require an explicit client IP whitelist. On the command line, pass one or more allowed addresses (single IPs or CIDR ranges) after the configuration file. An empty whitelist means no clients are accepted. When embedding the server programmatically, register allowed addresses with <code>addAllowedClientAddress(String)</code> or <code>setAllowedClientAddresses(Collection)</code> before clients connect. See the documentation on <a href="https://logback.qos.ch/manual/appenders.html#simpleSocketServerClientAccess">restricting client access</a>.</p> </li> <li> <p>Added <code>ThrowableProxyVOBuilder</code> for assembling a <code>ThrowableProxyVO</code> field by field, with a corresponding <code>ThrowableProxyVO.builder()</code> entry point.</p> </li> <li> <p>Dependency analysis handlers now run their <code>postHandle</code> method after child models have been processed, so checks that depend on nested appenders (such as caller-contradiction analysis) see a complete picture.</p> </li> <li> <p>Updated several dependencies, including Angus Mail to 2.0.4 and Jetty (test) to 12.1.12.</p> </li> <li> <p>A bit-wise identical binary of this version can be reproduced by building from <a href="https://github.com/qos-ch/logback">source code</a> at commit e3d78330ad1ba024fd987fd00c3ffb9cfcdb07dc associated with the tag <code>v_1.6.2</code>. The release was built using Java "21" 2023-10-17 LTS build 21.0.1.+12-LTS-29 under Linux Debian 11.6.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/qos-ch/logback/commit/e8e824dede022a6d7208b36cfa875b0d1b7772f3"><code>e8e824d</code></a> prepare release 1.6.3</li> <li><a href="https://github.com/qos-ch/logback/commit/761821bfaacac3a0ad44fa546cfc814429bf9312"><code>761821b</code></a> MDCBasedDiscriminator has a gated warning mechanism</li> <li><a href="https://github.com/qos-ch/logback/commit/53ed1229008d8b1902f5c234deaa07d742890879"><code>53ed122</code></a> update copyright year</li> <li><a href="https://github.com/qos-ch/logback/commit/c7e2db244671ffa916182b5da8c89579eb54a645"><code>c7e2db2</code></a> rename SimpleInvocationGate as FixedIntervalInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/b5aa931b096a4b0b6a9e140b74fabe7da152cbf0"><code>b5aa931</code></a> added BatchedSimpleInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/1f22af7686aadd25c08b4bd1e6943a906a743ad4"><code>1f22af7</code></a> add javadocs to SimpleInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/638ffa7e7852478b605a91b3e91238ff26f8158c"><code>638ffa7</code></a> prevent forward and backward slashes to escape to other directories</li> <li><a href="https://github.com/qos-ch/logback/commit/7d6b9a4f8c8996834c0a694f6c141705a003d7bb"><code>7d6b9a4</code></a> add missing ch.qos.logback.core.property package</li> <li><a href="https://github.com/qos-ch/logback/commit/fa25930346f35636fb6a077c1f66ebb06edd3b6f"><code>fa25930</code></a> add an extension path in ConsoleAppender for JansiConsoleAppender</li> <li><a href="https://github.com/qos-ch/logback/commit/c73b43f2011f9d4545abc7ea461172276a0a43b3"><code>c73b43f</code></a> deprecate the withJansi path</li> <li>Additional commits viewable in <a href="https://github.com/qos-ch/logback/compare/v_1.6.1...v_1.6.3">compare view</a></li> </ul> </details> <br /> Updates `ch.qos.logback:logback-classic` from 1.6.1 to 1.6.3 <details> <summary>Release notes</summary> <p><em>Sourced from <a href="https://github.com/qos-ch/logback/releases">ch.qos.logback:logback-classic's releases</a>.</em></p> <blockquote> <h2>Logback 1.6.3</h2> <h1>2026-08-14 Release of logback version 1.6.3</h1> <ul> <li> <p>In response <a href="https://www.cve.org/cverecord?id=CVE-2026-19880">CVE-2026-19880</a>, <code>MDCBasedDiscriminator</code> (used by <code>SiftingAppender</code>) now strips forward and backward slashes (<code>/</code>, <code>\</code>) from MDC values before they are used as discriminating keys. This prevents path segments from escaping into destinations controlled by an attacker. When sanitisation actually changes a value, a warning is emitted; the warning is rate-limited (a small batch, then a lull of about ten minutes).</p> </li> <li> <p>Colour console support is split out into a dedicated <a href="https://logback.qos.ch/manual/appenders.html#JansiConsoleAppender"><code>JansiConsoleAppender</code></a>. It wraps stdout or stderr with Jansi so ANSI escape sequences (for example coloured patterns) render correctly on terminals that need it, notably Windows. Prefer this class over the older path described next. See the <a href="https://logback.qos.ch/manual/appenders.html#JansiConsoleAppender">appenders documentation</a>.</p> </li> <li> <p>The <code>withJansi</code> property on <code>ConsoleAppender</code> is <strong>deprecated</strong>. Existing configurations that still set <code><withJansi>true</withJansi></code> continue to work for compatibility, but new setups should use <code>JansiConsoleAppender</code> instead.</p> </li> <li> <p><code>ConsoleAppender</code> no longer treats the process console as an exclusive resource: stopping it does not close <code>System.out</code> / <code>System.err</code>. <code>JansiConsoleAppender</code> pairs each <code>AnsiConsole.systemInstall()</code> with <code>systemUninstall()</code> on stop, so repeated start/stop cycles do not leave Jansi installed or tear down streams shared with the rest of the JVM. Related behavior is covered by tests for <a href="https://redirect.github.com/qos-ch/logback/issues/1063">issues/1063</a>.</p> </li> <li> <p>Invocation throttling helpers were reworked: <code>SimpleInvocationGate</code> is renamed <code>FixedIntervalInvocationGate</code>, and <code>BatchedFixedIntervalInvocationGate</code> allows a short burst of invocations before applying a fixed lull. The sanitisation warning above uses the batched gate.</p> </li> <li> <p>The JPMS <code>module-info</code> for logback-core now exports the <code>ch.qos.logback.core.property</code> package, which had been missing from the module descriptor.</p> </li> <li> <p>A bit-wise identical binary of this version can be reproduced by building from <a href="https://github.com/qos-ch/logback">source code</a> at commit <code>e8e824dede022a6d7208b36cfa875b0d1b7772f3</code> associated with the tag <code>v_1.6.3</code>. The release was built using Java "21" 2023-10-17 LTS build 21.0.1.+12-LTS-29 under Linux Debian 11.6.</p> </li> </ul> <p>-- Sponsoring SLF4J/logback/reload4j at <a href="https://github.com/sponsors/qos-ch">https://github.com/sponsors/qos-ch</a></p> <h2>Logback 1.6.2</h2> <p><a href="https://github.com/user-attachments/assets/9ceaf157-b758-4188-815d-edfe4e1b4edd">https://github.com/user-attachments/assets/9ceaf157-b758-4188-815d-edfe4e1b4edd</a></p> <h1>2026-08-10 Release of logback version 1.6.2</h1> <ul> <li> <p>Configuration analysis now detects <em>contradictory caller-data inclusion instructions</em>. For example, an <code>AsyncAppender</code>, <code>SocketAppender</code> or <code>SMTPAppender</code> with <code>includeCallerData</code> left at the default <code>false</code> is incompatible with a layout or encoder pattern that uses a caller-data converter such as <code>%C</code>, <code>%M</code>, <code>%L</code>, <code>%F</code>, <code>%l</code> or <code>%caller</code>. At runtime those converters would print question marks and still incur extraction cost on a worker thread. Logback now emits a configuration-time warning when such instructions disagree. See <a href="https://logback.qos.ch/codes.html#callerContradiction">codes.html#callerContradiction</a> for details. This issue was reported in <a href="https://redirect.github.com/qos-ch/logback/issues/1059">issues/1059</a> by <a href="https://github.com/leeychee">leeychee</a>. The initial analysis was contributed by <a href="https://github.com/seonwooj0810">seonwoo_jung</a>.</p> </li> <li> <p>Caller-contradiction analysis can be turned off by setting the <code>logback.skipCallerContradictionAnalysis</code> variable to <code>true</code>, either as a system property (<code>-Dlogback.skipCallerContradictionAnalysis=true</code>) or as a property in the configuration file:</p> <pre lang="xml"><code><property name="logback.skipCallerContradictionAnalysis" value="true"/> </code></pre> </li> <li> <p><code>SimpleSocketServer</code> and <code>SimpleSSLSocketServer</code> now require an explicit client IP whitelist. On the command line, pass one or more allowed addresses (single IPs or CIDR ranges) after the configuration file. An empty whitelist means no clients are accepted. When embedding the server programmatically, register allowed addresses with <code>addAllowedClientAddress(String)</code> or <code>setAllowedClientAddresses(Collection)</code> before clients connect. See the documentation on <a href="https://logback.qos.ch/manual/appenders.html#simpleSocketServerClientAccess">restricting client access</a>.</p> </li> <li> <p>Added <code>ThrowableProxyVOBuilder</code> for assembling a <code>ThrowableProxyVO</code> field by field, with a corresponding <code>ThrowableProxyVO.builder()</code> entry point.</p> </li> <li> <p>Dependency analysis handlers now run their <code>postHandle</code> method after child models have been processed, so checks that depend on nested appenders (such as caller-contradiction analysis) see a complete picture.</p> </li> <li> <p>Updated several dependencies, including Angus Mail to 2.0.4 and Jetty (test) to 12.1.12.</p> </li> <li> <p>A bit-wise identical binary of this version can be reproduced by building from <a href="https://github.com/qos-ch/logback">source code</a> at commit e3d78330ad1ba024fd987fd00c3ffb9cfcdb07dc associated with the tag <code>v_1.6.2</code>. The release was built using Java "21" 2023-10-17 LTS build 21.0.1.+12-LTS-29 under Linux Debian 11.6.</p> </li> </ul> </blockquote> </details> <details> <summary>Commits</summary> <ul> <li><a href="https://github.com/qos-ch/logback/commit/e8e824dede022a6d7208b36cfa875b0d1b7772f3"><code>e8e824d</code></a> prepare release 1.6.3</li> <li><a href="https://github.com/qos-ch/logback/commit/761821bfaacac3a0ad44fa546cfc814429bf9312"><code>761821b</code></a> MDCBasedDiscriminator has a gated warning mechanism</li> <li><a href="https://github.com/qos-ch/logback/commit/53ed1229008d8b1902f5c234deaa07d742890879"><code>53ed122</code></a> update copyright year</li> <li><a href="https://github.com/qos-ch/logback/commit/c7e2db244671ffa916182b5da8c89579eb54a645"><code>c7e2db2</code></a> rename SimpleInvocationGate as FixedIntervalInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/b5aa931b096a4b0b6a9e140b74fabe7da152cbf0"><code>b5aa931</code></a> added BatchedSimpleInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/1f22af7686aadd25c08b4bd1e6943a906a743ad4"><code>1f22af7</code></a> add javadocs to SimpleInvocationGate</li> <li><a href="https://github.com/qos-ch/logback/commit/638ffa7e7852478b605a91b3e91238ff26f8158c"><code>638ffa7</code></a> prevent forward and backward slashes to escape to other directories</li> <li><a href="https://github.com/qos-ch/logback/commit/7d6b9a4f8c8996834c0a694f6c141705a003d7bb"><code>7d6b9a4</code></a> add missing ch.qos.logback.core.property package</li> <li><a href="https://github.com/qos-ch/logback/commit/fa25930346f35636fb6a077c1f66ebb06edd3b6f"><code>fa25930</code></a> add an extension path in ConsoleAppender for JansiConsoleAppender</li> <li><a href="https://github.com/qos-ch/logback/commit/c73b43f2011f9d4545abc7ea461172276a0a43b3"><code>c73b43f</code></a> deprecate the withJansi path</li> <li>Additional commits viewable in <a href="https://github.com/qos-ch/logback/compare/v_1.6.1...v_1.6.3">compare view</a></li> </ul> </details> <br /> Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting `@dependabot rebase`. [//]: # (dependabot-automerge-start) [//]: # (dependabot-automerge-end) --- <details> <summary>Dependabot commands and options</summary> <br /> You can trigger Dependabot actions by commenting on this PR: - `@dependabot rebase` will rebase this PR - `@dependabot recreate` will recreate this PR, overwriting any edits that have been made to it - `@dependabot show <dependency name> ignore conditions` will show all of the ignore conditions of the specified dependency - `@dependabot ignore this major version` will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this minor version` will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself) - `@dependabot ignore this dependency` will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself) </details> Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
818 lines
31 KiB
Groovy
818 lines
31 KiB
Groovy
plugins {
|
|
id "java"
|
|
id "jacoco"
|
|
id "io.spring.dependency-management" version "1.1.7"
|
|
id "org.springframework.boot" version "4.0.6"
|
|
id "org.springdoc.openapi-gradle-plugin" version "1.9.0"
|
|
id "io.swagger.swaggerhub" version "1.3.2"
|
|
id "com.diffplug.spotless" version "8.8.0"
|
|
id "com.github.jk1.dependency-license-report"
|
|
//id "nebula.lint" version "19.0.3"
|
|
id "org.sonarqube" version "7.3.1.8318"
|
|
}
|
|
|
|
import com.github.jk1.license.render.*
|
|
import groovy.json.JsonOutput
|
|
import groovy.json.JsonSlurper
|
|
import groovy.xml.XmlSlurper
|
|
import org.gradle.api.JavaVersion
|
|
import org.gradle.api.tasks.testing.Test
|
|
import org.gradle.jvm.toolchain.JavaLanguageVersion
|
|
import stirling.software.gradle.ModuleLicenseOverrideFilter
|
|
|
|
ext {
|
|
springBootVersion = "4.0.6"
|
|
pdfboxVersion = "3.0.8"
|
|
imageioVersion = "3.14.0"
|
|
lombokVersion = "1.18.46"
|
|
bouncycastleVersion = "1.85"
|
|
springSecuritySamlVersion = "7.1.0"
|
|
openSamlVersion = "5.2.1"
|
|
commonmarkVersion = "0.28.0"
|
|
googleJavaFormatVersion = "1.35.0"
|
|
logback = "1.6.3"
|
|
commonsIoVersion = "2.22.0"
|
|
commonsLang3 = "3.20.0"
|
|
rhinoVersion = "1.9.1"
|
|
okhttpBomVersion = "5.3.2"
|
|
gsonVersion = "2.14.0"
|
|
guavaVersion = "33.6.0-jre"
|
|
jinjavaVersion = "2.8.4"
|
|
jackson2Version = "2.22.1"
|
|
bucket4jVersion = "8.19.0"
|
|
archunitVersion = "1.4.2"
|
|
batikVersion = "1.19"
|
|
jpdfiumVersion = "1.0.4"
|
|
jwtVersion = "0.13.0"
|
|
awsSdkVersion = "2.51.3"
|
|
jschVersion = "2.28.6"
|
|
commonsNetVersion = "3.13.0"
|
|
smbjVersion = "0.14.0"
|
|
tinkVersion = "1.23.0"
|
|
testcontainersMinioVersion = "1.21.4"
|
|
// junit-platform-launcher version managed by Spring Boot BOM
|
|
modernJavaVersion = 25
|
|
}
|
|
|
|
def buildJavaMajorVersion = (project.findProperty('javaVersion') ?: ext.modernJavaVersion).toString().toInteger()
|
|
def buildJavaLanguageVersion = JavaLanguageVersion.of(buildJavaMajorVersion)
|
|
def buildJavaVersion = JavaVersion.toVersion(buildJavaMajorVersion.toString())
|
|
|
|
java {
|
|
sourceCompatibility = buildJavaVersion
|
|
targetCompatibility = buildJavaVersion
|
|
toolchain {
|
|
languageVersion = buildJavaLanguageVersion
|
|
}
|
|
}
|
|
|
|
ext.isSecurityDisabled = { ->
|
|
System.getenv('DOCKER_ENABLE_SECURITY') == 'false' ||
|
|
System.getenv('DISABLE_ADDITIONAL_FEATURES') == 'true' ||
|
|
(project.hasProperty('DISABLE_ADDITIONAL_FEATURES') &&
|
|
System.getProperty('DISABLE_ADDITIONAL_FEATURES') == 'true')
|
|
}
|
|
|
|
ext.mavenUrl = System.getenv("MAVEN_PUBLIC_URL") ?: ""
|
|
ext.username = System.getenv('MAVEN_USER') ?: ""
|
|
ext.password = System.getenv('MAVEN_PASSWORD') ?: ""
|
|
|
|
if (rootProject.ext.mavenUrl.isEmpty()) {
|
|
println "No custom MAVEN_PUBLIC_URL set, defaulting to Maven Central"
|
|
} else {
|
|
println "MAVEN_PUBLIC_URL set"
|
|
}
|
|
|
|
jar {
|
|
enabled = false
|
|
manifest {
|
|
attributes "Implementation-Title": "Stirling-PDF",
|
|
"Implementation-Version": project.version
|
|
}
|
|
}
|
|
|
|
bootJar {
|
|
enabled = false
|
|
}
|
|
|
|
// :saas is only included for SaaS builds, but a default-flavor clean must still remove artifacts
|
|
// left behind by an earlier SaaS build.
|
|
tasks.named('clean') {
|
|
delete layout.projectDirectory.dir('app/saas/build')
|
|
}
|
|
|
|
// Configure main class for the root project
|
|
springBoot {
|
|
mainClass = 'stirling.software.SPDF.SPDFApplication'
|
|
}
|
|
|
|
allprojects {
|
|
group = 'stirling.software'
|
|
version = '2.14.3'
|
|
|
|
configurations.configureEach {
|
|
exclude group: "org.springframework.boot", module: "spring-boot-starter-tomcat"
|
|
}
|
|
}
|
|
|
|
def appVersionStr = project.version.toString()
|
|
def tauriConfigPath = layout.projectDirectory.file('frontend/editor/src-tauri/tauri.conf.json').asFile.path
|
|
def sim1Path = layout.projectDirectory.file('frontend/editor/src/core/testing/serverExperienceSimulations.ts').asFile.path
|
|
def sim2Path = layout.projectDirectory.file('frontend/editor/src/proprietary/testing/serverExperienceSimulations.ts').asFile.path
|
|
def aurDesktopPkgbuildPath = layout.projectDirectory.file('.github/aur/stirling-pdf-desktop/PKGBUILD').asFile.path
|
|
def aurServerPkgbuildPath = layout.projectDirectory.file('.github/aur/stirling-pdf-server-bin/PKGBUILD').asFile.path
|
|
|
|
tasks.register('syncAppVersion') {
|
|
group = 'versioning'
|
|
description = 'Synchronizes app version across desktop, simulation, and AUR PKGBUILD configs.'
|
|
|
|
doLast {
|
|
println "Synchronizing application version to ${appVersionStr}"
|
|
|
|
def tauriConfigFile = new File(tauriConfigPath)
|
|
if (tauriConfigFile.exists()) {
|
|
def content = tauriConfigFile.getText('UTF-8')
|
|
def matcher = (content =~ /(?m)^(\s*"version":\s*")([^"]*)(")/)
|
|
if (!matcher.find()) {
|
|
throw new GradleException("Could not locate version in ${tauriConfigFile} for synchronization")
|
|
}
|
|
def updatedContent = matcher.replaceFirst("${matcher.group(1)}${appVersionStr}${matcher.group(3)}")
|
|
if (content != updatedContent) {
|
|
tauriConfigFile.write(updatedContent, 'UTF-8')
|
|
}
|
|
}
|
|
|
|
[new File(sim1Path), new File(sim2Path)].each { f ->
|
|
if (f.exists()) {
|
|
def content = f.getText('UTF-8')
|
|
def matcher = (content =~ /(appVersion:\s*(['"]))(.*?)(\2)/)
|
|
if (!matcher.find()) {
|
|
throw new GradleException("Could not locate appVersion in ${f} for synchronization")
|
|
}
|
|
def updatedContent = matcher.replaceFirst("${matcher.group(1)}${appVersionStr}${matcher.group(4)}")
|
|
if (content != updatedContent) {
|
|
f.write(updatedContent, 'UTF-8')
|
|
}
|
|
}
|
|
}
|
|
|
|
[new File(aurDesktopPkgbuildPath), new File(aurServerPkgbuildPath)].each { f ->
|
|
if (f.exists()) {
|
|
def content = f.getText('UTF-8')
|
|
def matcher = (content =~ /(?m)^(pkgver=)(.*)$/)
|
|
if (!matcher.find()) {
|
|
throw new GradleException("Could not locate pkgver in ${f} for synchronization")
|
|
}
|
|
def updatedContent = matcher.replaceFirst("\$1${appVersionStr}")
|
|
if (content != updatedContent) {
|
|
f.write(updatedContent, 'UTF-8')
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.register('writeVersion', WriteProperties) {
|
|
destinationFile = layout.projectDirectory.file('app/common/src/main/resources/version.properties')
|
|
println "Writing version.properties to ${destinationFile.get().asFile.path}"
|
|
comment = "${new Date()}"
|
|
property 'version', project.provider { project.version.toString() }
|
|
}
|
|
|
|
subprojects {
|
|
apply plugin: 'java'
|
|
apply plugin: 'java-library'
|
|
apply plugin: 'com.diffplug.spotless'
|
|
apply plugin: 'org.springframework.boot'
|
|
apply plugin: 'io.spring.dependency-management'
|
|
apply plugin: 'jacoco'
|
|
apply from: rootProject.file('gradle/spotless.gradle')
|
|
|
|
java {
|
|
sourceCompatibility = buildJavaVersion
|
|
targetCompatibility = buildJavaVersion
|
|
toolchain {
|
|
languageVersion = buildJavaLanguageVersion
|
|
}
|
|
}
|
|
|
|
if (project.name != "stirling-pdf") {
|
|
bootJar {
|
|
enabled = false
|
|
}
|
|
}
|
|
|
|
repositories {
|
|
if (!rootProject.ext.mavenUrl.isEmpty()) {
|
|
maven {
|
|
url = rootProject.ext.mavenUrl + '/releases'
|
|
credentials(PasswordCredentials) {
|
|
username = rootProject.ext.username
|
|
password = rootProject.ext.password
|
|
}
|
|
authentication {
|
|
basic(BasicAuthentication)
|
|
}
|
|
allowInsecureProtocol = true
|
|
}
|
|
}
|
|
// Maven Central first; mirrors below are fallbacks for niche artifacts.
|
|
mavenCentral()
|
|
maven { url = "https://repository.jboss.org/" }
|
|
maven { url = "https://build.shibboleth.net/maven/releases" }
|
|
}
|
|
|
|
configurations.configureEach {
|
|
exclude group: 'org.springframework.boot', module: 'spring-boot-starter-tomcat'
|
|
// Exclude vulnerable BouncyCastle version used in tableau
|
|
exclude group: 'org.bouncycastle', module: 'bcpkix-jdk15on'
|
|
exclude group: 'org.bouncycastle', module: 'bcutil-jdk15on'
|
|
exclude group: 'org.bouncycastle', module: 'bcmail-jdk15on'
|
|
|
|
// Security CVE fixes - hardcoded resolution strategy to ensure safe versions
|
|
// Primary fixes via explicit dependencies in app/core/build.gradle:
|
|
// - CVE-2022-25647: gson 2.8.9+ (explicit dependency overrides tabula 2.8.7)
|
|
// - CVE-2025-66453: rhino 1.7.15 (explicit dependency overrides verapdf 1.7.13)
|
|
// Fallback strategy force declarations for additional safety:
|
|
resolutionStrategy.force "com.google.code.gson:gson:${gsonVersion}"
|
|
resolutionStrategy.force "org.mozilla:rhino:${rhinoVersion}"
|
|
// CVE-2025-48924: commons-lang3 3.20.0 DoS prevention
|
|
resolutionStrategy.force "org.apache.commons:commons-lang3:${commonsLang3}"
|
|
// CVE-2024-47554: commons-io DoS prevention
|
|
resolutionStrategy.force "commons-io:commons-io:${commonsIoVersion}"
|
|
// Jackson 2 is transitive-only here (jinjava, opensaml, jjwt request older versions);
|
|
// pin the family to a current release and keep modules aligned.
|
|
resolutionStrategy.force "com.fasterxml.jackson.core:jackson-core:${jackson2Version}"
|
|
resolutionStrategy.force "com.fasterxml.jackson.core:jackson-databind:${jackson2Version}"
|
|
resolutionStrategy.force "com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:${jackson2Version}"
|
|
resolutionStrategy.force "com.fasterxml.jackson.datatype:jackson-datatype-jdk8:${jackson2Version}"
|
|
resolutionStrategy.force "com.fasterxml.jackson.datatype:jackson-datatype-jsr310:${jackson2Version}"
|
|
// Keep BouncyCastle modules aligned to avoid runtime linkage errors
|
|
resolutionStrategy.force "org.bouncycastle:bcprov-jdk18on:${bouncycastleVersion}"
|
|
resolutionStrategy.force "org.bouncycastle:bcpkix-jdk18on:${bouncycastleVersion}"
|
|
resolutionStrategy.force "org.bouncycastle:bcutil-jdk18on:${bouncycastleVersion}"
|
|
}
|
|
|
|
dependencyManagement {
|
|
imports {
|
|
mavenBom "org.springframework.boot:spring-boot-dependencies:$springBootVersion"
|
|
}
|
|
dependencies {
|
|
// Override BOM-managed commons-lang3 for CVE-2025-48924 fix
|
|
dependency "org.apache.commons:commons-lang3:$commonsLang3"
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
implementation 'org.springframework.boot:spring-boot-starter-actuator'
|
|
implementation 'io.github.pixee:java-security-toolkit:1.2.3'
|
|
|
|
//tmp for security bumps
|
|
implementation "ch.qos.logback:logback-core:$logback"
|
|
implementation "ch.qos.logback:logback-classic:$logback"
|
|
compileOnly "org.projectlombok:lombok:$lombokVersion"
|
|
annotationProcessor "org.projectlombok:lombok:$lombokVersion"
|
|
|
|
// Jackson 3 (Spring Boot 4 uses tools.jackson)
|
|
implementation 'org.springframework.boot:spring-boot-starter-jackson'
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-webmvc-test'
|
|
testRuntimeOnly 'org.mockito:mockito-inline:5.2.0'
|
|
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
|
|
testImplementation platform("com.squareup.okhttp3:okhttp-bom:${okhttpBomVersion}")
|
|
testImplementation "com.squareup.okhttp3:mockwebserver"
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = "UTF-8"
|
|
options.release = buildJavaMajorVersion
|
|
if (!project.hasProperty("noSpotless")) {
|
|
dependsOn "spotlessApply"
|
|
}
|
|
}
|
|
|
|
tasks.named("compileJava", JavaCompile).configure {
|
|
// options.compilerArgs.add("-Xlint:deprecation")
|
|
// options.compilerArgs.add("-Xlint:unchecked")
|
|
}
|
|
|
|
def jacocoReport = tasks.named("jacocoTestReport")
|
|
|
|
tasks.withType(Test).configureEach {
|
|
useJUnitPlatform()
|
|
jvmArgs '--enable-native-access=ALL-UNNAMED'
|
|
systemProperty 'java.awt.headless', 'true'
|
|
systemProperty 'apple.awt.UIElement', 'true'
|
|
|
|
testLogging {
|
|
events "started", "failed"
|
|
showExceptions = true
|
|
showCauses = true
|
|
showStackTraces = true
|
|
exceptionFormat "full"
|
|
}
|
|
finalizedBy(jacocoReport)
|
|
}
|
|
|
|
jacocoReport.configure {
|
|
dependsOn(tasks.named("test"))
|
|
reports {
|
|
xml.required.set(true)
|
|
csv.required.set(false)
|
|
html.required.set(true)
|
|
}
|
|
doLast {
|
|
def xmlReport = reports.xml.outputLocation.get().asFile
|
|
if (!xmlReport.exists()) {
|
|
logger.lifecycle("Jacoco coverage report not found at ${xmlReport}")
|
|
return
|
|
}
|
|
|
|
def xmlContent = xmlReport.getText("UTF-8")
|
|
xmlContent = xmlContent.replaceFirst('(?s)<!DOCTYPE.*?>', '')
|
|
def report = new XmlSlurper(false, false).parseText(xmlContent)
|
|
def counters = report.counter.collectEntries { counter ->
|
|
def type = counter.@type.text()
|
|
def covered = counter.@covered.text() as BigDecimal
|
|
def missed = counter.@missed.text() as BigDecimal
|
|
[(type): [covered: covered, missed: missed]]
|
|
}
|
|
|
|
def thresholds = [
|
|
LINE : 0.13,
|
|
INSTRUCTION: 0.14,
|
|
BRANCH : 0.09
|
|
]
|
|
|
|
def types = ["LINE", "INSTRUCTION", "BRANCH"]
|
|
def headers = ["Metric", "Coverage", "Covered/Total", "Status", "Target"]
|
|
|
|
def rows = types.collect { String type ->
|
|
def data = counters[type]
|
|
if (!data) {
|
|
return [type, "—", "—", "No data", ""]
|
|
}
|
|
|
|
def total = data.covered + data.missed
|
|
if (total == 0) {
|
|
return [type, "—", "0/${total.toBigInteger()}", "No executions", ""]
|
|
}
|
|
|
|
def ratio = data.covered / total * 100
|
|
def coverageText = String.format(Locale.ROOT, "%.2f%%", ratio)
|
|
def coveredText = String.format(Locale.ROOT, "%d/%d",
|
|
data.covered.toBigInteger(),
|
|
total.toBigInteger())
|
|
|
|
def threshold = thresholds[type]
|
|
def thresholdPercent = threshold != null ? threshold * 100 : null
|
|
def targetText = thresholdPercent != null ?
|
|
String.format(Locale.ROOT, ">= %.2f%%", thresholdPercent) : ""
|
|
def passed = thresholdPercent != null ? ratio >= thresholdPercent : null
|
|
def statusText = passed == null ? "" : (passed ? "PASS" : "FAIL")
|
|
|
|
return [type, coverageText, coveredText, statusText, targetText]
|
|
}
|
|
|
|
def columnIndexes = (0..<headers.size())
|
|
def columnWidths = columnIndexes.collect { idx ->
|
|
Math.max(headers[idx].length(), rows.collect { row ->
|
|
row[idx] != null ? row[idx].toString().length() : 0
|
|
}.max() ?: 0)
|
|
}
|
|
|
|
def formatRow = { List<String> values ->
|
|
columnIndexes.collect { idx ->
|
|
def value = values[idx] ?: ""
|
|
value.padRight(columnWidths[idx])
|
|
}.join(" | ")
|
|
}
|
|
|
|
def separator = columnIndexes.collect { idx ->
|
|
''.padRight(columnWidths[idx], '-')
|
|
}.join("-+-")
|
|
|
|
logger.lifecycle("")
|
|
logger.lifecycle("==== JaCoCo Coverage Summary ====")
|
|
logger.lifecycle(formatRow(headers))
|
|
logger.lifecycle(separator)
|
|
rows.each { row ->
|
|
logger.lifecycle(formatRow(row))
|
|
}
|
|
logger.lifecycle(separator)
|
|
|
|
def htmlReport = reports.html.outputLocation.get().asFile
|
|
logger.lifecycle("Detailed HTML report available at: ${htmlReport}")
|
|
if (rows.any { it[3] == "FAIL" }) {
|
|
logger.lifecycle("Some coverage targets were missed. Please review the detailed report above.")
|
|
} else if (rows.any { it[3] == "PASS" }) {
|
|
logger.lifecycle("Great job! All tracked coverage metrics meet their targets.")
|
|
}
|
|
logger.lifecycle("=================================\n")
|
|
}
|
|
}
|
|
|
|
tasks.named("build") {
|
|
dependsOn jacocoReport
|
|
}
|
|
|
|
jacocoTestCoverageVerification {
|
|
dependsOn jacocoReport
|
|
violationRules {
|
|
rule {
|
|
enabled = true
|
|
element = 'BUNDLE'
|
|
// Bytecode-Anweisungen abgedeckt
|
|
limit {
|
|
counter = 'INSTRUCTION'
|
|
value = 'COVEREDRATIO'
|
|
minimum = 0.14
|
|
}
|
|
// wie viele Quellcode-Zeilen abgedeckt
|
|
limit {
|
|
counter = 'LINE'
|
|
value = 'COVEREDRATIO'
|
|
minimum = 0.13
|
|
}
|
|
// Verzweigungen (if/else, switch) abgedeckt; misst Logik-Abdeckung
|
|
limit {
|
|
counter = 'BRANCH'
|
|
value = 'COVEREDRATIO'
|
|
minimum = 0.09
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.named("processResources") {
|
|
dependsOn(rootProject.tasks.writeVersion)
|
|
}
|
|
|
|
if (name == 'stirling-pdf') {
|
|
apply plugin: 'org.springdoc.openapi-gradle-plugin'
|
|
|
|
openApi {
|
|
apiDocsUrl = "http://localhost:8080/v1/api-docs"
|
|
outputDir = file("$projectDir")
|
|
outputFileName = "SwaggerDoc.json"
|
|
waitTimeInSeconds = 60 // Increase the wait time to 60 seconds
|
|
}
|
|
|
|
tasks.named("forkedSpringBootRun") {
|
|
dependsOn(":common:jar")
|
|
dependsOn(":proprietary:jar")
|
|
}
|
|
|
|
tasks.register("copySwaggerDoc", Copy) {
|
|
doNotTrackState("Writes SwaggerDoc.json to project root")
|
|
from(layout.projectDirectory.file("SwaggerDoc.json"))
|
|
into(rootProject.projectDir)
|
|
dependsOn("generateOpenApiDocs")
|
|
}
|
|
|
|
tasks.register("cleanSwaggerInBuild", Delete) {
|
|
doNotTrackState("Cleans up SwaggerDoc.json in build directory")
|
|
delete(layout.projectDirectory.file("SwaggerDoc.json"))
|
|
dependsOn("copySwaggerDoc")
|
|
}
|
|
|
|
tasks.named("copySwaggerDoc") {
|
|
finalizedBy("cleanSwaggerInBuild")
|
|
}
|
|
|
|
tasks.named("generateOpenApiDocs") {
|
|
finalizedBy("copySwaggerDoc")
|
|
doNotTrackState("OpenAPI plugin writes outside build directory")
|
|
}
|
|
|
|
tasks.named("bootRun") {
|
|
def runtimeArgs = [
|
|
"-XX:+UseG1GC",
|
|
"-XX:MaxGCPauseMillis=200",
|
|
"-XX:G1HeapRegionSize=4m",
|
|
"-XX:+ExplicitGCInvokesConcurrent",
|
|
"-XX:+UseStringDeduplication",
|
|
"-XX:+UseCompactObjectHeaders",
|
|
"--enable-native-access=ALL-UNNAMED"
|
|
]
|
|
|
|
// Optional JaCoCo agent for e2e/cucumber backend coverage.
|
|
//
|
|
// Enabled with `-PjacocoAgent=true`. The default destfile lives
|
|
// outside the source tree so it doesn't poison a normal bootRun
|
|
// for a developer who forgot to pass the property. Override
|
|
// both with `-PjacocoExec=/path/to.exec` if you need a custom
|
|
// location (e.g. when sharing it with the Playwright runner).
|
|
if (rootProject.hasProperty('jacocoAgent') &&
|
|
rootProject.property('jacocoAgent').toString() == 'true') {
|
|
def agentJar = rootProject.layout.buildDirectory
|
|
.file('jacoco/jacocoagent.jar').get().asFile.absolutePath
|
|
def execFile = (rootProject.findProperty('jacocoExec') ?:
|
|
rootProject.layout.projectDirectory
|
|
.file('.test-state/playwright/jacoco.exec').asFile.absolutePath
|
|
).toString()
|
|
// The JaCoCo agent argument is a comma-separated key=value list,
|
|
// so a path that itself contains ',' or '=' would smuggle extra
|
|
// agent options (e.g. -PjacocoExec='out.exec,sessionid=evil').
|
|
// Today the value only comes from our own CI workflows, but
|
|
// validating defensively is cheap and silences Aikido.
|
|
//
|
|
// Control characters are checked via String.contains rather
|
|
// than inside a slashy regex character class - a literal NULL
|
|
// accidentally landing in the regex killed Groovy parsing on
|
|
// the previous attempt.
|
|
def hasBadChar = execFile.find(/[,= ]/) != null ||
|
|
execFile.contains('\r') ||
|
|
execFile.contains('\n') ||
|
|
execFile.contains('\t')
|
|
if (hasBadChar) {
|
|
throw new GradleException(
|
|
"jacocoExec='" + execFile + "' contains characters " +
|
|
"(',', '=', whitespace, or control chars) that " +
|
|
"would break -javaagent option parsing. Choose " +
|
|
"a different path."
|
|
)
|
|
}
|
|
runtimeArgs.add("-javaagent:${agentJar}=destfile=${execFile},output=file,append=false,dumponexit=true")
|
|
dependsOn(rootProject.tasks.named('copyJacocoAgent'))
|
|
doFirst {
|
|
new File(execFile).parentFile?.mkdirs()
|
|
logger.lifecycle("JaCoCo agent attached: ${execFile}")
|
|
}
|
|
}
|
|
|
|
jvmArgs = runtimeArgs
|
|
}
|
|
}
|
|
}
|
|
|
|
tasks.withType(JavaCompile).configureEach {
|
|
options.encoding = "UTF-8"
|
|
if (!project.hasProperty("noSpotless")) {
|
|
dependsOn "spotlessApply"
|
|
}
|
|
}
|
|
|
|
gradle.taskGraph.whenReady { graph ->
|
|
if (project.hasProperty("noSpotless")) {
|
|
allprojects { scopedProject ->
|
|
scopedProject.tasks.matching { it.name.startsWith("spotless") }.configureEach {
|
|
enabled = false
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
def allProjects = ((subprojects as Set<Project>) + project) as Set<Project>
|
|
def moduleLicenseOverridesFile = project.layout.projectDirectory.file("app/license-overrides.json").asFile
|
|
|
|
licenseReport {
|
|
projects = allProjects
|
|
renderers = [new JsonReportRenderer()]
|
|
allowedLicensesFile = project.layout.projectDirectory.file("app/allowed-licenses.json").asFile
|
|
outputDir = project.layout.buildDirectory.dir("reports/dependency-license").get().asFile.path
|
|
configurations = [ "productionRuntimeClasspath", "runtimeClasspath" ]
|
|
filters = [new ModuleLicenseOverrideFilter(moduleLicenseOverridesFile)]
|
|
}
|
|
|
|
tasks.named('generateLicenseReport') {
|
|
inputs.file(moduleLicenseOverridesFile)
|
|
}
|
|
|
|
tasks.named('checkLicensePreparation') {
|
|
inputs.file(moduleLicenseOverridesFile)
|
|
}
|
|
|
|
// Configure the forked spring boot run task to properly delegate to the stirling-pdf module
|
|
tasks.named('forkedSpringBootRun') {
|
|
dependsOn ':stirling-pdf:bootRun'
|
|
doFirst {
|
|
println "Delegating forkedSpringBootRun to :stirling-pdf:bootRun"
|
|
}
|
|
}
|
|
|
|
spotless {
|
|
yaml {
|
|
target '*.yml', '*.yaml'
|
|
trimTrailingWhitespace()
|
|
leadingTabsToSpaces()
|
|
endWithNewline()
|
|
}
|
|
format 'gradle', {
|
|
target 'build.gradle', 'settings.gradle', 'gradle/*.gradle', 'gradle/**/*.gradle'
|
|
trimTrailingWhitespace()
|
|
leadingTabsToSpaces()
|
|
endWithNewline()
|
|
}
|
|
}
|
|
|
|
sonar {
|
|
properties {
|
|
property "sonar.projectKey", "Stirling-Tools_Stirling-PDF"
|
|
property "sonar.organization", "stirling-tools"
|
|
|
|
property "sonar.exclusions", "**/build-wrapper-dump.json, **/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
|
property "sonar.coverage.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
|
property "sonar.cpd.exclusions", "**/src/main/java/org/apache/**, **/src/main/resources/static/pdfjs/**, **/src/main/resources/static/pdfjs-legacy/**, **/src/main/resources/static/js/thirdParty/**"
|
|
}
|
|
}
|
|
|
|
swaggerhubUpload {
|
|
// dependsOn = generateOpenApiDocs // Depends on your task generating Swagger docs
|
|
api = "Stirling-PDF" // The name of your API on SwaggerHub
|
|
owner = "${System.getenv().getOrDefault('SWAGGERHUB_USER', 'Frooodle')}" // Your SwaggerHub username (or organization name)
|
|
version = project.version // The version of your API
|
|
inputFile = file("SwaggerDoc.json") // The path to your Swagger docs
|
|
token = "${System.getenv("SWAGGERHUB_API_KEY")}" // Your SwaggerHub API key, passed as an environment variable
|
|
oas = "3.0.0" // The version of the OpenAPI Specification you"re using
|
|
}
|
|
|
|
repositories {
|
|
if (!rootProject.ext.mavenUrl.isEmpty()) {
|
|
maven {
|
|
url = rootProject.ext.mavenUrl + '/releases'
|
|
credentials(PasswordCredentials) {
|
|
username = rootProject.ext.username
|
|
password = rootProject.ext.password
|
|
}
|
|
authentication {
|
|
basic(BasicAuthentication)
|
|
}
|
|
allowInsecureProtocol = true
|
|
}
|
|
}
|
|
mavenCentral()
|
|
maven { url = "https://repository.jboss.org/" }
|
|
maven { url = "https://build.shibboleth.net/maven/releases" }
|
|
}
|
|
|
|
dependencies {
|
|
implementation project(':stirling-pdf')
|
|
implementation project(':common')
|
|
if (rootProject.ext.isSecurityDisabled()) {
|
|
implementation project(':proprietary')
|
|
}
|
|
|
|
testImplementation 'org.springframework.boot:spring-boot-starter-test'
|
|
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
|
|
|
|
testImplementation platform("com.squareup.okhttp3:okhttp-bom:${okhttpBomVersion}")
|
|
testImplementation "com.squareup.okhttp3:mockwebserver"
|
|
}
|
|
|
|
tasks.named("test") {
|
|
useJUnitPlatform()
|
|
}
|
|
|
|
// Make sure all relevant processes depend on writeVersion
|
|
processResources.dependsOn(writeVersion)
|
|
|
|
tasks.register('printVersion') {
|
|
doLast {
|
|
println project.version
|
|
}
|
|
}
|
|
|
|
tasks.named('bootRun') {
|
|
group = 'application'
|
|
description = 'Delegates to :stirling-pdf:bootRun'
|
|
dependsOn ':stirling-pdf:bootRun'
|
|
|
|
doFirst {
|
|
println "Delegating to :stirling-pdf:bootRun"
|
|
}
|
|
}
|
|
|
|
tasks.named('build') {
|
|
group = 'build'
|
|
description = 'Delegates to :stirling-pdf:bootJar'
|
|
dependsOn ':stirling-pdf:bootJar', 'buildRestartHelper', 'syncAppVersion'
|
|
|
|
doFirst {
|
|
println "Delegating to :stirling-pdf:bootJar"
|
|
}
|
|
}
|
|
|
|
// Task to compile RestartHelper.java
|
|
tasks.register('compileRestartHelper', JavaCompile) {
|
|
group = 'build'
|
|
description = 'Compiles the RestartHelper utility'
|
|
|
|
source = fileTree(dir: 'scripts', include: 'RestartHelper.java')
|
|
classpath = files()
|
|
destinationDirectory = layout.buildDirectory.dir("restart-helper-classes")
|
|
def restartMajorVersion = buildJavaMajorVersion
|
|
def restartLanguageVersion = JavaLanguageVersion.of(restartMajorVersion)
|
|
def restartCompatibility = JavaVersion.toVersion(restartMajorVersion.toString())
|
|
sourceCompatibility = restartCompatibility
|
|
targetCompatibility = restartCompatibility
|
|
javaCompiler = javaToolchains.compilerFor {
|
|
languageVersion = restartLanguageVersion
|
|
}
|
|
options.release.set(restartMajorVersion)
|
|
}
|
|
|
|
// Task to create restart-helper.jar
|
|
tasks.register('buildRestartHelper', Jar) {
|
|
group = 'build'
|
|
description = 'Builds the restart-helper.jar'
|
|
dependsOn 'compileRestartHelper'
|
|
|
|
from layout.buildDirectory.dir("restart-helper-classes")
|
|
archiveFileName = 'restart-helper.jar'
|
|
destinationDirectory = layout.buildDirectory.dir("libs")
|
|
|
|
manifest {
|
|
attributes 'Main-Class': 'RestartHelper'
|
|
}
|
|
|
|
doLast {
|
|
println "restart-helper.jar created at: ${destinationDirectory.get()}/restart-helper.jar"
|
|
}
|
|
}
|
|
|
|
tasks.withType(Test).configureEach {
|
|
// maxParallelForks: parallelise JUnit across cores
|
|
// Half of available CPUs is a safe default; bump if your tests are I/O-bound.
|
|
maxParallelForks = Math.max(1, (Runtime.runtime.availableProcessors().intdiv(2)) as int)
|
|
}
|
|
|
|
// ----------------------------------------------------------------------------
|
|
// JaCoCo helpers used by CI for cucumber + Playwright (live backend) coverage.
|
|
//
|
|
// These let CI attach the JaCoCo agent to a running Spring Boot process
|
|
// (gradle bootRun or the docker image, via JAVA_TOOL_OPTIONS) and then turn
|
|
// the resulting .exec dump back into HTML + XML reports without anyone
|
|
// hand-installing the JaCoCo CLI.
|
|
// ----------------------------------------------------------------------------
|
|
|
|
configurations {
|
|
jacocoRuntimeAgent
|
|
jacocoCli
|
|
}
|
|
|
|
dependencies {
|
|
// The :runtime classifier on org.jacoco.agent IS the agent jar - no
|
|
// unzipping required. Kept on the version the plugin already picks so
|
|
// agent + reporter line up exactly.
|
|
jacocoRuntimeAgent "org.jacoco:org.jacoco.agent:${jacoco.toolVersion}:runtime"
|
|
jacocoCli "org.jacoco:org.jacoco.cli:${jacoco.toolVersion}"
|
|
}
|
|
|
|
tasks.register('copyJacocoAgent', Copy) {
|
|
group = 'verification'
|
|
description = 'Copies the JaCoCo runtime agent jar to build/jacoco/jacocoagent.jar.'
|
|
from configurations.jacocoRuntimeAgent
|
|
into layout.buildDirectory.dir('jacoco')
|
|
rename { 'jacocoagent.jar' }
|
|
}
|
|
|
|
// Aggregates an externally-produced .exec (e.g. from e2e:live or the cucumber
|
|
// docker container) against this project's compiled classes + sources.
|
|
//
|
|
// Inputs are configured via -P properties so the same task works for every
|
|
// caller:
|
|
//
|
|
// ./gradlew jacocoReportFromExec -PexecFile=.test-state/playwright/jacoco.exec \
|
|
// -PreportDir=build/reports/jacoco/e2e-live
|
|
tasks.register('jacocoReportFromExec', JacocoReport) {
|
|
group = 'verification'
|
|
description = 'Generates a JaCoCo HTML+XML report from an externally captured .exec.'
|
|
|
|
def execProp = project.findProperty('execFile') ?: project.findProperty('execFiles')
|
|
def reportProp = project.findProperty('reportDir') ?: "build/reports/jacoco/external"
|
|
|
|
executionData fileTree(rootProject.rootDir) {
|
|
if (execProp) {
|
|
include execProp.toString().split(',').collect { it.trim() }
|
|
} else {
|
|
// Sensible defaults so the task is usable without props.
|
|
include '.test-state/**/*.exec'
|
|
include 'coverage-tools/exec/*.exec'
|
|
include 'testing/cucumber-coverage/*.exec'
|
|
}
|
|
}
|
|
|
|
// Pull compiled classes + sources from every subproject so the report is
|
|
// an aggregate. JaCoCo silently skips classes that have no matching .exec
|
|
// probes, so this is safe even when only a subset of code was exercised.
|
|
classDirectories.setFrom(files(subprojects.collect { sub ->
|
|
sub.fileTree(dir: "${sub.buildDir}/classes/java/main", excludes: [
|
|
'**/generated/**',
|
|
])
|
|
}))
|
|
sourceDirectories.setFrom(files(subprojects.collect { sub ->
|
|
"${sub.projectDir}/src/main/java"
|
|
}))
|
|
|
|
reports {
|
|
xml.required.set(true)
|
|
html.required.set(true)
|
|
csv.required.set(false)
|
|
xml.outputLocation.set(layout.projectDirectory.file("${reportProp}/jacocoTestReport.xml"))
|
|
html.outputLocation.set(layout.projectDirectory.dir("${reportProp}/html"))
|
|
}
|
|
}
|