From ebf038231e3234d3d038a77bf297bc9b8011522e Mon Sep 17 00:00:00 2001 From: cpw Date: Sun, 27 Jan 2019 11:37:56 -0500 Subject: [PATCH] Use recommended approach to applying version data to mdk. Signed-off-by: cpw --- mdk/build.gradle | 28 +++++++++-------------- mdk/src/main/resources/META-INF/mods.toml | 3 +-- 2 files changed, 12 insertions(+), 19 deletions(-) diff --git a/mdk/build.gradle b/mdk/build.gradle index 5dd003ece..ee9923880 100644 --- a/mdk/build.gradle +++ b/mdk/build.gradle @@ -78,21 +78,15 @@ dependencies { } -processResources { - // this will ensure that this task is redone when the versions change. - inputs.property 'version', project.version - inputs.property 'mcversion', '@MC_VERSION@' - - // replace stuff in mcmod.info, nothing else - from(sourceSets.main.resources.srcDirs) { - include 'META_INF/mods.toml' - - // replace version and mcversion - expand 'version':project.version, 'mcversion': '@MC_VERSION@' +// Example for how to get properties into the manifest for reading by the runtime.. +jar { + manifest { + attributes(["Specification-Title": "examplemod", + "Specification-Vendor": "examplemodsareus", + "Specification-Version": "24.0", // We are version 1 of the modlauncher specification + "Implementation-Title": project.name, + "Implementation-Version": "${version}", + "Implementation-Vendor" :"examplemodsareus", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")],) } - - // copy everything else except the mods.toml - from(sourceSets.main.resources.srcDirs) { - exclude 'META_INF/mods.toml' - } -} +} \ No newline at end of file diff --git a/mdk/src/main/resources/META-INF/mods.toml b/mdk/src/main/resources/META-INF/mods.toml index 90970be1e..3c4cc8777 100644 --- a/mdk/src/main/resources/META-INF/mods.toml +++ b/mdk/src/main/resources/META-INF/mods.toml @@ -24,7 +24,7 @@ authors="Love, Cheese and small house plants" #optional # The modid of the mod modId="examplemod" #mandatory # The version number of the mod - there's a few well known ${} variables useable here or just hardcode it -version="1.0" #mandatory +version="${file.jarVersion}" #mandatory # A display name for the mod displayName="Example Mod" #mandatory # The description text for the mod (multi line!) (#mandatory) @@ -35,7 +35,6 @@ Have some lorem ipsum. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed mollis lacinia magna. Orci varius natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Sed sagittis luctus odio eu tempus. Interdum et malesuada fames ac ante ipsum primis in faucibus. Pellentesque volutpat ligula eget lacus auctor sagittis. In hac habitasse platea dictumst. Nunc gravida elit vitae sem vehicula efficitur. Donec mattis ipsum et arcu lobortis, eleifend sagittis sem rutrum. Cras pharetra quam eget posuere fermentum. Sed id tincidunt justo. Lorem ipsum dolor sit amet, consectetur adipiscing elit. ''' - # A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. [[dependencies.examplemod]] #optional # the modid of the dependency