fix gradle 5 support changes
parent
0dcb7070be
commit
6749c9688e
|
@ -57,6 +57,10 @@ import java.util.Set;
|
||||||
public class AbstractPlugin implements Plugin<Project> {
|
public class AbstractPlugin implements Plugin<Project> {
|
||||||
protected Project project;
|
protected Project project;
|
||||||
|
|
||||||
|
private void extendsFrom(String a, String b) {
|
||||||
|
project.getConfigurations().getByName(a).extendsFrom(project.getConfigurations().getByName(b));
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void apply(Project target) {
|
public void apply(Project target) {
|
||||||
this.project = target;
|
this.project = target;
|
||||||
|
@ -76,14 +80,17 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
|
|
||||||
Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS);
|
Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS);
|
||||||
compileModsConfig.setTransitive(false); // Dont get transitive deps of mods
|
compileModsConfig.setTransitive(false); // Dont get transitive deps of mods
|
||||||
|
Configuration minecraftNamedConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_NAMED);
|
||||||
|
minecraftNamedConfig.setTransitive(false); // The launchers do not recurse dependencies
|
||||||
|
Configuration minecraftIntermediaryConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_INTERMEDIARY);
|
||||||
|
minecraftIntermediaryConfig.setTransitive(false);
|
||||||
|
Configuration minecraftDependenciesConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_DEPENDENCIES);
|
||||||
|
minecraftDependenciesConfig.setTransitive(false);
|
||||||
Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT);
|
Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT);
|
||||||
minecraftConfig.setTransitive(false); // The launchers do not recurse dependencies
|
minecraftConfig.setTransitive(false);
|
||||||
|
|
||||||
project.getConfigurations().maybeCreate(Constants.MAPPINGS);
|
project.getConfigurations().maybeCreate(Constants.MAPPINGS);
|
||||||
|
|
||||||
Configuration minecraftMappedConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT_MAPPED);
|
|
||||||
minecraftMappedConfig.setTransitive(false); // The launchers do not recurse dependencies
|
|
||||||
|
|
||||||
configureIDEs();
|
configureIDEs();
|
||||||
configureCompile();
|
configureCompile();
|
||||||
|
|
||||||
|
@ -236,6 +243,13 @@ public class AbstractPlugin implements Plugin<Project> {
|
||||||
handler.add("annotationProcessor", "net.fabricmc:sponge-mixin:" + extension.getMixinVersion());
|
handler.add("annotationProcessor", "net.fabricmc:sponge-mixin:" + extension.getMixinVersion());
|
||||||
handler.add("annotationProcessor", "net.fabricmc:fabric-loom:" + extension.getLoomVersion());
|
handler.add("annotationProcessor", "net.fabricmc:fabric-loom:" + extension.getLoomVersion());
|
||||||
|
|
||||||
|
extendsFrom(Constants.MINECRAFT_NAMED, Constants.MINECRAFT_DEPENDENCIES);
|
||||||
|
extendsFrom(Constants.COMPILE_MODS, Constants.MINECRAFT_NAMED);
|
||||||
|
extendsFrom("compile", Constants.COMPILE_MODS);
|
||||||
|
extendsFrom("compile", Constants.MAPPINGS);
|
||||||
|
extendsFrom("annotationProcessor", Constants.COMPILE_MODS);
|
||||||
|
extendsFrom("annotationProcessor", Constants.MAPPINGS);
|
||||||
|
|
||||||
// Enables the default mod remapper
|
// Enables the default mod remapper
|
||||||
if (extension.remapMod) {
|
if (extension.remapMod) {
|
||||||
AbstractArchiveTask jarTask = (AbstractArchiveTask) project1.getTasks().getByName("jar");
|
AbstractArchiveTask jarTask = (AbstractArchiveTask) project1.getTasks().getByName("jar");
|
||||||
|
|
|
@ -92,8 +92,6 @@ public class MappingsProvider extends DependencyProvider {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
project.getDependencies().add("compile", project.getDependencies().module(dependency.getDependency().getGroup() + ":" + dependency.getDependency().getName() + ":" + version));
|
|
||||||
|
|
||||||
mappedProvider = new MinecraftMappedProvider();
|
mappedProvider = new MinecraftMappedProvider();
|
||||||
mappedProvider.initFiles(project, minecraftProvider, this);
|
mappedProvider.initFiles(project, minecraftProvider, this);
|
||||||
mappedProvider.provide(dependency, project, extension, postPopulationScheduler);
|
mappedProvider.provide(dependency, project, extension, postPopulationScheduler);
|
||||||
|
|
|
@ -66,7 +66,7 @@ public class MinecraftLibraryProvider {
|
||||||
isClientOnly = true;
|
isClientOnly = true;
|
||||||
} */
|
} */
|
||||||
|
|
||||||
project.getDependencies().add("compile", project.getDependencies().module(library.getArtifactName()));
|
project.getDependencies().add(Constants.MINECRAFT_DEPENDENCIES, project.getDependencies().module(library.getArtifactName()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,9 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
||||||
}
|
}
|
||||||
|
|
||||||
String version = minecraftProvider.minecraftVersion + "-mapped-" + extension.getMappingsProvider().mappingsVersion;
|
String version = minecraftProvider.minecraftVersion + "-mapped-" + extension.getMappingsProvider().mappingsVersion;
|
||||||
project.getDependencies().add("compile", project.getDependencies().module("net.minecraft:minecraft:" + version));
|
project.getDependencies().add(Constants.MINECRAFT_NAMED, project.getDependencies().module("net.minecraft:minecraft:" + version));
|
||||||
|
version = minecraftProvider.minecraftVersion + "-intermediary";
|
||||||
|
project.getDependencies().add(Constants.MINECRAFT_INTERMEDIARY, project.getDependencies().module("net.minecraft:minecraft:" + version));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void initFiles(Project project, MinecraftProvider minecraftProvider, MappingsProvider mappingsProvider) {
|
public void initFiles(Project project, MinecraftProvider minecraftProvider, MappingsProvider mappingsProvider) {
|
||||||
|
@ -89,6 +91,6 @@ public class MinecraftMappedProvider extends DependencyProvider {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTargetConfig() {
|
public String getTargetConfig() {
|
||||||
return Constants.MINECRAFT_MAPPED;
|
return Constants.MINECRAFT_NAMED;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class ModRemapperProvider extends DependencyProvider {
|
||||||
throw new RuntimeException("Failed to remap mod");
|
throw new RuntimeException("Failed to remap mod");
|
||||||
}
|
}
|
||||||
|
|
||||||
project.getDependencies().add("compile", project.getDependencies().module(
|
project.getDependencies().add(Constants.COMPILE_MODS, project.getDependencies().module(
|
||||||
rds + verSuffix
|
rds + verSuffix
|
||||||
));
|
));
|
||||||
|
|
||||||
|
|
|
@ -37,6 +37,8 @@ public class Constants {
|
||||||
|
|
||||||
public static final String COMPILE_MODS = "modCompile";
|
public static final String COMPILE_MODS = "modCompile";
|
||||||
public static final String MINECRAFT = "minecraft";
|
public static final String MINECRAFT = "minecraft";
|
||||||
public static final String MINECRAFT_MAPPED = "minecraftMapped";
|
public static final String MINECRAFT_DEPENDENCIES = "minecraftLibraries";
|
||||||
|
public static final String MINECRAFT_INTERMEDIARY = "minecraftIntermediary";
|
||||||
|
public static final String MINECRAFT_NAMED = "minecraftNamed";
|
||||||
public static final String MAPPINGS = "mappings";
|
public static final String MAPPINGS = "mappings";
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue