Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: update to the latest forgegradle #50

Open
wants to merge 2 commits into
base: 1.12
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 54 additions & 20 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,25 +3,23 @@ buildscript
repositories
{
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven { url = 'https://maven.minecraftforge.net/' }
}

dependencies
{
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '5.1.+', changing: true
}
}

apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'net.minecraftforge.gradle'

if (project.hasProperty("dev"))
{
version += "-dev" + dev
}

version = project.version
group = "mchorse.mclib"
archivesBaseName = "mclib"
sourceCompatibility = targetCompatibility = "1.8"
Expand All @@ -35,14 +33,24 @@ compileJava

minecraft
{
version = "${mc_version}-${forge_version}"
runDir = "run"
mappings = snapshot

clientJvmArgs = ["-Xmx1G", "-Dfml.coreMods.load=" + coremodPath]
serverJvmArgs = ["-Xmx1G"]

replace "%VERSION%", project.version
mappings channel: 'snapshot', version: project.snapshot

runs {
client {
workingDirectory project.file('run')
jvmArgs(["-Dfml.coreMods.load=" + coremodPath])
}

server {

}
}
}



dependencies {
minecraft "net.minecraftforge:forge:${project.mc_version}-${project.forge_version}"
}

jar {
Expand All @@ -53,29 +61,55 @@ jar {

processResources
{
duplicatesStrategy = DuplicatesStrategy.INCLUDE

inputs.property "version", project.version
inputs.property "mcversion", project.minecraft.version
inputs.property "mcversion", project.mc_version

project.version += "-" + project.minecraft.version
project.version += "-" + project.mc_version

from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version

expand 'version':project.version, 'mcversion':project.mc_version
}

from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
}

import org.apache.tools.ant.filters.ReplaceTokens
def copyDir = "$compileJava.temporaryDir/replaced"

task tokenReplace(type:Copy){
var test = sourceSets.main.java.sourceDirectories;
from(sourceSets.main.java.sourceDirectories)
into copyDir
filter(ReplaceTokens, tokens: [VERSION: project.version])
}

compileJava.setSource(copyDir)

compileJava.dependsOn(tokenReplace)

/* Dev build */
task deobfJar(type: Jar) {
from sourceSets.main.output
classifier = 'dev'

manifest {
attributes 'FMLCorePlugin': coremodPath, 'FMLCorePluginContainsFMLMod': 'true'
attributes([
'FMLCorePlugin': coremodPath,
'FMLCorePluginContainsFMLMod': 'true',
"Specification-Title": project.archivesBaseName,
"Specification-Vendor": project.vendor,
"Specification-Version": "1", // We are version 1 of ourselves
"Implementation-Title": project.name,
"Implementation-Version": "${version}",
"Implementation-Vendor" : project.vendor,
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ")
])
}
}

Expand Down
5 changes: 3 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,6 @@ version=2.4.2
coremodPath=mchorse.mclib.core.McLibCM

mc_version=1.12.2
forge_version=14.23.3.2655
snapshot=snapshot_20171003
forge_version=14.23.5.2860
snapshot=20171003-1.12
vendor=McHorse
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Mon Sep 14 12:28:28 PDT 2015
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-2.14-bin.zip
2 changes: 1 addition & 1 deletion src/main/java/mchorse/mclib/McLib.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
public class McLib
{
public static final String MOD_ID = "mclib";
public static final String VERSION = "%VERSION%";
public static final String VERSION = "@VERSION@";

/* Proxies */
public static final String CLIENT_PROXY = "mchorse.mclib.ClientProxy";
Expand Down
2 changes: 0 additions & 2 deletions src/main/java/mchorse/mclib/client/gui/framework/GuiBase.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package mchorse.mclib.client.gui.framework;

import jline.internal.Nullable;
import mchorse.mclib.client.gui.framework.elements.IViewport;
import mchorse.mclib.client.gui.framework.elements.utils.GuiContext;
import mchorse.mclib.client.gui.framework.elements.GuiElement;
Expand Down Expand Up @@ -56,7 +55,6 @@ public GuiBase()
* @param <T>
* @return null if GuiBase.screen or GuiBase.screen.root is null or if the children List is empty.
*/
@Nullable
public static <T> List<T> getCurrentChildren(Class<T> clazz)
{
if (GuiBase.getCurrent() != null && GuiBase.getCurrent().screen != null && GuiBase.getCurrent().screen.root != null)
Expand Down
2 changes: 1 addition & 1 deletion src/main/java/mchorse/mclib/core/McLibCMInfo.java
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ public Object getMod()
@Override
public String getVersion()
{
return "%VERSION%";
return "@VERSION@";
}
}