Merge remote-tracking branch 'architectury/dev/0.10.0' into dev/0.11.0

This commit is contained in:
shedaniel
2022-01-06 15:12:59 +08:00
7 changed files with 54 additions and 24 deletions

View File

@@ -89,9 +89,19 @@ public final class CompileConfiguration {
extension.createLazyConfiguration(Constants.Configurations.FORGE_NAMED).configure(configuration -> configuration.setTransitive(false));
extension.createLazyConfiguration(Constants.Configurations.FORGE_EXTRA).configure(configuration -> configuration.setTransitive(false));
extension.createLazyConfiguration(Constants.Configurations.MCP_CONFIG).configure(configuration -> configuration.setTransitive(false));
extension.createLazyConfiguration(Constants.Configurations.FORGE_RUNTIME_LIBRARY);
extendsFrom(Constants.Configurations.MINECRAFT_DEPENDENCIES, Constants.Configurations.FORGE_DEPENDENCIES, project);
extendsFrom(Constants.Configurations.FORGE_RUNTIME_LIBRARY, Constants.Configurations.FORGE_DEPENDENCIES, project);
extendsFrom(Constants.Configurations.FORGE_RUNTIME_LIBRARY, Constants.Configurations.MINECRAFT_DEPENDENCIES, project);
extendsFrom(Constants.Configurations.FORGE_RUNTIME_LIBRARY, Constants.Configurations.FORGE_EXTRA, project);
extendsFrom(Constants.Configurations.FORGE_RUNTIME_LIBRARY, Constants.Configurations.MINECRAFT_NAMED, project);
extendsFrom(Constants.Configurations.FORGE_RUNTIME_LIBRARY, Constants.Configurations.FORGE_NAMED, project);
// Include any user-defined libraries on the runtime CP.
// (All the other superconfigurations are already on there.)
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_RUNTIME_LIBRARY, project);
extendsFrom(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_NAMED, project);
extendsFrom(JavaPlugin.RUNTIME_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_NAMED, project);
extendsFrom(JavaPlugin.TEST_COMPILE_CLASSPATH_CONFIGURATION_NAME, Constants.Configurations.FORGE_NAMED, project);

View File

