Skip to content

Commit

Permalink
Start release/1.21.2
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions[bot] committed Oct 22, 2024
1 parent 9a0151e commit 0885d10
Show file tree
Hide file tree
Showing 127 changed files with 254,060 additions and 91 deletions.
28 changes: 15 additions & 13 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,11 @@ subprojects {
mergetool
renametool
mergemaptool
nfrt {
canBeResolved = true
canBeConsumed = false
transitive = false
}
if (MCINJECTOR) {
mcinjector
}
Expand Down Expand Up @@ -191,6 +196,7 @@ subprojects {
transitive = false
}
}
nfrt "net.neoforged:neoform-runtime:1.0.4:all"
}

task downloadJson(type: Download, dependsOn: rootProject.downloadVersionManifest) {
Expand Down Expand Up @@ -224,20 +230,14 @@ subprojects {
config = CONFIG
dest = new File(gradle.gradleUserHomeDir, '/caches/neoform/libraries/')
}
task downloadAssets(type: DownloadAssets, dependsOn: downloadJson) {
json = downloadJson.dest
dest = new File(gradle.gradleUserHomeDir, '/caches/neoform/assets/')
}

task createAssetsData(type: CreateAssetsDataJson, dependsOn: downloadAssets) {
assets = downloadAssets.dest
json = downloadJson.dest

dest = file(PATH_CACHED_VERSION + 'assets.json')
task downloadAssets(type: DownloadAssets) {
assetJson = file(PATH_CACHED_VERSION + 'assets.json')
nfrt = configurations.nfrt
minecraftVersion = version
}

task createAssetsDataJar(type: Jar, dependsOn: downloadAssets) {
from createAssetsData.dest
from downloadAssets.assetJson
destinationDirectory = file(PATH_CACHED_VERSION)
archiveFileName = 'assets.json.jar'
}
Expand Down Expand Up @@ -469,11 +469,12 @@ subprojects {
CONFIG?.libraries?.get(side)?.each { library "'${it}'" }
version = project.name
libraryFile child.extra.extra.get().getAsFile()
if (child.assets)
if (child.assets) {
libraryFile createAssetsDataJar.archiveFile.get().asFile
assetJsonFile = downloadAssets.assetJson
}
replace '{java_target}', JAVA_TARGET + ''
replaceFile '{inject}', PATH_INJECT
replaceFile '{assets}', child.assets ? downloadAssets.dest : null
replaceFile '{natives}', child.jsonlibs ? extractNatives.dest : null
replaceFile '{merged_src}', MERGE_PATCHES ? project.file('projects/shared') : null
}
Expand Down Expand Up @@ -537,6 +538,7 @@ subprojects {
[name: 'hotspot20', Name: 'HotSpot20', version: 20, official: false],
[name: 'hotspot21', Name: 'HotSpot21', version: 21, official: false],
[name: 'hotspot22', Name: 'HotSpot22', version: 22, official: false],
[name: 'hotspot23', Name: 'HotSpot23', version: 23, official: false],
[name: 'official8', Name: 'Official8', version: 8, official: true ],
[name: 'official16', Name: 'Official16', version: 16, official: true ],
[name: 'official17', Name: 'Official17', version: 17, official: true ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ public abstract class ApplyPatches extends DefaultTask {
def patches = patches.get().asFile

def result = PatchOperation.builder()
.logTo((Consumer<String>){logger.log(it, LogLevel.LIFECYCLE)})
.logTo((Consumer<String>){logger.log(LogLevel.LIFECYCLE, it)})
.baseInput(Input.MultiInput.archive(ArchiveFormat.ZIP, baseZip.toPath()))
.patchesInput(Input.MultiInput.folder(patches.toPath()))
.patchedOutput(Output.MultiOutput.folder(output.toPath()))
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,9 @@
package net.minecraftforge.mcpconfig.tasks;

import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.provider.*
import org.gradle.api.tasks.*

import java.util.TreeSet

abstract class CreateFernflowerLibraries extends SingleFileOutput {
@InputFile abstract RegularFileProperty getMeta()
@Input abstract MapProperty<String, Object> getConfig()
Expand Down Expand Up @@ -34,6 +31,6 @@ abstract class CreateFernflowerLibraries extends SingleFileOutput {
}

config.get().libraries.get(side.get())?.collect{ it.toMavenPath() }?.each { libs.add(new File(root.get().getAsFile(), it)) }
dest.get().getAsFile().text = libs.collect{ '-e=' + it.absolutePath }.join('\n')
dest.get().getAsFile().write(libs.collect{ '-e=' + it.absolutePath }.join('\n'), "UTF-8")
}
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,12 @@
package net.minecraftforge.mcpconfig.tasks

import java.util.HashMap
import java.util.HashSet
import java.util.ArrayList
import java.util.List
import java.util.Set

import java.util.zip.ZipFile
import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.provider.*
import org.gradle.api.tasks.*
import groovy.json.JsonSlurper
import net.neoforged.srgutils.IMappingFile

public abstract class CreateProjectTemplate extends DefaultTask {
@Input abstract Property<String> getDistro()
Expand All @@ -22,7 +17,8 @@ public abstract class CreateProjectTemplate extends DefaultTask {
@Input abstract MapProperty<String, String> getReplace()
@Internal abstract ConfigurableFileCollection getDirectories()
@Input abstract Property<String> getVersion()

@Optional @InputFile abstract RegularFileProperty getAssetJsonFile()

@OutputDirectory abstract RegularFileProperty getDest()

def library(lib) {
Expand All @@ -41,7 +37,7 @@ public abstract class CreateProjectTemplate extends DefaultTask {
if (value == null) {
replace(key, 'null')
} else {
replace(key, "'" + value.get().getAsFile().absolutePath.replace('\\', '/') + "'")
replace(key, escapePathForGradle(value.get().getAsFile().absolutePath))
directories + value
}
}
Expand All @@ -50,11 +46,15 @@ public abstract class CreateProjectTemplate extends DefaultTask {
if (value == null) {
replace(key, 'null')
} else {
replace(key, "'" + value.absolutePath.replace('\\', '/') + "'")
replace(key, escapePathForGradle(value.absolutePath))
directories + value
}
}


private static String escapePathForGradle(String path) {
return "'" + path.replace('\\', '/') + "'"
}

@TaskAction
protected void exec() {
if (!dest.get().getAsFile().exists())
Expand Down Expand Up @@ -89,7 +89,12 @@ public abstract class CreateProjectTemplate extends DefaultTask {
def v = replace.get().get(k)
data = data.replace(k, v)
}


if (getAssetJsonFile().isPresent()) {
def assetInfo = new JsonSlurper().parse(getAssetJsonFile().get().asFile)
data = data.replace("{assets}", escapePathForGradle(assetInfo.assets))
}

new File(dest.get().getAsFile(), 'build.gradle').withWriter('UTF-8') { it.write(data) }
}
}
Original file line number Diff line number Diff line change
@@ -1,70 +1,72 @@
package net.minecraftforge.mcpconfig.tasks

import org.gradle.api.*
import org.gradle.api.file.*
import org.gradle.api.tasks.*
import de.undercouch.gradle.tasks.download.*
import org.gradle.api.DefaultTask
import org.gradle.api.file.ConfigurableFileCollection
import org.gradle.api.file.RegularFileProperty
import org.gradle.api.provider.Property
import org.gradle.api.tasks.Input
import org.gradle.api.tasks.InputFiles
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.gradle.jvm.toolchain.JavaLanguageVersion
import org.gradle.jvm.toolchain.JavaToolchainService
import org.gradle.process.ExecOperations
import org.gradle.work.DisableCachingByDefault

public abstract class DownloadAssets extends DefaultTask {
@InputFile abstract RegularFileProperty getJson()
@OutputDirectory abstract RegularFileProperty getDest()
@Internal DownloadAction indexAction
@Internal DownloadAction assetAction
import javax.inject.Inject

DownloadAssets() {
indexAction = new DownloadAction(project, this)
indexAction.onlyIfModified(true)
indexAction.useETag('all')
assetAction = new DownloadAction(project, this)
assetAction.overwrite(false)
assetAction.useETag('all')
}

@TaskAction
def exec() {
Utils.init()

def dl = json.get().getAsFile().json.assetIndex
def index = new File(dest.get().getAsFile(), 'indexes/' + dl.id + '.json')
if (index.sha1 != dl.sha1) {
indexAction.src dl.url
indexAction.dest index
indexAction.execute().join()
}

def assets = [] as Set // Some assets are copies of other assets
@DisableCachingByDefault(because = "has its own caching")
abstract class DownloadAssets extends DefaultTask {
/**
* Writes a JSON file detailing the path to the asset index and asset root.
*/
@OutputFile
abstract RegularFileProperty getAssetJson()

/**
* Points to the single executable jar for
* https://projects.neoforged.net/neoforged/neoformruntime
*/
@InputFiles
abstract ConfigurableFileCollection getNfrt();

assetAction.dest(new File(dest.get().getAsFile(), 'objects'))
index.json.objects.each { asset ->
def key = asset.value.hash.take(2) + '/' + asset.value.hash
def target = new File(dest.get().getAsFile(), 'objects/' + key)
if (!target.exists() && assets.add(asset.value.hash)) {
assetAction.src('https://resources.download.minecraft.net/' + key)
}
}
/**
* The Minecraft version matching the NeoForge version to install.
*/
@Input
abstract Property<String> getMinecraftVersion();

if (assets.size() > 1) {
assetAction.eachFile(new Action<DownloadDetails>() {
@Override
public void execute(DownloadDetails details) {
details.relativePath = new RelativePath(false, details.sourceURL.toString().replace('https://resources.download.minecraft.net/', ''))
}
})
} else if (assets.size() == 1) {
assetAction.dest(new File(dest.get().getAsFile(), 'objects/' + assets[0].take(2) + '/' + assets[0]))
}
@Inject
abstract ExecOperations getExecOperations();

if (!assets.isEmpty()) {
assetAction.execute()
}
@Inject
abstract JavaToolchainService getJavaToolchainService();

@Input
abstract Property<String> getJavaExecutable();

DownloadAssets() {
// Run NFRT with Java 21
getJavaExecutable().set(
getJavaToolchainService()
.launcherFor { spec -> spec.languageVersion = JavaLanguageVersion.of(21) }
.map { it.executablePath.asFile.absolutePath }
)
}

def download(def url, def target) {
def ret = new DownloadAction(project, this)
ret.overwrite(false)
ret.useETag('all')
ret.src url
ret.dest target
ret.execute()
@TaskAction
def exec() {
// Download Minecraft Assets and write asset index and location to JSON file to read back for starting the game
execOperations.javaexec(spec -> {
spec.executable = getJavaExecutable().get()
spec.classpath(getNfrt().getSingleFile());
spec.args(
"download-assets",
"--minecraft-version",
minecraftVersion.get(),
"--write-json",
assetJson.get().asFile.getAbsolutePath()
);
});
}
}
}
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.1-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
5 changes: 4 additions & 1 deletion gradlew
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
#

##############################################################################
#
Expand Down Expand Up @@ -84,7 +86,8 @@ done
# shellcheck disable=SC2034
APP_BASE_NAME=${0##*/}
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
' "$PWD" ) || exit

# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD=maximum
Expand Down
2 changes: 2 additions & 0 deletions gradlew.bat
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@rem SPDX-License-Identifier: Apache-2.0
@rem

@if "%DEBUG%"=="" @echo off
@rem ##########################################################################
Expand Down
39 changes: 39 additions & 0 deletions versions/release/1.21.2/config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"official": true,
"merge_patches": true,
"java_target": 21,
"encoding": "UTF-8",
"test_remap_official": false,
"fernflower": {
"version": "org.vineflower:vineflower:1.10.1",
"java_version": 21,
"args": ["--decompile-inner", "--remove-bridge", "--decompile-generics", "--ascii-strings", "--remove-synthetic", "--include-classpath", "--variable-renaming=jad", "--ignore-invalid-bytecode", "--bytecode-source-mapping", "--dump-code-lines", "--indent-string= ", "--log-level=TRACE", "-cfg", "{libraries}", "{input}", "{output}"],
"jvmargs": ["-Xmx4G"]
},
"merge": {
"version": "net.neoforged:mergetool:2.0.3:fatjar",
"args": ["--client", "{client}", "--server", "{server}", "--ann", "{version}", "--output", "{output}", "--inject", "false"],
"jvmargs": []
},
"rename": {
"version": "net.neoforged:AutoRenamingTool:2.0.4:all",
"args": ["--input", "{input}", "--output", "{output}", "--map", "{mappings}", "--cfg", "{libraries}", "--ann-fix", "--ids-fix", "--src-fix", "--record-fix", "--unfinal-params"]
},
"bundler_extract_jar": {
"version": "net.neoforged.installertools:installertools:2.1.2:fatjar",
"args": ["--task", "bundler_extract", "--input", "{input}", "--output", "{output}", "--jar-only"]
},
"bundler_extract_libs": {
"version": "net.neoforged.installertools:installertools:2.1.2:fatjar",
"args": ["--task", "bundler_extract", "--input", "{input}", "--output", "{output}", "--libraries"]
},
"mergemap": {
"version": "net.neoforged.installertools:installertools:2.1.2:fatjar",
"args": ["--task", "MERGE_MAPPING", "--left", "{mappings}", "--right", "{official}", "--right-names", "right,left", "--classes", "--fields", "--methods", "--output", "{output}"]
},
"libraries": {
"client": ["com.google.code.findbugs:jsr305:3.0.2", "ca.weblite:java-objc-bridge:1.1", "org.jetbrains:annotations:26.0.1"],
"server": ["com.google.code.findbugs:jsr305:3.0.2", "org.jetbrains:annotations:26.0.1"],
"joined": ["com.google.code.findbugs:jsr305:3.0.2", "ca.weblite:java-objc-bridge:1.1", "net.neoforged:mergetool:2.0.3:api", "org.jetbrains:annotations:26.0.1"]
}
}
Loading

0 comments on commit 0885d10

Please sign in to comment.