Skip to content

Commit

Permalink
fix(gradle): restore task replacement (#3110)
Browse files Browse the repository at this point in the history
* Use same approach as in Maven

* Re-enable task override

* Restore task dependency
  • Loading branch information
cromoteca authored Jan 2, 2025
1 parent c6fd240 commit 567ad7e
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,15 @@ private static Path generateAotArtifacts(

// Runs the SpringApplicationAotProcessor to generate the
// reflect-config.json file. This comes from the `process-aot` goal.
new ProcessBuilder().inheritIO().command(javaExecutable, "@" + argsFile)
.start().waitFor();
Files.delete(argsFile);
int exitCode = new ProcessBuilder().inheritIO()
.command(javaExecutable, "@" + argsFile).start().waitFor();

if (exitCode == 0) {
Files.delete(argsFile);
} else {
LOGGER.error(
SPRING_AOT_PROCESSOR + " exited with code: " + exitCode);
}

var json = aotOutput.resolve(Path.of("resources", "META-INF",
"native-image", engineConfiguration.getGroupId(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public open class EngineGenerateTask : DefaultTask() {
description = "Hilla Generate Task"

// we need the compiled classes:
dependsOn("classes", "hillaConfigure")
dependsOn("classes")

// Make sure to run this task before the `war`/`jar` tasks, so that
// generated endpoints and models will end up packaged in the war/jar archive.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ public class HillaPlugin : Plugin<Project> {
// to leverage from vaadinPrepareFrontend and vaadinBuildFrontend:
project.pluginManager.apply(VaadinPlugin::class.java)

project.tasks.replace("vaadinBuildFrontend", EngineBuildFrontendTask::class.java)

project.tasks.apply {
register("hillaConfigure", EngineConfigureTask::class.java)
register("hillaGenerate", EngineGenerateTask::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public void runProductionBuild() {
} catch (IOException e) {
fail(e);
}
runGradleCommand("--info -Pvaadin.productionMode=true build");
runGradleCommand("--info --stacktrace -Pvaadin.productionMode=true build");
}

private void runGradleCommand(String executable) {
Expand Down

0 comments on commit 567ad7e

Please sign in to comment.