Add dev config with default jar task on it, to aid with depending on … (#525)
* Add dev config with default jar task on it, to aid with depending on sub projects. * Rename to `namedElements` * Update src/main/java/net/fabricmc/loom/configuration/CompileConfiguration.java Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com> Co-authored-by: Juuxel <6596629+Juuxel@users.noreply.github.com>
This commit is contained in:
parent
177264420e
commit
e409f13b8c
4 changed files with 9 additions and 5 deletions
|
@ -57,6 +57,10 @@ public final class CompileConfiguration {
|
|||
extension.createLazyConfiguration(Constants.Configurations.MINECRAFT).configure(configuration -> configuration.setTransitive(false));
|
||||
extension.createLazyConfiguration(Constants.Configurations.INCLUDE).configure(configuration -> configuration.setTransitive(false)); // Dont get transitive deps
|
||||
extension.createLazyConfiguration(Constants.Configurations.MAPPING_CONSTANTS);
|
||||
extension.createLazyConfiguration(Constants.Configurations.NAMED_ELEMENTS).configure(configuration -> {
|
||||
configuration.setCanBeConsumed(true);
|
||||
configuration.setCanBeResolved(false);
|
||||
});
|
||||
|
||||
extendsFrom(JavaPlugin.COMPILE_ONLY_CONFIGURATION_NAME, Constants.Configurations.MAPPING_CONSTANTS, project);
|
||||
|
||||
|
@ -147,6 +151,9 @@ public final class CompileConfiguration {
|
|||
}
|
||||
});
|
||||
|
||||
// Add the "dev" jar to the "namedElements" configuration
|
||||
p.artifacts(artifactHandler -> artifactHandler.add(Constants.Configurations.NAMED_ELEMENTS, p.getTasks().getByName("jar")));
|
||||
|
||||
if (p.getPluginManager().hasPlugin("org.jetbrains.kotlin.kapt")) {
|
||||
// If loom is applied after kapt, then kapt will use the AP arguments too early for loom to pass the arguments we need for mixin.
|
||||
throw new IllegalArgumentException("fabric-loom must be applied BEFORE kapt in the plugins { } block.");
|
||||
|
|
|
@ -72,6 +72,7 @@ public class Constants {
|
|||
public static final String LOOM_DEVELOPMENT_DEPENDENCIES = "loomDevelopmentDependencies";
|
||||
public static final String MAPPING_CONSTANTS = "mappingsConstants";
|
||||
public static final String UNPICK_CLASSPATH = "unpick";
|
||||
public static final String NAMED_ELEMENTS = "namedElements";
|
||||
|
||||
private Configurations() {
|
||||
}
|
||||
|
|
|
@ -31,10 +31,6 @@ allprojects {
|
|||
|
||||
}
|
||||
|
||||
configurations {
|
||||
dev
|
||||
}
|
||||
|
||||
jar {
|
||||
archiveClassifier.set "dev"
|
||||
}
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
archivesBaseName = "example"
|
||||
|
||||
dependencies {
|
||||
implementation project(path: ":core", configuration: "dev")
|
||||
implementation project(path: ":core", configuration: "namedElements")
|
||||
}
|
||||
|
||||
loom {
|
||||
|
|
Loading…
Reference in a new issue