diff --git a/buildSrc/src/main/groovy/com.viaversion.java-conventions.gradle b/buildSrc/src/main/groovy/com.viaversion.java-conventions.gradle index 25f4c00a4..ea07f856f 100644 --- a/buildSrc/src/main/groovy/com.viaversion.java-conventions.gradle +++ b/buildSrc/src/main/groovy/com.viaversion.java-conventions.gradle @@ -6,31 +6,31 @@ plugins { repositories { mavenLocal() maven { - url = uri('https://repo.viaversion.com') + url = uri("https://repo.viaversion.com") } maven { - url = uri('https://repo.maven.apache.org/maven2/') + url = uri("https://repo.maven.apache.org/maven2/") } maven { - url = uri('https://hub.spigotmc.org/nexus/content/repositories/snapshots/') + url = uri("https://hub.spigotmc.org/nexus/content/repositories/snapshots/") } maven { - url = uri('https://oss.sonatype.org/content/repositories/snapshots') + url = uri("https://oss.sonatype.org/content/repositories/snapshots") } maven { - url = uri('https://maven.fabricmc.net/') + url = uri("https://maven.fabricmc.net/") } maven { - url = uri('https://repo.spongepowered.org/repository/maven-public/') + url = uri("https://repo.spongepowered.org/repository/maven-public/") } maven { - url = uri('https://nexus.velocitypowered.com/repository/maven-public/') + url = uri("https://nexus.velocitypowered.com/repository/maven-public/") } } @@ -46,6 +46,19 @@ version = project.maven_version java.sourceCompatibility = JavaVersion.VERSION_1_8 +tasks { + // Variable replacements + processResources { + inputs.property "version", project.version + + for (final def file in ["plugin.yml", "bungee.yml", "META-INF/sponge_plugins.json", "fabric.mod.json"]) { + filesMatching(file) { + expand "version": version + } + } + } +} + publishing { repositories { maven { diff --git a/bukkit/src/main/resources/plugin.yml b/bukkit/src/main/resources/plugin.yml index ead3e3a34..8a32d391d 100644 --- a/bukkit/src/main/resources/plugin.yml +++ b/bukkit/src/main/resources/plugin.yml @@ -1,5 +1,5 @@ name: ViaRewind -version: ${project.version} +version: ${version} main: com.viaversion.viarewind.BukkitPlugin api-version: 1.13 folia-supported: true diff --git a/bungee/src/main/resources/bungee.yml b/bungee/src/main/resources/bungee.yml index 008176702..96414e286 100644 --- a/bungee/src/main/resources/bungee.yml +++ b/bungee/src/main/resources/bungee.yml @@ -1,7 +1,7 @@ name: ViaRewind main: com.viaversion.viarewind.BungeePlugin authors: [Gerrygames, FlorianMichael/EnZaXD, creeper123321123] -version: ${project.version} +version: ${version} depends: [ViaVersion] softdepends: [ViaBackwards] website: https://viaversion.com/rewind diff --git a/common/build.gradle b/common/build.gradle index ee00ac392..9de966e46 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -3,15 +3,19 @@ plugins { } plugins { - id "net.kyori.blossom" version "1.3.1" + id "net.raphimc.class-token-replacer" version "1.0.0" } dependencies { } -blossom { - replaceToken("\$VERSION", project.version, "src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java") - replaceToken("\$IMPL_VERSION", "git-ViaRewind-${project.version}:${latestCommitHash()}", "src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java") +sourceSets { + main { + classTokenReplacer { + property("\${version}", rootProject.maven_version) + property("\${impl_version}", "git-${project.name}-${rootProject.maven_version}:${project.latestCommitHash()}") + } + } } String latestCommitHash() { diff --git a/common/src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java b/common/src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java index 13aeca5c9..80f5fde35 100644 --- a/common/src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java +++ b/common/src/main/java/com/viaversion/viarewind/api/ViaRewindPlatform.java @@ -33,8 +33,8 @@ */ public interface ViaRewindPlatform { - String VERSION = "$VERSION"; - String IMPL_VERSION = "$IMPL_VERSION"; + String VERSION = "${version}"; + String IMPL_VERSION = "${impl_version}"; /** * Initialize ViaRewind diff --git a/fabric/src/main/resources/fabric.mod.json b/fabric/src/main/resources/fabric.mod.json index b1b381e54..fc88e1758 100644 --- a/fabric/src/main/resources/fabric.mod.json +++ b/fabric/src/main/resources/fabric.mod.json @@ -2,7 +2,7 @@ "schemaVersion": 1, "id": "viarewind", "name": "ViaRewind", - "version": "${project.version}", + "version": "${version}", "license": "GPL-3.0", "contact": { "homepage": "https://viaversion.com/rewind", diff --git a/sponge/src/main/resources/META-INF/sponge_plugins.json b/sponge/src/main/resources/META-INF/sponge_plugins.json index dd9860324..d09655dd9 100644 --- a/sponge/src/main/resources/META-INF/sponge_plugins.json +++ b/sponge/src/main/resources/META-INF/sponge_plugins.json @@ -5,7 +5,7 @@ }, "license": "GNU GPLv3", "global": { - "version": "${project.version}", + "version": "${version}", "links": { "homepage": "https://viaversion.com/rewind", "source": "https://github.com/ViaVersion/ViaRewind",