Add modCompileOnlyApi, modRuntimeOnly; deprecate modRuntime (#458)

dev/0.11
Juuxel 2021-08-01 01:46:42 +03:00 committed by GitHub
parent f9a06cbd41
commit a0c2d877af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 3 deletions

View File

@ -151,6 +151,11 @@ public class ModCompileRemapper {
for (ModDependencyInfo info : modDependencies) { for (ModDependencyInfo info : modDependencies) {
project.getDependencies().add(info.targetConfig.getName(), info.getRemappedNotation()); project.getDependencies().add(info.targetConfig.getName(), info.getRemappedNotation());
} }
// Report deprecation warnings
if (entry.replacedWith() != null && !modDependencies.isEmpty()) {
extension.getDeprecationHelper().replaceWithInLoom0_11(entry.sourceConfiguration(), entry.replacedWith());
}
}); });
} }
} }

View File

@ -26,8 +26,13 @@ package net.fabricmc.loom.configuration;
import org.gradle.api.artifacts.ConfigurationContainer; import org.gradle.api.artifacts.ConfigurationContainer;
import org.gradle.api.plugins.JavaPlugin; import org.gradle.api.plugins.JavaPlugin;
import org.jetbrains.annotations.Nullable;
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope, @Nullable String replacedWith) {
public RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope) {
this(sourceConfiguration, targetConfiguration, isOnModCompileClasspath, mavenScope, null);
}
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope) {
public boolean hasMavenScope() { public boolean hasMavenScope() {
return mavenScope != null && !mavenScope.isEmpty(); return mavenScope != null && !mavenScope.isEmpty();
} }

View File

@ -45,8 +45,10 @@ public class Constants {
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, "compile"),
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"), new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"),
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, ""), new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "", "modRuntimeOnly"),
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "") new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, ""),
new RemappedConfigurationEntry("modCompileOnlyApi", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "compile"),
new RemappedConfigurationEntry("modRuntimeOnly", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "runtime")
); );
private Constants() { private Constants() {