mirror of
https://github.com/architectury/architectury-loom.git
synced 2026-03-28 04:07:01 -05:00
Add dependency and configuration helpers to ModSettings.
This commit is contained in:
@@ -28,6 +28,8 @@ import javax.inject.Inject;
|
||||
|
||||
import org.gradle.api.Named;
|
||||
import org.gradle.api.Project;
|
||||
import org.gradle.api.artifacts.Configuration;
|
||||
import org.gradle.api.artifacts.Dependency;
|
||||
import org.gradle.api.file.ConfigurableFileCollection;
|
||||
import org.gradle.api.provider.ListProperty;
|
||||
import org.gradle.api.tasks.SourceSet;
|
||||
@@ -77,6 +79,23 @@ public abstract class ModSettings implements Named {
|
||||
getModSourceSets().add(new SourceSetReference(sourceSet, project));
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a number of {@link Dependency} to the mod's classpath group. Should be used to include all dependencies that are shaded into your mod.
|
||||
*
|
||||
* <p>Uses a detached configuration.
|
||||
*/
|
||||
public void dependency(Dependency... dependencies) {
|
||||
Configuration detachedConfiguration = getProject().getConfigurations().detachedConfiguration(dependencies);
|
||||
configuration(detachedConfiguration);
|
||||
}
|
||||
|
||||
/**
|
||||
* Add a {@link Configuration} to the mod's classpath group. Should be used to include all dependencies that are shaded into your mod.
|
||||
*/
|
||||
public void configuration(Configuration configuration) {
|
||||
getModFiles().from(configuration);
|
||||
}
|
||||
|
||||
/**
|
||||
* List of classpath directories, used to populate the `fabric.classPathGroups` Fabric Loader system property.
|
||||
* Use the {@link ModSettings#sourceSet} methods to add to this.
|
||||
|
||||
@@ -38,7 +38,7 @@ class SplitProjectTest extends Specification implements GradleProjectTestTrait {
|
||||
def gradle = gradleProject(project: "splitSources", version: version)
|
||||
|
||||
when:
|
||||
def result = gradle.run(task: "build")
|
||||
def result = gradle.run(tasks: ["build", "generateDLIConfig"])
|
||||
|
||||
then:
|
||||
result.task(":build").outcome == SUCCESS
|
||||
|
||||
@@ -6,8 +6,21 @@ plugins {
|
||||
sourceCompatibility = JavaVersion.VERSION_17
|
||||
targetCompatibility = JavaVersion.VERSION_17
|
||||
|
||||
configurations {
|
||||
shade
|
||||
}
|
||||
|
||||
loom {
|
||||
splitEnvironmentSourceSets()
|
||||
|
||||
mods {
|
||||
modid {
|
||||
sourceSet sourceSets.main
|
||||
sourceSet sourceSets.client
|
||||
|
||||
configuration configurations.shade
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
@@ -16,6 +29,8 @@ dependencies {
|
||||
modImplementation "net.fabricmc:fabric-loader:0.13.3"
|
||||
|
||||
modImplementation "net.fabricmc.fabric-api:fabric-api:0.47.8+1.18.2"
|
||||
|
||||
shade "com.googlecode.json-simple:json-simple:1.1.1"
|
||||
}
|
||||
|
||||
tasks.withType(JavaCompile).configureEach {
|
||||
|
||||
Reference in New Issue
Block a user