diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index f65a3502..1e3f3283 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,18 +1,73 @@ -name: Build Plugin +name: "CI Build" + on: [ push, pull_request ] + jobs: - gradle-build: + check: # primes cache: runs-on: ubuntu-latest steps: - - name: git clone - uses: actions/checkout@v3.5.2 - - name: Set up JDK - uses: actions/setup-java@v3.11.0 + - uses: actions/checkout@v3.6.0 + - uses: actions/setup-java@v3.12.0 with: distribution: temurin - java-version: 17 - - name: gradle build - id: gradle - uses: gradle/gradle-build-action@v2.4.2 + java-version-file: .oj/jdk-version.txt + - uses: gradle/gradle-build-action@v2.7.1 + - run: "./oj check" + env: + BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }} + BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }} + + test-functional: + needs: check + strategy: + matrix: + module: [app] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.6.0 + - uses: actions/setup-java@v3.12.0 + with: + distribution: temurin + java-version-file: .oj/jdk-version.txt + - uses: gradle/gradle-build-action@v2.7.1 + - run: "./oj :${{ matrix.module }}:checkEndToEnd" + env: + BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }} + BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }} + + package: + needs: check + strategy: + matrix: + os: [ubuntu, macos, windows] + runs-on: ${{ matrix.os }}-latest + steps: + - uses: actions/checkout@v3.6.0 + - uses: actions/setup-java@v3.12.0 + with: + distribution: temurin + java-version-file: .oj/jdk-version.txt + - uses: gradle/gradle-build-action@v2.7.1 + - run: "./oj assemble${{ matrix.os }}" + env: + BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }} + BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }} + + build: + needs: [test-functional, package] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3.6.0 + - uses: actions/setup-java@v3.12.0 + with: + distribution: temurin + java-version-file: .oj/jdk-version.txt + - uses: gradle/gradle-build-action@v2.7.1 + - run: "./oj build" + env: + BUILD_CACHE_USER: ${{ secrets.BUILD_CACHE_USER }} + BUILD_CACHE_PWD: ${{ secrets.BUILD_CACHE_PWD }} + - uses: actions/upload-artifact@v4.0.0 with: - arguments: build \ No newline at end of file + name: Application Packages + path: .oj/build/*/packages/* diff --git a/gradle/wrapper/gradle-wrapper.jar b/.oj/gradle/gradle-wrapper.jar similarity index 100% rename from gradle/wrapper/gradle-wrapper.jar rename to .oj/gradle/gradle-wrapper.jar diff --git a/gradle/wrapper/gradle-wrapper.properties b/.oj/gradle/gradle-wrapper.properties similarity index 92% rename from gradle/wrapper/gradle-wrapper.properties rename to .oj/gradle/gradle-wrapper.properties index ae57b137..b61bd513 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/.oj/gradle/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-rc-2-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/.oj/gradle/platform/.gitignore b/.oj/gradle/platform/.gitignore new file mode 100644 index 00000000..e69de29b diff --git a/.oj/jdk-version.txt b/.oj/jdk-version.txt new file mode 100644 index 00000000..0c4da741 --- /dev/null +++ b/.oj/jdk-version.txt @@ -0,0 +1 @@ +17.0.6 diff --git a/.oj/modules.properties b/.oj/modules.properties new file mode 100644 index 00000000..8c322729 --- /dev/null +++ b/.oj/modules.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/modules + +# jakarta.activation=com.sun.activation:jakarta.activation diff --git a/.oj/patch/boms.properties b/.oj/patch/boms.properties new file mode 100644 index 00000000..1d2b9d0f --- /dev/null +++ b/.oj/patch/boms.properties @@ -0,0 +1,5 @@ +# https://onepiece.software/j/patch/boms + +# org.openjfx\:javafx=javafx-base,javafx-graphics,javafx-controls,javafx-fxml,javafx-media,javafx-swing,javafx-web% +org.apache.poi\:poi=org.apache.poi:poi-excelant,org.apache.poi:poi-ooxml,org.apache.poi:poi-scratchpad +org.slf4j\:slf4j-parent=org.slf4j:slf4j-api,org.slf4j:slf4j-simple,org.slf4j:slf4j-nop,org.slf4j:slf4j-jdk14,org.slf4j:slf4j-log4j12,org.slf4j:slf4j-reload4j,org.slf4j:slf4j-jcl,org.slf4j:slf4j-android,org.slf4j:slf4j-ext,org.slf4j:jcl-over-slf4j,org.slf4j:log4j-over-slf4j,org.slf4j:jul-to-slf4j,org.slf4j:osgi-over-slf4j \ No newline at end of file diff --git a/.oj/patch/conflicts.properties b/.oj/patch/conflicts.properties new file mode 100644 index 00000000..74cc4ba8 --- /dev/null +++ b/.oj/patch/conflicts.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/patch/conflicts + +# com.sun.activation\:jakarta.activation=jakarta.activation:jakarta.activation-api,com.sun.activation:jakarta.activation diff --git a/.oj/patch/dependencies-add.properties b/.oj/patch/dependencies-add.properties new file mode 100644 index 00000000..935bcc6a --- /dev/null +++ b/.oj/patch/dependencies-add.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/patch/dependencies-add + +# io.netty\:netty-common=io.projectreactor.tools:blockhound:1.0.8.RELEASE diff --git a/.oj/patch/dependencies-rm.properties b/.oj/patch/dependencies-rm.properties new file mode 100644 index 00000000..925c795c --- /dev/null +++ b/.oj/patch/dependencies-rm.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/patch/dependencies-rm + +com.google.guava\:guava=com.google.guava:failureaccess,com.google.guava:listenablefuture,com.google.code.findbugs:jsr305,org.checkerframework:checker-qual,com.google.errorprone:error_prone_annotations,com.google.j2objc:j2objc-annotations diff --git a/.oj/patch/features.properties b/.oj/patch/features.properties new file mode 100644 index 00000000..d8f64868 --- /dev/null +++ b/.oj/patch/features.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/patch/features + +# io.netty\:netty-transport-native-epoll=linux-x86_64,linux-aarch_64 diff --git a/.oj/patch/non-modules.properties b/.oj/patch/non-modules.properties new file mode 100644 index 00000000..3c7cee9a --- /dev/null +++ b/.oj/patch/non-modules.properties @@ -0,0 +1,12 @@ +# https://onepiece.software/j/patch/non-modules + +# com.google.common=com.google.guava:guava +org.apache.commons.collections4=org.apache.commons:commons-collections4 +org.apache.commons.codec=commons-codec:commons-codec +commons.math3=org.apache.commons:commons-math3 +SparseBitSet=com.zaxxer:SparseBitSet +com.github.virtuald.curvesapi=com.github.virtuald:curvesapi +com.google.common=com.google.guava:guava +javax.annotations.jsr305=com.google.code.findbugs:jsr305 +velocity.engine.core=org.apache.velocity:velocity-engine-core +org.apache.commons.lang3=org.apache.commons:commons-lang3 \ No newline at end of file diff --git a/.oj/patch/targets.properties b/.oj/patch/targets.properties new file mode 100644 index 00000000..64eefa7d --- /dev/null +++ b/.oj/patch/targets.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/patch/targets + +# org.openjfx\:javafx-base=[none|none],mac[macos|x86-64],mac-aarch64[macos|aarch64],win[windows|x86-64],linux-aarch64[linux|x86-64] diff --git a/.oj/product.properties b/.oj/product.properties new file mode 100644 index 00000000..9866f4cf --- /dev/null +++ b/.oj/product.properties @@ -0,0 +1,13 @@ +# https://onepiece.software/j/product + +name=Gradle Project Setup HowTo +version=1.0 +domain=example.org +modules= +targets=macos[macos|x86-64],ubuntu[linux|x86-64],windows[windows|x86-64] +classpath=false +opensource=true +javadoc=true +description=How to structure a growing Gradle project with smart dependency management? +vendor=Jendrik Johannes (onepiece.Software) +copyright=Copyright 2024, Jendrik Johannes \ No newline at end of file diff --git a/.oj/productivity.properties b/.oj/productivity.properties new file mode 100644 index 00000000..90eb3832 --- /dev/null +++ b/.oj/productivity.properties @@ -0,0 +1,4 @@ +# https://onepiece.software/j/productivity + +build.cache.url=https://gradle.onepiece.software:5071/cache +build.develocity.url=https://scans.gradle.com \ No newline at end of file diff --git a/.oj/publishing.properties b/.oj/publishing.properties new file mode 100644 index 00000000..1fd66e26 --- /dev/null +++ b/.oj/publishing.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/publishing + +# example=https://example.org/publishing-repository diff --git a/.oj/repositories.properties b/.oj/repositories.properties new file mode 100644 index 00000000..766a411d --- /dev/null +++ b/.oj/repositories.properties @@ -0,0 +1,3 @@ +# https://onepiece.software/j/repositories + +mavenCentral=https://repo1.maven.org/maven2 diff --git a/.oj/tweak/endToEndTest.properties b/.oj/tweak/endToEndTest.properties new file mode 100644 index 00000000..01c33c1f --- /dev/null +++ b/.oj/tweak/endToEndTest.properties @@ -0,0 +1,7 @@ +# https://onepiece.software/j/tweak/endToEndTest + +test.lifecycle=checkEndToEnd +javac.jvm.options= +javac.options= +test.jvm.options= +test.parallelism=8 \ No newline at end of file diff --git a/.oj/tweak/main.properties b/.oj/tweak/main.properties new file mode 100644 index 00000000..72d7ac5c --- /dev/null +++ b/.oj/tweak/main.properties @@ -0,0 +1,6 @@ +# https://onepiece.software/j/tweak/main + +javac.jvm.options= +javac.options= +run.jvm.options= +run.app.options= \ No newline at end of file diff --git a/.oj/tweak/mockApi.properties b/.oj/tweak/mockApi.properties new file mode 100644 index 00000000..56cca81d --- /dev/null +++ b/.oj/tweak/mockApi.properties @@ -0,0 +1,4 @@ +# https://onepiece.software/j/tweak/mockApi + +javac.jvm.options= +javac.options= \ No newline at end of file diff --git a/.oj/tweak/test.properties b/.oj/tweak/test.properties new file mode 100644 index 00000000..5d8e2891 --- /dev/null +++ b/.oj/tweak/test.properties @@ -0,0 +1,7 @@ +# https://onepiece.software/j/tweak/test + +test.lifecycle=check +javac.jvm.options= +javac.options= +test.jvm.options= +test.parallelism=8 \ No newline at end of file diff --git a/.oj/tweak/testFixtures.properties b/.oj/tweak/testFixtures.properties new file mode 100644 index 00000000..e9909ee8 --- /dev/null +++ b/.oj/tweak/testFixtures.properties @@ -0,0 +1,4 @@ +# https://onepiece.software/j/tweak/testFixtures + +javac.jvm.options= +javac.options= \ No newline at end of file diff --git a/.oj/versions.properties b/.oj/versions.properties new file mode 100644 index 00000000..e2cfa594 --- /dev/null +++ b/.oj/versions.properties @@ -0,0 +1,16 @@ +# https://onepiece.software/j/versions + +com.fasterxml.jackson.core=2.16.1 +com.google.common=33.0.0-jre +jakarta.activation=1.2.2 +jakarta.mail=1.6.7 +jakarta.servlet=6.0.0 +java.inject=1.0.5 +javax.annotations.jsr305=3.0.2 +org.apache.commons.compress=1.25.0 +org.apache.commons.io=2.15.1 +org.apache.poi.ooxml=5.2.2 +org.assertj.core=3.25.1 +org.junit.jupiter.api=5.10.1 +org.slf4j=2.0.10 +velocity.engine.core=2.3 \ No newline at end of file diff --git a/app/build.gradle.kts b/app/build.gradle.kts index 6ba24171..225a4356 100644 --- a/app/build.gradle.kts +++ b/app/build.gradle.kts @@ -1,8 +1,10 @@ plugins { - id("org.example.application") + id("org.example.gradlebuild.java-application-module") + id("org.example.gradlebuild.feature-mock-api") + id("org.example.gradlebuild.test-suite-end-to-end-test") } application { - mainModule.set("org.example.product.app") - mainClass.set("org.example.product.app.Application") + mainModule = "org.example.product.app" + mainClass = "org.example.product.app.Application" } diff --git a/app/resources/icon.icns b/app/resources/icon.icns deleted file mode 100644 index 8cd1f12d..00000000 Binary files a/app/resources/icon.icns and /dev/null differ diff --git a/app/resources/icon.ico b/app/resources/icon.ico deleted file mode 100644 index d9f3b458..00000000 Binary files a/app/resources/icon.ico and /dev/null differ diff --git a/app/resources/icon.png b/app/resources/icon.png deleted file mode 100644 index f26adf57..00000000 Binary files a/app/resources/icon.png and /dev/null differ diff --git a/app/resources/linux/icon.png b/app/resources/linux/icon.png new file mode 100644 index 00000000..e69de29b diff --git a/app/resources/macos/icon-volume.icns b/app/resources/macos/icon-volume.icns new file mode 100644 index 00000000..e69de29b diff --git a/app/resources/macos/icon.icns b/app/resources/macos/icon.icns new file mode 100644 index 00000000..e69de29b diff --git a/app/resources/windows/icon.ico b/app/resources/windows/icon.ico new file mode 100644 index 00000000..e69de29b diff --git a/app/src/main/java/module-info.java b/app/src/main/java/module-info.java index 0241d1a1..c592c4bd 100644 --- a/app/src/main/java/module-info.java +++ b/app/src/main/java/module-info.java @@ -1,3 +1,4 @@ +// @MainClass("org.example.product.app.Application") module org.example.product.app { exports org.example.product.app; diff --git a/bespin/build.gradle.kts b/bespin/build.gradle.kts index 605f513f..4fc03f2b 100644 --- a/bespin/build.gradle.kts +++ b/bespin/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library") + id("org.example.gradlebuild.java-library-module") } diff --git a/bespin/src/test/java/module-info.java b/bespin/src/test/java/module-info.java index d5db6c9c..3b2cc1b6 100644 --- a/bespin/src/test/java/module-info.java +++ b/bespin/src/test/java/module-info.java @@ -1,4 +1,6 @@ open module org.example.product.bespin.test { requires org.example.product.corellia.test.fixtures; requires org.junit.jupiter.api; + + requires /*runtime*/ org.slf4j.simple; } diff --git a/build.gradle.kts b/build.gradle.kts index 42b87b3a..b9445238 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.root") -} \ No newline at end of file + id("org.example.gradlebuild.root") +} diff --git a/corellia/build.gradle.kts b/corellia/build.gradle.kts index 8ea2fcc5..0d596bef 100644 --- a/corellia/build.gradle.kts +++ b/corellia/build.gradle.kts @@ -1,3 +1,4 @@ plugins { - id("org.example.java-library-with-test-fixtures") + id("org.example.gradlebuild.java-library-module") + id("org.example.gradlebuild.feature-test-fixtures") } diff --git a/corellia/src/main/java/module-info.java b/corellia/src/main/java/module-info.java index f445c3fd..cc56de5d 100644 --- a/corellia/src/main/java/module-info.java +++ b/corellia/src/main/java/module-info.java @@ -1,8 +1,6 @@ module org.example.product.corellia { exports org.example.product.corellia; - requires transitive org.apache.poi.poi; - requires org.apache.commons.io; requires org.apache.poi.ooxml; } diff --git a/coruscant/build.gradle.kts b/coruscant/build.gradle.kts index 62f80b5d..4fc03f2b 100644 --- a/coruscant/build.gradle.kts +++ b/coruscant/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library-published") + id("org.example.gradlebuild.java-library-module") } diff --git a/coruscant/src/test/java/module-info.java b/coruscant/src/test/java/module-info.java index d359048a..86a24960 100644 --- a/coruscant/src/test/java/module-info.java +++ b/coruscant/src/test/java/module-info.java @@ -2,4 +2,6 @@ requires org.example.product.coruscant; requires org.assertj.core; requires org.junit.jupiter.api; + + requires /*runtime*/ org.slf4j.simple; } diff --git a/gradle/meta-plugins/build-parameters-plugins/build.gradle.kts b/gradle/meta-plugins/build-parameters-plugins/build.gradle.kts deleted file mode 100644 index ee8509ef..00000000 --- a/gradle/meta-plugins/build-parameters-plugins/build.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -plugins { - id("org.gradlex.build-parameters") version "1.4.3" -} - -group = "org.example" - -buildParameters { - pluginId("org.example.build-parameters") - bool("ci") { - defaultValue.set(false) - fromEnvironment() - } - group("catalina") { - string("home") { - fromEnvironment() - description.set("Root of the Tomcat installation") - } - } -} diff --git a/gradle/meta-plugins/plugin-analysis-plugins/build.gradle.kts b/gradle/meta-plugins/plugin-analysis-plugins/build.gradle.kts deleted file mode 100644 index 2ae4b073..00000000 --- a/gradle/meta-plugins/plugin-analysis-plugins/build.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - `kotlin-dsl` -} - -group = "org.example" \ No newline at end of file diff --git a/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org.example.plugin-analysis.gradle.kts b/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org.example.plugin-analysis.gradle.kts deleted file mode 100644 index a6633b6f..00000000 --- a/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org.example.plugin-analysis.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -import org.example.pluginanalysis.PluginApplicationOrderAnalysis - -tasks.register("analysePluginApplicationOrder") { - group = "help" - - pluginSrcFolders.from(subprojects.map { it.layout.projectDirectory.dir("src/main/kotlin") }) - pluginApplicationDiagram.set(layout.buildDirectory.file("reports/plugins/plugin-application-order.puml")) -} \ No newline at end of file diff --git a/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org/example/pluginanalysis/PluginApplicationOrderAnalysis.kt b/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org/example/pluginanalysis/PluginApplicationOrderAnalysis.kt deleted file mode 100644 index 7a4e00d4..00000000 --- a/gradle/meta-plugins/plugin-analysis-plugins/src/main/kotlin/org/example/pluginanalysis/PluginApplicationOrderAnalysis.kt +++ /dev/null @@ -1,70 +0,0 @@ -package org.example.pluginanalysis - -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputFiles -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction - -abstract class PluginApplicationOrderAnalysis : DefaultTask() { - - @get:InputFiles - abstract val pluginSrcFolders : ConfigurableFileCollection - - @get:OutputFile - abstract val pluginApplicationDiagram: RegularFileProperty - - @TaskAction - fun analyse() { - val pluginDependencies = pluginSrcFolders.associate { srcFolder -> - val pluginProjectName = srcFolder.parentFile.parentFile.parentFile.name - pluginProjectName to (srcFolder.listFiles() ?: emptyArray()).filter { - it.name.endsWith(".gradle.kts") - }.associate { pluginFile -> - val pluginId = pluginFile.name.replaceFirst(".gradle.kts", "") - val shortenedPluginId = shorten(pluginId) - shortenedPluginId to pluginsBlock(pluginFile.readText()).lines().filter { it.contains("id(") }.map { - shorten(it.substring(it.indexOf("id(\"") + 4, it.indexOf("\")"))) - } - } - }.filter { it.value.isNotEmpty() } - - val lineBreak = "\n " - pluginApplicationDiagram.get().asFile.writeText(""" - @startuml - - ${pluginDependencies.map { (projectName, pluginIds) -> - "package \"$projectName\" {$lineBreak" + - pluginIds.keys.joinToString("") { "agent \"$it\"$lineBreak" } + - "$lineBreak}" - }.joinToString(lineBreak)} - - ${pluginDependencies.values.fold(emptyMap>()) { a, b -> a + b }.filter { - it.value.isNotEmpty() - }.map { - (from, to) -> to.joinToString("") { "\"$from\" --down--> \"$it\"$lineBreak" } - }.joinToString(lineBreak)} - - @enduml - """.trimIndent()) - - logger.lifecycle("Diagram: ${pluginApplicationDiagram.get().asFile.absolutePath}") - } - - private fun pluginsBlock(script: String) = script.indexOf("}").let { - when(it) { - -1 -> "" - else -> script.substring(0, it) - } - } - - private fun shorten(pluginId: String) = pluginId.split(".").let { segments -> - when (segments.size) { - 1 -> segments.single() - else -> segments.subList(0, segments.size - 1).map { it.first() } - .joinToString(".", "", ".") + segments.last() - } - - } -} \ No newline at end of file diff --git a/gradle/meta-plugins/settings-plugins/build.gradle.kts b/gradle/meta-plugins/settings-plugins/build.gradle.kts deleted file mode 100644 index f5c6502c..00000000 --- a/gradle/meta-plugins/settings-plugins/build.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(project(":build-parameters-plugins")) - implementation("com.gradle:gradle-enterprise-gradle-plugin:3.15.1") -} diff --git a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.gradle-enterprise.settings.gradle.kts b/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.gradle-enterprise.settings.gradle.kts deleted file mode 100644 index b5ef95d8..00000000 --- a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.gradle-enterprise.settings.gradle.kts +++ /dev/null @@ -1,19 +0,0 @@ -import buildparameters.BuildParametersExtension - -plugins { - // Use the Gradle Enterprise plugin to publish Build Scan to https://scans.gradle.com - id("com.gradle.enterprise") - id("org.example.build-parameters") -} - -// Configure the Gradle Enterprise plugin -gradleEnterprise { - buildScan { - // You may remove this check to publish build scans for every build (preferred, if there are no concerns) - if (the().ci) { - publishAlways() - } - termsOfServiceUrl = "https://gradle.com/terms-of-service" - termsOfServiceAgree = "yes" - } -} diff --git a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.project-structure.settings.gradle.kts b/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.project-structure.settings.gradle.kts deleted file mode 100644 index fcf1797b..00000000 --- a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.project-structure.settings.gradle.kts +++ /dev/null @@ -1,4 +0,0 @@ -// Include all subfolders that contain a 'build.gradle.kts' as subprojects -rootDir.listFiles()?.filter { File(it, "build.gradle.kts").exists() }?.forEach { subproject -> - include(subproject.name) -} diff --git a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.repositories.settings.gradle.kts b/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.repositories.settings.gradle.kts deleted file mode 100644 index 3c184c9d..00000000 --- a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.repositories.settings.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -pluginManagement { - // Get community plugins from the Gradle Plugin Portal - repositories.gradlePluginPortal() - - // Get our own convention plugins from 'gradle/plugins' - if (File(rootDir, "gradle/plugins").exists()) { - includeBuild("gradle/plugins") - } - // If not the main build, 'plugins' is located next to the build (e.g. gradle/settings) - if (File(rootDir, "../plugins").exists()) { - includeBuild("../plugins") - } -} - -dependencyResolutionManagement { - // Get components from Maven Central - repositories.mavenCentral() - // In the main build, find the platform in 'gradle/platform' - if (File(rootDir, "gradle/platform").exists()) { - includeBuild("gradle/platform") - } -} diff --git a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.settings.settings.gradle.kts b/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.settings.settings.gradle.kts deleted file mode 100644 index 3ac0503d..00000000 --- a/gradle/meta-plugins/settings-plugins/src/main/kotlin/org.example.settings.settings.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("org.example.gradle-enterprise") - id("org.example.project-structure") - id("org.example.repositories") -} diff --git a/gradle/meta-plugins/settings.gradle.kts b/gradle/meta-plugins/settings.gradle.kts deleted file mode 100644 index 5d527fc6..00000000 --- a/gradle/meta-plugins/settings.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -dependencyResolutionManagement { - repositories.gradlePluginPortal() -} - -include("build-parameters-plugins", "plugin-analysis-plugins", "settings-plugins") diff --git a/gradle/platform/build.gradle.kts b/gradle/platform/build.gradle.kts index 515154e3..545aeafd 100644 --- a/gradle/platform/build.gradle.kts +++ b/gradle/platform/build.gradle.kts @@ -1,27 +1,20 @@ plugins { - id("org.example.platform") -} - -dependencies { - api(platform("com.fasterxml.jackson:jackson-bom:2.13.4")) - api(platform("org.apache.poi:poi:5.2.2")) { because ("see PoiPlatformRule") } // Central component as Anchor for Alignment BOM - api(platform("org.junit:junit-bom:5.7.2")) { (this as ExternalModuleDependency).version { reject("[5.8.0,)") } } // Do not Upgrade to 5.8: https://github.com/gradle/gradle/issues/18627 - api(platform("org.mockito:mockito-bom:4.8.0")) - api(platform("org.slf4j:slf4j-parent:2.0.3")) { because ("see Slf4jPlatformRule") } // Parent as Anchor for Alignment BOM + id("org.example.gradlebuild.platform") } moduleInfo { - version("com.google.common", "30.1-jre") - version("jakarta.activation") { require("1.2.2"); reject("[2.0.0,)") } // Upgrade to 2.x requires newer Jakarta APIs - version("java.inject") { require("1.0.5"); reject("[2.0.0,)") } // Upgrade to 2.x requires newer Jakarta APIs - version("jakarta.mail") { require("1.6.7"); reject("[2.0.0,)") } // Upgrade to 2.x requires newer Jakarta APIs - version("jakarta.servlet", "6.0.0") + version("jakarta.mail", "1.6.7") + version("org.slf4j", "2.0.10") + version("org.assertj.core", "3.25.1") + version("jakarta.activation", "1.2.2") version("javax.annotations.jsr305", "3.0.2") - version("org.assertj.core", "3.22.0") + version("com.fasterxml.jackson.core", "2.16.1") + version("org.apache.commons.io", "2.15.1") + version("com.google.common", "33.0.0-jre") + version("java.inject", "1.0.5") + version("jakarta.servlet", "6.0.0") + version("org.junit.jupiter.api", "5.10.1") version("velocity.engine.core", "2.3") -} - -dependencies { - // list the 'main' modules of our software product for 'checkPlatformVersionConsistency' - product("org.example.product:app") + version("org.apache.commons.compress", "1.25.0") + version("org.apache.poi.ooxml", "5.2.2") } diff --git a/gradle/platform/settings.gradle.kts b/gradle/platform/settings.gradle.kts deleted file mode 100644 index 5b7f2cee..00000000 --- a/gradle/platform/settings.gradle.kts +++ /dev/null @@ -1,7 +0,0 @@ -pluginManagement { - includeBuild("../meta-plugins") -} -plugins { - id("org.example.settings") -} -includeBuild("../..") diff --git a/gradle/plugins/base-plugins/build.gradle.kts b/gradle/plugins/base-plugins/build.gradle.kts deleted file mode 100644 index cd774386..00000000 --- a/gradle/plugins/base-plugins/build.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation(project(":dependency-analysis-plugins")) - implementation(project(":dependency-rules-plugins")) -} diff --git a/gradle/plugins/base-plugins/src/main/kotlin/org.example.base.gradle.kts b/gradle/plugins/base-plugins/src/main/kotlin/org.example.base.gradle.kts deleted file mode 100644 index 15df32b4..00000000 --- a/gradle/plugins/base-plugins/src/main/kotlin/org.example.base.gradle.kts +++ /dev/null @@ -1,11 +0,0 @@ -plugins { - id("base") - id("org.example.dependency-rules") -} - -// Set the group (some components will be published) -group = "org.example.product" - -// Set the version from 'version.txt' -version = providers.fileContents( - rootProject.layout.projectDirectory.file("gradle/version.txt")).asText.getOrElse("") diff --git a/gradle/plugins/base-plugins/src/main/kotlin/org.example.platform.gradle.kts b/gradle/plugins/base-plugins/src/main/kotlin/org.example.platform.gradle.kts deleted file mode 100644 index 7f862a9c..00000000 --- a/gradle/plugins/base-plugins/src/main/kotlin/org.example.platform.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -plugins { - id("java-platform") - id("org.example.base") - id("org.example.dependency-analysis-platform") - id("org.gradlex.java-module-versions") -} - -// Depend on other Platforms/BOMs to align versions for libraries that consist of multiple components (like Jackson) -javaPlatform.allowDependencies() diff --git a/gradle/plugins/base-plugins/src/main/kotlin/org.example.root.gradle.kts b/gradle/plugins/base-plugins/src/main/kotlin/org.example.root.gradle.kts deleted file mode 100644 index 1db9f6ae..00000000 --- a/gradle/plugins/base-plugins/src/main/kotlin/org.example.root.gradle.kts +++ /dev/null @@ -1,52 +0,0 @@ -plugins { - id("lifecycle-base") - id("org.example.dependency-analysis-root") -} - -// Configure the ':tasks' task of the root project to only show -// the main lifecycle tasks as entry points to the build -val mainBuildGroup = "main build" -tasks.named("tasks") { - displayGroup = mainBuildGroup -} - -tasks.named("build") { - group = mainBuildGroup - description = "Complete build of all modules and the application" - dependsOn(subprojects.map { ":${it.name}:$name" }) -} - -tasks.register("compileAll") { - group = mainBuildGroup - description = "Complete build of all modules and the application" - dependsOn(subprojects.map { ":${it.name}:$name" }) -} - -tasks.named("check") { - group = mainBuildGroup - description = "Runs all checks and produces test summary and code coverage reports" - dependsOn(subprojects.map { ":${it.name}:$name" }) - dependsOn(gradle.includedBuild("platform").task(":check")) - doLast { - println("Unit test summary: app/build/reports/tests/unit-test/aggregated-results/index.html") - println("Unit test code coverage: app/build/reports/jacoco/testCodeCoverageReport/html/index.html") - } -} - -tasks.register("run") { - group = mainBuildGroup - description = "Build and run as standalone application" - dependsOn(":app:$name") -} - -tasks.register("deployWebApp") { - group = mainBuildGroup - description = "Deploy web app into local Tomcat found via CATALINA_HOME" - dependsOn(":app:$name") -} - -tasks.register("checkForDependencyVulnerabilities") { - group = mainBuildGroup - description = "Check current dependencies for known vulnerabilities" - dependsOn(":app:dependencyCheckAnalyze") -} diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts deleted file mode 100644 index 5a4984ec..00000000 --- a/gradle/plugins/build.gradle.kts +++ /dev/null @@ -1,3 +0,0 @@ -plugins { - id("org.example.plugin-analysis") -} \ No newline at end of file diff --git a/gradle/plugins/dependency-analysis-plugins/build.gradle.kts b/gradle/plugins/dependency-analysis-plugins/build.gradle.kts deleted file mode 100644 index 3a6ce05f..00000000 --- a/gradle/plugins/dependency-analysis-plugins/build.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation("com.autonomousapps:dependency-analysis-gradle-plugin") - implementation("org.gradlex:java-module-dependencies") -} diff --git a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-platform.gradle.kts b/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-platform.gradle.kts deleted file mode 100644 index 2e2a66b1..00000000 --- a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-platform.gradle.kts +++ /dev/null @@ -1,54 +0,0 @@ -import org.example.dependencyanalysis.DependencyFormatCheck -import org.example.dependencyanalysis.PlatformVersionConsistencyCheck - -plugins { - id("java-platform") - id("org.gradlex.java-module-dependencies") -} - -val checkDependencyFormatting = tasks.register("checkDependencyFormatting") { - group = LifecycleBasePlugin.VERIFICATION_GROUP - - buildFilePath.set(project.buildFile.absolutePath) - declaredDependencies.put("api", provider { configurations.api.get().dependencies.map { d -> d.toDeclaredString() } }) - declaredDependencies.put("runtime", provider { configurations.runtime.get().dependencies.map { d -> d.toDeclaredString() } }) - declaredConstraints.put("api", provider { configurations.api.get().dependencyConstraints.map { d -> d.toDeclaredString() } }) - declaredConstraints.put("runtime", provider { configurations.runtime.get().dependencyConstraints.map { d -> d.toDeclaredString() } }) -} - -// Install a task that checks the consistency of the platform against the resolution result of the product -val product = configurations.dependencyScope("product").get() -dependencies { - product(platform(project(path))) -} -val purePlatformVersions = configurations.dependencyScope("purePlatformVersions") { - withDependencies { - add(project.dependencies.platform(project(project.path))) - // Create a dependency for each constraint defined in the platform (this is to check for unused entries) - configurations.api.get().dependencyConstraints.forEach { constraint -> - add(project.dependencies.create("${constraint.group}:${constraint.name}") { isTransitive = false }) - } - } -} -val fullProductRuntimeClasspath = configurations.resolvable("fullProductRuntimeClasspath") { - attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attributes.attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) - extendsFrom(product) -} -val purePlatformVersionsPath = configurations.resolvable("purePlatformVersionsPath") { - attributes.attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - attributes.attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category.LIBRARY)) - extendsFrom(purePlatformVersions.get()) -} -tasks.register("checkPlatformVersionConsistency") { - group = HelpTasksPlugin.HELP_GROUP - productClasspath.set(fullProductRuntimeClasspath.map { it.incoming.resolutionResult.allComponents }) - classpathFromPlatform.set(purePlatformVersionsPath.map { it.incoming.resolutionResult.allComponents }) -} - -tasks.check { - dependsOn(checkDependencyFormatting) -} - -fun Dependency.toDeclaredString() = "$group:$name:$version" -fun DependencyConstraint.toDeclaredString() = "version(\"${javaModuleDependencies.moduleName("$group:$name").getOrElse("$group:$name")}\", \"$version\")" diff --git a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-project.gradle.kts b/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-project.gradle.kts deleted file mode 100644 index 9065acd9..00000000 --- a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-project.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -plugins { - id("java") - id("org.gradlex.java-module-dependencies") -} - -tasks.check { - dependsOn(tasks.checkAllModuleInfo) -} diff --git a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-root.gradle.kts b/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-root.gradle.kts deleted file mode 100644 index ac62c304..00000000 --- a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org.example.dependency-analysis-root.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - id("com.autonomousapps.dependency-analysis") -} - -// Lifecycle task to check dependency scopes in all subprojects -tasks.register("checkAllModuleInfo") { - group = LifecycleBasePlugin.VERIFICATION_GROUP - description = "Check scope and order of directives in 'module-info.java' files" - dependsOn(subprojects.map { "${it.path}:checkAllModuleInfo"}) -} diff --git a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/DependencyFormatCheck.kt b/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/DependencyFormatCheck.kt deleted file mode 100644 index 6b04f4a8..00000000 --- a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/DependencyFormatCheck.kt +++ /dev/null @@ -1,59 +0,0 @@ -package org.example.dependencyanalysis - -import org.gradle.api.DefaultTask -import org.gradle.api.provider.MapProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.TaskAction - -/** - * Check that 'dependencies' are defined in alphabetical order and without version. - */ -abstract class DependencyFormatCheck : DefaultTask() { - - @get:Input - abstract val buildFilePath : Property - - @get:Input - abstract val declaredDependencies : MapProperty> // Map of 'scope' to 'coordinates' - - @get:Input - abstract val declaredConstraints : MapProperty> // Map of 'scope' to 'coordinates' - - @TaskAction - fun check() { - declaredDependencies.get().forEach { (scope, dependencies) -> - val declaredInBuildFile = dependencies.filter { - // Ignore dependencies that are defined in our plugins - it !in listOf( - "org.example.product:platform", - "org.slf4j:slf4j-simple", - "org.junit.jupiter:junit-jupiter-engine", - "org.junit.jupiter:junit-jupiter") - } - val sortedProject = declaredInBuildFile.filter { it.startsWith(":") }.sorted() - val sortedExternal = declaredInBuildFile.filter { !it.startsWith(":") }.sorted() - if (declaredInBuildFile != sortedProject + sortedExternal) { - throw RuntimeException(""" - ${buildFilePath.get()} - - Module versions are not declared in alphabetical order. Please use this order: - ${sortedProject.joinToString("\n ") {"${scope}(project(\"${it}\"))"}} - ${sortedExternal.joinToString("\n ") {"${scope}(\"${it}\")"}} - """.trimIndent()) - } - } - - declaredConstraints.get().forEach { (scope, constraints) -> - val sortedConstraints = constraints.sorted() - if (constraints != sortedConstraints) { - throw RuntimeException(""" - ${buildFilePath.get()} - - $scope dependency constraints are not declared in alphabetical order. Please use this order: - ${sortedConstraints.joinToString("\n ")} - """.trimIndent()) - } - } - } -} diff --git a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/PlatformVersionConsistencyCheck.kt b/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/PlatformVersionConsistencyCheck.kt deleted file mode 100644 index dda68726..00000000 --- a/gradle/plugins/dependency-analysis-plugins/src/main/kotlin/org/example/dependencyanalysis/PlatformVersionConsistencyCheck.kt +++ /dev/null @@ -1,63 +0,0 @@ -package org.example.dependencyanalysis - -import org.gradle.api.DefaultTask -import org.gradle.api.artifacts.component.ModuleComponentSelector -import org.gradle.api.artifacts.result.ResolvedComponentResult -import org.gradle.api.attributes.Attribute -import org.gradle.api.attributes.Category -import org.gradle.api.provider.SetProperty -import org.gradle.api.tasks.Internal -import org.gradle.api.tasks.TaskAction - -/** - * Checks that all versions declared in the platform are used and are consistent with the consistent resolution result. - */ -abstract class PlatformVersionConsistencyCheck : DefaultTask() { - - @get:Internal - abstract val productClasspath: SetProperty - - @get:Internal - abstract val classpathFromPlatform: SetProperty - - @TaskAction - fun check() { - val publishedCategory = Attribute.of( Category.CATEGORY_ATTRIBUTE.name, String::class.java) - val resolvedToDeclaredVersions = - productClasspath.get().filter { it.moduleVersion?.group != "org.example.product" }.associate { cpEntry -> - cpEntry.moduleVersion to cpEntry.dependents.find { - it.from.variants.any { variant -> - variant.attributes.getAttribute(Category.CATEGORY_ATTRIBUTE)?.name == Category.REGULAR_PLATFORM - || variant.attributes.getAttribute(publishedCategory) == Category.REGULAR_PLATFORM - } - }?.let { - (it.requested as ModuleComponentSelector).version - } - } - - - val unnecessaryEntries = classpathFromPlatform.get().filter { platformEntry -> - productClasspath.get().none { platformEntry.moduleVersion?.module == it.moduleVersion?.module } - } - val missingEntries = resolvedToDeclaredVersions.filter { it.value == null }.map { it.key } - val wrongEntries = resolvedToDeclaredVersions.filter { it.value != null && it.key?.version != it.value } - - if (unnecessaryEntries.isNotEmpty() || missingEntries.isNotEmpty() || wrongEntries.isNotEmpty()) { - throw RuntimeException(""" - The following entries are not used in production code: - - ${unnecessaryEntries.joinToString("\n ") { "api(\"${it.moduleVersion}\")" }} - - The following transitive dependencies are not listed in the platform: - - ${missingEntries.joinToString("\n ") { "api(\"${it}\")" }} - - The following dependencies should be updated to the resolved versions: - - ${wrongEntries.keys.joinToString("\n ") { "api(\"${it}\") - currently declared '${wrongEntries[it]}'" }} - - """.trimIndent()) - } - } -} - diff --git a/gradle/plugins/dependency-rules-plugins/build.gradle.kts b/gradle/plugins/dependency-rules-plugins/build.gradle.kts deleted file mode 100644 index deabc6a5..00000000 --- a/gradle/plugins/dependency-rules-plugins/build.gradle.kts +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation("dev.jacomet.gradle.plugins:logging-capabilities") - implementation("org.gradlex:extra-java-module-info") - implementation("org.gradlex:java-ecosystem-capabilities") - implementation("org.gradlex:java-module-dependencies") -} diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.dependency-rules.gradle.kts b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.dependency-rules.gradle.kts deleted file mode 100644 index 57155c23..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.dependency-rules.gradle.kts +++ /dev/null @@ -1,29 +0,0 @@ -import org.example.metadatarules.fixdependencies.GuavaCleanupRule -import org.example.metadatarules.status.ComponentStatusRule -import org.example.metadatarules.versionalignment.PoiPlatformRule -import org.example.metadatarules.versionalignment.Slf4jPlatformRule -import org.example.metadatarules.versionalignment.ParentPomAsPlatformRule - -plugins { - id("dev.jacomet.logging-capabilities") - id("org.gradlex.java-ecosystem-capabilities") - id("org.example.java-modules-dependency-rules") -} - -// Configure logging capabilities plugin to default to Slf4JSimple -loggingCapabilities.enforceSlf4JSimple() - -dependencies.components { - // Versions that are not final get the 'integration' status - all() - - // Fix dependencies - withModule(GuavaCleanupRule.GUAVA_MODULE) - - // Define 'Alignment Platforms' (platforms for multi-component libraries without published BOM) - withModule(PoiPlatformRule.POI_COMMON) - withModule(Slf4jPlatformRule.SLF4J_PARENT) - - // Make parents usable as pure 'Alignment Platforms' - remove all constraints that do not concern the alignment - withModule(Slf4jPlatformRule.SLF4J_PARENT) -} diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.java-modules-dependency-rules.gradle.kts b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.java-modules-dependency-rules.gradle.kts deleted file mode 100644 index 53f2830a..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org.example.java-modules-dependency-rules.gradle.kts +++ /dev/null @@ -1,64 +0,0 @@ -plugins { - id("org.gradlex.extra-java-module-info") - id("org.gradlex.java-module-dependencies") -} - -extraJavaModuleInfo { - failOnAutomaticModules.set(true) - - module("com.google.code.findbugs:jsr305", "javax.annotations.jsr305") { - exports("javax.annotation") - requireAllDefinedDependencies() - } - module("com.google.guava:guava", "com.google.common") { - exportAllPackages() - requireAllDefinedDependencies() - } - module("com.github.virtuald:curvesapi", "com.github.virtuald.curvesapi") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("com.zaxxer:SparseBitSet", "SparseBitSet") { // required by org.apache.poi.poi - exports("com.zaxxer.sparsebits") - requireAllDefinedDependencies() - } - module("commons-codec:commons-codec", "org.apache.commons.codec") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.apache.commons:commons-collections4", "org.apache.commons.collections4") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.apache.commons:commons-compress", "org.apache.commons.compress") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("commons-io:commons-io", "org.apache.commons.io") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.apache.commons:commons-lang3", "org.apache.commons.lang3") { // required by velocity - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.apache.commons:commons-math3", "commons.math3") { // required by org.apache.poi.poi - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.apache.velocity:velocity-engine-core", "velocity.engine.core") { - exportAllPackages() - requireAllDefinedDependencies() - } - module("org.hamcrest:hamcrest-core", "org.hamcrest.core") { - exportAllPackages() - requireAllDefinedDependencies() - } - knownModule("org.slf4j:slf4j-api", "org.slf4j") -} - -javaModuleDependencies { - // Override because there are multiple options - moduleNameToGA.put("jakarta.activation", "com.sun.activation:jakarta.activation") - moduleNameToGA.put("jakarta.mail", "com.sun.mail:jakarta.mail") - } diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/fixdependencies/GuavaCleanupRule.kt b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/fixdependencies/GuavaCleanupRule.kt deleted file mode 100644 index bdf375c1..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/fixdependencies/GuavaCleanupRule.kt +++ /dev/null @@ -1,26 +0,0 @@ -package org.example.metadatarules.fixdependencies - -import org.gradle.api.artifacts.CacheableRule -import org.gradle.api.artifacts.ComponentMetadataContext -import org.gradle.api.artifacts.ComponentMetadataRule - -/** - * Removes dependencies of Guava that we do not need and that are not Java Modules - */ -@CacheableRule -abstract class GuavaCleanupRule : ComponentMetadataRule { - companion object { - const val GUAVA_MODULE = "com.google.guava:guava" - } - - override fun execute(context: ComponentMetadataContext) { - context.details.allVariants { - withDependencies { - removeIf { it.name == "failureaccess" } - removeIf { it.name == "j2objc-annotations" } - removeIf { it.name == "checker-qual" } - removeIf { it.name == "error_prone_annotations" } - } - } - } -} diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/status/ComponentStatusRule.kt b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/status/ComponentStatusRule.kt deleted file mode 100644 index 3e5d1d7f..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/status/ComponentStatusRule.kt +++ /dev/null @@ -1,29 +0,0 @@ -package org.example.metadatarules.status - -import org.gradle.api.artifacts.CacheableRule -import org.gradle.api.artifacts.ComponentMetadataContext -import org.gradle.api.artifacts.ComponentMetadataRule - -/** - * Make sure versions that are not final released have a different status than 'release'. - * Otherwise, they will be considered when asking for the 'latest.release' version. - * - * (POM metadata does not support the 'status' concept and thus Gradle assumes everything is a 'release' by default) - */ -@CacheableRule -abstract class ComponentStatusRule : ComponentMetadataRule { - override fun execute(context: ComponentMetadataContext) { - val version = context.details.id.version - val lcVersion = version.lowercase() - if (lcVersion.contains("alpha") - || lcVersion.contains("-b") - || lcVersion.contains("beta") - || lcVersion.contains("cr") - || lcVersion.contains("m") - || lcVersion.contains("rc") - || lcVersion.startsWith("200")) { - - context.details.status = "integration" - } - } -} diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/ParentPomAsPlatformRule.kt b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/ParentPomAsPlatformRule.kt deleted file mode 100644 index 95427191..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/ParentPomAsPlatformRule.kt +++ /dev/null @@ -1,23 +0,0 @@ -package org.example.metadatarules.versionalignment - -import org.gradle.api.artifacts.CacheableRule -import org.gradle.api.artifacts.ComponentMetadataContext -import org.gradle.api.artifacts.ComponentMetadataRule - -/** - * Sometime libraries consisting of multiple components do not offer a BOM but have - * a 'Parent POM' that contains the information for alignment. - * However, these often also contain constraints on other components that we do not - * want to include. This Rule removes these additional constraints. - */ -@CacheableRule -abstract class ParentPomAsPlatformRule : ComponentMetadataRule { - override fun execute(context: ComponentMetadataContext) { - val group = context.details.id.group - context.details.allVariants { - withDependencyConstraints { - removeAll { it.group != group } - } - } - } -} diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/PoiPlatformRule.kt b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/PoiPlatformRule.kt deleted file mode 100644 index 46482edb..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/PoiPlatformRule.kt +++ /dev/null @@ -1,30 +0,0 @@ -package org.example.metadatarules.versionalignment - -import org.gradle.api.artifacts.CacheableRule -import org.gradle.api.artifacts.ComponentMetadataContext -import org.gradle.api.artifacts.ComponentMetadataRule - -/** - * Extend the central 'poi' component with constraints so that it can be used as platform - * to align the versions of all 'org.apache.poi' components. - * - * See: - * https://repo1.maven.org/maven2/org/apache/poi/poi/5.2.0/poi-5.2.0.pom - */ -@CacheableRule -abstract class PoiPlatformRule : ComponentMetadataRule { - companion object { - const val POI_COMMON = "org.apache.poi:poi" - } - - override fun execute(context: ComponentMetadataContext) { - val version = context.details.id.version - context.details.allVariants { - withDependencyConstraints { - add("org.apache.poi:poi-excelant:$version") - add("org.apache.poi:poi-ooxml:$version") - add("org.apache.poi:poi-scratchpad:$version") - } - } - } -} \ No newline at end of file diff --git a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/Slf4jPlatformRule.kt b/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/Slf4jPlatformRule.kt deleted file mode 100644 index ea067f38..00000000 --- a/gradle/plugins/dependency-rules-plugins/src/main/kotlin/org/example/metadatarules/versionalignment/Slf4jPlatformRule.kt +++ /dev/null @@ -1,40 +0,0 @@ -package org.example.metadatarules.versionalignment - -import org.gradle.api.artifacts.CacheableRule -import org.gradle.api.artifacts.ComponentMetadataContext -import org.gradle.api.artifacts.ComponentMetadataRule - -/** - * Extend the Parent POM 'slf4j-parent' with constraints so that it can be used as platform - * to align the versions of all 'org.slf4j' components. - * - * See: - * https://repo1.maven.org/maven2/org/slf4j/slf4j-parent/1.7.36/slf4j-parent-1.7.36.pom - */ -@CacheableRule -abstract class Slf4jPlatformRule : ComponentMetadataRule { - companion object { - const val SLF4J_PARENT = "org.slf4j:slf4j-parent" - } - - override fun execute(context: ComponentMetadataContext) { - val version = context.details.id.version - context.details.allVariants { - withDependencyConstraints { - add("org.slf4j:slf4j-api:$version") - add("org.slf4j:slf4j-simple:$version") - add("org.slf4j:slf4j-nop:$version") - add("org.slf4j:slf4j-jdk14:$version") - add("org.slf4j:slf4j-log4j12:$version") - add("org.slf4j:slf4j-reload4j:$version") - add("org.slf4j:slf4j-jcl:$version") - add("org.slf4j:slf4j-android:$version") - add("org.slf4j:slf4j-ext:$version") - add("org.slf4j:jcl-over-slf4j:$version") - add("org.slf4j:log4j-over-slf4j:$version") - add("org.slf4j:jul-to-slf4j:$version") - add("org.slf4j:osgi-over-slf4j:$version") - } - } - } -} \ No newline at end of file diff --git a/gradle/plugins/java-application-plugins/build.gradle.kts b/gradle/plugins/java-application-plugins/build.gradle.kts deleted file mode 100644 index 20df9997..00000000 --- a/gradle/plugins/java-application-plugins/build.gradle.kts +++ /dev/null @@ -1,12 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation(project(":java-base-plugins")) - implementation("org.example:build-parameters-plugins") - implementation("org.owasp:dependency-check-gradle") - implementation("io.fuchs.gradle.classpath-collision-detector:classpath-collision-detector") -} diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.application.gradle.kts b/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.application.gradle.kts deleted file mode 100644 index c92ff2db..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.application.gradle.kts +++ /dev/null @@ -1,70 +0,0 @@ -import org.example.application.tasks.Jpackage -import org.example.application.tasks.MD5DirectoryChecksum -import org.example.application.tasks.VersionXml - -plugins { - id("org.example.java") - id("application") // For stand-alone application packaging - id("jacoco-report-aggregation") // get and aggregated coverage report for all tests - id("test-report-aggregation") // get and aggregated result report for all tests - id("org.example.war") // For web application packaging/deployment - id("org.example.end2end-testing") - id("io.fuchs.gradle.classpath-collision-detector") - id("org.owasp.dependencycheck") -} - -configurations.aggregateTestReportResults { - shouldResolveConsistentlyWith(configurations.appRuntimeClasspath.get()) -} -configurations.aggregateCodeCoverageReportResults { - shouldResolveConsistentlyWith(configurations.appRuntimeClasspath.get()) -} - -// Generate additional resources required at application runtime -val generateVersionXml = tasks.register("generateVersionXml") { - mainVersion.set(providers.fileContents( - rootProject.layout.projectDirectory.file("gradle/version.txt")).asText) - xmlFile.set(layout.buildDirectory.file("generated-resources/xml/version.xml")) -} -val resourcesChecksum = tasks.register("resourcesChecksum") { - inputDirectory.set(layout.projectDirectory.dir("src/main/resources")) - checksumFile.set(layout.buildDirectory.file("generated-resources/md5/resources.MD5")) -} - -tasks.processResources { - from(generateVersionXml) - from(resourcesChecksum) -} - -tasks.register("jpackage") { - group = "build" - - javaInstallation.set(javaToolchains.compilerFor(java.toolchain).map { it.metadata }) - operatingSystem.set("macos") - architecture.set("aarch64") - - mainModule.set(application.mainModule) - mainClass.set(application.mainClass) - version.set(project.version as String) - resources.set(layout.projectDirectory.dir("resources")) - applicationName.set("Gradle Project Setup Howto") - applicationDescription.set("How to structure a growing Gradle project with smart dependency management?") - vendor.set("Jendrik Johannes (Onepiece.Software)") - copyright.set("Copyright © 2023 Jendrik Johannes") - - modulePath.from(tasks.jar) - modulePath.from(configurations.runtimeClasspath) - - destination.set(layout.buildDirectory.dir("package")) -} - -dependencyCheck { - scanConfigurations = listOf(configurations.runtimeClasspath.get().name) - autoUpdate = false -} - -tasks.check { - dependsOn(tasks.testAggregateTestReport) - dependsOn(tasks.testCodeCoverageReport) - dependsOn(tasks.detectCollisions) -} diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.end2end-testing.gradle.kts b/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.end2end-testing.gradle.kts deleted file mode 100644 index d91b118c..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.end2end-testing.gradle.kts +++ /dev/null @@ -1,33 +0,0 @@ -plugins { - id("org.example.java") -} - -// Specific API fixtures used for testing without live service -val mockApi = sourceSets.create("mockApi") -java.registerFeature(mockApi.name) { - usingSourceSet(mockApi) -} - -// end-to-end tests located in the :app project -testing.suites.create("endToEndTest") { - useJUnitJupiter("") - targets.all { - testTask { - options { - this as JUnitPlatformOptions - excludeTags("slow") - } - } - tasks.check { - dependsOn(testTask) - } - } -} - -// Add a second task for the endToEndTest suite (not yet supported by suites directly) -tasks.register("endToEndTestSlow") { - testClassesDirs = sourceSets["endToEndTest"].output.classesDirs - classpath = sourceSets["endToEndTest"].runtimeClasspath - group = LifecycleBasePlugin.VERIFICATION_GROUP - useJUnitPlatform { includeTags("slow") } -} diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.war.gradle.kts b/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.war.gradle.kts deleted file mode 100644 index be5f514d..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org.example.war.gradle.kts +++ /dev/null @@ -1,22 +0,0 @@ -plugins { - id("war") - id("org.example.java") - id("org.example.build-parameters") -} - -// The war plugin used 'providedRuntime' / 'providedCompile' to resolve dependencies for packaging the WAR file -configurations.providedCompile { - shouldResolveConsistentlyWith(configurations.appRuntimeClasspath.get()) -} -configurations.providedRuntime { - shouldResolveConsistentlyWith(configurations.appRuntimeClasspath.get()) -} - -tasks.register("deployWebApp") { - group = "distribution" - description = "Deploy web app into local Tomcat found via CATALINA_HOME" - from(tasks.war) { - into("webapps") - } - into(buildParameters.catalina.home) -} diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/Jpackage.kt b/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/Jpackage.kt deleted file mode 100644 index 300e20c8..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/Jpackage.kt +++ /dev/null @@ -1,194 +0,0 @@ -package org.example.application.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.file.ConfigurableFileCollection -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.internal.file.FileOperations -import org.gradle.api.provider.ListProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.CacheableTask -import org.gradle.api.tasks.Classpath -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.InputDirectory -import org.gradle.api.tasks.Nested -import org.gradle.api.tasks.OutputDirectory -import org.gradle.api.tasks.PathSensitive -import org.gradle.api.tasks.PathSensitivity -import org.gradle.api.tasks.TaskAction -import org.gradle.jvm.toolchain.JavaInstallationMetadata -import org.gradle.process.ExecOperations -import java.io.File -import java.io.IOException -import java.nio.file.Files -import java.security.MessageDigest -import java.security.NoSuchAlgorithmException -import java.util.* -import javax.inject.Inject - - -@CacheableTask -abstract class Jpackage : DefaultTask() { - - @get:Nested - abstract val javaInstallation: Property - - @get:Input - abstract val operatingSystem: Property - - @get:Input - abstract val architecture: Property - - @get:Input - abstract val mainModule: Property - - @get:Input - abstract val mainClass: Property - - @get:PathSensitive(PathSensitivity.RELATIVE) - @get:InputDirectory - abstract val resources: DirectoryProperty - - @get:Input - abstract val version: Property - - @get:Classpath - abstract val modulePath: ConfigurableFileCollection - - @get:Input - abstract val javaOptions: ListProperty - - @get:Input - abstract val applicationName: Property - - @get:Input - abstract val applicationDescription: Property - - @get:Input - abstract val vendor: Property - - @get:Input - abstract val copyright: Property - - @get:OutputDirectory - abstract val destination: DirectoryProperty - - @get:Inject - protected abstract val files: FileOperations - - @get:Inject - protected abstract val exec: ExecOperations - - @TaskAction - @Throws(NoSuchAlgorithmException::class, IOException::class) - fun runJlink() { - files.delete(destination) - - val os = operatingSystem.get() - val arch = architecture.get() - val hostOs = System.getProperty("os.name").replace(" ", "").lowercase() - val hostArch = System.getProperty("os.arch") - - val resourcesDir = destination.dir("additional-resources").get() - - if (arch.contains("64") && !hostArch.contains("64")) { - wrongHostSystemError(hostArch, arch) - } - if (arch.contains("aarch") && !hostArch.contains("aarch")) { - wrongHostSystemError(hostArch, arch) - } - if (!arch.contains("aarch") && hostArch.contains("aarch")) { - wrongHostSystemError(hostArch, arch) - } - - if (os.contains("macos")) { - if (!hostOs.contains(os)) { - wrongHostSystemError(hostOs, os) - } - val icon = resources.file("icon.icns").get() - files.copy { - from(icon) { - rename { "${applicationName.get()}.icns" } - } - from(icon) { - rename { "${applicationName.get()}-volume.icns" } - } - into(resourcesDir) - } - } else if (os.contains("windows")) { - if (!hostOs.contains(os)) { - wrongHostSystemError(hostOs, os) - } - val icon = resources.file("icon.ico").get() - files.copy { - from(icon) { - rename { "${applicationName.get()}.ico" } - } - into(resourcesDir) - } - } else { - if (hostOs.contains("windows") || hostOs.contains("osx")) { - wrongHostSystemError(hostOs, os) - } - val icon = resources.file("icon.png").get() - files.copy { - from(icon) { - rename { "${applicationName.get()}.png" } - } - into(resourcesDir) - } - } - - val dest = destination.get().asFile - - exec.exec { - commandLine( - javaInstallation.get().getInstallationPath().file("bin/jpackage").getAsFile().getAbsolutePath(), - "--module", - mainModule.get() + "/" + mainClass.get(), - "--resource-dir", - resourcesDir.asFile.absolutePath, - "--app-version", - version.get(), - "--module-path", - modulePath.getAsPath(), - "--name", - applicationName.get(), - "--vendor", - vendor.get(), - "--copyright", - copyright.get(), - "--description", - applicationDescription.get(), - "--dest", - dest.path - ) - for (javaOption in javaOptions.get()) { - args("--java-options", javaOption) - } - } - - files.delete(resourcesDir) - - for (result in Objects.requireNonNull(dest.listFiles())) { - val digest = MessageDigest.getInstance("SHA-256") - val encoded = digest.digest(Files.readAllBytes(result.toPath())) - Files.write(File(dest, result.name + ".sha256").toPath(), bytesToHex(encoded).toByteArray()) - } - } - - private fun bytesToHex(hash: ByteArray): String { - val hexString = StringBuilder(2 * hash.size) - for (b in hash) { - val hex = Integer.toHexString(0xff and b.toInt()) - if (hex.length == 1) { - hexString.append('0') - } - hexString.append(hex) - } - return hexString.toString() - } - - private fun wrongHostSystemError(hostOs: String, os: String) { - throw RuntimeException("Running on $hostOs; cannot build for $os") - } -} diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/MD5DirectoryChecksum.kt b/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/MD5DirectoryChecksum.kt deleted file mode 100644 index bfd8f6d4..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/MD5DirectoryChecksum.kt +++ /dev/null @@ -1,77 +0,0 @@ -package org.example.application.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.file.DirectoryProperty -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.tasks.InputDirectory -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction -import java.io.File -import java.nio.file.Files -import java.security.DigestInputStream -import java.security.MessageDigest - -/** - * Gradle task based on 'Checksum' Ant Task but stripped down to what we need in this build. - * - * See: https://github.com/apache/ant/blob/master/src/main/org/apache/tools/ant/taskdefs/Checksum.java - */ -abstract class MD5DirectoryChecksum : DefaultTask() { - - @get:InputDirectory - abstract val inputDirectory: DirectoryProperty - - @get:OutputFile - abstract val checksumFile: RegularFileProperty - - @TaskAction - fun generateChecksum() { - val messageDigest = MessageDigest.getInstance("MD5") - - val allDigests = mutableMapOf() - val bufSize = 8 * 1024 - val buf = ByteArray(bufSize) - - val folder = inputDirectory.get().asFile - folder.walkTopDown().filter { it.isFile }.forEach { - messageDigest.reset() - val fis = Files.newInputStream(it.toPath()) - val dis = DigestInputStream( - fis, - messageDigest - ) - while (dis.read(buf, 0, bufSize) != -1) { - // Empty statement - } - dis.close() - fis.close() - val fileDigest = messageDigest.digest() - allDigests[it] = fileDigest - } - // Calculate the total checksum - // Convert the keys (source files) into a sorted array. - val keyArray = allDigests.keys.sortedBy { it.relativeTo(folder).path } - - // Loop over the checksums and generate a total hash. - messageDigest.reset() - keyArray.forEach { - // Add the digest for the file content - val digest = allDigests.getValue(it) - messageDigest.update(digest) - - // Add the file path - val fileName = it.relativeTo(folder).path.replace(File.separatorChar, '/') - messageDigest.update(fileName.toByteArray()) - } - checksumFile.get().asFile.writeText(createDigestString(messageDigest.digest())) - } - - private fun createDigestString(fileDigest: ByteArray): String { - val byteMask = 0xFF - val checksumSb = StringBuilder() - for (digestByte in fileDigest) { - checksumSb.append(String.format("%02x", byteMask and digestByte.toInt())) - } - return checksumSb.toString() - } -} \ No newline at end of file diff --git a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/VersionXml.kt b/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/VersionXml.kt deleted file mode 100644 index 0a1e8ef4..00000000 --- a/gradle/plugins/java-application-plugins/src/main/kotlin/org/example/application/tasks/VersionXml.kt +++ /dev/null @@ -1,27 +0,0 @@ -package org.example.application.tasks - -import org.gradle.api.DefaultTask -import org.gradle.api.file.RegularFileProperty -import org.gradle.api.provider.Property -import org.gradle.api.tasks.Input -import org.gradle.api.tasks.OutputFile -import org.gradle.api.tasks.TaskAction - -/** - * Encodes the current product version in an XML format used at application runtime. - */ -abstract class VersionXml : DefaultTask() { - - @get:Input - abstract val mainVersion: Property - - @get:OutputFile - abstract val xmlFile: RegularFileProperty - - @TaskAction - fun generate() { - xmlFile.get().asFile.writeText( - "" - ) - } -} diff --git a/gradle/plugins/java-base-plugins/build.gradle.kts b/gradle/plugins/java-base-plugins/build.gradle.kts deleted file mode 100644 index 1bcd0aac..00000000 --- a/gradle/plugins/java-base-plugins/build.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation(project(":base-plugins")) - implementation("org.gradlex:java-module-dependencies") -} diff --git a/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.consistent-resolution.gradle.kts b/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.consistent-resolution.gradle.kts deleted file mode 100644 index 4fc15b53..00000000 --- a/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.consistent-resolution.gradle.kts +++ /dev/null @@ -1,32 +0,0 @@ -plugins { - id("java-base") -} - -// Expose the ':app' project runtime classpath in every project -val app = configurations.dependencyScope("app") { - withDependencies { - // Depend on ':app' and with this on all its (transitive) dependencies - add(project.dependencies.create(project(":app"))) - // Get our own version information from the platform project - add(project.dependencies.create(project.dependencies.platform("org.example.product:platform"))) - } -} -val appRuntimeClasspath = configurations.resolvable("appRuntimeClasspath") { - description = "Runtime classpath of the complete application" - extendsFrom(app.get()) - attributes { - // We want the runtime classpath represented by Usage.JAVA_RUNTIME - attribute(Usage.USAGE_ATTRIBUTE, objects.named(Usage.JAVA_RUNTIME)) - } -} - -// Every compile classpath and runtime classpath uses the versions of the -sourceSets.all { - configurations[compileClasspathConfigurationName].shouldResolveConsistentlyWith(appRuntimeClasspath.get()) - configurations[runtimeClasspathConfigurationName].shouldResolveConsistentlyWith(appRuntimeClasspath.get()) - // Source sets without production code (tests / fixtures) are allowed to have dependencies that are - // not part of the consistent resolution result and might need additional version information - if (this != sourceSets["main"]) { - dependencies.add(implementationConfigurationName, dependencies.platform("org.example.product:platform")) - } -} diff --git a/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.java.gradle.kts b/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.java.gradle.kts deleted file mode 100644 index 6dc7b5fe..00000000 --- a/gradle/plugins/java-base-plugins/src/main/kotlin/org.example.java.gradle.kts +++ /dev/null @@ -1,44 +0,0 @@ -import org.gradlex.javamodule.dependencies.dsl.GradleOnlyDirectives - -plugins { - id("java") - id("jacoco") // Record test coverage data during test execution - id("org.example.base") - id("org.example.consistent-resolution") - id("org.example.dependency-analysis-project") -} - -// Configure Java compilation on java {} extension or directly on 'JavaCompile' tasks -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) -} -tasks.withType().configureEach { - options.encoding = "UTF-8" -} - -// Configure details for *all* test executions directly on 'Test' task -tasks.withType().configureEach { - useJUnitPlatform() // Use JUnit 5 as test framework - maxParallelForks = 4 - - testLogging.showStandardStreams = true - - maxHeapSize = "1g" - systemProperty("file.encoding", "UTF-8") -} - -// Configure common test runtime dependencies for *all* projects -extensions.configure("testModuleInfo") { - runtimeOnly("org.junit.jupiter.engine") - runtimeOnly("org.slf4j.simple") -} - -// We use the merge Jar feature of 'extra-java-module-info' and javaModulesMergeJars also needs to get version from somewhere -configurations.javaModulesMergeJars.get().shouldResolveConsistentlyWith(configurations["appRuntimeClasspath"]) - -// Add a 'compileAll' task to run all of Java compilation in one go -tasks.register("compileAll") { - group = LifecycleBasePlugin.BUILD_GROUP - description = "Compile all Java code (use to prime the build cache for CI pipeline)" - dependsOn(tasks.withType()) -} diff --git a/gradle/plugins/java-library-plugins/build.gradle.kts b/gradle/plugins/java-library-plugins/build.gradle.kts deleted file mode 100644 index 833ce0d5..00000000 --- a/gradle/plugins/java-library-plugins/build.gradle.kts +++ /dev/null @@ -1,10 +0,0 @@ -plugins { - `kotlin-dsl` -} - -dependencies { - implementation(platform(project(":plugins-platform"))) - - implementation(project(":java-base-plugins")) - implementation("org.gradlex:java-module-testing") -} diff --git a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-published.gradle.kts b/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-published.gradle.kts deleted file mode 100644 index 4b6a639a..00000000 --- a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-published.gradle.kts +++ /dev/null @@ -1,35 +0,0 @@ -plugins { - id("maven-publish") - id("org.example.java-library") -} - -// Publish with sources and Javadoc -java { - withSourcesJar() - withJavadocJar() -} - -// Configure details of Javadoc generation -tasks.javadoc { - (options as StandardJavadocDocletOptions).apply { - memberLevel = JavadocMemberLevel.PUBLIC - isAuthor = true - } -} - -publishing.publications.create("mavenJava") { - from(components["java"]) - - // We use consistent resolution + a platform for controlling versions - // -> Publish the versions that are the result of the consistent resolution - versionMapping { - allVariants { - fromResolutionResult() - } - } -} - -// The repository to publish to -publishing.repositories { - maven("/tmp/my-repo") -} diff --git a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-with-test-fixtures.gradle.kts b/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-with-test-fixtures.gradle.kts deleted file mode 100644 index 79940f87..00000000 --- a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library-with-test-fixtures.gradle.kts +++ /dev/null @@ -1,4 +0,0 @@ -plugins { - id("org.example.java-library") - id("java-test-fixtures") -} diff --git a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library.gradle.kts b/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library.gradle.kts deleted file mode 100644 index a3bc16c5..00000000 --- a/gradle/plugins/java-library-plugins/src/main/kotlin/org.example.java-library.gradle.kts +++ /dev/null @@ -1,5 +0,0 @@ -plugins { - id("java-library") - id("org.example.java") - id("org.gradlex.java-module-testing") -} diff --git a/gradle/plugins/plugins-platform/build.gradle.kts b/gradle/plugins/plugins-platform/build.gradle.kts deleted file mode 100644 index 262e9e2c..00000000 --- a/gradle/plugins/plugins-platform/build.gradle.kts +++ /dev/null @@ -1,14 +0,0 @@ -plugins { - id("java-platform") -} - -dependencies.constraints { - api("com.autonomousapps:dependency-analysis-gradle-plugin:1.28.0") - api("dev.jacomet.gradle.plugins:logging-capabilities:0.11.1") - api("io.fuchs.gradle.classpath-collision-detector:classpath-collision-detector:0.3") - api("org.gradlex:extra-java-module-info:1.6") - api("org.gradlex:java-ecosystem-capabilities:1.3.1") - api("org.gradlex:java-module-dependencies:1.5") - api("org.gradlex:java-module-testing:1.3") - api("org.owasp:dependency-check-gradle:7.4.4") -} diff --git a/gradle/plugins/settings.gradle.kts b/gradle/plugins/settings.gradle.kts deleted file mode 100644 index a7ec1ee2..00000000 --- a/gradle/plugins/settings.gradle.kts +++ /dev/null @@ -1,11 +0,0 @@ -pluginManagement { - includeBuild("../meta-plugins") -} -plugins { - id("org.example.settings") -} - -dependencyResolutionManagement { - repositories.gradlePluginPortal() - includeBuild("../meta-plugins") // for 'build-parameters' -} diff --git a/gradle/version.txt b/gradle/version.txt deleted file mode 100644 index ea710abb..00000000 --- a/gradle/version.txt +++ /dev/null @@ -1 +0,0 @@ -1.2 \ No newline at end of file diff --git a/kamino/build.gradle.kts b/kamino/build.gradle.kts index 62f80b5d..4fc03f2b 100644 --- a/kamino/build.gradle.kts +++ b/kamino/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library-published") + id("org.example.gradlebuild.java-library-module") } diff --git a/kamino/src/test/java/module-info.java b/kamino/src/test/java/module-info.java index 6ca905f6..3def250e 100644 --- a/kamino/src/test/java/module-info.java +++ b/kamino/src/test/java/module-info.java @@ -1,4 +1,6 @@ open module org.example.product.kamino.test { requires org.example.product.kamino; requires org.junit.jupiter.api; + + requires /*runtime*/ org.slf4j.simple; } diff --git a/kashyyyk/build.gradle.kts b/kashyyyk/build.gradle.kts index 605f513f..4fc03f2b 100644 --- a/kashyyyk/build.gradle.kts +++ b/kashyyyk/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library") + id("org.example.gradlebuild.java-library-module") } diff --git a/kashyyyk/src/test/java9/module-info.java b/kashyyyk/src/test/java9/module-info.java index 4f133873..a0c7c157 100644 --- a/kashyyyk/src/test/java9/module-info.java +++ b/kashyyyk/src/test/java9/module-info.java @@ -3,4 +3,6 @@ requires org.example.product.kashyyyk; requires org.junit.jupiter.api; + + requires /*runtime*/ org.slf4j.simple; } diff --git a/naboo/build.gradle.kts b/naboo/build.gradle.kts index 605f513f..4fc03f2b 100644 --- a/naboo/build.gradle.kts +++ b/naboo/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library") + id("org.example.gradlebuild.java-library-module") } diff --git a/gradlew b/oj similarity index 99% rename from gradlew rename to oj index 1aa94a42..87ccb819 100755 --- a/gradlew +++ b/oj @@ -112,7 +112,7 @@ case "$( uname )" in #( NONSTOP* ) nonstop=true ;; esac -CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar +CLASSPATH=$APP_HOME/.oj/gradle/gradle-wrapper.jar # Determine the Java command to use to start the JVM. diff --git a/gradlew.bat b/oj.bat similarity index 94% rename from gradlew.bat rename to oj.bat index 7101f8e4..d7f407ab 100644 --- a/gradlew.bat +++ b/oj.bat @@ -68,7 +68,7 @@ goto fail :execute @rem Setup the command line -set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar +set CLASSPATH=%APP_HOME%\.oj\gradle\gradle-wrapper.jar @rem Execute Gradle diff --git a/settings.gradle b/settings.gradle new file mode 100644 index 00000000..43383332 --- /dev/null +++ b/settings.gradle @@ -0,0 +1,5 @@ +pluginManagement { + repositories.maven { url = 'https://plugins.gradle.org/m2' } + repositories.maven { url = 'https://gradle.onepiece.software:1443/releases' } +} +plugins { id 'software.onepiece.j' version '0.0.18' } \ No newline at end of file diff --git a/settings.gradle.kts b/settings.gradle.kts deleted file mode 100644 index 14163a0b..00000000 --- a/settings.gradle.kts +++ /dev/null @@ -1,8 +0,0 @@ -pluginManagement { - includeBuild("gradle/meta-plugins") -} -plugins { - id("org.example.settings") -} - -rootProject.name = "gradle-project-setup-howto" diff --git a/tatooine/build.gradle.kts b/tatooine/build.gradle.kts index 605f513f..4fc03f2b 100644 --- a/tatooine/build.gradle.kts +++ b/tatooine/build.gradle.kts @@ -1,3 +1,3 @@ plugins { - id("org.example.java-library") + id("org.example.gradlebuild.java-library-module") }