From d94942735b6237c7791a32636bb187cfb4146082 Mon Sep 17 00:00:00 2001 From: RedEnergy Date: Tue, 8 Dec 2015 21:15:44 +0400 Subject: [PATCH] Build script: added shaded jar --- build.gradle | 37 ++++++++++++++++--- .../java/com/rabbit/gui/GuiFoundation.java | 4 +- src/main/resources/mcmod.info | 12 +++--- 3 files changed, 40 insertions(+), 13 deletions(-) diff --git a/build.gradle b/build.gradle index 9812324..97fea14 100644 --- a/build.gradle +++ b/build.gradle @@ -17,7 +17,7 @@ buildscript { apply plugin: 'forge' -version = "1.0" +version = "v1.2.0" group= "com.rabbit" archivesBaseName = "rabbit-gui" @@ -26,21 +26,48 @@ minecraft { runDir = "eclipse" } +configurations { + shade + compile.extendsFrom shade +} + +dependencies { + shade 'net.objecthunter:exp4j:0.4.5' +} + +task shadedJar(type: Jar){ + from (sourceSets.main.output) { + setDuplicatesStrategy(DuplicatesStrategy.EXCLUDE) + } + configurations.shade.each{ dep -> + from(project.zipTree(dep)){ + exclude 'META-ING', 'META-INF/**' + } + } + classifier = 'shaded' +} + task sourceJar(type: Jar) { from sourceSets.main.allSource classifier = 'sources' } -tasks.build.dependsOn('sourceJar') +def action = new Action(){ + void execute(net.minecraftforge.gradle.tasks.user.reobf.ArtifactSpec artifactSpec) { + artifactSpec.classpath = sourceSets.main.compileClasspath + } +} + +reobf.reobf(shadedJar, action) + +tasks.jar.dependsOn('sourceJar', 'shadedJar') artifacts { archives jar archives sourceJar + archives shadedJar } -dependencies { - compile 'net.objecthunter:exp4j:0.4.5' -} compileJava { sourceCompatibility = 1.8 diff --git a/src/main/java/com/rabbit/gui/GuiFoundation.java b/src/main/java/com/rabbit/gui/GuiFoundation.java index eed1494..decd6a0 100644 --- a/src/main/java/com/rabbit/gui/GuiFoundation.java +++ b/src/main/java/com/rabbit/gui/GuiFoundation.java @@ -7,12 +7,12 @@ import cpw.mods.fml.common.event.FMLPostInitializationEvent; import net.minecraft.client.Minecraft; -@Mod(modid = "rabbit-gui", name = "Rabbit Gui Library") +@Mod(modid = "rabbit-gui", name = "Rabbit Gui Library", version = "v1.2.0") public class GuiFoundation { @Mod.EventHandler public void postLoad(FMLPostInitializationEvent event) { - FMLLog.info("Rabbit Gui has been successfuly initialized"); + FMLLog.info("Rabbit Gui has been successfully initialized"); } /** diff --git a/src/main/resources/mcmod.info b/src/main/resources/mcmod.info index f480667..3bc4ad7 100644 --- a/src/main/resources/mcmod.info +++ b/src/main/resources/mcmod.info @@ -1,14 +1,14 @@ [ { - "modid": "examplemod", - "name": "Example Mod", - "description": "Example placeholder mod.", + "modid": "rabbit-gui", + "name": "Rabbit GUI library", + "description": "Graphical framework built on top of Forge Mod Loader and designed to facilitate the creation of graphical user interfaces.", "version": "${version}", "mcversion": "${mcversion}", - "url": "", + "url": "https://github.com/FRedEnergy/rabbit-gui", "updateUrl": "", - "authorList": ["ExampleDude"], - "credits": "The Forge and FML guys, for making this example", + "authorList": ["RedEnergy"], + "credits": "JavaFX and Android team for inspiration", "logoFile": "", "screenshots": [], "dependencies": []