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

gradle cleanup #645

Draft
wants to merge 24 commits into
base: 24w40a
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
cf40d52
complete SharedConstants
supersaiyansubtlety Sep 22, 2024
82ceedd
complete n.m.village
supersaiyansubtlety Sep 22, 2024
31a647b
remove 'registryKey' from simple_type_field_names
supersaiyansubtlety Sep 22, 2024
8b28730
registry work
supersaiyansubtlety Sep 22, 2024
a88c6ec
complete n.m.registry.tag, more registry work
supersaiyansubtlety Sep 23, 2024
e5ce8c3
explicitly map CommandTreeUpdateS2CPacket consturctor param to work a…
supersaiyansubtlety Sep 24, 2024
3e107f0
complete n.m.registry
supersaiyansubtlety Sep 24, 2024
31f60c0
Add class comments to new simple type names
supersaiyansubtlety Sep 24, 2024
cd0714c
map ~97/270 RegsitryKeys affected by their removal from simple type n…
supersaiyansubtlety Sep 25, 2024
fe1096c
complete Items with the help of simple type names
supersaiyansubtlety Sep 25, 2024
bfce206
half way there! (through RegistryKeys affected by their removal from …
supersaiyansubtlety Sep 25, 2024
afe70fb
finished! fixing up RegistryKeys affected by their removal from simpl…
supersaiyansubtlety Sep 25, 2024
f09e955
fix typos
supersaiyansubtlety Sep 25, 2024
a1a050b
remove FindInvalidSimpleTypeFieldNamesTask stub for separate PR
supersaiyansubtlety Sep 25, 2024
8d5f91f
fixup a few things folling self-review
supersaiyansubtlety Sep 25, 2024
89139e6
make simple_type_field_names an input of insertAutoGeneratedMappings …
supersaiyansubtlety Sep 26, 2024
3158034
make simple_type_field_names an input of insertAutoGeneratedMappings …
supersaiyansubtlety Sep 28, 2024
0b2b23f
replace MappingTask::getTaskByType with MappingsTask::getTaskNamed; t…
supersaiyansubtlety Sep 28, 2024
617179f
the registerening
supersaiyansubtlety Sep 28, 2024
ce5a5ed
move downloadVersionsManifest and downloadWantedVersionManifest confi…
supersaiyansubtlety Sep 28, 2024
32b7c0e
move downloadMinecraftJars, extractServerJar, and mergeJars configura…
supersaiyansubtlety Sep 28, 2024
5616c3a
move downloadMinecraftLibraries and openGlConstantUnpickGenerator con…
supersaiyansubtlety Sep 29, 2024
3d15b0e
AbstractDownloadMappingsTask -> DownloadMappingsTask, reworked its pr…
supersaiyansubtlety Sep 30, 2024
6391a20
move conventions for MergeTinyTask, MergeTinyV2Task, and MergeInterme…
supersaiyansubtlety Oct 1, 2024
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
15 changes: 9 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ plugins {
id "mappings-logic"
}

mappings {
enigmaProfile = file("enigma_profile.json")
}

def USE_SNAPSHOT_HASHES = false

def minecraft_version = Constants.MINECRAFT_VERSION
Expand Down Expand Up @@ -92,7 +96,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 @@ -115,11 +118,10 @@ clean.doFirst {

tasks.build.dependsOn "compressTiny", "tinyJar", "v2UnmergedMappingsJar", "v2MergedMappingsJar"

task insertAutoGeneratedMappings(dependsOn: [buildMappingsTiny, downloadPerVersionMappings], type: AddProposedMappingsTask) {
inputJar.set mappings.fileConstants.perVersionMappingsJar
inputMappings.set buildMappingsTiny.outputMappings
profile.set file("enigma_profile.json")
}
// task insertAutoGeneratedMappings(dependsOn: [buildMappingsTiny, downloadPerVersionMappings], type: AddProposedMappingsTask) {
// inputJar.set mappings.fileConstants.perVersionMappingsJar
// inputMappings.set buildMappingsTiny.outputMappings
// }

combineUnpickDefinitions {
input = mappings.fileConstants.unpickDefinitions
Expand Down Expand Up @@ -188,6 +190,7 @@ task mappings(type: EnigmaMappingsTask, dependsOn: "mapPerVersionMappingsJar") {

build.dependsOn constantsJar, generatePackageInfoMappings

// TODO despaghetify this
task v2UnmergedMappingsJar(type: MappingsV2JarTask, dependsOn: [insertAutoGeneratedMappings, combineUnpickDefinitions]) {
archiveFileName = "${Constants.MAPPINGS_NAME}-${Constants.MAPPINGS_VERSION}-v2.jar"
mappings = insertAutoGeneratedMappings.outputMappings
Expand Down
4 changes: 4 additions & 0 deletions buildSrc/src/main/java/quilt/internal/Constants.java
Original file line number Diff line number Diff line change
@@ -1,12 +1,16 @@
package quilt.internal;

// TODO consider moving these to MappingsExtension
public class Constants {
public static final String MINECRAFT_VERSION = "24w38a";

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

public static final String PER_VERSION_MAPPINGS_NAME = "hashed";

// TODO replace duplicates with this
public static final String INTERMEDIARY_MAPPINGS_NAME = "intermediary";

public static final String MAPPINGS_VERSION = MINECRAFT_VERSION + "+build." + System.getenv().getOrDefault("BUILD_NUMBER", "local");

public static final class Groups {
Expand Down
47 changes: 43 additions & 4 deletions buildSrc/src/main/java/quilt/internal/MappingsExtension.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,54 @@
package quilt.internal;

import org.gradle.api.GradleException;
import org.gradle.api.Project;
import org.gradle.api.file.RegularFile;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.provider.Provider;
import org.quiltmc.enigma.api.EnigmaProfile;

import java.io.File;
import java.io.IOException;

public abstract class MappingsExtension {
public final Provider<EnigmaProfile> enigmaProfile;

public class MappingsExtension {
private final FileConstants fileConstants;

public MappingsExtension(Project target) {
fileConstants = new FileConstants(target);
public static MappingsExtension get(Project project) {
return project.getExtensions().getByType(MappingsExtension.class);
}

protected abstract RegularFileProperty getEnigmaProfileFile();

public MappingsExtension(Project project) {
this.fileConstants = new FileConstants(project);

this.enigmaProfile = this.getEnigmaProfileFile()

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maped providers are not cached, and I assume this is used in several placed -- so instead of having, say, a public final Provider<EnigmaProfile> enigmaProfile, have a Property<EnigmaProfile> and set it to the mapped provider, which is cached

.map(RegularFile::getAsFile)
.map(File::toPath)
.map(profilePath -> {
try {
return EnigmaProfile.read(profilePath);
} catch (IOException e) {
throw new GradleException("Failed to read enigma profile", e);
}
});
}

public FileConstants getFileConstants() {
return fileConstants;
return this.fileConstants;
}

public void setEnigmaProfile(File file) {
this.getEnigmaProfileFile().set(file);
}

public void setEnigmaProfile(RegularFile file) {
this.getEnigmaProfileFile().set(file);
}

public void setEnigmaProfile(Provider<? extends RegularFile> fileProvider) {
this.getEnigmaProfileFile().set(fileProvider);
}
}
Loading