Use a detached configuration to add jetbrains annotations to the source remapper classpath.

dev/0.11
modmuss50 2021-07-04 00:58:09 +01:00
parent 5bccf43761
commit 3a51777b4b
3 changed files with 5 additions and 6 deletions

View File

@ -48,7 +48,6 @@ import net.fabricmc.loom.configuration.RemappedConfigurationEntry;
import net.fabricmc.loom.util.Constants; import net.fabricmc.loom.util.Constants;
public class LaunchProvider extends DependencyProvider { public class LaunchProvider extends DependencyProvider {
public Dependency annotationDependency;
public LaunchProvider(Project project) { public LaunchProvider(Project project) {
super(project); super(project);
@ -81,7 +80,7 @@ public class LaunchProvider extends DependencyProvider {
addDependency(Constants.Dependencies.DEV_LAUNCH_INJECTOR + Constants.Dependencies.Versions.DEV_LAUNCH_INJECTOR, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES); addDependency(Constants.Dependencies.DEV_LAUNCH_INJECTOR + Constants.Dependencies.Versions.DEV_LAUNCH_INJECTOR, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES);
addDependency(Constants.Dependencies.TERMINAL_CONSOLE_APPENDER + Constants.Dependencies.Versions.TERMINAL_CONSOLE_APPENDER, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES); addDependency(Constants.Dependencies.TERMINAL_CONSOLE_APPENDER + Constants.Dependencies.Versions.TERMINAL_CONSOLE_APPENDER, Constants.Configurations.LOOM_DEVELOPMENT_DEPENDENCIES);
annotationDependency = addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME); addDependency(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS, JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME);
postPopulationScheduler.accept(this::writeRemapClassPath); postPopulationScheduler.accept(this::writeRemapClassPath);
} }

View File

@ -189,9 +189,9 @@ public class SourceRemapper {
m.getClassPath().add(extension.getMinecraftMappedProvider().getMappedJar().toPath()); m.getClassPath().add(extension.getMinecraftMappedProvider().getMappedJar().toPath());
m.getClassPath().add(extension.getMinecraftMappedProvider().getIntermediaryJar().toPath()); m.getClassPath().add(extension.getMinecraftMappedProvider().getIntermediaryJar().toPath());
Dependency annotationDependency = extension.getDependencyManager().getProvider(LaunchProvider.class).annotationDependency; Set<File> files = project.getConfigurations()
Set<File> files = project.getConfigurations().getByName(JavaPlugin.COMPILE_CLASSPATH_CONFIGURATION_NAME) .detachedConfiguration(project.getDependencies().create(Constants.Dependencies.JETBRAINS_ANNOTATIONS + Constants.Dependencies.Versions.JETBRAINS_ANNOTATIONS))
.files(annotationDependency); .resolve();
for (File file : files) { for (File file : files) {
m.getClassPath().add(file.toPath()); m.getClassPath().add(file.toPath());

View File

@ -29,7 +29,7 @@ import org.gradle.testkit.runner.GradleRunner
trait ProjectTestTrait { trait ProjectTestTrait {
final static String DEFAULT_GRADLE = "7.0.1" final static String DEFAULT_GRADLE = "7.0.1"
final static String PRE_RELEASE_GRADLE = "7.2-20210629235357+0000" final static String PRE_RELEASE_GRADLE = "7.2-20210703221006+0000"
static File gradleHome = File.createTempDir() static File gradleHome = File.createTempDir()
File testProjectDir = File.createTempDir() File testProjectDir = File.createTempDir()