Skip to content

Commit

Permalink
Replace Deprecated .getBuildDir with .getLayout().getBuildDirectory()…
Browse files Browse the repository at this point in the history
… and make Lazy (#978)

* replace Deprecated .getBuildDir with .getLayout().getBuildDirectory().getAsFile().get()

Signed-off-by: Joseph T. McQuigg <[email protected]>

* Make lazy

Co-authored-by: modmuss <[email protected]>

* MORE

Signed-off-by: Joseph T. McQuigg <[email protected]>

* remove file import

Signed-off-by: Joseph T. McQuigg <[email protected]>

---------

Signed-off-by: Joseph T. McQuigg <[email protected]>
Co-authored-by: modmuss <[email protected]>
  • Loading branch information
JT122406 and modmuss50 authored Dec 8, 2023
1 parent 229b3b3 commit 53112fb
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,6 @@ protected File getProjectDir() {

@Override
protected File getBuildDir() {
return project.getBuildDir();
return project.getLayout().getBuildDirectory().getAsFile().get();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@

package net.fabricmc.loom.task;

import java.io.File;

import javax.inject.Inject;

import org.gradle.api.Project;
Expand Down Expand Up @@ -92,7 +90,7 @@ public void run() {
// Configure the default jar task
getTasks().named(JavaPlugin.JAR_TASK_NAME, AbstractArchiveTask.class).configure(task -> {
task.getArchiveClassifier().convention("dev");
task.getDestinationDirectory().set(new File(getProject().getBuildDir(), "devlibs"));
task.getDestinationDirectory().set(getProject().getLayout().getBuildDirectory().map(directory -> directory.dir("devlibs")));
});

getTasks().named(BasePlugin.ASSEMBLE_TASK_NAME).configure(task -> task.dependsOn(remapJarTask));
Expand Down Expand Up @@ -139,7 +137,7 @@ private void trySetupSourceRemapping() {
}

sourcesJarTask.getArchiveClassifier().convention("dev-sources");
sourcesJarTask.getDestinationDirectory().set(new File(getProject().getBuildDir(), "devlibs"));
sourcesJarTask.getDestinationDirectory().set(getProject().getLayout().getBuildDirectory().map(directory -> directory.dir("devlibs")));
task.getArchiveClassifier().convention("sources");

task.dependsOn(sourcesJarTask);
Expand Down

0 comments on commit 53112fb

Please sign in to comment.