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>
dev/0.11
modmuss50 2021-10-29 13:29:29 +01:00 committed by GitHub
parent 177264420e
commit e409f13b8c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View File

@ -57,6 +57,10 @@ public final class CompileConfiguration {
extension.createLazyConfiguration(Constants.Configurations.MINECRAFT).configure(configuration -> configuration.setTransitive(false)); 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.INCLUDE).configure(configuration -> configuration.setTransitive(false)); // Dont get transitive deps
extension.createLazyConfiguration(Constants.Configurations.MAPPING_CONSTANTS); 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); 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 (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. // 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."); throw new IllegalArgumentException("fabric-loom must be applied BEFORE kapt in the plugins { } block.");

View File

@ -72,6 +72,7 @@ public class Constants {
public static final String LOOM_DEVELOPMENT_DEPENDENCIES = "loomDevelopmentDependencies"; public static final String LOOM_DEVELOPMENT_DEPENDENCIES = "loomDevelopmentDependencies";
public static final String MAPPING_CONSTANTS = "mappingsConstants"; public static final String MAPPING_CONSTANTS = "mappingsConstants";
public static final String UNPICK_CLASSPATH = "unpick"; public static final String UNPICK_CLASSPATH = "unpick";
public static final String NAMED_ELEMENTS = "namedElements";
private Configurations() { private Configurations() {
} }

View File

@ -31,10 +31,6 @@ allprojects {
} }
configurations {
dev
}
jar { jar {
archiveClassifier.set "dev" archiveClassifier.set "dev"
} }

View File

@ -1,7 +1,7 @@
archivesBaseName = "example" archivesBaseName = "example"
dependencies { dependencies {
implementation project(path: ":core", configuration: "dev") implementation project(path: ":core", configuration: "namedElements")
} }
loom { loom {