* Add modCompileOnlyApi, modRuntimeOnly; deprecate modRuntime
* begin
* continue
* Make RemapSourcesJarTask use properties
* finish
* Remove cursed version hack 😉
* Finish for real
* Add missing header
* Clarify a comment
* Fix tests
* Use Gradle's own *Elements and remove -dev jars
* Fix maven test
* Put mappingsFinal onto runtimeClasspath instead of implementation
* Make non-mod dependencies work with the legacy pom magic too
* Be a bit more clever when removing dev artifacts
dev/0.11
parent
b1b395cedf
commit
08f055489b
|
@ -73,7 +73,7 @@ public class LoomGradlePlugin implements BootstrappedPlugin {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Apply default plugins
|
// Apply default plugins
|
||||||
project.apply(ImmutableMap.of("plugin", "java"));
|
project.apply(ImmutableMap.of("plugin", "java-library"));
|
||||||
project.apply(ImmutableMap.of("plugin", "eclipse"));
|
project.apply(ImmutableMap.of("plugin", "eclipse"));
|
||||||
project.apply(ImmutableMap.of("plugin", "idea"));
|
project.apply(ImmutableMap.of("plugin", "idea"));
|
||||||
|
|
||||||
|
|
|
@ -174,4 +174,14 @@ public interface LoomGradleExtensionAPI {
|
||||||
getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest");
|
getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest");
|
||||||
return getCustomMinecraftManifest().getOrNull();
|
return getCustomMinecraftManifest().getOrNull();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* If true, Loom will replace the {@code -dev} jars in the {@code *Elements} configurations
|
||||||
|
* with remapped outgoing variants.
|
||||||
|
*
|
||||||
|
* <p>Will only apply if {@link #getRemapArchives()} is also true.
|
||||||
|
*
|
||||||
|
* @return the property controlling the setup of remapped variants
|
||||||
|
*/
|
||||||
|
Property<Boolean> getSetupRemappedVariants();
|
||||||
}
|
}
|
||||||
|
|
|
@ -25,14 +25,12 @@
|
||||||
package net.fabricmc.loom.configuration;
|
package net.fabricmc.loom.configuration;
|
||||||
|
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.ConfigurationContainer;
|
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.plugins.JavaPluginConvention;
|
import org.gradle.api.plugins.JavaPluginConvention;
|
||||||
import org.gradle.api.tasks.SourceSet;
|
import org.gradle.api.tasks.SourceSet;
|
||||||
import org.gradle.api.tasks.javadoc.Javadoc;
|
import org.gradle.api.tasks.javadoc.Javadoc;
|
||||||
import org.gradle.jvm.tasks.Jar;
|
import org.gradle.jvm.tasks.Jar;
|
||||||
|
|
||||||
import net.fabricmc.loom.extension.MixinApExtension;
|
|
||||||
import net.fabricmc.loom.LoomGradleExtension;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.build.mixin.JavaApInvoker;
|
import net.fabricmc.loom.build.mixin.JavaApInvoker;
|
||||||
import net.fabricmc.loom.build.mixin.KaptApInvoker;
|
import net.fabricmc.loom.build.mixin.KaptApInvoker;
|
||||||
|
@ -41,6 +39,7 @@ import net.fabricmc.loom.configuration.ide.SetupIntelijRunConfigs;
|
||||||
import net.fabricmc.loom.configuration.providers.LaunchProvider;
|
import net.fabricmc.loom.configuration.providers.LaunchProvider;
|
||||||
import net.fabricmc.loom.configuration.providers.MinecraftProviderImpl;
|
import net.fabricmc.loom.configuration.providers.MinecraftProviderImpl;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
import net.fabricmc.loom.configuration.providers.mappings.MappingsProviderImpl;
|
||||||
|
import net.fabricmc.loom.extension.MixinApExtension;
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.util.Constants;
|
||||||
|
|
||||||
public final class CompileConfiguration {
|
public final class CompileConfiguration {
|
||||||
|
@ -48,8 +47,6 @@ public final class CompileConfiguration {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setupConfigurations(Project project) {
|
public static void setupConfigurations(Project project) {
|
||||||
final ConfigurationContainer configurations = project.getConfigurations();
|
|
||||||
|
|
||||||
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||||
|
|
||||||
extension.createLazyConfiguration(Constants.Configurations.MOD_COMPILE_CLASSPATH).configure(configuration -> configuration.setTransitive(true));
|
extension.createLazyConfiguration(Constants.Configurations.MOD_COMPILE_CLASSPATH).configure(configuration -> configuration.setTransitive(true));
|
||||||
|
@ -76,11 +73,18 @@ public final class CompileConfiguration {
|
||||||
extension.createLazyConfiguration(entry.getRemappedConfiguration())
|
extension.createLazyConfiguration(entry.getRemappedConfiguration())
|
||||||
.configure(configuration -> configuration.setTransitive(false));
|
.configure(configuration -> configuration.setTransitive(false));
|
||||||
|
|
||||||
extendsFrom(entry.getTargetConfiguration(configurations), entry.getRemappedConfiguration(), project);
|
if (entry.compileClasspath()) {
|
||||||
|
|
||||||
if (entry.isOnModCompileClasspath()) {
|
|
||||||
extendsFrom(Constants.Configurations.MOD_COMPILE_CLASSPATH, entry.sourceConfiguration(), project);
|
extendsFrom(Constants.Configurations.MOD_COMPILE_CLASSPATH, entry.sourceConfiguration(), project);
|
||||||
extendsFrom(Constants.Configurations.MOD_COMPILE_CLASSPATH_MAPPED, entry.getRemappedConfiguration(), project);
|
extendsFrom(Constants.Configurations.MOD_COMPILE_CLASSPATH_MAPPED, entry.getRemappedConfiguration(), project);
|
||||||
|
extendsFrom(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME, entry.getRemappedConfiguration(), project);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.runtimeClasspath()) {
|
||||||
|
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, entry.getRemappedConfiguration(), project);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (entry.hasConsumerConfiguration()) {
|
||||||
|
extendsFrom(entry.consumerConfiguration(), entry.sourceConfiguration(), project);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -92,7 +96,7 @@ public final class CompileConfiguration {
|
||||||
extendsFrom(Constants.Configurations.LOADER_DEPENDENCIES, Constants.Configurations.MINECRAFT_DEPENDENCIES, project);
|
extendsFrom(Constants.Configurations.LOADER_DEPENDENCIES, Constants.Configurations.MINECRAFT_DEPENDENCIES, project);
|
||||||
extendsFrom(Constants.Configurations.MINECRAFT_NAMED, Constants.Configurations.LOADER_DEPENDENCIES, project);
|
extendsFrom(Constants.Configurations.MINECRAFT_NAMED, Constants.Configurations.LOADER_DEPENDENCIES, project);
|
||||||
|
|
||||||
extendsFrom(JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, Constants.Configurations.MAPPINGS_FINAL, project);
|
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.MAPPINGS_FINAL, project);
|
||||||
|
|
||||||
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES, project);
|
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES, project);
|
||||||
extendsFrom(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES, project);
|
extendsFrom(JavaPlugin.TEST_RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES, project);
|
||||||
|
|
|
@ -24,9 +24,12 @@
|
||||||
|
|
||||||
package net.fabricmc.loom.configuration;
|
package net.fabricmc.loom.configuration;
|
||||||
|
|
||||||
|
import java.lang.reflect.Method;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
|
import java.util.Map;
|
||||||
import java.util.Optional;
|
import java.util.Optional;
|
||||||
import java.util.Set;
|
import java.util.Set;
|
||||||
|
import java.util.concurrent.atomic.AtomicBoolean;
|
||||||
|
|
||||||
import groovy.util.Node;
|
import groovy.util.Node;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
|
@ -34,43 +37,66 @@ import org.gradle.api.artifacts.Configuration;
|
||||||
import org.gradle.api.artifacts.Dependency;
|
import org.gradle.api.artifacts.Dependency;
|
||||||
import org.gradle.api.artifacts.ExcludeRule;
|
import org.gradle.api.artifacts.ExcludeRule;
|
||||||
import org.gradle.api.artifacts.ModuleDependency;
|
import org.gradle.api.artifacts.ModuleDependency;
|
||||||
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.publish.Publication;
|
import org.gradle.api.publish.Publication;
|
||||||
import org.gradle.api.publish.PublishingExtension;
|
import org.gradle.api.publish.PublishingExtension;
|
||||||
|
|
||||||
import net.fabricmc.loom.util.Constants;
|
import net.fabricmc.loom.LoomGradleExtension;
|
||||||
import net.fabricmc.loom.util.GroovyXmlUtil;
|
import net.fabricmc.loom.util.GroovyXmlUtil;
|
||||||
|
|
||||||
public final class MavenPublication {
|
public final class MavenPublication {
|
||||||
|
private static final Map<String, String> CONFIGURATION_TO_SCOPE = Map.of(
|
||||||
|
JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME, "compile",
|
||||||
|
JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME, "runtime"
|
||||||
|
);
|
||||||
|
|
||||||
private MavenPublication() {
|
private MavenPublication() {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void configure(Project project) {
|
public static void configure(Project project) {
|
||||||
project.afterEvaluate((p) -> {
|
project.afterEvaluate((p) -> {
|
||||||
for (RemappedConfigurationEntry entry : Constants.MOD_COMPILE_ENTRIES) {
|
AtomicBoolean reportedDeprecation = new AtomicBoolean(false);
|
||||||
if (!entry.hasMavenScope()) {
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
Configuration compileModsConfig = p.getConfigurations().getByName(entry.sourceConfiguration());
|
CONFIGURATION_TO_SCOPE.forEach((configurationName, scope) -> {
|
||||||
|
Configuration config = p.getConfigurations().getByName(configurationName);
|
||||||
|
|
||||||
// add modsCompile to maven-publish
|
// add modsCompile to maven-publish
|
||||||
PublishingExtension mavenPublish = p.getExtensions().findByType(PublishingExtension.class);
|
PublishingExtension mavenPublish = p.getExtensions().findByType(PublishingExtension.class);
|
||||||
|
|
||||||
if (mavenPublish != null) {
|
if (mavenPublish != null) {
|
||||||
processEntry(entry, compileModsConfig, mavenPublish);
|
processEntry(project, scope, config, mavenPublish, reportedDeprecation);
|
||||||
}
|
}
|
||||||
}
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void processEntry(RemappedConfigurationEntry entry, Configuration compileModsConfig, PublishingExtension mavenPublish) {
|
private static boolean hasSoftwareComponent(Publication publication) {
|
||||||
|
try {
|
||||||
|
Method getComponent = publication.getClass().getMethod("getComponent");
|
||||||
|
return getComponent.invoke(publication) != null;
|
||||||
|
} catch (ReflectiveOperationException e) {
|
||||||
|
// our hacks have broken!
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// TODO: Remove this in Loom 0.12
|
||||||
|
private static void processEntry(Project project, String scope, Configuration config, PublishingExtension mavenPublish, AtomicBoolean reportedDeprecation) {
|
||||||
mavenPublish.publications((publications) -> {
|
mavenPublish.publications((publications) -> {
|
||||||
for (Publication publication : publications) {
|
for (Publication publication : publications) {
|
||||||
if (!(publication instanceof org.gradle.api.publish.maven.MavenPublication)) {
|
if (!(publication instanceof org.gradle.api.publish.maven.MavenPublication mavenPublication)) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
((org.gradle.api.publish.maven.MavenPublication) publication).pom((pom) -> pom.withXml((xml) -> {
|
if (hasSoftwareComponent(publication)) {
|
||||||
|
continue;
|
||||||
|
} else if (!reportedDeprecation.get()) {
|
||||||
|
var deprecationHelper = LoomGradleExtension.get(project).getDeprecationHelper();
|
||||||
|
deprecationHelper.warn("Loom is applying dependency data manually to publications instead of using a software component (from(components[\"java\"])). This is deprecated and will be removed in Loom 0.12.");
|
||||||
|
reportedDeprecation.set(true);
|
||||||
|
}
|
||||||
|
|
||||||
|
mavenPublication.pom((pom) -> pom.withXml((xml) -> {
|
||||||
Node dependencies = GroovyXmlUtil.getOrCreateNode(xml.asNode(), "dependencies");
|
Node dependencies = GroovyXmlUtil.getOrCreateNode(xml.asNode(), "dependencies");
|
||||||
Set<String> foundArtifacts = new HashSet<>();
|
Set<String> foundArtifacts = new HashSet<>();
|
||||||
|
|
||||||
|
@ -83,7 +109,7 @@ public final class MavenPublication {
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
for (Dependency dependency : compileModsConfig.getAllDependencies()) {
|
for (Dependency dependency : config.getAllDependencies()) {
|
||||||
if (foundArtifacts.contains(dependency.getGroup() + ":" + dependency.getName())) {
|
if (foundArtifacts.contains(dependency.getGroup() + ":" + dependency.getName())) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
@ -92,7 +118,7 @@ public final class MavenPublication {
|
||||||
depNode.appendNode("groupId", dependency.getGroup());
|
depNode.appendNode("groupId", dependency.getGroup());
|
||||||
depNode.appendNode("artifactId", dependency.getName());
|
depNode.appendNode("artifactId", dependency.getName());
|
||||||
depNode.appendNode("version", dependency.getVersion());
|
depNode.appendNode("version", dependency.getVersion());
|
||||||
depNode.appendNode("scope", entry.mavenScope());
|
depNode.appendNode("scope", scope);
|
||||||
|
|
||||||
if (!(dependency instanceof ModuleDependency)) {
|
if (!(dependency instanceof ModuleDependency)) {
|
||||||
continue;
|
continue;
|
||||||
|
|
|
@ -31,6 +31,8 @@ import org.gradle.api.Action;
|
||||||
import org.gradle.api.Project;
|
import org.gradle.api.Project;
|
||||||
import org.gradle.api.Task;
|
import org.gradle.api.Task;
|
||||||
import org.gradle.api.UnknownTaskException;
|
import org.gradle.api.UnknownTaskException;
|
||||||
|
import org.gradle.api.artifacts.Configuration;
|
||||||
|
import org.gradle.api.artifacts.dsl.ArtifactHandler;
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.tasks.bundling.AbstractArchiveTask;
|
import org.gradle.api.tasks.bundling.AbstractArchiveTask;
|
||||||
import org.jetbrains.annotations.ApiStatus;
|
import org.jetbrains.annotations.ApiStatus;
|
||||||
|
@ -54,6 +56,35 @@ public class RemapConfiguration {
|
||||||
|
|
||||||
public static void setupDefaultRemap(Project project) {
|
public static void setupDefaultRemap(Project project) {
|
||||||
setupRemap(project, true, DEFAULT_JAR_TASK_NAME, DEFAULT_SOURCES_JAR_TASK_NAME, DEFAULT_REMAP_JAR_TASK_NAME, DEFAULT_REMAP_SOURCES_JAR_TASK_NAME, DEFAULT_REMAP_ALL_JARS_TASK_NAME, DEFAULT_REMAP_ALL_SOURCES_TASK_NAME);
|
setupRemap(project, true, DEFAULT_JAR_TASK_NAME, DEFAULT_SOURCES_JAR_TASK_NAME, DEFAULT_REMAP_JAR_TASK_NAME, DEFAULT_REMAP_SOURCES_JAR_TASK_NAME, DEFAULT_REMAP_ALL_JARS_TASK_NAME, DEFAULT_REMAP_ALL_SOURCES_TASK_NAME);
|
||||||
|
|
||||||
|
LoomGradleExtension extension = LoomGradleExtension.get(project);
|
||||||
|
extension.getSetupRemappedVariants().finalizeValue();
|
||||||
|
|
||||||
|
if (extension.getSetupRemappedVariants().get()) {
|
||||||
|
ArtifactHandler artifacts = project.getArtifacts();
|
||||||
|
project.getTasks().named(DEFAULT_REMAP_JAR_TASK_NAME, task -> {
|
||||||
|
artifacts.add(JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME, task);
|
||||||
|
artifacts.add(JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME, task);
|
||||||
|
});
|
||||||
|
project.getTasks().named(DEFAULT_REMAP_SOURCES_JAR_TASK_NAME, RemapSourcesJarTask.class, task -> {
|
||||||
|
var artifact = artifacts.add(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME, task.getOutput());
|
||||||
|
|
||||||
|
// 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.
|
||||||
|
Configuration configuration = project.getConfigurations().getByName(JavaPlugin.SOURCES_ELEMENTS_CONFIGURATION_NAME);
|
||||||
|
configuration.getArtifacts().removeIf(a -> a != artifact && artifact.getFile().equals(a.getFile()));
|
||||||
|
});
|
||||||
|
|
||||||
|
// Remove -dev jars from the default jar task
|
||||||
|
for (String configurationName : new String[] { JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME, JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME }) {
|
||||||
|
Configuration configuration = project.getConfigurations().getByName(configurationName);
|
||||||
|
configuration.getArtifacts().removeIf(artifact -> {
|
||||||
|
Task jarTask = project.getTasks().getByName(DEFAULT_JAR_TASK_NAME);
|
||||||
|
// if the artifact is a -dev jar and "builtBy jar"
|
||||||
|
return "dev".equals(artifact.getClassifier()) && artifact.getBuildDependencies().getDependencies(null).contains(jarTask);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ApiStatus.Experimental // This is only an api if you squint really hard, expect it to explode every 5 mins. If you must call in afterEvaluate on all projects
|
@ApiStatus.Experimental // This is only an api if you squint really hard, expect it to explode every 5 mins. If you must call in afterEvaluate on all projects
|
||||||
|
|
|
@ -28,13 +28,13 @@ import org.gradle.api.artifacts.ConfigurationContainer;
|
||||||
import org.gradle.api.plugins.JavaPlugin;
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.jetbrains.annotations.Nullable;
|
import org.jetbrains.annotations.Nullable;
|
||||||
|
|
||||||
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope, @Nullable String replacedWith) {
|
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean compileClasspath, boolean runtimeClasspath, String consumerConfiguration, @Nullable String replacedWith) {
|
||||||
public RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope) {
|
public RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean compileClasspath, boolean runtimeClasspath, String consumerConfiguration) {
|
||||||
this(sourceConfiguration, targetConfiguration, isOnModCompileClasspath, mavenScope, null);
|
this(sourceConfiguration, targetConfiguration, compileClasspath, runtimeClasspath, consumerConfiguration, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean hasMavenScope() {
|
public boolean hasConsumerConfiguration() {
|
||||||
return mavenScope != null && !mavenScope.isEmpty();
|
return consumerConfiguration != null && !consumerConfiguration.isEmpty();
|
||||||
}
|
}
|
||||||
|
|
||||||
public String getRemappedConfiguration() {
|
public String getRemappedConfiguration() {
|
||||||
|
|
|
@ -33,9 +33,9 @@ import org.gradle.api.file.RegularFileProperty;
|
||||||
import org.gradle.api.provider.ListProperty;
|
import org.gradle.api.provider.ListProperty;
|
||||||
import org.gradle.api.provider.Property;
|
import org.gradle.api.provider.Property;
|
||||||
|
|
||||||
|
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
||||||
import net.fabricmc.loom.api.MixinApExtensionAPI;
|
import net.fabricmc.loom.api.MixinApExtensionAPI;
|
||||||
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
|
||||||
import net.fabricmc.loom.api.LoomGradleExtensionAPI;
|
|
||||||
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
|
||||||
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
import net.fabricmc.loom.configuration.processors.JarProcessor;
|
||||||
import net.fabricmc.loom.configuration.providers.mappings.GradleMappingContext;
|
import net.fabricmc.loom.configuration.providers.mappings.GradleMappingContext;
|
||||||
|
@ -56,6 +56,7 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
protected final Property<Boolean> shareCaches;
|
protected final Property<Boolean> shareCaches;
|
||||||
protected final Property<Boolean> remapArchives;
|
protected final Property<Boolean> remapArchives;
|
||||||
protected final Property<String> customManifest;
|
protected final Property<String> customManifest;
|
||||||
|
protected final Property<Boolean> setupRemappedVariants;
|
||||||
|
|
||||||
private NamedDomainObjectContainer<RunConfigSettings> runConfigs;
|
private NamedDomainObjectContainer<RunConfigSettings> runConfigs;
|
||||||
|
|
||||||
|
@ -73,6 +74,8 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
this.remapArchives = project.getObjects().property(Boolean.class)
|
this.remapArchives = project.getObjects().property(Boolean.class)
|
||||||
.convention(true);
|
.convention(true);
|
||||||
this.customManifest = project.getObjects().property(String.class);
|
this.customManifest = project.getObjects().property(String.class);
|
||||||
|
this.setupRemappedVariants = project.getObjects().property(Boolean.class)
|
||||||
|
.convention(true);
|
||||||
|
|
||||||
this.deprecationHelper = new DeprecationHelper.ProjectBased(project);
|
this.deprecationHelper = new DeprecationHelper.ProjectBased(project);
|
||||||
}
|
}
|
||||||
|
@ -140,6 +143,11 @@ public abstract class LoomGradleExtensionApiImpl implements LoomGradleExtensionA
|
||||||
return customManifest;
|
return customManifest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Property<Boolean> getSetupRemappedVariants() {
|
||||||
|
return setupRemappedVariants;
|
||||||
|
}
|
||||||
|
|
||||||
protected abstract Project getProject();
|
protected abstract Project getProject();
|
||||||
|
|
||||||
protected abstract LoomFiles getFiles();
|
protected abstract LoomFiles getFiles();
|
||||||
|
|
|
@ -131,4 +131,10 @@ public class MinecraftGradleExtension implements LoomGradleExtensionAPI {
|
||||||
reportDeprecation();
|
reportDeprecation();
|
||||||
return parent.getCustomMinecraftManifest();
|
return parent.getCustomMinecraftManifest();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Property<Boolean> getSetupRemappedVariants() {
|
||||||
|
reportDeprecation();
|
||||||
|
return parent.getSetupRemappedVariants();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import org.gradle.api.Project;
|
||||||
import org.gradle.api.artifacts.Configuration;
|
import org.gradle.api.artifacts.Configuration;
|
||||||
import org.gradle.api.file.FileCollection;
|
import org.gradle.api.file.FileCollection;
|
||||||
import org.gradle.api.file.RegularFileProperty;
|
import org.gradle.api.file.RegularFileProperty;
|
||||||
|
import org.gradle.api.plugins.JavaPlugin;
|
||||||
import org.gradle.api.provider.Property;
|
import org.gradle.api.provider.Property;
|
||||||
import org.gradle.api.tasks.Input;
|
import org.gradle.api.tasks.Input;
|
||||||
import org.gradle.api.tasks.InputFile;
|
import org.gradle.api.tasks.InputFile;
|
||||||
|
@ -233,7 +234,7 @@ public class RemapJarTask extends Jar {
|
||||||
FileCollection files = this.classpath;
|
FileCollection files = this.classpath;
|
||||||
|
|
||||||
if (files == null) {
|
if (files == null) {
|
||||||
files = getProject().getConfigurations().getByName("compileClasspath");
|
files = getProject().getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME);
|
||||||
}
|
}
|
||||||
|
|
||||||
return files.getFiles().stream()
|
return files.getFiles().stream()
|
||||||
|
|
|
@ -44,14 +44,16 @@ public class Constants {
|
||||||
public static final int ASM_VERSION = Opcodes.ASM9;
|
public static final int ASM_VERSION = Opcodes.ASM9;
|
||||||
|
|
||||||
public static final List<RemappedConfigurationEntry> MOD_COMPILE_ENTRIES = ImmutableList.of(
|
public static final List<RemappedConfigurationEntry> MOD_COMPILE_ENTRIES = ImmutableList.of(
|
||||||
new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, "compile"),
|
new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, true, JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME),
|
||||||
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"),
|
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, true, JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME),
|
||||||
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "", "modRuntimeOnly"),
|
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, true, "", "modRuntimeOnly"),
|
||||||
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, ""),
|
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, false, ""),
|
||||||
new RemappedConfigurationEntry("modCompileOnlyApi", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "compile"),
|
new RemappedConfigurationEntry("modCompileOnlyApi", JavaPlugin.COMPILE_ONLY_API_CONFIGURATION_NAME, true, false, JavaPlugin.API_ELEMENTS_CONFIGURATION_NAME),
|
||||||
new RemappedConfigurationEntry("modRuntimeOnly", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "runtime")
|
new RemappedConfigurationEntry("modRuntimeOnly", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, true, JavaPlugin.RUNTIME_ELEMENTS_CONFIGURATION_NAME)
|
||||||
);
|
);
|
||||||
|
|
||||||
|
public static final String SOFTWARE_COMPONENT_NAME = "loom";
|
||||||
|
|
||||||
private Constants() {
|
private Constants() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,13 +76,7 @@ jar {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,7 @@ jar {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -76,13 +76,7 @@ loom {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -80,13 +80,7 @@ jar {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -30,16 +30,11 @@ java {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
|
from components.java
|
||||||
|
|
||||||
artifact(remapJar) {
|
artifact(remapJar) {
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
classifier "classifier"
|
classifier "classifier"
|
||||||
}
|
}
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -118,13 +118,7 @@ assemble {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -99,13 +99,7 @@ assemble {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,7 @@ jar {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -29,16 +29,11 @@ java {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
artifact(remapJar) {
|
from components.java
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(remapJar) {
|
artifact(remapJar) {
|
||||||
builtBy remapJar
|
builtBy remapJar
|
||||||
classifier "classifier"
|
classifier "classifier"
|
||||||
}
|
}
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -72,13 +72,7 @@ jar {
|
||||||
publishing {
|
publishing {
|
||||||
publications {
|
publications {
|
||||||
mavenJava(MavenPublication) {
|
mavenJava(MavenPublication) {
|
||||||
// add all the jars that should be included when publishing to maven
|
from components.java
|
||||||
artifact(remapJar) {
|
|
||||||
builtBy remapJar
|
|
||||||
}
|
|
||||||
artifact(sourcesJar) {
|
|
||||||
builtBy remapSourcesJar
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue