Skip to content
This repository has been archived by the owner on Feb 6, 2024. It is now read-only.

Commit

Permalink
Avoid War and Jar task creation
Browse files Browse the repository at this point in the history
  • Loading branch information
chanseokoh committed Feb 18, 2021
1 parent 29190de commit bae6dc2
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,11 @@ private void configureExtensions() {
// we can only set the default location of "archive" after project evaluation (callback)
if (stageExtension.getArtifact() == null) {
if (project.getPlugins().hasPlugin(WarPlugin.class)) {
War war = tasks.withType(War.class).getByName("war");
stageExtension.setArtifact(war.getArchivePath());
stageExtension.setArtifact(
tasks.withType(War.class).named("war").map(war -> war.getArchivePath()));
} else if (project.getPlugins().hasPlugin(JavaPlugin.class)) {
Jar jar = tasks.withType(Jar.class).getByName("jar");
stageExtension.setArtifact(jar.getArchivePath());
stageExtension.setArtifact(
tasks.withType(Jar.class).named("jar").map(jar -> jar.getArchivePath()));
} else {
throw new GradleException("Could not find JAR or WAR configuration");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -149,18 +149,10 @@ private void createExplodeWarTask() {
task.dependsOn(WarPlugin.WAR_TASK_NAME);
task.setGroup(APP_ENGINE_STANDARD_TASK_GROUP);
task.setDescription("Explode a war into a directory");
task.setWarFile(
tasks.withType(War.class).named("war").map(war -> war.getArchivePath()));
});

project.afterEvaluate(
project ->
explodeWar.configure(
task ->
task.setWarFile(
tasks
.withType(War.class)
.getByName((WarPlugin.WAR_TASK_NAME))
.getArchivePath())));

tasks.named(BasePlugin.ASSEMBLE_TASK_NAME).configure(task -> task.dependsOn(explodeWar));
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ public class ExplodeWarTask extends Sync {

private File explodedAppDirectory;

public void setWarFile(File warFile) {
public void setWarFile(Object warFile) {
from(getProject().zipTree(warFile));
}

Expand Down

0 comments on commit bae6dc2

Please sign in to comment.