diff --git a/build.gradle b/build.gradle index b64efbb..c89a3a7 100644 --- a/build.gradle +++ b/build.gradle @@ -12,80 +12,10 @@ multiLoader.root() { minecraftVersion.set(project.property("minecraft_version")) modID.set(project.property("mod_id")) splitSources.set(true) -} - -allprojects { - def isSnapshot = providers.environmentVariable("SNAPSHOT").map {it == "true"}.getOrElse(false) - version = "${mod_version}+mc${minecraft_version}${isSnapshot ? '-SNAPSHOT' : ''}" - setArchivesBaseName("${mod_name}-${project.name}".toLowerCase()) - group = "com.unrealdinnerbone" - - -} - -subprojects { - - - apply plugin: 'java-library' - apply plugin: 'maven-publish' - apply plugin: 'dev.nanite.mlp' - - - sourceSets.main.resources.srcDir project.file('src/generated/resources') - - java.toolchain.languageVersion = JavaLanguageVersion.of(21) - - - base { - archivesName = "${project.property("mod_name")}-${project.name}".toLowerCase() - } - repositories { - maven { - name = "NeoForge" - url = "https://maven.neoforged.net/" - } - maven { - name = "Fabric" - url = "https://maven.fabricmc.net/" - } - maven { - name = "Nanite" - url = "https://maven.nanite.dev/releases" - } - } - tasks.withType(ProcessResources).configureEach { - outputs.upToDateWhen { false } - } - - test { - enabled = false - } - - publishing { - repositories { - if (providers.environmentVariable("NANITE_TOKEN").isPresent()) { - maven { - def isSnapshot = providers.environmentVariable("SNAPSHOT").map {it == "true"}.getOrElse(false) - url "https://maven.nanite.dev/${isSnapshot ? 'snapshots' : 'releases'}" - credentials { - username = "nanite" - password = providers.environmentVariable("NANITE_TOKEN").get() - } - } - } - } - publications { - register("mavenJava", MavenPublication) { - groupId project.group - artifactId project.getArchivesBaseName() - } - } - } - + group.set(project.property("maven_group")) } - publishMods { dryRun = providers.environmentVariable("CURSE_TOKEN").getOrNull() == null changelog = file("./CHANGELOG.md").text @@ -98,6 +28,7 @@ publishMods { modLoaders.add("fabric") } + def neoOptions = publishOptions { file = project.provider { project(":neo").tasks.jar }.flatMap { it.archiveFile } displayName = "${project.name} Neo ${mod_version}+mc${minecraft_version}" @@ -109,9 +40,6 @@ publishMods { accessToken = providers.environmentVariable("CURSE_TOKEN") projectId = "${curse_id}" minecraftVersions.add("${minecraft_version}") - requires { - slug = "trenzalore" - } } curseforge("curseforgeFabric") { @@ -124,9 +52,4 @@ publishMods { curseforge("curseforgeNeoForge") { from(curseForgeOptions, neoOptions) } - -} - - - - +} \ No newline at end of file diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle new file mode 100644 index 0000000..1957c33 --- /dev/null +++ b/buildSrc/build.gradle @@ -0,0 +1,3 @@ +plugins { + id 'groovy-gradle-plugin' +} \ No newline at end of file diff --git a/buildSrc/src/main/groovy/multiloader.gradle b/buildSrc/src/main/groovy/multiloader.gradle new file mode 100644 index 0000000..105f312 --- /dev/null +++ b/buildSrc/src/main/groovy/multiloader.gradle @@ -0,0 +1,73 @@ +plugins { + id 'java-library' + id 'maven-publish' + id 'dev.nanite.mlp' +} + +java.toolchain.languageVersion = JavaLanguageVersion.of(21) + +def isASnapshot = providers.environmentVariable("SNAPSHOT").map {it == "true"}.getOrElse(false) +version = "${mod_version}+mc${minecraft_version}${isASnapshot ? '-SNAPSHOT' : ''}" +setArchivesBaseName("${mod_name}-${project.name}".toLowerCase()) +group = "${maven_group}" + +idea { + module { + downloadSources = true + downloadJavadoc = true + } +} + +base { + archivesName = "${project.property("mod_name")}-${project.name}".toLowerCase() +} + +repositories { + repositories { + maven { + name = "NeoForge" + url = "https://maven.neoforged.net/" + } + maven { + name = "Fabric" + url = "https://maven.fabricmc.net/" + } + maven { + name = "Nanite" + url = "https://maven.nanite.dev/releases" + } + maven { + name = "Curse Maven" + url = "https://cursemaven.com" + } + } +} + +tasks.withType(ProcessResources).configureEach { + outputs.upToDateWhen { false } +} + +test { + enabled = false +} + +publishing { + repositories { + if (providers.environmentVariable("NANITE_TOKEN").isPresent()) { + maven { + def isSnapshot = providers.environmentVariable("SNAPSHOT").map {it == "true"}.getOrElse(false) + url "https://maven.nanite.dev/${isSnapshot ? 'snapshots' : 'releases'}" + credentials { + username = "nanite" + password = providers.environmentVariable("NANITE_TOKEN").get() + } + } + } + } + publications { + register("mavenJava", MavenPublication) { + groupId project.group + artifactId project.getArchivesBaseName() + } + } +} \ No newline at end of file diff --git a/common/build.gradle b/common/build.gradle index 062535d..939f48e 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -1,3 +1,7 @@ +plugins { + id 'multiloader' +} + multiLoader.common() publishing.publications.mavenJava.from components.java diff --git a/fabric/build.gradle b/fabric/build.gradle index 3a3b3a0..c8b8ab1 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -1,15 +1,15 @@ +plugins { + id 'multiloader' +} + multiLoader.fabric() { fabricLoaderVersion.set("${fabric_loader_version}") fabricApiVersion.set("${fabric_version}") } +publishing.publications.mavenJava.from components.java + dependencies { modImplementation("com.unrealdinnerbone:trenzalore-fabric:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}") } - -publishing.publications.mavenJava.from components.java - -remapJar { - setArchivesBaseName("${project.property("mod_name")}-${project.name}".toLowerCase()) -} \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 8b0cf63..fa136d1 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,5 +1,5 @@ # Project -mod_version=6.0.0 +mod_version=7.0.0 maven_group=com.unrealdinnerbone curse_id=517002 mod_name=IBICF @@ -8,18 +8,18 @@ mod_id=ibicf # Common -minecraft_version=1.21 +minecraft_version=1.21.1 # Forge #forge_version=49.0.13 -neo_version=21.0.0-beta +neo_version=21.1.50 -fabric_version=0.100.1+1.21 -fabric_loader_version=0.15.11 +fabric_version=0.104.0+1.21.1 +fabric_loader_version=0.16.5 # Other -trenzalore_version=6.0.0 +trenzalore_version=6.1.1 # Gradle org.gradle.jvmargs=-Xmx3G diff --git a/neo/build.gradle b/neo/build.gradle index 90e7c97..b17f2a2 100644 --- a/neo/build.gradle +++ b/neo/build.gradle @@ -1,22 +1,16 @@ +plugins { + id 'multiloader' +} + multiLoader.neo() { neoVersion.set("${neo_version}") } -java.sourceSets { - main { - java { - srcDirs = ["src/main/java", project(":common").file("src/client/java")] - } - resources { - srcDirs = ["src/main/resources", project(":common").file("src/client/resources")] - } - } -} +publishing.publications.mavenJava.from components.java +sourceSets.main.resources { srcDir project(":common").file('src/generated/resources') } dependencies { implementation("com.unrealdinnerbone:trenzalore-neo:${project.property("trenzalore_version")}+mc${project.property("minecraft_version")}") } -publishing.publications.mavenJava.from components.java - diff --git a/settings.gradle b/settings.gradle index b534184..82c6945 100644 --- a/settings.gradle +++ b/settings.gradle @@ -15,7 +15,7 @@ pluginManagement { plugins { id "org.jetbrains.gradle.plugin.idea-ext" version "1.1.7" apply(false) - id 'org.gradle.toolchains.foojay-resolver-convention' version '0.5.0' + id 'org.gradle.toolchains.foojay-resolver-convention' version '0.8.0' } }