Remove "namedElements" when debof (#1435)

This commit is contained in:
modmuss
2025-11-08 23:20:06 +00:00
committed by GitHub
parent 03d4fd077b
commit 549edb7ad9
3 changed files with 15 additions and 11 deletions

View File

@@ -149,8 +149,10 @@ public abstract class CompileConfiguration implements Runnable {
finalizedBy("eclipse", "genEclipseRuns");
// Add the "dev" jar to the "namedElements" configuration
getProject().artifacts(artifactHandler -> artifactHandler.add(Configurations.NAMED_ELEMENTS, getTasks().named("jar")));
if (!extension.disableObfuscation()) {
// Add the "dev" jar to the "namedElements" configuration
getProject().artifacts(artifactHandler -> artifactHandler.add(Configurations.NAMED_ELEMENTS, getTasks().named("jar")));
}
// Ensure that the encoding is set to UTF-8, no matter what the system default is
// this fixes some edge cases with special characters not displaying correctly

View File

@@ -126,15 +126,15 @@ public abstract class LoomConfigurations implements Runnable {
});
});
registerNonTransitive(Constants.Configurations.MAPPING_CONSTANTS, Role.RESOLVABLE);
register(Constants.Configurations.NAMED_ELEMENTS, Role.CONSUMABLE).configure(configuration -> {
configuration.extendsFrom(getConfigurations().getByName(JavaPlugin.API_CONFIGURATION_NAME));
});
extendsFrom(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, Constants.Configurations.MAPPING_CONSTANTS);
if (!extension.disableObfuscation()) {
registerNonTransitive(Constants.Configurations.MAPPING_CONSTANTS, Role.RESOLVABLE);
register(Constants.Configurations.NAMED_ELEMENTS, Role.CONSUMABLE).configure(configuration -> {
configuration.extendsFrom(getConfigurations().getByName(JavaPlugin.API_CONFIGURATION_NAME));
});
extendsFrom(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, Constants.Configurations.MAPPING_CONSTANTS);
register(Constants.Configurations.MAPPINGS, Role.RESOLVABLE);
register(Constants.Configurations.MAPPINGS_FINAL, Role.RESOLVABLE);
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.MAPPINGS_FINAL);

View File

@@ -146,7 +146,9 @@ public final class SourceSetHelper {
// Add dev jars from dependency projects if the source set is "main".
if (forExport && SourceSet.MAIN_SOURCE_SET_NAME.equals(reference.sourceSet().getName()) && GradleUtils.isLoomCompanionProject(reference.project())) {
String configurationName = GradleUtils.isLoomProject(reference.project())
boolean isLoom = GradleUtils.isLoomProject(reference.project());
boolean isDebof = isLoom && LoomGradleExtension.get(reference.project()).disableObfuscation();
String configurationName = isLoom && !isDebof
? Constants.Configurations.NAMED_ELEMENTS : JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME;
final Configuration namedElements = reference.project().getConfigurations().getByName(configurationName);