Skip to content

Commit

Permalink
Update ForgeGradle & mappings (#2288)
Browse files Browse the repository at this point in the history
Co-authored-by: mezz
  • Loading branch information
iTitus committed Apr 11, 2021
1 parent 348e2b3 commit bf73a11
Show file tree
Hide file tree
Showing 16 changed files with 174 additions and 141 deletions.
168 changes: 90 additions & 78 deletions build.gradle
Expand Up @@ -2,91 +2,98 @@ import se.bjurr.gitchangelog.plugin.gradle.GitChangelogTask

buildscript {
repositories {
maven { url = "https://files.minecraftforge.net/maven" }
jcenter()
maven { url = 'https://files.minecraftforge.net/maven' }
mavenCentral()
}
// This is only here while FG is under active development
configurations.classpath {
resolutionStrategy {
cacheDynamicVersionsFor 10, "seconds"
cacheChangingModulesFor 0, "seconds"
cacheDynamicVersionsFor 10, 'seconds'
cacheChangingModulesFor 0, 'seconds'
}
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "3.+", changing: true
classpath group: 'net.minecraftforge.gradle', name: 'ForgeGradle', version: '4.1.+', changing: true
}
}

plugins {
id "com.matthewprenger.cursegradle" version "1.4.0"
id "se.bjurr.gitchangelog.git-changelog-gradle-plugin" version "1.64"
id 'java'
id 'eclipse'
id 'idea'
id 'com.matthewprenger.cursegradle' version '1.4.0'
id 'se.bjurr.gitchangelog.git-changelog-gradle-plugin' version '1.66'
}
apply from: "buildtools/ColoredOutput.gradle"
apply plugin: 'idea'
apply plugin: "net.minecraftforge.gradle"
apply plugin: 'net.minecraftforge.gradle'
apply from: 'buildtools/ColoredOutput.gradle'

//adds the build number to the end of the version string if on a build server
String build_number = System.getenv().BUILD_NUMBER
if (build_number == null) {
build_number = "9999"
build_number = '9999'
}

String semver = "${version_major}.${version_minor}.${version_patch}"
version = "${semver}.${build_number}"
group = "mezz.jei" // http://maven.apache.org/guides/mini/guide-naming-conventions.html

sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
compileJava {
sourceCompatibility = targetCompatibility = JavaVersion.VERSION_1_8
}

repositories {
maven { url 'https://repo1.maven.org/maven2' }
maven { url 'https://maven.latmod.com/' }
}
group = 'mezz.jei' // http://maven.apache.org/guides/mini/guide-naming-conventions.html

sourceSets {
api
main
test
main {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
resources {
srcDir 'src/generated/resources'
}
}
test {
compileClasspath += sourceSets.api.output
runtimeClasspath += sourceSets.api.output
}
}

configurations {
apiCompile.extendsFrom(compile)
apiImplementation.extendsFrom(implementation)
apiRuntimeOnly.extendsFrom(runtimeOnly)
}

java.toolchain.languageVersion = JavaLanguageVersion.of(8)

repositories {
mavenCentral()
maven { url 'https://maven.latmod.com/' }
}

dependencies {
minecraft([
group : "${project.forgegroup}",
name : "forge",
version: "${project.mcversion}-${project.forgeversion}"
group : "${project.forgegroup}",
name : 'forge',
version: "${project.mcversion}-${project.forgeversion}"
])
implementation sourceSets.api.output
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.6.2'
testImplementation "org.junit.jupiter:junit-jupiter-api:5.7.1"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:5.7.1"

compileOnly fg.deobf('com.feed_the_beast.mods:ftb-gui-library:1.0.0.18')
}

task replaceResources(type: Copy) {
outputs.upToDateWhen { false }
from(sourceSets.main.resources.srcDirs) {
include "META-INF/mods.toml"
expand 'version': version, 'mc_version': minecraft_version_range, 'forge_version': forge_version_range
}
into "$buildDir/resources/main/"
outputs.upToDateWhen { false }
from(sourceSets.main.resources.srcDirs) {
include 'META-INF/mods.toml'
expand 'version': version, 'mc_version': minecraft_version_range, 'forge_version': forge_version_range
}
into "$buildDir/resources/main/"
}

processResources {
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
finalizedBy replaceResources
from(sourceSets.main.resources.srcDirs) {
exclude 'META-INF/mods.toml'
}
finalizedBy replaceResources
}

minecraft {
mappings channel: "snapshot", version: project.mcp_mappings
mappings channel: 'snapshot', version: project.mcp_mappings

accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg')

Expand Down Expand Up @@ -125,67 +132,66 @@ minecraft {
}
}

// prevent java 8's strict doclint for javadocs from failing builds
if (JavaVersion.current().isJava8Compatible()) {
tasks.withType(Javadoc) {
options.addStringOption('Xdoclint:none', '-quiet')
}
javadoc {
source = [sourceSets.main.allJava, sourceSets.api.allJava]
// prevent java 8's strict doclint for javadocs from failing builds
options.addStringOption('Xdoclint:none', '-quiet')
}

task makeChangelog(type: GitChangelogTask) {
file = new File("changelog.html")
file = file('changelog.html')
untaggedName = "Current release ${project.version}"
fromCommit = "2fe051cf727adce1be210a46f778aa8fe031331e"
toRef = "HEAD"
templateContent = file("changelog.mustache").getText("UTF-8")
fromCommit = '2fe051cf727adce1be210a46f778aa8fe031331e'
toRef = 'HEAD'
templateContent = file('changelog.mustache').getText('UTF-8')
}

curseforge {
apiKey = project.hasProperty("curseforge_apikey") ? project.curseforge_apikey : "0"
apiKey = project.findProperty('curseforge_apikey') ?: '0'
project {
id = curse_project_id
changelog = file("changelog.html")
changelogType = "html"
releaseType = "beta"
changelog = file('changelog.html')
changelogType = 'html'
releaseType = 'beta'
}
}

afterEvaluate {
tasks.curseforge238222.dependsOn.add(makeChangelog)
tasks.curseforge238222.dependsOn makeChangelog
}

jar {
from sourceSets.main.output.classesDirs
from sourceSets.api.output.classesDirs
from sourceSets.main.output.resourcesDir
from sourceSets.api.output.resourcesDir

from sourceSets.main.output
from sourceSets.api.output

manifest {
attributes([
"Specification-Title": "Just Enough Items",
"Specification-Vendor": "mezz",
"Specification-Version": "${semver}",
"Implementation-Title": project.name,
"Implementation-Version": "${project.version}",
"Implementation-Vendor" :"mezz",
"Implementation-Timestamp": new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
'Specification-Title' : 'Just Enough Items',
'Specification-Vendor' : 'mezz',
'Specification-Version' : "${semver}",
'Implementation-Title' : project.name,
'Implementation-Version' : "${project.version}",
'Implementation-Vendor' : 'mezz',
'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"),
])
}

finalizedBy 'reobfJar'
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
archiveClassifier = 'javadoc'
from javadoc.destinationDir
}

task sourcesJar(type: Jar) {
classifier = "sources"
archiveClassifier = 'sources'
from sourceSets.main.allJava
from sourceSets.api.allJava
}

task apiJar(type: Jar) {
classifier = "api"
archiveClassifier = 'api'
from sourceSets.api.output

// TODO: when FG bug is fixed, remove allJava from the api jar.
Expand All @@ -194,16 +200,23 @@ task apiJar(type: Jar) {
from sourceSets.api.allJava
}

task deobfJar(type: Jar) {
archiveClassifier = 'deobf'
from sourceSets.main.output
from sourceSets.api.output
}

artifacts {
archives javadocJar
archives sourcesJar
archives apiJar
archives deobfJar
}

task("uploadJars", dependsOn: "build") {
description = "uploads JARs"
if (project.hasProperty("local_maven")) {
apply plugin: "maven"
task uploadJars(dependsOn: build) {
description = 'Uploads JARs'
if (project.hasProperty('local_maven')) {
apply plugin: 'maven'
uploadArchives {
repositories {
mavenDeployer {
Expand All @@ -216,9 +229,8 @@ task("uploadJars", dependsOn: "build") {

idea {
module {
for (String excludeDirName in ["run", "out", "logs", "gradle"]) {
File excludeDir = new File(projectDir, excludeDirName)
excludeDirs.add(excludeDir)
for (String exclude in ['run', 'out', 'logs']) {
excludeDirs += file(exclude)
}
}
}
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
@@ -1,11 +1,12 @@
org.gradle.jvmargs=-Xmx3G
org.gradle.daemon=false

mcversion=1.16.5
forgeversion=36.1.0
forge_version_range=[34.0.3,)
minecraft_version_range=[1.16.2, 1.17)
forgegroup=net.minecraftforge
mcp_mappings=20201028-1.16.3
mcp_mappings=20210309-1.16.5
curse_project_id=238222

version_major=7
Expand Down
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,5 @@
#Sun Jan 06 21:09:47 PST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
53 changes: 33 additions & 20 deletions gradlew
@@ -1,5 +1,21 @@
#!/usr/bin/env sh

#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

##############################################################################
##
## Gradle start up script for UN*X
Expand Down Expand Up @@ -28,7 +44,7 @@ APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`

# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS=""
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
Expand Down Expand Up @@ -66,6 +82,7 @@ esac

CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar


# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
Expand Down Expand Up @@ -109,10 +126,11 @@ if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi

# For Cygwin, switch paths to Windows format before running java
if $cygwin ; then
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`

JAVACMD=`cygpath --unix "$JAVACMD"`

# We build the pattern for arguments to be converted via cygpath
Expand All @@ -138,19 +156,19 @@ if $cygwin ; then
else
eval `echo args$i`="\"$arg\""
fi
i=$((i+1))
i=`expr $i + 1`
done
case $i in
(0) set -- ;;
(1) set -- "$args0" ;;
(2) set -- "$args0" "$args1" ;;
(3) set -- "$args0" "$args1" "$args2" ;;
(4) set -- "$args0" "$args1" "$args2" "$args3" ;;
(5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
(6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
(7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
(8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
(9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi

Expand All @@ -159,14 +177,9 @@ save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=$(save "$@")
APP_ARGS=`save "$@"`

# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"

# by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
cd "$(dirname "$0")"
fi

exec "$JAVACMD" "$@"

0 comments on commit bf73a11

Please sign in to comment.