diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 175133a9..865b5092 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("publishing-conventions") + id("squaremap.publishing") } description = "API for extending squaremap, a minimalistic and lightweight world map viewer for Minecraft servers" diff --git a/build-logic/src/main/kotlin/CopyFile.kt b/build-logic/src/main/kotlin/CopyFile.kt index ee15e517..c1a3d0d2 100644 --- a/build-logic/src/main/kotlin/CopyFile.kt +++ b/build-logic/src/main/kotlin/CopyFile.kt @@ -3,7 +3,9 @@ import org.gradle.api.file.RegularFileProperty import org.gradle.api.tasks.InputFile import org.gradle.api.tasks.OutputFile import org.gradle.api.tasks.TaskAction +import org.gradle.work.DisableCachingByDefault +@DisableCachingByDefault(because = "Not worth caching") abstract class CopyFile : DefaultTask() { @get:InputFile abstract val fileToCopy: RegularFileProperty diff --git a/build-logic/src/main/kotlin/SquaremapPlatformExtension.kt b/build-logic/src/main/kotlin/SquaremapPlatformExtension.kt index e6343d80..879a623a 100644 --- a/build-logic/src/main/kotlin/SquaremapPlatformExtension.kt +++ b/build-logic/src/main/kotlin/SquaremapPlatformExtension.kt @@ -1,10 +1,14 @@ import org.gradle.api.file.RegularFileProperty +import org.gradle.api.model.ObjectFactory import org.gradle.api.provider.Property +import org.gradle.kotlin.dsl.newInstance +import javax.inject.Inject -abstract class SquaremapPlatformExtension { +abstract class SquaremapPlatformExtension @Inject constructor(objects: ObjectFactory) { abstract val productionJar: RegularFileProperty + val loom: Loom = objects.newInstance(Loom::class) - abstract class Loom : SquaremapPlatformExtension() { + abstract class Loom { abstract val modInfoFilePath: Property } } diff --git a/build-logic/src/main/kotlin/base-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts similarity index 89% rename from build-logic/src/main/kotlin/base-conventions.gradle.kts rename to build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts index 1c4ef797..7796af39 100644 --- a/build-logic/src/main/kotlin/base-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/squaremap.base-conventions.gradle.kts @@ -28,9 +28,6 @@ repositories { sonatype.s01Snapshots() sonatype.ossSnapshots() maven("https://repo.papermc.io/repository/maven-public/") - maven("https://maven.fabricmc.net/") { - mavenContent { includeGroup("net.fabricmc") } - } } tasks.withType(JavaCompile::class).configureEach { diff --git a/build-logic/src/main/kotlin/parent-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.parent.gradle.kts similarity index 100% rename from build-logic/src/main/kotlin/parent-conventions.gradle.kts rename to build-logic/src/main/kotlin/squaremap.parent.gradle.kts diff --git a/build-logic/src/main/kotlin/platform-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.platform.gradle.kts similarity index 88% rename from build-logic/src/main/kotlin/platform-conventions.gradle.kts rename to build-logic/src/main/kotlin/squaremap.platform.gradle.kts index 7815adb3..18233b79 100644 --- a/build-logic/src/main/kotlin/platform-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/squaremap.platform.gradle.kts @@ -1,16 +1,12 @@ import me.modmuss50.mpp.ReleaseType plugins { - id("base-conventions") + id("squaremap.base-conventions") id("com.github.johnrengelman.shadow") id("me.modmuss50.mod-publish-plugin") } -val platformExt = extensions.create( - SquaremapPlatformExtension::class, - "squaremapPlatform", - SquaremapPlatformExtension.Loom::class -) +val platformExt = extensions.create("squaremapPlatform", SquaremapPlatformExtension::class) decorateVersion() diff --git a/build-logic/src/main/kotlin/loom-platform-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.platform.loom.gradle.kts similarity index 55% rename from build-logic/src/main/kotlin/loom-platform-conventions.gradle.kts rename to build-logic/src/main/kotlin/squaremap.platform.loom.gradle.kts index 9b192f12..b5b9c901 100644 --- a/build-logic/src/main/kotlin/loom-platform-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/squaremap.platform.loom.gradle.kts @@ -1,32 +1,30 @@ plugins { - id("platform-conventions") + id("squaremap.platform") id("xyz.jpenilla.quiet-architectury-loom") } -extensions.add( - SquaremapPlatformExtension.Loom::class.java, - "squaremapLoomPlatform", - extensions.getByType() as SquaremapPlatformExtension.Loom -) -val loomExt = extensions.getByType() -loomExt.productionJar = tasks.remapJar.flatMap { it.archiveFile } +val platformExt = extensions.getByType() +platformExt.productionJar = tasks.remapJar.flatMap { it.archiveFile } -val squaremap: Configuration by configurations.creating +val shade: Configuration by configurations.creating configurations.implementation { - extendsFrom(squaremap) + extendsFrom(shade) +} +val shadeFiltered: Configuration by configurations.creating { + extendsFrom(shade) + + exclude("org.checkerframework") + exclude("com.google.errorprone") } tasks { shadowJar { - configurations = listOf(squaremap) + configurations = listOf(shadeFiltered) listOf( "javax.inject", "com.google.inject", "org.aopalliance", ).forEach(::reloc) - dependencies { - exclude { it.moduleGroup == "org.checkerframework" || it.moduleGroup == "com.google.errorprone" } - } } } @@ -38,7 +36,7 @@ afterEvaluate { "description" to project.description, ) inputs.properties(props) - filesMatching(loomExt.modInfoFilePath.get()) { + filesMatching(platformExt.loom.modInfoFilePath.get()) { // filter manually to avoid trying to replace $Initializer in initializer class name... filter { string -> var result = string diff --git a/build-logic/src/main/kotlin/publishing-conventions.gradle.kts b/build-logic/src/main/kotlin/squaremap.publishing.gradle.kts similarity index 92% rename from build-logic/src/main/kotlin/publishing-conventions.gradle.kts rename to build-logic/src/main/kotlin/squaremap.publishing.gradle.kts index f1c60f66..81b83437 100644 --- a/build-logic/src/main/kotlin/publishing-conventions.gradle.kts +++ b/build-logic/src/main/kotlin/squaremap.publishing.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("base-conventions") + id("squaremap.base-conventions") id("net.kyori.indra.publishing") } diff --git a/build.gradle.kts b/build.gradle.kts index 533f5157..4a867259 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,3 @@ plugins { - id("parent-conventions") + id("squaremap.parent") } - -group = "xyz.jpenilla" -version = "1.2.3-SNAPSHOT" -description = "Minimalistic and lightweight world map viewer for Minecraft servers" diff --git a/common/build.gradle.kts b/common/build.gradle.kts index dc7ced04..be12227e 100644 --- a/common/build.gradle.kts +++ b/common/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("base-conventions") + id("squaremap.base-conventions") id("org.spongepowered.gradle.vanilla") } diff --git a/fabric/build.gradle.kts b/fabric/build.gradle.kts index 48ca853d..4283e4e9 100644 --- a/fabric/build.gradle.kts +++ b/fabric/build.gradle.kts @@ -1,8 +1,8 @@ plugins { - id("loom-platform-conventions") + id("squaremap.platform.loom") } -loom.accessWidenerPath.set(layout.projectDirectory.file("src/main/resources/squaremap-fabric.accesswidener")) +loom.accessWidenerPath = layout.projectDirectory.file("src/main/resources/squaremap-fabric.accesswidener") repositories { maven("https://maven.ladysnake.org/releases/") { @@ -18,7 +18,7 @@ dependencies { modImplementation(libs.fabricLoader) modImplementation(libs.fabricApi) - squaremap(projects.squaremapCommon) { + shade(projects.squaremapCommon) { exclude("cloud.commandframework", "cloud-core") exclude("cloud.commandframework", "cloud-minecraft-extras") exclude("io.leangen.geantyref") @@ -41,7 +41,7 @@ dependencies { include(libs.cardinalComponentsEntity) } -squaremapLoomPlatform.modInfoFilePath = "fabric.mod.json" +squaremapPlatform.loom.modInfoFilePath = "fabric.mod.json" tasks.remapJar { archiveFileName = productionJarName(libs.versions.minecraft) diff --git a/gradle.properties b/gradle.properties index 6cebc8a7..036e5b15 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,3 +1,7 @@ +group=xyz.jpenilla +version=1.2.3-SNAPSHOT +description=Minimalistic and lightweight world map viewer for Minecraft servers + githubUrl=https://github.com/jpenilla/squaremap/ org.gradle.parallel=true diff --git a/neoforge/build.gradle.kts b/neoforge/build.gradle.kts index 6d70ac68..8473f659 100644 --- a/neoforge/build.gradle.kts +++ b/neoforge/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("loom-platform-conventions") + id("squaremap.platform.loom") } repositories { @@ -11,7 +11,7 @@ dependencies { mappings(loom.officialMojangMappings()) neoForge(libs.neoforge) - squaremap(projects.squaremapCommon) { + shade(projects.squaremapCommon) { exclude("cloud.commandframework", "cloud-core") exclude("cloud.commandframework", "cloud-minecraft-extras") exclude("io.leangen.geantyref") @@ -43,7 +43,7 @@ tasks.remapJar { archiveFileName = productionJarName(libs.versions.minecraft) } -squaremapLoomPlatform.modInfoFilePath = "META-INF/mods.toml" +squaremapPlatform.loom.modInfoFilePath = "META-INF/mods.toml" publishMods.modrinth { minecraftVersions.add(libs.versions.minecraft) diff --git a/paper/build.gradle.kts b/paper/build.gradle.kts index b5e5be76..1b2f21ea 100644 --- a/paper/build.gradle.kts +++ b/paper/build.gradle.kts @@ -1,7 +1,7 @@ import io.papermc.hangarpublishplugin.model.Platforms plugins { - id("platform-conventions") + id("squaremap.platform") id("io.papermc.paperweight.userdev") alias(libs.plugins.run.paper) alias(libs.plugins.hangar.publish) @@ -51,7 +51,7 @@ tasks { "version" to project.version, "website" to providers.gradleProperty("githubUrl").get(), "description" to project.description, - "apiVersion" to "'" + minecraftVersion.get().take(4) + "'", + "apiVersion" to minecraftVersion.get().take(4), ) inputs.properties(props) filesMatching("plugin.yml") { diff --git a/paper/src/main/resources/plugin.yml b/paper/src/main/resources/plugin.yml index 4f69c721..13cee969 100644 --- a/paper/src/main/resources/plugin.yml +++ b/paper/src/main/resources/plugin.yml @@ -6,5 +6,5 @@ description: $description authors: - jmp website: $website -api-version: $apiVersion +api-version: '$apiVersion' folia-supported: true diff --git a/sponge/build.gradle.kts b/sponge/build.gradle.kts index 734e02b2..da32f6ea 100644 --- a/sponge/build.gradle.kts +++ b/sponge/build.gradle.kts @@ -2,7 +2,7 @@ import org.spongepowered.gradle.plugin.config.PluginLoaders import org.spongepowered.plugin.metadata.model.PluginDependency plugins { - id("platform-conventions") + id("squaremap.platform") alias(libs.plugins.sponge.gradle.plugin) id("org.spongepowered.gradle.vanilla") alias(libs.plugins.sponge.gradle.ore)