Skip to content

Commit a0c2d87

Browse files
authored
Add modCompileOnlyApi, modRuntimeOnly; deprecate modRuntime (FabricMC#458)
1 parent f9a06cb commit a0c2d87

File tree

3 files changed

+15
-3
lines changed

3 files changed

+15
-3
lines changed

src/main/java/net/fabricmc/loom/build/ModCompileRemapper.java

+5
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,11 @@ public static void remapDependencies(Project project, String mappingsSuffix, Loo
151151
for (ModDependencyInfo info : modDependencies) {
152152
project.getDependencies().add(info.targetConfig.getName(), info.getRemappedNotation());
153153
}
154+
155+
// Report deprecation warnings
156+
if (entry.replacedWith() != null && !modDependencies.isEmpty()) {
157+
extension.getDeprecationHelper().replaceWithInLoom0_11(entry.sourceConfiguration(), entry.replacedWith());
158+
}
154159
});
155160
}
156161
}

src/main/java/net/fabricmc/loom/configuration/RemappedConfigurationEntry.java

+6-1
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,13 @@
2626

2727
import org.gradle.api.artifacts.ConfigurationContainer;
2828
import org.gradle.api.plugins.JavaPlugin;
29+
import org.jetbrains.annotations.Nullable;
30+
31+
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope, @Nullable String replacedWith) {
32+
public RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope) {
33+
this(sourceConfiguration, targetConfiguration, isOnModCompileClasspath, mavenScope, null);
34+
}
2935

30-
public record RemappedConfigurationEntry(String sourceConfiguration, String targetConfiguration, boolean isOnModCompileClasspath, String mavenScope) {
3136
public boolean hasMavenScope() {
3237
return mavenScope != null && !mavenScope.isEmpty();
3338
}

src/main/java/net/fabricmc/loom/util/Constants.java

+4-2
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,10 @@ public class Constants {
4545
public static final List<RemappedConfigurationEntry> MOD_COMPILE_ENTRIES = ImmutableList.of(
4646
new RemappedConfigurationEntry("modApi", JavaPlugin.API_CONFIGURATION_NAME, true, "compile"),
4747
new RemappedConfigurationEntry("modImplementation", JavaPlugin.IMPLEMENTATION_CONFIGURATION_NAME, true, "runtime"),
48-
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, ""),
49-
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "")
48+
new RemappedConfigurationEntry("modRuntime", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "", "modRuntimeOnly"),
49+
new RemappedConfigurationEntry("modCompileOnly", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, ""),
50+
new RemappedConfigurationEntry("modCompileOnlyApi", JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, true, "compile"),
51+
new RemappedConfigurationEntry("modRuntimeOnly", JavaPlugin.RUNTIME_ONLY_CONFIGURATION_NAME, false, "runtime")
5052
);
5153

5254
private Constants() {

0 commit comments

Comments
 (0)