diff --git a/.gitignore b/.gitignore index ddc444d2..cbe31989 100644 --- a/.gitignore +++ b/.gitignore @@ -25,6 +25,7 @@ hs_err_pid* # Ignore Gradle /.gradle/ +/build-logic/.gradle build/ local.properties diff --git a/build-logic/build.gradle.kts b/build-logic/build.gradle.kts new file mode 100644 index 00000000..f2399c5b --- /dev/null +++ b/build-logic/build.gradle.kts @@ -0,0 +1,14 @@ +// Copyright 2026 The Terasology Foundation +// SPDX-License-Identifier: Apache-2.0 + +plugins { + `kotlin-dsl` +} + +repositories { + gradlePluginPortal() +} + +dependencies { + implementation("ru.vyarus:gradle-animalsniffer-plugin:2.0.1") +} diff --git a/build-logic/settings.gradle.kts b/build-logic/settings.gradle.kts new file mode 100644 index 00000000..e69de29b diff --git a/gradle/common.gradle.kts b/build-logic/src/main/kotlin/gestalt-library-common.gradle.kts similarity index 85% rename from gradle/common.gradle.kts rename to build-logic/src/main/kotlin/gestalt-library-common.gradle.kts index c05f2047..f9516830 100644 --- a/gradle/common.gradle.kts +++ b/build-logic/src/main/kotlin/gestalt-library-common.gradle.kts @@ -1,9 +1,16 @@ -// Copyright 2021 The Terasology Foundation +// Copyright 2026 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 // Most typical common config, but not quite global -apply(plugin = "java-library") -apply(plugin = "maven-publish") +plugins { + `java-library` + `maven-publish` + id("ru.vyarus.animalsniffer") +} + +dependencies { + add("signature", "com.toasttab.android:gummy-bears-api-24:0.15.0:coreLib2@signature") +} extensions.configure { withSourcesJar() @@ -13,6 +20,11 @@ extensions.configure { targetCompatibility = JavaVersion.VERSION_17 } +extensions.configure { + // java.nio.* APIs can be desugared by D8. java.io.File.toPath() also needs to be excluded. + ignore = listOf("java.nio.file.*", "java.io.File") +} + // Extra details provided for unit tests tasks.withType { useJUnit() diff --git a/gestalt-android/build.gradle b/gestalt-android/build.gradle index fed1dff6..3dc0ffac 100644 --- a/gestalt-android/build.gradle +++ b/gestalt-android/build.gradle @@ -3,6 +3,7 @@ plugins { id("com.android.library") id("maven-publish") + id("ru.vyarus.animalsniffer") version "2.0.1" } android { @@ -30,7 +31,14 @@ android { lintOptions { lintConfig file("lintconfig.xml") } + lint { + // Somehow, AndroidAssetsFileSource.java breaks this lint. + disable "BidiSpoofing" + } +} +tasks.withType(AnimalSniffer) { + ignoreFailures = false } dependencies { @@ -46,6 +54,8 @@ dependencies { testImplementation(libs.junit) androidTestImplementation("androidx.test:runner:1.6.2") androidTestImplementation("androidx.test.espresso:espresso-core:3.6.1") + + signature("com.toasttab.android:gummy-bears-api-24:0.15.0:coreLib2@signature") } task androidJavadocs(type: Javadoc) { diff --git a/gestalt-asset-core/build.gradle.kts b/gestalt-asset-core/build.gradle.kts index a6ca2b68..54596899 100644 --- a/gestalt-asset-core/build.gradle.kts +++ b/gestalt-asset-core/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id ("gestalt-library-common") } // Primary dependencies definition diff --git a/gestalt-di/build.gradle.kts b/gestalt-di/build.gradle.kts index de17ea5c..a1e1adcf 100644 --- a/gestalt-di/build.gradle.kts +++ b/gestalt-di/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id("gestalt-library-common") } tasks.register("gatherJarModules") { diff --git a/gestalt-entity-system/build.gradle.kts b/gestalt-entity-system/build.gradle.kts index e01a7afc..dda3e582 100644 --- a/gestalt-entity-system/build.gradle.kts +++ b/gestalt-entity-system/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id("gestalt-library-common") } dependencies { diff --git a/gestalt-es-perf/build.gradle.kts b/gestalt-es-perf/build.gradle.kts index 92f5deb6..93b03dd1 100644 --- a/gestalt-es-perf/build.gradle.kts +++ b/gestalt-es-perf/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id("gestalt-library-common") } dependencies { @@ -29,7 +27,7 @@ description = "High performance access methods to replace the use of reflections */ // Register the gatherJarModules task -val gatherJarModules by tasks.registering(Copy::class) { +val gatherJarModules = tasks.register("gatherJarModules") { dependsOn(":testpack:moduleF:jar") from("../testpack/moduleF/build/libs/") into("test-modules") @@ -37,7 +35,7 @@ val gatherJarModules by tasks.registering(Copy::class) { } // Register the gatherModules task -val gatherModules by tasks.registering { +val gatherModules = tasks.register("gatherModules") { dependsOn(":gestalt-es-perf:gatherJarModules") } @@ -45,3 +43,8 @@ val gatherModules by tasks.registering { tasks.named("test") { dependsOn(gatherModules) } + +tasks.withType { + // The gestalt-es-perf library is not intended for use on Android. + exclude("**/*") +} diff --git a/gestalt-inject-java/build.gradle.kts b/gestalt-inject-java/build.gradle.kts index 03cc19f5..1735af66 100644 --- a/gestalt-inject-java/build.gradle.kts +++ b/gestalt-inject-java/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id("gestalt-library-common") } dependencies { @@ -29,3 +27,8 @@ dependencies { tasks.withType().configureEach { failOnNoDiscoveredTests = false } + +tasks.withType { + // The gestalt-inject-java annotation processor is only used at compile-time and not intended for use on Android. + exclude("**/*") +} \ No newline at end of file diff --git a/gestalt-inject/build.gradle.kts b/gestalt-inject/build.gradle.kts index 224d605e..c38c37d9 100644 --- a/gestalt-inject/build.gradle.kts +++ b/gestalt-inject/build.gradle.kts @@ -1,9 +1,7 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") - plugins { - `java-library` + id("gestalt-library-common") } dependencies { diff --git a/gestalt-module/build.gradle.kts b/gestalt-module/build.gradle.kts index 8e7d40bd..af14eba4 100644 --- a/gestalt-module/build.gradle.kts +++ b/gestalt-module/build.gradle.kts @@ -1,9 +1,8 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") plugins { - `java-library` + id ("gestalt-library-common") } dependencies { diff --git a/gestalt-util/build.gradle.kts b/gestalt-util/build.gradle.kts index b40092b3..084cb32b 100644 --- a/gestalt-util/build.gradle.kts +++ b/gestalt-util/build.gradle.kts @@ -1,9 +1,8 @@ // Copyright 2021 The Terasology Foundation // SPDX-License-Identifier: Apache-2.0 -apply(from = "$rootDir/gradle/common.gradle.kts") plugins { - `java-library` + id("gestalt-library-common") } // Primary dependencies definition diff --git a/settings.gradle.kts b/settings.gradle.kts index 646b0fe3..334557b2 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -16,6 +16,10 @@ dependencyResolutionManagement { } } +pluginManagement { + includeBuild("build-logic") +} + include( "gestalt-util", "gestalt-di",