diff --git a/build.gradle b/build.gradle index 66ada5aca..5e255630a 100644 --- a/build.gradle +++ b/build.gradle @@ -18,25 +18,22 @@ buildscript { repositories { - mavenLocal() + maven { url = 'https://files.minecraftforge.net/maven' } jcenter() mavenCentral() - maven { - name = "forge" - url = "http://files.minecraftforge.net/maven" - } } dependencies { - classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT' + classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '3.+', changing: true } } plugins { - id "org.sonarqube" version "2.6" + id "org.sonarqube" version "2.8" + id "jacoco" } -apply plugin: 'net.minecraftforge.gradle.forge' -apply plugin: 'jacoco' +apply plugin: 'net.minecraftforge.gradle' +apply plugin: "eclipse" repositories { mavenLocal() @@ -44,12 +41,10 @@ repositories { mavenCentral() } -apply from: 'gradle/scripts/dependencies.gradle' -apply from: 'gradle/scripts/artifacts.gradle' -apply from: 'gradle/scripts/optional.gradle' - -sourceCompatibility = JavaVersion.VERSION_1_8 -targetCompatibility = JavaVersion.VERSION_1_8 +sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 +compileJava { + sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8 +} // ensure everything uses UTF-8 and not some random codepage chosen by gradle compileJava.options.encoding = 'UTF-8' @@ -57,65 +52,66 @@ tasks.withType(JavaCompile) { options.encoding = 'UTF-8' } -version = aeversion + "-" + aechannel + "-" + aebuild -group = aegroup -archivesBaseName = aebasename - -// Add Coremod Manifest -jar { - manifest { - attributes 'FMLAT': 'appeng_at.cfg' - } - - from sourceSets.api.output - dependsOn apiClasses - - // specify which files are really included, can control which APIs should be in - include "appeng/**" - include "assets/**" - include "mcmod.info" - include "pack.mcmeta" - include "META-INF/appeng_at.cfg" -} - -minecraft { - version = minecraft_version + "-" + forge_version - - replaceIn "AEConfig.java" - replaceIn "package-info.java" - - replace "@version@", project.version - replace "@aeversion@", aeversion - replace "@aechannel@", aechannel - replace "@aebuild@", aebuild - - // used when launching minecraft in dev env - runDir = "run" - mappings = mcp_mappings -} +version = version_major + "." + version_minor + "." + version_patch +group = artifact_group +archivesBaseName = artifact_basename sourceSets { api - main + main { + compileClasspath += sourceSets.api.output + runtimeClasspath += sourceSets.api.output + } + test { + compileClasspath += sourceSets.api.output + runtimeClasspath += sourceSets.api.output + } } -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': project.minecraft.version - } - - // copy everything else, thats not the mcmod.info - from(sourceSets.main.resources.srcDirs) { - exclude 'mcmod.info' - } - - // move access transformer to META-INF - rename '(.+_at.cfg)', 'META-INF/$1' +configurations { + apiCompile.extendsFrom(compile) } + +apply from: 'gradle/scripts/dependencies.gradle' + +minecraft { + mappings channel: "snapshot", version: project.mcp_mappings + + accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + + runs { + client { + property 'forge.logging.console.level', 'debug' + workingDirectory project.file('run') + mods { + appliedenergistics2 { + source sourceSets.main + source sourceSets.api + } + } + } + server { + property 'forge.logging.console.level', 'debug' + workingDirectory project.file('run') + mods { + appliedenergistics2 { + source sourceSets.main + source sourceSets.api + } + } + } + data { + property 'forge.logging.console.level', 'debug' + workingDirectory project.file('run') + args '--mod', 'appliedenergistics2', '--all', '--output', file('src/generated/resources/') + mods { + appliedenergistics2 { + source sourceSets.main + source sourceSets.api + } + } + } + } +} + +apply from: 'gradle/scripts/artifacts.gradle' diff --git a/gradle.properties b/gradle.properties index 993731d66..99035cf74 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,35 +1,33 @@ -aeversion=rv6 -aechannel=alpha -aebuild=0 -aegroup=appeng -aebasename=appliedenergistics2 +version_major=0 +version_minor=0 +version_patch=0 + +artifact_group=appeng +artifact_basename=appliedenergistics2 ######################################################### -# Versions # +# Minecraft Versions # ######################################################### -minecraft_version=1.12.2 -mcp_mappings=snapshot_20171003 -forge_version=14.23.5.2768 - -######################################################### -# Installable # -######################################################### -hwyla_version=1.8.26-B41_1.12.2 +minecraft_release=1.15 +minecraft_version=1.15.2 +mcp_mappings=20200411-1.15.1 +forge_version=31.1.43 ######################################################### # Provided APIs # ######################################################### -jei_version=4.13.0.219 +jei_version=6.0.0.4 tesla_version=1.0.63 ic2_version=2.8.73-ex112 -top_version=1.12-1.4.23-16 +top_version=2.0.2-4 cofhcore_version=1.12.2-4.5.2.19 crafttweaker_version=4.1.8.9 inventorytweaks_version=1.63 ctm_version=MC1.12.2-0.3.1.16 +hwyla_version=1.8.26-B41_1.12.2 ######################################################### # Deployment # ######################################################### -website_version=1.12.2 -curse_versions=1.12.2 +website_version=1.15.2 +curse_versions=1.15.2 diff --git a/gradle/scripts/artifacts.gradle b/gradle/scripts/artifacts.gradle index a85c05935..71dc55219 100644 --- a/gradle/scripts/artifacts.gradle +++ b/gradle/scripts/artifacts.gradle @@ -28,40 +28,54 @@ javadoc { options.charSet = 'UTF-8' } -task javadocs(type: Javadoc) { - source = sourceSets.api.java - include "appeng/api/**" +jar { + from sourceSets.main.output.classesDirs + from sourceSets.api.output.classesDirs + from sourceSets.main.output.resourcesDir + from sourceSets.api.output.resourcesDir - // 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 + manifest { + attributes([ + "Specification-Title": "Applied Energistics 2", + "Specification-Vendor": "TeamAppliedEnergistics", + "Specification-Version": "${project.version}", + "Implementation-Title": "${project.name}", + "Implementation-Version": "${project.version}", + "Implementation-Vendor" :"TeamAppliedEnergistics", + "Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), + ]) + } } -task javadocJar(type: Jar, dependsOn: javadocs) { - from javadoc.destinationDir +task javadocs(type: Javadoc) { + source = sourceSets.api.java + include "appeng/api/**" +} - classifier = 'javadoc' +task javadocJar(type: Jar, dependsOn: javadoc) { + classifier = "javadoc" + from javadoc.destinationDir +} + +task sourcesJar(type: Jar) { + classifier = "sources" + from sourceSets.main.allJava + from sourceSets.api.allJava } task apiJar(type: Jar) { - from sourceSets.api.java - include "appeng/api/**" + classifier = "api" + from sourceSets.api.output + include "appeng/api/**" - from sourceSets.api.output - include "appeng/api/**" - - classifier = 'api' -} - -task sourceJar(type: Jar, overwrite: true) { - from sourceSets.api.allSource - from sourceSets.main.allSource - - classifier = 'sources' + // TODO: when FG bug is fixed, remove allJava from the api jar. + // https://github.com/MinecraftForge/ForgeGradle/issues/369 + // Gradle should be able to pull them from the -sources jar. + from sourceSets.api.allJava } artifacts { - archives apiJar - archives javadocJar - archives sourceJar + archives javadocJar + archives sourcesJar + archives apiJar } \ No newline at end of file diff --git a/gradle/scripts/dependencies.gradle b/gradle/scripts/dependencies.gradle index 5c442bb53..51a22a4e9 100644 --- a/gradle/scripts/dependencies.gradle +++ b/gradle/scripts/dependencies.gradle @@ -64,10 +64,10 @@ repositories { url "http://maven.blamejared.com/" } - //maven { // modmaven, maven proxy - // name 'modmaven' - // url "https://modmaven.k-4u.nl/" - //} + maven { // modmaven, maven proxy + name 'modmaven' + url "https://modmaven.k-4u.nl/" + } maven { name = "CurseForge" @@ -80,25 +80,26 @@ configurations { } dependencies { - // installable runtime dependencies - mods "mcp.mobius.waila:Hwyla:${hwyla_version}" - mods "net.industrial-craft:industrialcraft-2:${ic2_version}:dev" - mods "mcjty.theoneprobe:TheOneProbe-${minecraft_version}:${top_version}" + minecraft([ + group : "net.minecraftforge", + name : "forge", + version: "${project.minecraft_version}-${project.forge_version}" + ]) // compile against provided APIs - compileOnly "mezz.jei:jei_${minecraft_version}:${jei_version}:api" - compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}" - compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}" - compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" - compileOnly "mcjty.theoneprobe:TheOneProbe-1.12:${top_version}:api" - compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf" - compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}" - compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api" - compileOnly "team.chisel.ctm:CTM:${ctm_version}" + compileOnly "mezz.jei:jei-${minecraft_version}:${jei_version}:api" + //compileOnly "mcp.mobius.waila:Hwyla:${hwyla_version}" + //compileOnly "net.darkhax.tesla:Tesla-1.12.2:${tesla_version}" + //compileOnly "net.industrial-craft:industrialcraft-2:${ic2_version}:api" + compileOnly "mcjty.theoneprobe:TheOneProbe-${minecraft_release}:${minecraft_release}-${top_version}:api" + //compileOnly "cofh:CoFHCore:${cofhcore_version}:deobf" + //compileOnly "CraftTweaker2:CraftTweaker2-API:${crafttweaker_version}" + //compileOnly "inventory-tweaks:InventoryTweaks:${inventorytweaks_version}:api" + //compileOnly "team.chisel.ctm:CTM:${ctm_version}" // at runtime, use the full JEI jar - runtime "mezz.jei:jei_${minecraft_version}:${jei_version}" + runtime "mezz.jei:jei-${minecraft_version}:${jei_version}" // unit test dependencies - testCompile "junit:junit:4.12" + testCompile "junit:junit:4.13" } diff --git a/gradle/scripts/optional.gradle b/gradle/scripts/optional.gradle deleted file mode 100644 index 046613679..000000000 --- a/gradle/scripts/optional.gradle +++ /dev/null @@ -1,55 +0,0 @@ -/* - * 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.14" -} - -// HWYLA -task installHwyla(type: Copy, dependsOn: "deinstallHwyla") { - from { configurations.mods } - include "**/*Hwyla*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallHwyla(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*Hwyla*.jar") -} - -// IC2 -task installIC2(type: Copy, dependsOn: "deinstallIC2") { - from { configurations.mods } - include "**/*industrialcraft-2*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallIC2(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*industrialcraft-2*.jar") -} - -// TOP -task installTop(type: Copy, dependsOn: ["deinstallTop"]) { - from { configurations.mods } - include "**/*TheOneProbe*.jar" - into file(minecraft.runDir + "/mods") -} - -task deinstallTop(type: Delete) { - delete fileTree(dir: minecraft.runDir + "/mods", include: "*TheOneProbe*.jar") -} - diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 736fb7d3f..1948b9074 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 9d2dc020a..a95009c3b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,5 +1,5 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip diff --git a/src/main/resources/appeng_at.cfg b/src/main/resources/appeng_at.cfg deleted file mode 100644 index 9c010e3c1..000000000 --- a/src/main/resources/appeng_at.cfg +++ /dev/null @@ -1,3 +0,0 @@ -# GUI rendering -public net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V # drawSlot -public net.minecraft.client.gui.GuiTextField func_146188_c(IIII)V # drawSelectionBox diff --git a/src/main/resources/assets/appliedenergistics2/META-INF/accesstransformer.cfg b/src/main/resources/assets/appliedenergistics2/META-INF/accesstransformer.cfg new file mode 100644 index 000000000..6a851028a --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/META-INF/accesstransformer.cfg @@ -0,0 +1,3 @@ +# GUI rendering +#public net.minecraft.client.gui.inventory.GuiContainer func_146977_a(Lnet/minecraft/inventory/Slot;)V # drawSlot +#public net.minecraft.client.gui.GuiTextField func_146188_c(IIII)V # drawSelectionBox diff --git a/src/main/resources/assets/appliedenergistics2/META-INF/mods.toml b/src/main/resources/assets/appliedenergistics2/META-INF/mods.toml new file mode 100644 index 000000000..b75960057 --- /dev/null +++ b/src/main/resources/assets/appliedenergistics2/META-INF/mods.toml @@ -0,0 +1,55 @@ +# There are several mandatory fields (#mandatory), and many more that are optional (#optional). +# The overall format is standard TOML format, v0.5.0. +# Note that there are a couple of TOML lists in this file. +# Find more information on toml format here: https://github.com/toml-lang/toml + +# The name of the mod loader type to load - for regular FML @Mod mods it should be javafml +modLoader="javafml" #mandatory + +# A version range to match for said mod loader - for regular FML @Mod it will be the minecraft version (without the 1.) +loaderVersion="[31,)" #mandatory + +# A URL to query for updates for this mod. See the JSON update specification +#updateJSONURL="" #optional + +# A URL to refer people to when problems occur with this mod +issueTrackerURL="https://github.com/AppliedEnergistics/Applied-Energistics-2/issues" #optional + +# A URL for the "homepage" for this mod, displayed in the mod UI +displayURL="https://github.com/AppliedEnergistics/Applied-Energistics-2" #optional + +# A file name (in the root of the mod JAR) containing a logo for display +#logoFile="examplemod.png" #optional + +# A text field displayed in the mod UI +#credits="Thanks for this example mod goes to Java" #optional + +# A text field displayed in the mod UI +authors="TeamAppliedEnergistics" #optional + +# A list of mods - how many allowed here is determined by the individual mod loader +[[mods]] #mandatory + +# The modid of the mod +modId="appliedenergistics2" #mandatory + +# The version number of the mod +version="${file.jarVersion}" #mandatory + +# A display name for the mod +displayName="Applied Energistics 2" #mandatory + +# The description text for the mod (multi line!) (#mandatory) +description=''' +A Mod about Matter, Energy and using them to conquer the world.. +''' + +# A dependency - use the . to indicate dependency for a specific modid. Dependencies are optional. +[[dependencies.jei]] + modId="forge" #mandatory + mandatory=true #mandatory + versionRange="[31.0.0,)" #mandatory + # An ordering relationship for the dependency - BEFORE or AFTER required if the relationship is not mandatory + ordering="NONE" + # Side this dependency is applied on - BOTH, CLIENT or SERVER + side="BOTH" \ No newline at end of file