fix AP not being present on classpath

dev/0.11
asie 2018-11-05 14:57:43 +01:00
parent 1691c8c2d8
commit 8e3822dec7
7 changed files with 20 additions and 21 deletions

View File

@ -69,7 +69,6 @@ public class AbstractPlugin implements Plugin<Project> {
// Force add Mojang repository
addMavenRepo(target, "Mojang", "https://libraries.minecraft.net/");
Configuration compileModsConfig = project.getConfigurations().maybeCreate(Constants.COMPILE_MODS);
compileModsConfig.setTransitive(false); // Dont get transitive deps of mods
Configuration minecraftConfig = project.getConfigurations().maybeCreate(Constants.MINECRAFT);
@ -89,9 +88,6 @@ public class AbstractPlugin implements Plugin<Project> {
javaCompileTask.doFirst(task1 -> {
project.getLogger().lifecycle(":setting java compiler args");
try {
//javaCompileTask.getClasspath().add(target.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()));
javaCompileTask.getOptions().getCompilerArgs().add("-AinMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_TINY.getCanonicalPath());
javaCompileTask.getOptions().getCompilerArgs().add("-AoutMapFileNamedIntermediary=" + extension.getMinecraftProvider().pomfProvider.MAPPINGS_MIXIN_EXPORT.getCanonicalPath());
if(extension.refmapName == null || extension.refmapName.isEmpty()){

View File

@ -46,10 +46,10 @@ public class MinecraftJarProvider {
public MinecraftJarProvider(Project project, MinecraftProvider minecraftProvider) throws IOException {
this.minecraftProvider = minecraftProvider;
initFiles(project, minecraftProvider);
proccess(project, minecraftProvider);
process(project, minecraftProvider);
}
private void proccess(Project project, MinecraftProvider minecraftProvider) throws IOException {
private void process(Project project, MinecraftProvider minecraftProvider) throws IOException {
if (!MINECRAFT_MERGED_JAR.exists()) {
mergeJars(project);
}
@ -67,7 +67,7 @@ public class MinecraftJarProvider {
if (!MINECRAFT_MAPPED_JAR.exists()) {
throw new RuntimeException("mapped jar not found");
}
minecraftProvider.addDep(MINECRAFT_MAPPED_JAR, project);
minecraftProvider.addDependency(MINECRAFT_MAPPED_JAR, project);
}
public void mergeJars(Project project) throws IOException {

View File

@ -24,8 +24,6 @@
package net.fabricmc.loom.providers;
import com.google.common.collect.HashMultimap;
import com.google.common.collect.Multimap;
import com.google.gson.Gson;
import net.fabricmc.loom.LoomGradleExtension;
import net.fabricmc.loom.util.Checksum;
@ -44,7 +42,6 @@ import java.net.URL;
import java.util.Collection;
import java.util.HashSet;
import java.util.Map;
import java.util.Objects;
public class MinecraftLibraryProvider {
@ -71,7 +68,7 @@ public class MinecraftLibraryProvider {
FileUtils.copyURLToFile(new URL(library.getURL()), library.getFile(MINECRAFT_LIBS));
}
libs.add(library.getFile(MINECRAFT_LIBS));
minecraftProvider.addDep(library.getFile(MINECRAFT_LIBS), project);
minecraftProvider.addDependency(library.getFile(MINECRAFT_LIBS), project);
}
}

View File

@ -57,7 +57,7 @@ public class MinecraftProvider extends DependencyProvider {
Gson gson = new Gson();
@Override
public void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception {
minecraftVersion = dependency.getDependency().getName();
pomfVersion = dependency.getDependency().getVersion();
@ -66,12 +66,14 @@ public class MinecraftProvider extends DependencyProvider {
downloadMcJson();
versionInfo = gson.fromJson(new FileReader(MINECRAFT_JSON), MinecraftVersionInfo.class);
// Add Loom as an annotation processor
addDependency(project.files(this.getClass().getProtectionDomain().getCodeSource().getLocation()), project, "compileOnly");
downloadJars();
libraryProvider = new MinecraftLibraryProvider();
libraryProvider.provide(this, project);
//Downloads and setups up pomf
pomfProvider = new PomfProvider(pomfVersion, minecraftVersion, project);
jarProvider = new MinecraftJarProvider(project, this);

View File

@ -34,7 +34,7 @@ import java.io.File;
public class ModRemapperProvider extends DependencyProvider {
@Override
public void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) {
public void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) {
File input = dependency.resolveFile();
project.getLogger().lifecycle("Providing " + dependency.getDepString());
@ -46,7 +46,7 @@ public class ModRemapperProvider extends DependencyProvider {
ModProcessor.handleMod(input, output, project);
addDep(output, project);
addDependency(output, project);
}
@Override

View File

@ -36,15 +36,19 @@ public abstract class DependencyProvider {
private LoomDependencyManager dependencyManager;
public abstract void provide(DependcyInfo dependency, Project project, LoomGradleExtension extension) throws Exception;
public abstract void provide(DependencyInfo dependency, Project project, LoomGradleExtension extension) throws Exception;
public abstract String getTargetConfig();
public void addDep(Object object, Project project){
public void addDependency(Object object, Project project) {
addDependency(object, project, "compile");
}
public void addDependency(Object object, Project project, String target) {
if(object instanceof File){
object = project.files(object);
}
project.getDependencies().add("compile", object);
project.getDependencies().add(target, object);
}
public void register(LoomDependencyManager dependencyManager){
@ -55,11 +59,11 @@ public abstract class DependencyProvider {
return dependencyManager;
}
public static class DependcyInfo {
public static class DependencyInfo {
final Dependency dependency;
final Configuration sourceConfiguration;
public DependcyInfo(Dependency dependency, Configuration sourceConfiguration) {
public DependencyInfo(Dependency dependency, Configuration sourceConfiguration) {
this.dependency = dependency;
this.sourceConfiguration = sourceConfiguration;
}

View File

@ -69,7 +69,7 @@ public class LoomDependencyManager {
configuration.getDependencies().stream().forEach(dependency -> {
for(DependencyProvider provider : dependencyProviderList){
if(provider.getTargetConfig().equals(config)){
DependencyProvider.DependcyInfo info = new DependencyProvider.DependcyInfo(dependency, configuration);
DependencyProvider.DependencyInfo info = new DependencyProvider.DependencyInfo(dependency, configuration);
try {
provider.provide(info, project, extension);
} catch (Exception e) {