From 281319fb21c50f33494d474dfac7d4322cf437f2 Mon Sep 17 00:00:00 2001 From: Sychic <47618543+Sychic@users.noreply.github.com> Date: Thu, 29 Feb 2024 08:01:04 -0500 Subject: [PATCH] New: unstable projects These are (successful) experiments, originally developed internally at Essential, of future Elementa features. While a feature is classified as an unstable project, no guarantees with respect to backwards compatibility are made. We will however attempt to avoid non-obvious behavioral changes and try to provide a gradual migration path where possible. Note: Due to these features not being backwards compatible, they are also not yet included in the main Elementa publication (which does guarantee indefinite backwards compatibility). Instead if you want to use one of these, you must depend on the respective unstable artifact, relocate it to a dedicated package within your mod and bundle this relocated version in your jar (that way your mod always gets the version it needs, and you can freely choose when to upgrade to a newer version). GitHub: #134 Co-authored-by: Jonas Herzig --- build.gradle.kts | 2 +- settings.gradle.kts | 2 ++ unstable/layoutdsl/build.gradle.kts | 39 +++++++++++++++++++++++++++++ unstable/statev2/build.gradle.kts | 38 ++++++++++++++++++++++++++++ 4 files changed, 80 insertions(+), 1 deletion(-) create mode 100644 unstable/layoutdsl/build.gradle.kts create mode 100644 unstable/statev2/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts index 0ee9179a..211df882 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -49,7 +49,7 @@ dependencies { } apiValidation { - ignoredProjects.add("platform") + ignoredProjects.addAll(listOf("platform", "statev2", "layoutdsl")) ignoredPackages.add("com.example") nonPublicMarkers.add("org.jetbrains.annotations.ApiStatus\$Internal") } diff --git a/settings.gradle.kts b/settings.gradle.kts index e9984556..ce43e72e 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -22,6 +22,8 @@ project(":platform").apply { projectDir = file("versions/") buildFileName = "root.gradle.kts" } +include(":unstable:statev2") +include(":unstable:layoutdsl") listOf( "1.8.9-forge", diff --git a/unstable/layoutdsl/build.gradle.kts b/unstable/layoutdsl/build.gradle.kts new file mode 100644 index 00000000..76435d66 --- /dev/null +++ b/unstable/layoutdsl/build.gradle.kts @@ -0,0 +1,39 @@ +import gg.essential.gradle.multiversion.StripReferencesTransform.Companion.registerStripReferencesAttribute +import gg.essential.gradle.util.setJvmDefault +import gg.essential.gradle.util.versionFromBuildIdAndBranch + +plugins { + kotlin("jvm") + id("gg.essential.defaults") + id("maven-publish") +} + +version = versionFromBuildIdAndBranch() +group = "gg.essential" + +dependencies { + compileOnly(project(":")) + api(project(":unstable:statev2")) + + val common = registerStripReferencesAttribute("common") { + excludes.add("net.minecraft") + } + compileOnly(libs.versions.universalcraft.map { "gg.essential:universalcraft-1.8.9-forge:$it" }) { + attributes { attribute(common, true) } + } +} +tasks.compileKotlin.setJvmDefault("all") + +kotlin.jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8)) +} + +publishing { + publications { + register("maven") { + from(components["java"]) + + artifactId = "elementa-unstable-${project.name}" + } + } +} \ No newline at end of file diff --git a/unstable/statev2/build.gradle.kts b/unstable/statev2/build.gradle.kts new file mode 100644 index 00000000..5967b7b5 --- /dev/null +++ b/unstable/statev2/build.gradle.kts @@ -0,0 +1,38 @@ +import gg.essential.gradle.multiversion.StripReferencesTransform.Companion.registerStripReferencesAttribute +import gg.essential.gradle.util.setJvmDefault +import gg.essential.gradle.util.versionFromBuildIdAndBranch + +plugins { + kotlin("jvm") + id("gg.essential.defaults") + id("maven-publish") +} + +version = versionFromBuildIdAndBranch() +group = "gg.essential" + +dependencies { + compileOnly(project(":")) + + val common = registerStripReferencesAttribute("common") { + excludes.add("net.minecraft") + } + compileOnly(libs.versions.universalcraft.map { "gg.essential:universalcraft-1.8.9-forge:$it" }) { + attributes { attribute(common, true) } + } +} +tasks.compileKotlin.setJvmDefault("all") + +kotlin.jvmToolchain { + (this as JavaToolchainSpec).languageVersion.set(JavaLanguageVersion.of(8)) +} + +publishing { + publications { + register("maven") { + from(components["java"]) + + artifactId = "elementa-unstable-${project.name}" + } + } +} \ No newline at end of file