From f1c1f2f39a2e9576f42a3df4498fa40abef04b8b Mon Sep 17 00:00:00 2001 From: xfl03 Date: Sun, 20 Nov 2016 12:49:08 +0800 Subject: [PATCH] BuildInfo Test --- 1.7.10-mcp908/build.gradle | 20 ++++++++++++-------- Common/BuildInfo.json | 10 ++++++++++ common.gradle | 19 +++++++++++-------- 3 files changed, 33 insertions(+), 16 deletions(-) create mode 100644 Common/BuildInfo.json diff --git a/1.7.10-mcp908/build.gradle b/1.7.10-mcp908/build.gradle index 08dc556..3ca7fcf 100644 --- a/1.7.10-mcp908/build.gradle +++ b/1.7.10-mcp908/build.gradle @@ -48,14 +48,6 @@ minecraft { replace '@MOD_VERSION@', rootConfig.version replace '@MOD_FULL_VERSION@', project.version replaceIn 'CustomSkinLoader.java' - - /* - replace '@MC_VERSION@', config.minecraft_version - replace '@MC_FULL_VERSIONS@', config.minecraft_full_versions - replace '@FORGE_VERSION@', config.forge_version - replace '@GIT_VERSION@', System.getenv("GIT_VERSION") - replace '@BUILD_URL@', System.getenv("BUILD_URL") - replaceIn 'BuildInfo.json'*/ } jar { @@ -80,6 +72,17 @@ task copySource << { } sourceMainJava.dependsOn copySource +processResources { + expand ([ + modVersion:rootProject.ext.config.version, + modFullVersion:config.minecraft_full_versions, + mcVersion:config.minecraft_version, + mcFullVersions:config.minecraft_full_versions, + forgeVersion:config.forge_version, + gitVersion:System.getenv("GIT_VERSION"), + buildUrl:System.getenv("BUILD_URL") + ]) +} task copyResources << { def outputFile = file("src/main/resources") outputFile.deleteDir() @@ -91,6 +94,7 @@ task copyResources << { } processResources.dependsOn copyResources + task afterBuild << { //renameSrgJar def file0 = file("build/libs/${archivesBaseName}-${version}.jar") diff --git a/Common/BuildInfo.json b/Common/BuildInfo.json new file mode 100644 index 0000000..2dd951c --- /dev/null +++ b/Common/BuildInfo.json @@ -0,0 +1,10 @@ +{ + "name": "CustomSkinLoader", + "version": "${modVersion}", + "fullVersion": "${modFullVersion}", + "mcVersion": "${mcVersion}", + "mcFullVersions": "${mcFullVersions}", + "forgeVersion": "${forgeVersion}", + "gitVersion": "${gitVersion}", + "buildUrl": "${buildUrl}" +} \ No newline at end of file diff --git a/common.gradle b/common.gradle index f06d328..2ed5ce5 100644 --- a/common.gradle +++ b/common.gradle @@ -42,14 +42,6 @@ minecraft { replace '@MOD_VERSION@', rootProject.ext.config.version replace '@MOD_FULL_VERSION@', project.version replaceIn 'CustomSkinLoader.java' - - /* - replace '@MC_VERSION@', config.minecraft_version - replace '@MC_FULL_VERSIONS@', config.minecraft_full_versions - replace '@FORGE_VERSION@', config.forge_version - replace '@GIT_VERSION@', System.getenv("GIT_VERSION") - replace '@BUILD_URL@', System.getenv("BUILD_URL") - replaceIn 'BuildInfo.json'*/ } jar { @@ -74,6 +66,17 @@ task copySource << { } sourceMainJava.dependsOn copySource +processResources { + expand ([ + modVersion:rootProject.ext.config.version, + modFullVersion:config.minecraft_full_versions, + mcVersion:config.minecraft_version, + mcFullVersions:config.minecraft_full_versions, + forgeVersion:config.forge_version, + gitVersion:System.getenv("GIT_VERSION"), + buildUrl:System.getenv("BUILD_URL") + ]) +} task copyResources << { def outputFile = file("src/main/resources") outputFile.deleteDir()