Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composite builds support for nested jars #992

Open
wants to merge 2 commits into
base: exp/1.5
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion src/main/java/net/fabricmc/loom/task/RemapJarTask.java
Original file line number Diff line number Diff line change
Expand Up @@ -80,9 +80,13 @@
import net.fabricmc.tinyremapper.TinyRemapper;

public abstract class RemapJarTask extends AbstractRemapJarTask {
@Deprecated
@InputFiles
public abstract ConfigurableFileCollection getNestedJars();
Comment on lines +83 to 85
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We cannot deprecate this, as its used for adding files that arent part of a Configuration

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding to this collection directly doesn't add any metadata even if the file isn't actually a mod jar. Files can also be added directly to Configurations. So it doesn't really make sense to me to actually keep this.


@Internal
public abstract ListProperty<Configuration> getNestedConfigurations();

@Input
public abstract Property<Boolean> getAddNestedDependencies();

Expand All @@ -106,7 +110,7 @@ public RemapJarTask() {
getAddNestedDependencies().convention(true).finalizeValueOnRead();

Configuration includeConfiguration = getProject().getConfigurations().getByName(Constants.Configurations.INCLUDE);
getNestedJars().from(new IncludedJarFactory(getProject()).getNestedJars(includeConfiguration));
getNestedConfigurations().add(includeConfiguration);

getUseMixinAP().set(LoomGradleExtension.get(getProject()).getMixin().getUseLegacyMixinAp());

Expand All @@ -121,6 +125,18 @@ public RemapJarTask() {
getJarType().set("classes");
}

@InputFiles
public FileCollection getNestedDependenciesResolved() { // for task up-to-date checking
final ConfigurableFileCollection files = getProject().files();

if (getAddNestedDependencies().get()) {
getNestedConfigurations().get().forEach(files::from);
files.from(getNestedJars());
}

return files;
}
Comment on lines +128 to +138
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How is this any different from putting the Configuration in the existing ConfigurableFileCollection

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding configuration directly to the existing ConfigurableFileCollection causes duplicates. That collection also doesn't take care of metadata.


private void setupPreparationTask() {
PrepareJarRemapTask prepareJarTask = getProject().getTasks().create("prepare" + getName().substring(0, 1).toUpperCase() + getName().substring(1), PrepareJarRemapTask.class, this);

Expand All @@ -141,6 +157,9 @@ private void setupPreparationTask() {
public void run() {
submitWork(RemapAction.class, params -> {
if (getAddNestedDependencies().get()) {
getNestedConfigurations().get().forEach(configuration -> {
params.getNestedJars().from(new IncludedJarFactory(getProject()).getNestedJars(configuration));
});
params.getNestedJars().from(getNestedJars());
}

Expand Down