Skip to content
This repository has been archived by the owner on Dec 21, 2024. It is now read-only.

Commit

Permalink
Update to Forge 36.2.42
Browse files Browse the repository at this point in the history
  • Loading branch information
Mgazul committed Mar 22, 2024
1 parent 9a886d5 commit 281a642
Show file tree
Hide file tree
Showing 30 changed files with 1,321 additions and 761 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
[![](https://img.shields.io/jenkins/build?jobUrl=https%3A%2F%2Fci.codemc.io%2Fjob%2FMohistMC%2Fjob%2FMohist-1.16.5)](https://ci.codemc.io/job/MohistMC/job/Mohist-1.16.5)
[![](https://img.shields.io/github/stars/MohistMC/Mohist.svg?label=Stars&logo=github)](https://github.com/MohistMC/Mohist/stargazers)
[![](https://img.shields.io/github/license/MohistMC/Mohist?)](https://github.com/MohistMC/Mohist/blob/1.16.5/LICENSE)
[![](https://img.shields.io/badge/Forge-1.16.5--36.2.41-brightgreen.svg?colorB=26303d&logo=Conda-Forge)](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.16.5.html)
[![](https://img.shields.io/badge/Forge-1.16.5--36.2.42-brightgreen.svg?colorB=26303d&logo=Conda-Forge)](https://files.minecraftforge.net/net/minecraftforge/forge/index_1.16.5.html)
[![](https://img.shields.io/badge/AdoptOpenJDK-11.0.15+10-brightgreen.svg?colorB=469C00&logo=java)](https://adoptopenjdk.net/?variant=openjdk11&)
[![](https://img.shields.io/badge/Gradle-7.3.3-brightgreen.svg?colorB=469C00&logo=gradle)](https://docs.gradle.org/7.3.3/release-notes.html)
[![](https://img.shields.io/bstats/servers/6762?label=bStats)](https://bstats.org/plugin/server-implementation/Mohist/6762)
Expand All @@ -23,7 +23,7 @@
Progress
------

- [x] Rectify Forge [09f1b8d43](https://github.com/MinecraftForge/MinecraftForge/commit/09f1b8d43)
- [x] Rectify Forge [54233da14](https://github.com/MinecraftForge/MinecraftForge/commit/54233da14)
- [x] Start patch
* CraftBukkit(f4830a16)
* Bukkit(7e29f765)
Expand Down
181 changes: 142 additions & 39 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,53 @@ buildscript {
maven { url = "https://maven.minecraftforge.net/" }
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:5.1.+'
classpath 'net.minecraftforge.gradle:ForgeGradle:[6.0.16,6.2)'
}
}

import com.mohistmc.tasks.JenkinsNumber

import groovy.json.JsonBuilder
import org.apache.tools.ant.filters.ReplaceTokens
import net.minecraftforge.forge.tasks.checks.CheckATs
import net.minecraftforge.forge.tasks.checks.CheckExcs
import net.minecraftforge.forge.tasks.checks.CheckPatches
import net.minecraftforge.forge.tasks.checks.CheckSAS
import net.minecraftforge.forge.tasks.checks.CheckTask

import java.nio.file.Files
import net.minecraftforge.forge.tasks.*
import static net.minecraftforge.forge.tasks.Util.*
import net.minecraftforge.gradle.common.tasks.ApplyBinPatches
import net.minecraftforge.gradle.common.tasks.CheckJarCompatibility
import net.minecraftforge.gradle.common.tasks.DownloadMavenArtifact
import net.minecraftforge.gradle.common.tasks.ExtractInheritance
import net.minecraftforge.gradle.patcher.tasks.GeneratePatches
import net.minecraftforge.gradle.common.tasks.SignJar
import net.minecraftforge.gradle.patcher.tasks.ReobfuscateJar
import org.gradle.plugins.ide.eclipse.model.SourceFolder

plugins {
id 'net.minecraftforge.gradleutils' version '1.+'
id 'com.github.ben-manes.versions' version '0.36.0'
id 'org.cadixdev.licenser' version '0.6.1'
id 'net.minecraftforge.gradleutils' version '[2.2,2.3)'
id 'com.github.ben-manes.versions' version '0.46.0'
id 'eclipse'
id 'de.undercouch.download' version '5.4.0'
}

Util.init() //Init all our extension methods

println('Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))

if (System.getProperty("_JAVA_OPTIONS") == null) {
System.setProperty("_JAVA_OPTIONS", "-Xmx3500M")
}


ext {
JAR_SIGNER = null
MAPPING_CHANNEL = 'official'
MAPPING_VERSION = '1.16.5'
MC_VERSION = '1.16.5'
MCP_VERSION = '20210115.111550'
ASM_VERSION = '9.6'
SPI_VERSION = '3.2.0'
GIT_INFO = gradleutils.gitInfo

MOHIST_VERSION = JenkinsNumber.info()
}
Expand Down Expand Up @@ -101,6 +108,7 @@ project(':mohist') {
apply plugin: 'eclipse'
apply plugin: 'net.minecraftforge.gradle.patcher'

java.toolchain.languageVersion = JavaLanguageVersion.of(8)
group = 'com.mohistmc'

sourceSets {
Expand Down Expand Up @@ -154,15 +162,14 @@ project(':mohist') {
// ForgeMC is a unique identifier for every MC version we have supported.
// Essentially, the same as the old, except dropping the first number, and the builds are no longer unique.
MCP_ARTIFACT = project(':mcp').mcp.config.get()
SPECIAL_SOURCE = 'net.md-5:SpecialSource:1.10.0'
SPECIAL_SOURCE_MCP = 'net.md-5:SpecialSource:1.8.5'
VERSION_JSON = project(':mcp').file('build/mcp/downloadJson/version.json')
BINPATCH_TOOL = 'net.minecraftforge:binarypatcher:1.0.12:fatjar'
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.2.6'
INSTALLER_TOOLS = 'net.minecraftforge:installertools:1.3.0'
}

version = "1.16.5-" + MOHIST_VERSION
String forge_version = "36.2.41"
String forge_version = "36.2.42"
println('Forge Version: ' + forge_version)

patcher {
Expand All @@ -181,6 +188,12 @@ project(':mohist') {
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project.file('run')

// Support Forge devs running on Java 8 and up, including 16
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'

environment 'target', 'fmldevserver'

environment 'MC_VERSION', MC_VERSION
Expand All @@ -206,6 +219,12 @@ project(':mohist') {
main 'net.minecraftforge.userdev.LaunchTesting'
workingDirectory project.file('run')

// Support Forge devs running on Java 8 and up, including 16
jvmArgs '-XX:+IgnoreUnrecognizedVMOptions'
jvmArgs '--add-exports=java.base/sun.security.util=ALL-UNNAMED'
jvmArgs '--add-exports=jdk.naming.dns/com.sun.jndi.dns=java.naming'
jvmArgs '--add-opens=java.base/java.util.jar=ALL-UNNAMED'

environment 'target', 'fmldevdata'
environment 'assetIndex', '{asset_index}'
environment 'assetDirectory', downloadAssets.output
Expand All @@ -230,6 +249,33 @@ project(':mohist') {
}
}

afterEvaluate {
if (!patcher.srgPatches) {
srg2mcpClean {
dependsOn = []
input = project(':mcp').setupMCP.output
}
userdevJar {
onlyIf = { t -> true }
}
def patches = project.file('build/genPatchesForUserdev/output/')
patches.mkdirs()
def genPatchesForUserdev = tasks.register('genPatchesForUserdev', GeneratePatches){
base = project(':mcp').setupMCP.output
modified = applyRangeMapBase.output
originalPrefix = genPatches.originalPrefix
modifiedPrefix = genPatches.modifiedPrefix
output = patches
autoHeader true
lineEnding = '\n'
}
bakePatches {
dependsOn = []
input = genPatchesForUserdev.get().output
}
}
}

ext {
MANIFESTS = [
'/': [
Expand Down Expand Up @@ -312,11 +358,11 @@ project(':mohist') {
fmllauncherImplementation.extendsFrom(installer, implementation)
}
dependencies {
installer 'org.ow2.asm:asm:9.5'
installer 'org.ow2.asm:asm-commons:9.5'
installer 'org.ow2.asm:asm-tree:9.5'
installer 'org.ow2.asm:asm-util:9.5'
installer 'org.ow2.asm:asm-analysis:9.5'
installer 'org.ow2.asm:asm:' + ASM_VERSION
installer 'org.ow2.asm:asm-commons:' + ASM_VERSION
installer 'org.ow2.asm:asm-tree:' + ASM_VERSION
installer 'org.ow2.asm:asm-util:' + ASM_VERSION
installer 'org.ow2.asm:asm-analysis:' + ASM_VERSION
installer 'cpw.mods:modlauncher:mohist-8.1.3'
installer 'cpw.mods:grossjava9hacks:1.3.3'
installer 'net.minecraftforge:accesstransformers:3.0.1'
Expand Down Expand Up @@ -392,20 +438,14 @@ project(':mohist') {
}
}

tasks.named('compileFmllauncherJava') {
java {
sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
}
}

task downloadLibraries(type: DownloadLibraries, dependsOn: ':mcp:setupMCP') {
input = VERSION_JSON
output = rootProject.file('build/libraries/')
}

task extractInheritance(type: ExtractInheritance, dependsOn: [genJoinedBinPatches, downloadLibraries]) {
tool = INSTALLER_TOOLS + ':fatjar'
args.add '--annotations'
input = genJoinedBinPatches.cleanJar
libraries.addAll downloadLibraries.librariesOutput.map { rf -> Files.readAllLines(rf.asFile.toPath()).stream().map(File::new).collect(java.util.stream.Collectors.toList()) }
}
Expand Down Expand Up @@ -446,29 +486,97 @@ project(':mohist') {
}
}

task checkATs(type: CheckATs, dependsOn: [extractInheritance, createSrg2Mcp]) {
inheritance = extractInheritance.output
tasks.register('checkAll') {
dependsOn 'checkLicenses'
group = 'checks'
}
tasks.register('checkAllAndFix') {
dependsOn 'findFieldInstanceChecks', 'checkLicenses'
group = 'checks'
}

CheckTask.registerTask(tasks, 'ATs', CheckATs) {
dependsOn extractInheritance, createSrg2Mcp
ats.from patcher.accessTransformers
inheritance = extractInheritance.output
mappings = createSrg2Mcp.output
}

task checkSAS(type: CheckSAS, dependsOn: extractInheritance) {
inheritance = extractInheritance.output
CheckTask.registerTask(tasks, 'SAS', CheckSAS) {
dependsOn extractInheritance
sass.from patcher.sideAnnotationStrippers
inheritance = extractInheritance.output
}

task checkExcs(type: CheckExcs, dependsOn: jar) {
binary = jar.archiveFile
CheckTask.registerTask(tasks, 'Excs', CheckExcs) {
dependsOn jar
binary = jar.archiveFile.get().asFile
excs.from patcher.excs
}

task checkAll(dependsOn: [checkATs, checkSAS, checkExcs, findFieldInstanceChecks]){}
CheckTask.registerTask(tasks, 'Patches', CheckPatches) {
dependsOn genPatches
patchDir = file("$rootDir/patches")
patchesWithS2SArtifact = [
'minecraft/net/minecraft/client/renderer/ViewFrustum.java.patch',
'minecraft/net/minecraft/data/BlockModelDefinition.java.patch',
]
}

genPatches {
autoHeader true
lineEnding = '\n'
}

def baseForgeVersionProperty = project.objects.property(String)
baseForgeVersionProperty.set(project.provider { getLatestForgeVersion(MC_VERSION) }.map { MC_VERSION + '-' + it })
baseForgeVersionProperty.finalizeValueOnRead()
def jarCompatibilityTaskSetup = { task ->
task.group = 'jar compatibility'
task.onlyIf {
baseForgeVersionProperty.getOrNull() != null
}
}

tasks.register('setupCheckJarCompatibility', SetupCheckJarCompatibility) {
inputVersion = baseForgeVersionProperty
}

tasks.register('applyBaseCompatibilityJarBinPatches', ApplyBinPatches) {
jarCompatibilityTaskSetup(it)

clean = project.tasks.createJoinedSRG.output
patch = project.tasks.named('setupCheckJarCompatibility').flatMap { it.baseBinPatchesOutput }
output = project.layout.buildDirectory.dir(name).map { it.file('output.jar') }
}

tasks.register('mergeBaseForgeJar', MergeJars) {
jarCompatibilityTaskSetup(it)

inputJars.from(project.tasks.named('applyBaseCompatibilityJarBinPatches').flatMap { it.output })
inputJars.from(baseForgeVersionProperty.map { inputVersion ->
def output = project.layout.buildDirectory.dir(name).map { it.file("forge-${inputVersion}-universal.jar") }.get().asFile
project.rootProject.extensions.download.run {
src "https://maven.minecraftforge.net/net/minecraftforge/forge/${inputVersion}/forge-${inputVersion}-universal.jar"
dest output
}
return output
})
}

tasks.register('checkJarCompatibility', CheckJarCompatibility) {
jarCompatibilityTaskSetup(it)
dependsOn 'setupCheckJarCompatibility'

baseJar = project.tasks.named('mergeBaseForgeJar').flatMap { it.output }
baseLibraries.from(project.tasks.named('createJoinedSRG').flatMap { it.output })

inputJar = project.tasks.named('reobfJar').flatMap { it.output }

commonLibraries.from(project.configurations.minecraftImplementation)
commonLibraries.from(project.configurations.installer)
}

task launcherJson(dependsOn: ['signUniversalJar', 'signLauncherJar']) {
inputs.file universalJar.archiveFile
inputs.file { launcherJar.archiveFile }
Expand Down Expand Up @@ -564,7 +672,7 @@ project(':mohist') {

task launcherJar(type: Jar) {
archiveBaseName = 'mohist'
archiveClassifier = 'launcher'
archiveClassifier.set('launcher')
from sourceSets.fmllauncher.output
doFirst {
def classpath = new StringBuilder()
Expand Down Expand Up @@ -599,7 +707,7 @@ project(':mohist') {
}

task downloadInstaller(type: DownloadMavenArtifact) {
artifact = 'net.minecraftforge:installer:2.1.+:shrunk'
artifact = 'net.minecraftforge:installer:2.2.+:fatjar'
changing = true
}

Expand Down Expand Up @@ -733,19 +841,14 @@ project(':mohist') {
task userdevExtras(type:Jar) {
dependsOn classes
from sourceSets.userdev.output
classifier 'userdev-temp'
}

reobfJar {
tool = SPECIAL_SOURCE + ':shaded'
archiveClassifier.set('userdev-temp')
}

task userdevExtrasReobf(type: ReobfuscateJar) {
dependsOn userdevExtras, createMcp2Srg
input = tasks.userdevExtras.archiveFile
classpath.from project.configurations.userdevCompileClasspath
srg = tasks.createMcp2Srg.output
tool = SPECIAL_SOURCE + ':shaded'
}

userdevJar {
Expand Down Expand Up @@ -834,4 +937,4 @@ project(':mohist') {
task setup() {
dependsOn ':clean:extractMapped'
dependsOn ':mohist:extractMapped' //These must be strings so that we can do lazy resolution. Else we need evaluationDependsOnChildren above
}
}
8 changes: 6 additions & 2 deletions buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
repositories {
maven { url = 'https://maven.minecraftforge.net/' }
mavenCentral()
}
dependencies {
implementation 'org.ow2.asm:asm:9.0'
implementation 'org.ow2.asm:asm-tree:9.0'
implementation 'org.ow2.asm:asm:9.6'
implementation 'org.ow2.asm:asm-tree:9.6'
implementation 'net.minecraftforge:srgutils:0.4.+'
implementation 'commons-io:commons-io:2.12.0'
implementation 'com.google.code.gson:gson:2.10'
}
Loading

0 comments on commit 281a642

Please sign in to comment.