mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-04-01 21:17:46 -05:00
Fix namedElements not extending from api (#533)
* Fix `namedElements` not extending from api Fix artifact not waiting for remapAllJars with shared caches * Use apiElements * Add a better test for this. * Also add remapped api mods to namedElements
This commit is contained in:
@@ -45,6 +45,7 @@ import org.gradle.api.artifacts.result.ComponentArtifactsResult;
|
||||
import org.gradle.api.artifacts.result.ResolvedArtifactResult;
|
||||
import org.gradle.api.file.FileCollection;
|
||||
import org.gradle.api.logging.Logger;
|
||||
import org.gradle.api.plugins.JavaPlugin;
|
||||
import org.gradle.jvm.JvmLibrary;
|
||||
import org.gradle.language.base.artifact.SourcesArtifact;
|
||||
import org.jetbrains.annotations.Nullable;
|
||||
@@ -156,6 +157,11 @@ public class ModCompileRemapper {
|
||||
if (entry.replacedWith() != null && !modDependencies.isEmpty()) {
|
||||
extension.getDeprecationHelper().replaceWithInLoom0_11(entry.sourceConfiguration(), entry.replacedWith());
|
||||
}
|
||||
|
||||
// Export to other projects
|
||||
if (entry.targetConfiguration().equals(JavaPlugin.API_CONFIGURATION_NAME)) {
|
||||
project.getConfigurations().getByName(Constants.Configurations.NAMED_ELEMENTS).extendsFrom(remappedConfig);
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
@@ -64,6 +64,7 @@ public final class CompileConfiguration {
|
||||
extension.createLazyConfiguration(Constants.Configurations.NAMED_ELEMENTS).configure(configuration -> {
|
||||
configuration.setCanBeConsumed(true);
|
||||
configuration.setCanBeResolved(false);
|
||||
configuration.extendsFrom(project.getConfigurations().getByName(JavaPlugin.API_CONFIGURATION_NAME));
|
||||
});
|
||||
|
||||
extendsFrom(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, Constants.Configurations.MAPPING_CONSTANTS, project);
|
||||
|
||||
@@ -73,7 +73,15 @@ public class RemapConfiguration {
|
||||
return;
|
||||
}
|
||||
|
||||
PublishArtifact artifact = artifacts.add(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME, task.getOutput());
|
||||
PublishArtifact artifact = artifacts.add(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME, task.getOutput(), configurablePublishArtifact -> {
|
||||
Task remapJarTask = task;
|
||||
|
||||
if (extension.getShareRemapCaches().get()) {
|
||||
remapJarTask = project.getRootProject().getTasks().getByName(DEFAULT_REMAP_ALL_JARS_TASK_NAME);
|
||||
}
|
||||
|
||||
configurablePublishArtifact.builtBy(remapJarTask);
|
||||
});
|
||||
|
||||
// Remove the existing artifact that does not run remapSourcesJar.
|
||||
// It doesn't seem to hurt, but I'm not sure if the file-level duplicates cause issues.
|
||||
|
||||
Reference in New Issue
Block a user