@@ -61,6 +61,7 @@ public class LaunchProvider extends DependencyProvider {
.property("fabric.development", "true")
.property("fabric.remapClasspathFile", getRemapClasspathFile().getAbsolutePath())
.property("log4j.configurationFile", getAllLog4JConfigFiles())
.property("log4j2.formatMsgNoLookups", "true")
.property("client", "java.library.path", getExtension().getMinecraftProvider().nativesDir().getAbsolutePath())
.property("client", "org.lwjgl.librarypath", getExtension().getMinecraftProvider().nativesDir().getAbsolutePath());

View File

@@ -299,21 +299,11 @@ public class ForgeUserdevProvider extends DependencyProvider {
private Set<File> runtimeClasspath() {
// Should we actually include the runtime classpath here? Forge doesn't seem to be using this property anyways
Set<File> mcLibs = DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_DEPENDENCIES), true);
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_EXTRA), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_NAMED), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_NAMED), false));
return mcLibs;
return minecraftClasspath();
}
private Set<File> minecraftClasspath() {
Set<File> mcLibs = DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_DEPENDENCIES), true);
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_DEPENDENCIES), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_EXTRA), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.MINECRAFT_NAMED), false));
mcLibs.addAll(DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_NAMED), false));
return mcLibs;
return DependencyDownloader.resolveFiles(getProject().getConfigurations().getByName(Constants.Configurations.FORGE_RUNTIME_LIBRARY), true);
}
public File getUserdevJar() {

View File

@@ -72,8 +72,8 @@ public class SrgProvider extends DependencyProvider {
private Path mergedMojangRaw;
private Path mergedMojang;
private Path mergedMojangTrimmed;
private static Path mojmapTsrg;
private static Path mojmapTsrg2;
private static Map<String, Path> mojmapTsrgMap = new HashMap<>();
private static Map<String, Path> mojmapTsrg2Map = new HashMap<>();
public SrgProvider(Project project) {
super(project);
@@ -218,9 +218,10 @@ public class SrgProvider extends DependencyProvider {
}
public static Path getMojmapTsrg(Project project, LoomGradleExtension extension) throws IOException {
if (mojmapTsrg != null) return mojmapTsrg;
String minecraftVersion = extension.getMinecraftProvider().minecraftVersion();
if (mojmapTsrgMap.containsKey(minecraftVersion)) return mojmapTsrgMap.get(minecraftVersion);
mojmapTsrg = extension.getMinecraftProvider().dir("forge").toPath().resolve("mojmap.tsrg");
Path mojmapTsrg = extension.getMinecraftProvider().dir("forge").toPath().resolve("mojmap.tsrg");
if (Files.notExists(mojmapTsrg) || LoomGradlePlugin.refreshDeps) {
try (BufferedWriter writer = Files.newBufferedWriter(mojmapTsrg, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
@@ -229,13 +230,15 @@ public class SrgProvider extends DependencyProvider {
}
}
mojmapTsrgMap.put(minecraftVersion, mojmapTsrg);
return mojmapTsrg;
}
public static Path getMojmapTsrg2(Project project, LoomGradleExtension extension) throws IOException {
if (mojmapTsrg2 != null) return mojmapTsrg2;
String minecraftVersion = extension.getMinecraftProvider().minecraftVersion();
if (mojmapTsrg2Map.containsKey(minecraftVersion)) return mojmapTsrg2Map.get(minecraftVersion);
mojmapTsrg2 = extension.getMinecraftProvider().dir("forge").toPath().resolve("mojmap.tsrg2");
Path mojmapTsrg2 = extension.getMinecraftProvider().dir("forge").toPath().resolve("mojmap.tsrg2");
if (Files.notExists(mojmapTsrg2) || LoomGradlePlugin.refreshDeps) {
try (BufferedWriter writer = Files.newBufferedWriter(mojmapTsrg2, StandardCharsets.UTF_8, StandardOpenOption.CREATE, StandardOpenOption.TRUNCATE_EXISTING)) {
@@ -245,6 +248,7 @@ public class SrgProvider extends DependencyProvider {
}
}
mojmapTsrg2Map.put(minecraftVersion, mojmapTsrg2);
return mojmapTsrg2;
}

View File

@@ -78,9 +78,24 @@ public class Constants {
public static final String FORGE_USERDEV = "forgeUserdev";
public static final String FORGE_INSTALLER = "forgeInstaller";
public static final String FORGE_UNIVERSAL = "forgeUniversal";
/**
* Forge's own dependencies. Not intended to be used by users,
* {@link #FORGE_RUNTIME_LIBRARY forgeRuntimeLibrary} is for that instead.
*/
public static final String FORGE_DEPENDENCIES = "forgeDependencies";
public static final String FORGE_NAMED = "forgeNamed";
/**
* "Extra" runtime dependencies on Forge. Contains the Minecraft resources
* and {@linkplain Dependencies#FORGE_RUNTIME the Architectury Loom runtime}.
*/
public static final String FORGE_EXTRA = "forgeExtra";
/**
* The configuration used to create the Forge runtime classpath file list.
* Users can also directly add files to this config.
*
* @see net.fabricmc.loom.configuration.providers.forge.ForgeUserdevProvider
*/
public static final String FORGE_RUNTIME_LIBRARY = "forgeRuntimeLibrary";
public static final String MAPPING_CONSTANTS = "mappingsConstants";
public static final String UNPICK_CLASSPATH = "unpick";
/**

View File

@@ -81,6 +81,16 @@ public final class DependencyDownloader {
return files;
}
/**
* Resolves a configuration and its superconfigurations.
*
* <p>Note that unlike resolving a {@linkplain Configuration#copyRecursive() recursive copy} of the configuration,
* this method overrides the transitivity of all superconfigurations as well.
*
* @param configuration the configuration to resolve
* @param transitive true if transitive dependencies should be included, false otherwise
* @return a mutable set containing the resolved files of the configuration
*/
public static Set<File> resolveFiles(Configuration configuration, boolean transitive) {
return resolve(configuration, transitive);
}