diff --git a/.oj/jdk-version.txt b/.oj/jdk-version.txt index 0c4da741..d1fd34fb 100644 --- a/.oj/jdk-version.txt +++ b/.oj/jdk-version.txt @@ -1 +1 @@ -17.0.6 +17.0.6 \ No newline at end of file diff --git a/.oj/modules.properties b/.oj/modules.properties index 8c322729..d07c2639 100644 --- a/.oj/modules.properties +++ b/.oj/modules.properties @@ -1,3 +1,4 @@ -# https://onepiece.software/j/modules +# https://onepiece.software/j/#modules -# jakarta.activation=com.sun.activation:jakarta.activation +jakarta.activation=com.sun.activation:jakarta.activation +jakarta.mail=com.sun.mail:jakarta.mail diff --git a/.oj/patch/conflicts.properties b/.oj/patch/conflicts.properties index 74cc4ba8..91ff323d 100644 --- a/.oj/patch/conflicts.properties +++ b/.oj/patch/conflicts.properties @@ -1,3 +1,3 @@ -# https://onepiece.software/j/patch/conflicts +# https://onepiece.software/j/#conflicts.properties # 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 index 935bcc6a..bcb94407 100644 --- a/.oj/patch/dependencies-add.properties +++ b/.oj/patch/dependencies-add.properties @@ -1,3 +1,3 @@ -# https://onepiece.software/j/patch/dependencies-add +# https://onepiece.software/j/#dependencies.add.properties # io.netty\:netty-common=io.projectreactor.tools:blockhound:1.0.8.RELEASE diff --git a/.oj/patch/features.properties b/.oj/patch/features.properties index d8f64868..2420c522 100644 --- a/.oj/patch/features.properties +++ b/.oj/patch/features.properties @@ -1,3 +1,3 @@ -# https://onepiece.software/j/patch/features +# https://onepiece.software/j/#features.properties # 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 index 3c7cee9a..976c2f90 100644 --- a/.oj/patch/non-modules.properties +++ b/.oj/patch/non-modules.properties @@ -1,12 +1,11 @@ # 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 +commons.math3=org.apache.commons:commons-math3 javax.annotations.jsr305=com.google.code.findbugs:jsr305 +org.apache.commons.codec=commons-codec:commons-codec +org.apache.commons.collections4=org.apache.commons:commons-collections4 +org.apache.commons.lang3=org.apache.commons:commons-lang3 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 index 64eefa7d..0141c4d7 100644 --- a/.oj/patch/targets.properties +++ b/.oj/patch/targets.properties @@ -1,3 +1,3 @@ -# https://onepiece.software/j/patch/targets +# https://onepiece.software/j/#targets.properties -# org.openjfx\:javafx-base=[none|none],mac[macos|x86-64],mac-aarch64[macos|aarch64],win[windows|x86-64],linux-aarch64[linux|x86-64] +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/publishing.properties b/.oj/publishing.properties index 1fd66e26..a84942a1 100644 --- a/.oj/publishing.properties +++ b/.oj/publishing.properties @@ -1,3 +1,3 @@ # https://onepiece.software/j/publishing -# example=https://example.org/publishing-repository +local=/tmp/my-repo diff --git a/.oj/repositories.properties b/.oj/repositories.properties index 766a411d..91d21485 100644 --- a/.oj/repositories.properties +++ b/.oj/repositories.properties @@ -1,3 +1,4 @@ -# https://onepiece.software/j/repositories +# https://onepiece.software/j/#repositories.properties mavenCentral=https://repo1.maven.org/maven2 +foojayJavaToolchains=https://api.foojay.io/disco diff --git a/.oj/tweak/test.properties b/.oj/tweak/test.properties index 5d8e2891..eba011ca 100644 --- a/.oj/tweak/test.properties +++ b/.oj/tweak/test.properties @@ -3,5 +3,5 @@ test.lifecycle=check javac.jvm.options= javac.options= -test.jvm.options= +test.jvm.options=-Xmx1g test.parallelism=8 \ No newline at end of file diff --git a/.oj/versions.properties b/.oj/versions.properties index e2cfa594..8e797f49 100644 --- a/.oj/versions.properties +++ b/.oj/versions.properties @@ -1,6 +1,6 @@ # https://onepiece.software/j/versions -com.fasterxml.jackson.core=2.16.1 +com.fasterxml.jackson.databind=2.16.1 com.google.common=33.0.0-jre jakarta.activation=1.2.2 jakarta.mail=1.6.7 diff --git a/gradle/jdk-version.txt b/gradle/jdk-version.txt new file mode 100644 index 00000000..d1fd34fb --- /dev/null +++ b/gradle/jdk-version.txt @@ -0,0 +1 @@ +17.0.6 \ No newline at end of file diff --git a/gradle/modules.properties b/gradle/modules.properties new file mode 100644 index 00000000..d07c2639 --- /dev/null +++ b/gradle/modules.properties @@ -0,0 +1,4 @@ +# https://onepiece.software/j/#modules + +jakarta.activation=com.sun.activation:jakarta.activation +jakarta.mail=com.sun.mail:jakarta.mail diff --git a/gradle/platform/build.gradle.kts b/gradle/platform/build.gradle.kts index 545aeafd..9c3f8168 100644 --- a/gradle/platform/build.gradle.kts +++ b/gradle/platform/build.gradle.kts @@ -3,18 +3,18 @@ plugins { } moduleInfo { - 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("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") - version("org.apache.commons.compress", "1.25.0") - version("org.apache.poi.ooxml", "5.2.2") + version("com.fasterxml.jackson.databind", "2.16.1") { reject("[3.0.0,)") } + version("com.google.common", "33.0.0-jre") { reject("[34.0.0,)") } + version("jakarta.activation", "1.2.2") { reject("[2.0.0,)") } + version("jakarta.mail", "1.6.7") { reject("[2.0.0,)") } + version("jakarta.servlet", "6.0.0") { reject("[7.0.0,)") } + version("java.inject", "1.0.5") { reject("[2.0.0,)") } + version("javax.annotations.jsr305", "3.0.2") { reject("[4.0.0,)") } + version("org.apache.commons.compress", "1.25.0") { reject("[2.0.0,)") } + version("org.apache.commons.io", "2.15.1") { reject("[3.0.0,)") } + version("org.apache.poi.ooxml", "5.2.2") { reject("[6.0.0,)") } + version("org.assertj.core", "3.25.1") { reject("[4.0.0,)") } + version("org.junit.jupiter.api", "5.10.1") { reject("[6.0.0,)") } + version("org.slf4j", "2.0.10") { reject("[3.0.0,)") } + version("velocity.engine.core", "2.3") { reject("[3.0.0,)") } } diff --git a/gradle/plugins/build.gradle.kts b/gradle/plugins/build.gradle.kts new file mode 100644 index 00000000..7cb140d5 --- /dev/null +++ b/gradle/plugins/build.gradle.kts @@ -0,0 +1,16 @@ +plugins { `kotlin-dsl`} + +repositories.maven("https://plugins.gradle.org/m2") +repositories.maven("https://gradle.onepiece.software:1443/releases") + +dependencies { + implementation("com.autonomousapps:dependency-analysis-gradle-plugin:1.28.0") + implementation("com.gradle:gradle-enterprise-gradle-plugin:3.16.1") + implementation("io.fuchs.gradle.classpath-collision-detector:classpath-collision-detector:0.3") + implementation("org.gradle.toolchains:foojay-resolver:0.7.0") + implementation("org.gradlex:extra-java-module-info:1.7") + implementation("org.gradlex:java-ecosystem-capabilities:1.4") + implementation("org.gradlex:java-module-dependencies:1.5.1") + implementation("org.gradlex:java-module-packaging:0.0.2") + implementation("org.gradlex:java-module-testing:1.3.1") +} diff --git a/gradle/plugins/settings.gradle.kts b/gradle/plugins/settings.gradle.kts new file mode 100644 index 00000000..2e2a2d24 --- /dev/null +++ b/gradle/plugins/settings.gradle.kts @@ -0,0 +1 @@ +includeBuild("../../../../plugins/onepiece-j") \ No newline at end of file diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-main.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-main.gradle.kts new file mode 100644 index 00000000..fbc5caaf --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-main.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("java") +} + +tasks.compileJava { + options.forkOptions.jvmArgs = listOf() + options.compilerArgs = listOf() +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-mock-api.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-mock-api.gradle.kts new file mode 100644 index 00000000..c685decd --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-mock-api.gradle.kts @@ -0,0 +1,11 @@ +plugins { + id("java") +} + +val mockApi = sourceSets.create("mockApi") +java.registerFeature(mockApi.name) { usingSourceSet(mockApi) } + +tasks.named("compileMockApiJava") { + options.forkOptions.jvmArgs = listOf() + options.compilerArgs = listOf() +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-test-fixtures.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-test-fixtures.gradle.kts new file mode 100644 index 00000000..b4c3d46f --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.feature-test-fixtures.gradle.kts @@ -0,0 +1,8 @@ +plugins { + id("java-test-fixtures") +} + +tasks.compileTestFixturesJava { + options.forkOptions.jvmArgs = listOf() + options.compilerArgs = listOf() +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-application-module.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-application-module.gradle.kts new file mode 100644 index 00000000..864be36d --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-application-module.gradle.kts @@ -0,0 +1,20 @@ +plugins { + id("application") + id("io.fuchs.gradle.classpath-collision-detector") + id("org.example.gradlebuild.java-base") + id("org.example.gradlebuild.java-module-building") + id("org.example.gradlebuild.java-module-testing") +} + +javaModulePackaging { + applicationName = "Gradle Project Setup HowTo" + applicationDescription = "How to structure a growing Gradle project with smart dependency management?" + vendor = "Jendrik Johannes (onepiece.Software)" + copyright = "Copyright 2024, Jendrik Johannes" +} + +application { + applicationDefaultJvmArgs = listOf() +} + +tasks.withType().configureEach { args() } diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-base.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-base.gradle.kts new file mode 100644 index 00000000..5bc6d947 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-base.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("org.example.gradlebuild.patch-metadata") + id("org.example.gradlebuild.patch-non-modules") +} + +group = "org.example" +version = providers.fileContents(rootProject.layout.projectDirectory.file("gradle/version.txt")).asText.getOrElse("") diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-library-module.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-library-module.gradle.kts new file mode 100644 index 00000000..5865ed4a --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-library-module.gradle.kts @@ -0,0 +1,7 @@ +plugins { + id("java-library") + id("org.example.gradlebuild.java-base") + id("org.example.gradlebuild.java-module-building") + id("org.example.gradlebuild.java-module-testing") + id("org.example.gradlebuild.java-module-publishing") +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-building.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-building.gradle.kts new file mode 100644 index 00000000..833f9a75 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-building.gradle.kts @@ -0,0 +1,54 @@ +plugins { + id("java") + id("org.gradlex.java-module-dependencies") + id("org.gradlex.java-module-packaging") + id("org.example.gradlebuild.feature-main") + id("org.example.gradlebuild.test-suite-test") +} + +javaModulePackaging { + target("macos") { + operatingSystem = "macos" + architecture = "x86-64" + } + target("ubuntu") { + operatingSystem = "linux" + architecture = "x86-64" + } + target("windows") { + operatingSystem = "windows" + architecture = "x86-64" + } +} + +val fullJavaVersion = providers.fileContents(rootProject.layout.projectDirectory.file("gradle/jdk-version.txt")).asText.get() +val majorJavaVersion = fullJavaVersion.substring(0, fullJavaVersion.indexOf(".")) +java.toolchain.languageVersion = JavaLanguageVersion.of(majorJavaVersion) + +javaModuleDependencies.versionsFromPlatformAndConsistentResolution(":platform", rootProject.subprojects.map { it.path }.filter { it != ":platform" }) + +tasks.withType().configureEach { + inputs.property("fullJavaVersion", fullJavaVersion) + options.isFork = true + options.encoding = "UTF-8" + options.javaModuleVersion = project.version as String + doFirst { + this as JavaCompile + val trackedVersion = inputs.properties["fullJavaVersion"] as String + val usedVersion = javaCompiler.get().metadata.javaRuntimeVersion + if (!usedVersion.startsWith(trackedVersion)) { + throw RuntimeException("Selected JDK version $usedVersion does not fit defined JDK version $trackedVersion") + } + } +} + +tasks.withType().configureEach { + isPreserveFileTimestamps = false + isReproducibleFileOrder = true + fileMode = 436 // 0664 + dirMode = 509 // 0775 +} + +tasks.withType().configureEach { + options.encoding = "UTF-8" +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-publishing.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-publishing.gradle.kts new file mode 100644 index 00000000..29034baf --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-publishing.gradle.kts @@ -0,0 +1,23 @@ +plugins { + id("java") + id("maven-publish") +} + +java.withSourcesJar() + +java.withJavadocJar() + +publishing.publications.create("module") { + from(components["java"]) + versionMapping { + allVariants { fromResolutionResult() } + } +} + +publishing.repositories { + maven { + name = "local" + url = uri("/tmp/my-repo") + if (providers.gradleProperty("localUsername").isPresent()) { credentials(PasswordCredentials::class) } + } +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-testing.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-testing.gradle.kts new file mode 100644 index 00000000..d2f2a3ec --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.java-module-testing.gradle.kts @@ -0,0 +1,10 @@ +plugins { + id("java") + id("org.gradlex.java-module-testing") +} + +tasks.check { + dependsOn(tasks.withType()) + dependsOn(tasks.withType()) + dependsOn(tasks.withType()) +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-metadata.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-metadata.gradle.kts new file mode 100644 index 00000000..a25419fe --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-metadata.gradle.kts @@ -0,0 +1,32 @@ +import org.gradlex.javaecosystem.capabilities.customrules.* + +plugins { + id("org.gradlex.java-ecosystem-capabilities") +} + +dependencies.components { + all() + withModule("org.apache.poi:poi") { params(listOf("org.apache.poi:poi-excelant", "org.apache.poi:poi-ooxml", "org.apache.poi:poi-scratchpad")) } + withModule("org.slf4j:slf4j-parent") { params(listOf("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")) } + withModule("org.apache.poi:poi-excelant") { params("org.apache.poi:poi") } + withModule("org.apache.poi:poi-ooxml") { params("org.apache.poi:poi") } + withModule("org.apache.poi:poi-scratchpad") { params("org.apache.poi:poi") } + withModule("org.slf4j:slf4j-api") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-simple") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-nop") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-jdk14") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-log4j12") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-reload4j") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-jcl") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-android") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:slf4j-ext") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:jcl-over-slf4j") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:log4j-over-slf4j") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:jul-to-slf4j") { params("org.slf4j:slf4j-parent") } + withModule("org.slf4j:osgi-over-slf4j") { params("org.slf4j:slf4j-parent") } + withModule("com.google.guava:guava") { params(listOf("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")) } + withModule("org.openjfx:javafx-base") { params(listOf(Target("", "none", "none"), Target("mac", "macos", "x86-64"), Target("mac-aarch64", "macos", "aarch64"), Target("win", "windows", "x86-64"), Target("linux-aarch64", "linux", "x86-64"))) } +} + +configurations.all { +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-non-modules.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-non-modules.gradle.kts new file mode 100644 index 00000000..5cc8e96b --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.patch-non-modules.gradle.kts @@ -0,0 +1,43 @@ +plugins { + id("org.gradlex.extra-java-module-info") +} + +extraJavaModuleInfo { + failOnAutomaticModules = true + module("com.zaxxer:SparseBitSet", "SparseBitSet") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("com.github.virtuald:curvesapi", "com.github.virtuald.curvesapi") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("com.google.guava:guava", "com.google.common") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("org.apache.commons:commons-math3", "commons.math3") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("com.google.code.findbugs:jsr305", "javax.annotations.jsr305") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("commons-codec:commons-codec", "org.apache.commons.codec") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("org.apache.commons:commons-collections4", "org.apache.commons.collections4") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("org.apache.commons:commons-lang3", "org.apache.commons.lang3") { + exportAllPackages() + requireAllDefinedDependencies() + } + module("org.apache.velocity:velocity-engine-core", "velocity.engine.core") { + exportAllPackages() + requireAllDefinedDependencies() + } +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.platform.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.platform.gradle.kts new file mode 100644 index 00000000..0f42775c --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.platform.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("java-platform") + id("org.gradlex.java-module-versions") + id("org.example.gradlebuild.java-base") +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.root.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.root.gradle.kts new file mode 100644 index 00000000..b7a8ed37 --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.root.gradle.kts @@ -0,0 +1,5 @@ +plugins { + id("com.autonomousapps.dependency-analysis") +} + +defaultTasks("tasks") diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.settings.settings.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.settings.settings.gradle.kts new file mode 100644 index 00000000..d08cc90b --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.settings.settings.gradle.kts @@ -0,0 +1,34 @@ +plugins { + id("com.gradle.enterprise") + id("org.gradle.toolchains.foojay-resolver-convention") +} + +dependencyResolutionManagement { + repositories.maven("https://repo1.maven.org/maven2") { + name = "mavenCentral" + if (providers.gradleProperty("mavenCentralUsername").isPresent()) { credentials(PasswordCredentials::class) } + } +} + +rootProject.name = "gradle-project-setup-howto" +includeBuild(".") +include("platform") +project(":platform").projectDir = layout.rootDirectory.dir("gradle/platform").asFile + +layout.rootDirectory.asFile.listFiles()?.filter { File(it, "build.gradle.kts").exists() }?.forEach { + include(it.name) +} +buildCache.remote { + url = uri("https://gradle.onepiece.software:5071/cache/") + if (providers.environmentVariable("CI").getOrElse("false").toBoolean()) { + isPush = true + credentials.username = providers.environmentVariable("BUILD_CACHE_USER").get() + credentials.password = providers.environmentVariable("BUILD_CACHE_PWD").get() + } +} + +gradleEnterprise.buildScan { + termsOfServiceUrl = "https://gradle.com/terms-of-service" + termsOfServiceAgree = "yes" + publishAlways() +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-end-to-end-test.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-end-to-end-test.gradle.kts new file mode 100644 index 00000000..ad0f69ee --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-end-to-end-test.gradle.kts @@ -0,0 +1,26 @@ +plugins { + id("java") +} + +if (!tasks.names.contains("checkEndToEnd")) { + tasks.register("checkEndToEnd") { + group = "verification" + description = "Runs checks in the checkEndToEnd lifecycle" + } + tasks.build { dependsOn("checkEndToEnd") } +} + +testing.suites.create("endToEndTest") { + targets.all { + tasks.named("checkEndToEnd") { dependsOn(testTask) } + testTask { + jvmArgs = listOf() + maxParallelForks = 8 + } + } +} + +tasks.named("compileEndToEndTestJava") { + options.forkOptions.jvmArgs = listOf() + options.compilerArgs = listOf() +} diff --git a/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-test.gradle.kts b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-test.gradle.kts new file mode 100644 index 00000000..4666d66d --- /dev/null +++ b/gradle/plugins/src/main/kotlin/org.example.gradlebuild.test-suite-test.gradle.kts @@ -0,0 +1,17 @@ +plugins { + id("java") +} + +testing.suites.named("test") { + targets.all { + testTask { + jvmArgs = listOf("-Xmx1g") + maxParallelForks = 8 + } + } +} + +tasks.compileTestJava { + options.forkOptions.jvmArgs = listOf() + options.compilerArgs = listOf() +} diff --git a/gradle/version.txt b/gradle/version.txt new file mode 100644 index 00000000..9f8e9b69 --- /dev/null +++ b/gradle/version.txt @@ -0,0 +1 @@ +1.0 \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 43383332..564502eb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,5 +1,6 @@ pluginManagement { repositories.maven { url = 'https://plugins.gradle.org/m2' } repositories.maven { url = 'https://gradle.onepiece.software:1443/releases' } + includeBuild("../../plugins/onepiece-j") } 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 new file mode 100644 index 00000000..41697cf8 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,9 @@ +pluginManagement { + repositories.maven("https://plugins.gradle.org/m2") + repositories.maven("https://gradle.onepiece.software:1443/releases") + + includeBuild("gradle/plugins") +} +plugins { + id("org.example.gradlebuild.settings") +}