diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 0000000..2da8380 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,42 @@ +val versionMain: String = System.getenv("VERSION") ?: "0.0.0" + +plugins { + id("java-platform") + id("maven-publish") +} + +javaPlatform.allowDependencies() + +base { + group = "dev.compactmods.compactmachines" + version = versionMain +} + +afterEvaluate { + println(rootProject.name) + rootProject.childProjects.forEach { + println(it.key) + } +} + +var deps: List = listOf( + project(":core-api"), + project(":room-api"), + project(":room-upgrade-api") +) + +dependencies { + deps.forEach { + api(it) + runtime(it) + } +} + +publishing { + publications { + create("platform") { + artifactId = "platform" + from(components["javaPlatform"]) + } + } +} \ No newline at end of file diff --git a/common-compat/build.gradle.kts b/common-compat/build.gradle.kts deleted file mode 100644 index 7eaf581..0000000 --- a/common-compat/build.gradle.kts +++ /dev/null @@ -1,109 +0,0 @@ -import java.text.SimpleDateFormat -import java.util.* -import net.fabricmc.loom.task.RemapJarTask -import net.fabricmc.loom.task.RemapSourcesJarTask - -val versionMain: String = System.getenv("CM_VERSION") ?: "0.0.0" -val mcVersion = property("minecraft_version") as String -// val parchmentVersion = property("parchment_version") as String - -val targets: List = (rootProject.property("enabled_platforms") as String).split(",") - -plugins { - java - id("maven-publish") - id("architectury-plugin") version "3.4-SNAPSHOT" - id("dev.architectury.loom") version "1.1-SNAPSHOT" -} - -architectury { - this.minecraft = mcVersion - common(targets) -} - -loom { - setGenerateSrgTiny(true) -} - -sourceSets { - named("main") { - resources { - //The API has no resources - setSrcDirs(emptyList()) - } - } - - named("test") { - resources { - //The test module has no resources - setSrcDirs(emptyList()) - } - } -} - -base { - group = "dev.compactmods.compactmachines" - version = versionMain -} - -java { - toolchain.languageVersion.set(JavaLanguageVersion.of(17)) - withJavadocJar() - withSourcesJar() -} - -repositories { - maven("https://maven.parchmentmc.org") { - name = "ParchmentMC" - } -} - -val loom = project.extensions.getByName("loom") -dependencies { - this.add("minecraft", "com.mojang:minecraft:${mcVersion}") - - // The following line declares the mojmap mappings, you may use other mappings as well - this.add("mappings", loom.layered { - officialMojangMappings() - // parchment("org.parchmentmc.data:parchment-${mcVersion}:${parchmentVersion}@zip") - }) -} - -tasks.withType { - manifest { - val now = SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssZ").format(Date()) - attributes(mapOf( - "Specification-Title" to "Compact Machines - Compat", - "Specification-Version" to "1", // We are version 1 of ourselves - "Implementation-Title" to "Compact Machines - Compat", - "Implementation-Timestamp" to now, - "FMLModType" to "GAMELIBRARY" - )) - } -} - -tasks.withType { - options.encoding = "UTF-8" - options.compilerArgs.add("-proc:none") -} - -val PACKAGES_URL = System.getenv("GH_PKG_URL") ?: "https://maven.pkg.github.com/compactmods/compactmachines-core" -publishing { - publications.register("compat") { - artifactId = "core-compat" - groupId = "dev.compactmods.compactmachines" - - from(components.getByName("java")) - } - - repositories { - // GitHub Packages - maven(PACKAGES_URL) { - name = "GitHubPackages" - credentials { - username = System.getenv("GITHUB_ACTOR") - password = System.getenv("GITHUB_TOKEN") - } - } - } -} \ No newline at end of file diff --git a/core-api/build.gradle.kts b/core-api/build.gradle.kts index 955ca63..c295735 100644 --- a/core-api/build.gradle.kts +++ b/core-api/build.gradle.kts @@ -3,8 +3,6 @@ import java.text.SimpleDateFormat import java.util.* val versionMain: String = System.getenv("VERSION") ?: "0.0.0" -val mcVersion = property("minecraft_version") as String -// val parchmentVersion = property("parchment_version") as String plugins { java @@ -13,7 +11,7 @@ plugins { } minecraft { - version(mcVersion) + version(libraries.versions.minecraft.get()) } sourceSets { diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 120371d..8c7ba36 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -3,9 +3,6 @@ import java.text.SimpleDateFormat import java.util.* val versionMain: String = System.getenv("VERSION") ?: "0.0.0" -val mcVersion = property("minecraft_version") as String -// val parchmentVersion = property("parchment_version") as String -val feather_version = property("feather_version") as String plugins { java @@ -14,7 +11,7 @@ plugins { } minecraft { - version(mcVersion) + version(libraries.versions.minecraft.get()) } sourceSets { @@ -64,19 +61,21 @@ repositories { } val cmModules = listOf( - project(":core-api"), - project(":room-api"), - project(":room-upgrade-api") + findProject(":core-api"), + findProject(":room-api"), + findProject(":room-upgrade-api") ) dependencies { cmModules.forEach { - implementation(it) - testImplementation(it) + if(it != null) { + implementation(it) + testImplementation(it) + } } - compileOnly("com.aventrix.jnanoid", "jnanoid", "2.0.0") - implementation("dev.compactmods", "feather", feather_version) + compileOnly(libraries.feather) + implementation(libraries.jnanoid) } tasks.withType { diff --git a/gradle.properties b/gradle.properties index 4dd9f3a..479ea4c 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,7 +3,4 @@ org.gradle.jvmargs=-Xmx3G org.gradle.daemon=false -minecraft_version=1.20.4 -feather_version=0.1.6 - mod_id=compactmachines \ No newline at end of file diff --git a/room-api/build.gradle.kts b/room-api/build.gradle.kts index 0762d68..a4ac3b6 100644 --- a/room-api/build.gradle.kts +++ b/room-api/build.gradle.kts @@ -3,8 +3,6 @@ import java.text.SimpleDateFormat import java.util.* val versionMain: String = System.getenv("VERSION") ?: "0.0.0" -val mcVersion = property("minecraft_version") as String -// val parchmentVersion = property("parchment_version") as String plugins { java @@ -13,7 +11,7 @@ plugins { } minecraft { - version(mcVersion) + version(libraries.versions.minecraft.get()) } base { diff --git a/room-upgrade-api/build.gradle.kts b/room-upgrade-api/build.gradle.kts index 1cfd741..3f89f53 100644 --- a/room-upgrade-api/build.gradle.kts +++ b/room-upgrade-api/build.gradle.kts @@ -3,8 +3,6 @@ import java.text.SimpleDateFormat import java.util.* val versionMain: String = System.getenv("VERSION") ?: "0.0.0" -val mcVersion = property("minecraft_version") as String -// val parchmentVersion = property("parchment_version") as String plugins { java @@ -13,7 +11,7 @@ plugins { } minecraft { - version(mcVersion) + version(libraries.versions.minecraft.get()) } base { diff --git a/settings.gradle.kts b/settings.gradle.kts index 6da23f1..a61d871 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1,3 +1,12 @@ +dependencyResolutionManagement { + versionCatalogs.create("libraries") { + library("feather", "dev.compactmods:feather:0.1.6") + library("jnanoid", "com.aventrix.jnanoid:jnanoid:2.0.0") + + version("minecraft", "1.20.4") + } +} + pluginManagement { repositories { mavenCentral() @@ -25,10 +34,10 @@ plugins { id("org.gradle.toolchains.foojay-resolver-convention") version("0.5.0") } -rootProject.name = "Compact Machines Core" - -include("core-api") include("core") -// include("common-compat") +include("core-api") include("room-api") include("room-upgrade-api") + +include("platform") +