Skip to content

Commit

Permalink
Merge remote-tracking branch 'refs/remotes/quiltmc/24w40a' into recipes
Browse files Browse the repository at this point in the history
# Conflicts:
#	mappings/net/minecraft/recipe/InputSlotFiller.mapping
#	mappings/net/minecraft/recipe/RecipeMatcher.mapping
  • Loading branch information
ix0rai committed Oct 7, 2024
2 parents c9519e5 + a449f67 commit 61e2203
Show file tree
Hide file tree
Showing 1,197 changed files with 4,318 additions and 6,190 deletions.
16 changes: 13 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,6 @@ dependencies {
intermediary "net.fabricmc:intermediary:${minecraft_version}:v2"
}


import org.objectweb.asm.ClassVisitor
import org.objectweb.asm.Opcodes
import org.quiltmc.draftsman.asm.visitor.DraftsmanAdapterClassVisitor
Expand All @@ -104,6 +103,7 @@ import quilt.internal.tasks.build.TransformJarClassesTask
import quilt.internal.tasks.decompile.DecompileTask
import quilt.internal.tasks.jarmapping.MapPerVersionMappingsJarTask
import quilt.internal.tasks.mappings.EnigmaMappingsTask
import quilt.internal.tasks.mappings.EnigmaMappingsServerTask
import quilt.internal.tasks.unpick.RemapUnpickDefinitionsTask
import quilt.internal.tasks.unpick.UnpickJarTask
import quilt.internal.util.MappingsJavadocProvider
Expand All @@ -116,9 +116,11 @@ clean.doFirst {
tasks.build.dependsOn "compressTiny", "tinyJar", "v2UnmergedMappingsJar", "v2MergedMappingsJar"

task insertAutoGeneratedMappings(dependsOn: [buildMappingsTiny, downloadPerVersionMappings], type: AddProposedMappingsTask) {
final enigmaProfile = file("enigma_profile.json")

inputJar.set mappings.fileConstants.perVersionMappingsJar
inputMappings.set buildMappingsTiny.outputMappings
profile.set file("enigma_profile.json")
profile.set enigmaProfile
}

combineUnpickDefinitions {
Expand Down Expand Up @@ -184,6 +186,14 @@ task mappings(type: EnigmaMappingsTask, dependsOn: "mapPerVersionMappingsJar") {
jarToMap.set mappings.fileConstants.perVersionMappingsJar
}

task mappingsUnpickedServer(type: EnigmaMappingsServerTask, dependsOn: unpickHashedJar) {
jarToMap.set unpickHashedJar.outputFile.get()
}

task mappingsServer(type: EnigmaMappingsServerTask, dependsOn: "mapPerVersionMappingsJar") {
jarToMap.set project.extensions.mappings.fileConstants.perVersionMappingsJar
}

// Only build jars for package infos if we need to actually expose stuff like annotation in the future.

build.dependsOn constantsJar, generatePackageInfoMappings
Expand Down Expand Up @@ -351,7 +361,7 @@ javadoc {
destinationDir = file("${buildDir}/docs/${project.version}")
def docletResources = sourceSets.doclet.resources.asFileTree

failOnError = false // Failing on error is important to ensure that a Javadoc jar is available.
failOnError = true // Failing on error is important to ensure that a Javadoc jar is available.
maxMemory = '2G'

// verbose = true // enable to debug
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/java/quilt/internal/Constants.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package quilt.internal;

public class Constants {
public static final String MINECRAFT_VERSION = "24w33a";
public static final String MINECRAFT_VERSION = "24w40a";

public static final String MAPPINGS_NAME = "quilt-mappings";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,30 @@

import java.io.BufferedWriter;
import java.io.File;
import java.io.IOException;
import java.io.PrintWriter;
import java.io.Reader;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Locale;
import java.util.Objects;

import java.util.stream.Stream;

import org.gradle.api.GradleException;
import org.gradle.api.file.FileCollection;
import org.gradle.api.file.RegularFile;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.tasks.InputFiles;
import org.gradle.api.tasks.Optional;
import org.jetbrains.annotations.NotNull;
import org.quiltmc.enigma.api.Enigma;
import org.quiltmc.enigma.api.EnigmaProfile;
import org.quiltmc.enigma.api.EnigmaProject;
import org.quiltmc.enigma.api.service.JarIndexerService;
import org.quiltmc.enigma.command.Command;
import org.quiltmc.enigma.command.FillClassMappingsCommand;
import org.quiltmc.enigma.command.CommandsUtil;
Expand All @@ -38,35 +49,63 @@
import quilt.internal.Constants;
import quilt.internal.tasks.DefaultMappingsTask;

public class AddProposedMappingsTask extends DefaultMappingsTask {
import static org.quiltmc.enigma_plugin.Arguments.SIMPLE_TYPE_FIELD_NAMES_PATH;

public abstract class AddProposedMappingsTask extends DefaultMappingsTask {
private static Path getPath(RegularFileProperty fileProperty) {
return fileProperty.map(RegularFile::getAsFile).map(File::toPath).get();
}

@OutputFile
public File outputMappings;

@InputFile
private final Property<File> inputJar;
public abstract RegularFileProperty getInputJar();

@InputFile
private final Property<File> inputMappings;
public abstract RegularFileProperty getInputMappings();

@InputFile
private final Property<File> profile;
public abstract RegularFileProperty getProfile();

@Optional
@InputFiles
protected abstract Property<FileCollection> getSimpleTypeFieldNames();

public AddProposedMappingsTask() {
super(Constants.Groups.BUILD_MAPPINGS_GROUP);
outputMappings = new File(fileConstants.buildDir, getName() + ".tiny");
inputJar = getProject().getObjects().property(File.class);
inputMappings = getProject().getObjects().property(File.class);
profile = getProject().getObjects().property(File.class);
this.outputMappings = new File(fileConstants.buildDir, getName() + ".tiny");

this.getSimpleTypeFieldNames().set(
this.getProfile()
.map(RegularFile::getAsFile)
.map(File::toPath)
.map(profilePath -> {
try {
return this.getProject().files(
EnigmaProfile.read(profilePath).getServiceProfiles(JarIndexerService.TYPE).stream()
.flatMap(service -> service.getArgument(SIMPLE_TYPE_FIELD_NAMES_PATH).stream())
.map(stringOrStrings -> stringOrStrings.mapBoth(Stream::of, Collection::stream))
.flatMap(bothStringStreams ->
bothStringStreams.left().orElseGet(bothStringStreams::rightOrThrow)
)
.toList()
);
} catch (IOException e) {
throw new GradleException("Failed to read enigma profile", e);
}
})
);
}

@TaskAction
public void addProposedMappings() throws Exception {
getLogger().lifecycle(":seeking auto-mappable entries");

Path input = inputMappings.get().toPath();
Path input = getPath(this.getInputMappings());
Path output = outputMappings.toPath();
Path jar = inputJar.get().toPath();
Path profilePath = profile.map(File::toPath).get();
Path jar = getPath(this.getInputJar());
Path profilePath = getPath(this.getProfile());

addProposedMappings(input, output, fileConstants.tempDir.toPath(), jar, profilePath);
}
Expand Down Expand Up @@ -204,16 +243,4 @@ public File getOutputMappings() {
public void setOutputMappings(File outputMappings) {
this.outputMappings = outputMappings;
}

public Property<File> getInputJar() {
return inputJar;
}

public Property<File> getInputMappings() {
return inputMappings;
}

public Property<File> getProfile() {
return profile;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ public void run() {
final Multimap<String, File> allMappings = HashMultimap.create();
final Set<String> duplicateMappings = new HashSet<>();
final List<File> emptyFiles = new ArrayList<>();
final List<File> mapNoClassFiles = new ArrayList<>();
final List<File> wrongExtensionFiles = new ArrayList<>();

try (Stream<Path> mappingPaths = Files.walk(getMappingDirectory().get().getAsFile().toPath())) {
Expand All @@ -42,15 +41,14 @@ public void run() {
try (var reader = new BufferedReader(new FileReader(mappingFile))) {
final String firstLine = reader.readLine();
if (firstLine != null) {
getClassMatch(firstLine).ifPresentOrElse(
getClassMatch(firstLine).ifPresent(
classMatch -> {
final Collection<File> classMappings = allMappings.get(classMatch);

if (!classMappings.isEmpty()) duplicateMappings.add(classMatch);

classMappings.add(mappingFile);
},
() -> mapNoClassFiles.add(mappingFile)
}
);
} else {
emptyFiles.add(mappingFile);
Expand Down Expand Up @@ -98,19 +96,6 @@ public void run() {
}
}

if (!mapNoClassFiles.isEmpty()) {
final String message = "%d file%s not mapping a class".formatted(
mapNoClassFiles.size(),
mapNoClassFiles.size() == 1 ? "" : "s"
);
errorMessages.add(message);

LOGGER.error("Found {}!", message);
for (final File mapNoClassFile : mapNoClassFiles) {
LOGGER.error("\t{}", mapNoClassFile);
}
}

if (!wrongExtensionFiles.isEmpty()) {
final String message = "%d file%s without the mapping extension".formatted(
wrongExtensionFiles.size(),
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
package quilt.internal.tasks.mappings;

import org.gradle.api.Project;
import org.gradle.api.file.DirectoryProperty;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.tasks.InputDirectory;
import org.gradle.api.tasks.InputFile;
import org.gradle.api.tasks.JavaExec;
import quilt.internal.Constants;
import quilt.internal.tasks.MappingsTask;

import java.util.ArrayList;
import java.util.List;

public abstract class EnigmaMappingsServerTask extends JavaExec implements MappingsTask {
@InputFile
private final RegularFileProperty jarToMap;
@InputDirectory
protected abstract DirectoryProperty getMappings();

private final List<String> serverArgs;

public EnigmaMappingsServerTask() {
final Project project = this.getProject();
this.setGroup(Constants.Groups.MAPPINGS_GROUP);
this.getMainClass().set("org.quiltmc.enigma.network.DedicatedEnigmaServer");
this.classpath(project.getConfigurations().getByName("enigmaRuntime"));
this.jvmArgs("-Xmx2048m");

this.jarToMap = getObjectFactory().fileProperty();
this.getMappings().convention(project.getLayout().dir(project.provider(() -> project.file("mappings"))));

this.serverArgs = new ArrayList<>();

if (project.hasProperty("port")) {
this.serverArgs.add("-port");
this.serverArgs.add(project.getProperties().get("port").toString());
}
if (project.hasProperty("password")) {
this.serverArgs.add("-password");
this.serverArgs.add(project.getProperties().get("password").toString());
}
if (project.hasProperty("log")) {
this.serverArgs.add("-log");
this.serverArgs.add(project.getProperties().get("log").toString());
} else {
this.serverArgs.add("-log");
this.serverArgs.add("build/logs/server.log");
}
if (project.hasProperty("args")) {
this.serverArgs.addAll(List.of(project.getProperties().get("args").toString().split(" ")));
}
}

@Override
public void exec() {
var args = new ArrayList<>(List.of(
"-jar", this.jarToMap.get().getAsFile().getAbsolutePath(),
"-mappings", this.getMappings().get().getAsFile().getAbsolutePath(),
"-profile", "enigma_profile.json"
));
args.addAll(this.serverArgs);

args(args);
super.exec();
}

public RegularFileProperty getJarToMap() {
return this.jarToMap;
}
}
4 changes: 4 additions & 0 deletions buildSrc/src/main/resources/minecraft_specific_words.txt
Original file line number Diff line number Diff line change
Expand Up @@ -105,6 +105,7 @@ whitelist
whitelisted
shorthair
highlightable
timespan

// commands
deop
Expand Down Expand Up @@ -154,12 +155,14 @@ colormap
dpfail
dppass
framebuffer
framegraph
framerate
fullscreen
gequal
glfw
glsl
glx
grayscale
hsv
keyframe
lacunarity
Expand Down Expand Up @@ -513,6 +516,7 @@ unicode

// registry
memoize
memoized
unregister

// javadoc
Expand Down
5 changes: 4 additions & 1 deletion enigma_profile.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@
"id": "enigma:specialized_method_name_proposer"
},
{
"id": "quiltmc:name_proposal"
"id": "quiltmc:name_proposal",
"args": {
"disable_map_non_hashed": "false"
}
}
],
"jar_indexer": {
Expand Down
4 changes: 2 additions & 2 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ download_task = "4.1.1"
guava = "33.2.1-jre"
jackson_xml = "2.14.1"
launchermeta_parser = "1.0.0"
enigma = "2.4.2"
enigma_plugin = "2.2.2"
enigma = "2.5.0"
enigma_plugin = "2.2.3"
tiny_remapper = "0.7.2"
stitch = "0.6.1"
unpick = "3.0.8"
Expand Down
2 changes: 0 additions & 2 deletions mappings/com/mojang/blaze3d/font/Font.mapping
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
CLASS net/minecraft/unmapped/C_wywmjnuh com/mojang/blaze3d/font/Font
FIELD f_yricfcax BASELINE F
METHOD close close ()V
METHOD m_ftqqrdgk getProvidedGlyphs ()Lit/unimi/dsi/fastutil/ints/IntSet;
COMMENT {@return the set of code points for which this font can provide glyphs}
METHOD m_ojontmif getGlyph (I)Lnet/minecraft/unmapped/C_sxmfadan;
ARG 1 codePoint
CLASS C_bavmfosz Filtered
METHOD close close ()V
3 changes: 1 addition & 2 deletions mappings/com/mojang/blaze3d/font/Glyph.mapping
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
CLASS net/minecraft/unmapped/C_sxmfadan com/mojang/blaze3d/font/Glyph
METHOD bake bake (Ljava/util/function/Function;)Lnet/minecraft/unmapped/C_wrqtxozz;
METHOD bake (Ljava/util/function/Function;)Lnet/minecraft/unmapped/C_wrqtxozz;
ARG 1 baker
METHOD getAdvance getAdvance ()F
METHOD m_orjzkxxs getShadowOffset ()F
METHOD m_tbyurgqb getBoldOffset ()F
METHOD m_tivsypqx getAdvance (Z)F
Expand Down
Loading

0 comments on commit 61e2203

Please sign in to comment.