From badf123946eb20dd03a838e943df83eec3681c1a Mon Sep 17 00:00:00 2001 From: yueh Date: Sun, 2 Oct 2016 02:09:10 +0200 Subject: [PATCH] Gradle cleanup Removed all outdated dependencies, repositories, etc. This allows us to have a clean state to build upon without having to care about obsolete things. Removed the deobf jar since forge can handle normal ones just fine since 1.8.9. Fixed build errors during javadoc creation due to missing symbols caused by ForgeGradle breaking gradle conventions and not providing the necessary dependencies. --- build.gradle | 28 +++---- gradle.properties | 39 +-------- gradle/scripts/artifacts.gradle | 56 ++++++------- gradle/scripts/dependencies.gradle | 116 ++------------------------- gradle/scripts/integration.gradle | 20 ++++- gradle/scripts/optional.gradle | 124 +++++------------------------ 6 files changed, 88 insertions(+), 295 deletions(-) diff --git a/build.gradle b/build.gradle index 392c0b8b3..b0fd1db5f 100644 --- a/build.gradle +++ b/build.gradle @@ -38,17 +38,11 @@ repositories { mavenCentral() } -dependencies { - testCompile "junit:junit:4.12" -} - apply from: 'gradle/scripts/dependencies.gradle' apply from: 'gradle/scripts/artifacts.gradle' -//apply from: 'gradle/scripts/autoinstallruntime.gradle' apply from: 'gradle/scripts/integration.gradle' apply from: 'gradle/scripts/optional.gradle' - sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 @@ -56,14 +50,6 @@ version = aeversion + "-" + aechannel + "-" + aebuild group = aegroup archivesBaseName = aebasename -// If TeamCity is running this build, lets set the version info -if (hasProperty("teamcity")) { - version = teamcity["build.number"] - - // Fix for main branch being built - version = version.replaceAll("/", "-") -} - // Add Coremod Manifest jar { manifest { @@ -118,10 +104,20 @@ sourceSets { } } -processResources { +processResources +{ + // this will ensure that this task is redone when the versions change. + inputs.property "version", project.version + inputs.property "mcversion", project.minecraft.version + // replace stuff in mcmod.info, nothing else from(sourceSets.main.resources.srcDirs) { include 'mcmod.info' - expand 'version': project.version, 'mcversion': minecraft_version + expand 'version': project.version, 'mcversion': project.minecraft.version + } + + // copy everything else, thats not the mcmod.info + from(sourceSets.main.resources.srcDirs) { + exclude 'mcmod.info' } } \ No newline at end of file diff --git a/gradle.properties b/gradle.properties index 57247bdaf..2095448cf 100644 --- a/gradle.properties +++ b/gradle.properties @@ -14,46 +14,9 @@ forge_version=12.18.1.2094 ######################################################### # Installable # ######################################################### -waila_version=1.7.0-B3 -jabba_version=1.2.1a -#enderstorage_version=1.4.7.36 -#translocator_version=1.1.2.15 -ic2_version=2.2.717 -enderio_version=2.3.0.375_beta -#cofhlib_version=1.0.1-157 -#cofhcore_version=3.0.2-270 -#texpansion_version=4.0.0-176 -#tfoundation_version=1.0.0-82 -betterstorage_version=0.11.3.123.20 -invtweaks_version=1.59 +waila_version=1.7.0-B3_1.9.4 ######################################################### # Provided APIs # ######################################################### -fmp_version=1.2.0.345 -code_chicken_lib_version=1.1.3.138 -code_chicken_core_version=1.0.7.47 jei_version=3.12.2.291 -bc_version=7.0.9 -opencomputers_version=1.5.18.39 -pneumaticcraft_version=1.9.15-105 - -######################################################### -# Self Compiled APIs # -######################################################### -mekansim_version=8.0.1.198 -rotarycraft_version=V6e - - -######################################################### -# Self Compiled API Stubs # -# Note: Do not edit these version numbers as they are # -# not the version of the mod, but stub code for AE2 to # -# compile # -######################################################### -api_coloredlightscore_version=1 -api_craftguide_version=1 -api_immibis_version=1 -api_mfr_version=1 -api_railcraft_version=1 -api_rf_version=2 diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle index 9f67d01c7..1d7ae23bb 100644 --- a/gradle/scripts/artifacts.gradle +++ b/gradle/scripts/artifacts.gradle @@ -1,9 +1,26 @@ -if (JavaVersion.current().isJava8Compatible()) { - allprojects { - tasks.withType(Javadoc) { - options.addStringOption('Xdoclint:none', '-quiet') - } - } +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + +// Suppresses warnings/errors when building javadocs +allprojects { + tasks.withType(Javadoc) { + options.addStringOption('Xdoclint:none', '-quiet') + } } javadoc { @@ -11,32 +28,18 @@ javadoc { options.charSet = 'UTF-8' } -task myJavadocs(type: Javadoc) { +task javadocs(type: Javadoc) { source = sourceSets.api.java include "appeng/api/**" - classpath = configurations.compile + // Due to ForgeGradle having to be a special snowflake, + // we have to add some custom configurations to the normal compile configuration and hope it does not break. + classpath = configurations.compile + configurations.forgeGradleMc + configurations.forgeGradleMcDeps } -task javadocJar(type: Jar, dependsOn: myJavadocs) { +task javadocJar(type: Jar, dependsOn: javadocs) { + from javadoc.destinationDir classifier = 'javadoc' - from 'build/docs/javadoc/' -} - -task devJar(type: Jar) { - - manifest { - attributes 'FMLCorePlugin': 'appeng.transformer.AppEngCore' - attributes 'FMLCorePluginContainsFMLMod': 'true' - } - - from(sourceSets.main.output) { - include "appeng/**" - include "assets/**" - include 'mcmod.info' - } - - classifier = 'dev' } task apiJar(type: Jar) { @@ -50,7 +53,6 @@ task apiJar(type: Jar) { } artifacts { - archives devJar archives apiJar archives javadocJar archives sourceJar diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle index ea20f4b9e..27db457a0 100644 --- a/gradle/scripts/dependencies.gradle +++ b/gradle/scripts/dependencies.gradle @@ -1,4 +1,3 @@ - /* * This file is part of Applied Energistics 2. * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. @@ -17,80 +16,18 @@ * along with Applied Energistics 2. If not, see . */ - - repositories { mavenLocal() - maven { - name "ChickenBones" - url "http://chickenbones.net/maven/" - } maven { name "Mobius" url "http://mobiusstrip.eu/maven" } - maven { - name "FireBall API Depot" - url "http://dl.tsr.me/artifactory/libs-release-local" - } - - maven { - name = "Player" - url = "http://maven.ic2.player.to/" - } - - maven { - name = "Tterrag" - url = "http://maven.tterrag.com/" - } - - maven { - name = "RX14 Proxy" - url = "http://mvn.rx14.co.uk/repo/" - } - - maven { - name "OpenComputers Repo" - url = "http://maven.cil.li/" - } - - maven { - name = "MM repo" - url = "http://maven.k-4u.nl/" - } - maven { name = "JEI repo" url "http://dvs1.progwml6.com/files/maven" } - - ivy { - name "BuildCraft" - artifactPattern "http://www.mod-buildcraft.com/releases/BuildCraft/[revision]/[module]-[revision]-[classifier].[ext]" - } - -// CurseForge DNS for TE is not available or I am just being unlucky, code part can stay since this is applicable to any other curseforge mod though -// ivy { -// name = "CoFHLib" -// artifactPattern "http://addons.cursecdn.com/files/2212/893/[module]-[revision].[ext]" -// } -// -// ivy { -// name = "CoFHCore" -// artifactPattern "http://addons.cursecdn.com/files/2212/895/[module]-[revision].[ext]" -// } - -// ivy { -// name = "ThermalExpansion" -// artifactPattern "http://addons.curse.cursecdn.com/files/2212/446/[module]-[revision].[ext]" -// } - -// ivy { -// name = "ThermalFoundation" -// artifactPattern "http://addons.curse.cursecdn.com/files/2212/444/[module]-[revision].[ext]" -// } } configurations { @@ -98,55 +35,16 @@ configurations { } dependencies { - // installable - mods "mcp.mobius.waila:Waila:${waila_version}_1.9.4:dev" + // installable runtime dependencies + mods "mcp.mobius.waila:Waila:${waila_version}" -// mods "mcp.mobius.jabba:Jabba:${jabba_version}_${minecraft_version}:dev" -// mods "codechicken:EnderStorage:${minecraft_version}-${enderstorage_version}:dev" -// mods "codechicken:Translocator:${minecraft_version}-${translocator_version}:dev" -// mods "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:dev" -// mods "com.enderio:EnderIO:${minecraft_version}-${enderio_version}:dev" -// mods "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:deobf" -// mods "inventorytweaks:InventoryTweaks:${invtweaks_version}:deobf" -// mods "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:dev" - -// mods name: 'CoFHLib', version: "[${minecraft_version}]${cofhlib_version}-dev", ext: 'jar' -// mods name: 'CoFHCore', version: "[${minecraft_version}]${cofhcore_version}-dev", ext: 'jar' -// mods name: 'ThermalExpansion', version: "[${minecraft_version}]${texpansion_version}-dev", ext: 'jar' -// mods name: 'ThermalFoundation', version: "[${minecraft_version}]${tfoundation_version}-dev", ext: 'jar' - -// compile "codechicken:ForgeMultipart:${minecraft_version}-${fmp_version}:dev" -// compile "codechicken:CodeChickenLib:${minecraft_version}-${code_chicken_lib_version}:dev" -// compile "codechicken:CodeChickenCore:${minecraft_version}-${code_chicken_core_version}:dev" -// compile "codechicken:NotEnoughItems:${minecraft_version}-${nei_version}:dev" -// compile "com.mod-buildcraft:buildcraft:${bc_version}:dev" -// compile "pneumaticCraft:PneumaticCraft-${minecraft_version}:${pneumaticcraft_version}:api" - - // provided APIs -// compile "li.cil.oc:OpenComputers:MC${minecraft_version}-${opencomputers_version}:api" -// compile "net.industrial-craft:industrialcraft-2:${ic2_version}-experimental:api" -// compile "net.mcft.copy.betterstorage:BetterStorage:${minecraft_version}-${betterstorage_version}:api" - - // self compiled APIs -// compile "appeng:Waila:${waila_version}_${minecraft_version}:api" -// compile "appeng:RotaryCraft:${rotarycraft_version}:api" -// compile "appeng:mekanism:${minecraft_version}-${mekansim_version}:api" -// compile "appeng:InventoryTweaks:${invtweaks_version}:api" - - // self compiled stubs -// compile(group: 'api', name: 'coloredlightscore', version: "${api_coloredlightscore_version}") -// compile(group: 'api', name: 'craftguide', version: "${api_craftguide_version}") -// compile(group: 'api', name: 'immibis', version: "${api_immibis_version}") -// compile(group: 'api', name: 'mfr', version: "${api_mfr_version}") -// compile(group: 'api', name: 'railcraft', version: "${api_railcraft_version}") -// compile(group: 'api', name: 'rf', version: "${api_rf_version}") - - // compile against various APIs - compileOnly "mezz.jei:jei_1.10.2:${jei_version}:api" - compileOnly "mcp.mobius.waila:Waila:${waila_version}_1.9.4:dev" + // compile against provided APIs + compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api" + compileOnly "mcp.mobius.waila:Waila:${waila_version}" // at runtime, use the full JEI jar - runtime "mezz.jei:jei_1.10.2:${jei_version}" + runtime "mezz.jei:jei_${minecraft_version}:${jei_version}" + // unit test dependencies testCompile "junit:junit:4.12" } diff --git a/gradle/scripts/integration.gradle b/gradle/scripts/integration.gradle index 0ebc4cdac..c05b128e1 100644 --- a/gradle/scripts/integration.gradle +++ b/gradle/scripts/integration.gradle @@ -1,3 +1,22 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + +// Should be provided by ForgeGradle, some idea user should confirm it. apply plugin: 'idea' idea { @@ -5,7 +24,6 @@ idea { inheritOutputDirs = true // excludes integration due to not being available upon port - excludeDirs += file('src/main/java/appeng/fmp/') excludeDirs += file('src/main/java/appeng/parts/layers/') } } \ No newline at end of file diff --git a/gradle/scripts/optional.gradle b/gradle/scripts/optional.gradle index b71b1f1ce..fdf33f1fd 100644 --- a/gradle/scripts/optional.gradle +++ b/gradle/scripts/optional.gradle @@ -1,116 +1,32 @@ +/* + * This file is part of Applied Energistics 2. + * Copyright (c) 2013 - 2014, AlgorithmX2, All rights reserved. + * + * Applied Energistics 2 is free software: you can redistribute it and/or modify + * it under the terms of the GNU Lesser General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * Applied Energistics 2 is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public License + * along with Applied Energistics 2. If not, see . + */ + task wrapper(type: Wrapper) { - gradleVersion = "2.7" + gradleVersion = "2.14" } // WAILA task installWaila(type: Copy, dependsOn: "deinstallWaila") { from { configurations.mods } - include "**/*Waila*dev.jar" + include "**/*Waila*.jar" into file(minecraft.runDir + "/mods") } task deinstallWaila(type: Delete) { delete fileTree(dir: minecraft.runDir + "/mods", include: "*Waila*.jar") } - -// JABBA -task installJabba(type: Copy, dependsOn: "deinstallJabba") { - from { configurations.mods } - include "**/*Jabba*dev.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallJabba(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*Jabba*.jar") -} - -// ENDER STORAGE -task installEnderStorage(type: Copy, dependsOn: "deinstallEnderStorage") { - from { configurations.mods } - include "**/*EnderStorage*dev.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallEnderStorage(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*EnderStorage*.jar") -} - -// TRANSLOCATOR -task installTranslocator(type: Copy, dependsOn: "deinstallTranslocator") { - from { configurations.mods } - include "**/*Translocator*dev.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallTranslocator(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*Translocator*.jar") -} - -// INDUSTRIALCRAFT -task installIC2(type: Copy, dependsOn: "deinstallIC2") { - from { configurations.mods } - include "**/*industrialcraft*dev.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallIC2(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft*.jar") -} - -// ENDER IO -task installEnderIO(type: Copy, dependsOn: "deinstallEnderIO") { - from { configurations.mods } - include "**/*EnderIO*dev.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallEnderIO(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*EnderIO*.jar") -} - -// TE -//task installTE(type: Copy, dependsOn: "deinstallTE") { -// from { configurations.mods } -// include "**/*CoFHLib*.jar" -// include "**/*CoFHCore*.jar" -// include "**/*ThermalFoundation*.jar" -// include "**/*ThermalExpansion*.jar" -// -// into file(minecraft.runDir + "/mods") -//} -// -//task deinstallTE(type: Delete) { -// delete fileTree(dir: minecraft.runDir + "/mods", includes: ["*CoFHLib*.jar", "*CoFHCore*.jar", "*ThermalFoundation*.jar", "*ThermalExpansion*.jar"]) -//} - -// INV TWEAKS -task installInvTweaks(type: Copy, dependsOn: "deinstallInvTweaks") { - from { configurations.mods } - include "**/*InventoryTweaks*dev*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallInvTweaks(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*InventoryTweaks*.jar") -} - -// BETTER STORAGE -task installBetterStorage(type: Copy, dependsOn: "deinstallBetterStorage") { - from { configurations.mods } - include "**/*BetterStorage*deobf*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallBetterStorage(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*BetterStorage*.jar") -} - -task installOpenComputers(type: Copy, dependsOn: "deinstallOpenComputers") { - from { configurations.mods } - include "**/*OpenComputer*dev*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallOpenComputers(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*OpenComputers*.jar") -}