Skip to content

Commit

Permalink
Make sure quarkusGenerateCode is run before tests
Browse files Browse the repository at this point in the history
  • Loading branch information
glefloch committed Dec 3, 2021
1 parent 0c752d9 commit 7e078ae
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,7 @@ public void execute(Task test) {
});
tasks.named(JavaPlugin.COMPILE_TEST_JAVA_TASK_NAME, JavaCompile.class,
compileTestJava -> {
compileTestJava.dependsOn(quarkusGenerateCode);
compileTestJava.dependsOn(quarkusGenerateCodeTests);
if (project.getGradle().getStartParameter().getTaskNames().contains(QUARKUS_DEV_TASK_NAME)) {
compileTestJava.getOptions().setFailOnError(false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,16 @@ public void canRunTest() throws Exception {
assertThat(buildResult.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
}

@Test
public void generateCodeBeforeTests() throws Exception {
createProject(SourceType.JAVA);

BuildResult firstBuild = runGradleWrapper(projectRoot, "test", "--stacktrace");
assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCode");
assertThat(firstBuild.getOutput()).contains("Task :quarkusGenerateCodeTests");
assertThat(firstBuild.getTasks().get(":test")).isEqualTo(BuildResult.SUCCESS_OUTCOME);
}

private void createProject(SourceType sourceType) throws Exception {
Map<String, Object> context = new HashMap<>();
context.put("path", "/greeting");
Expand Down

0 comments on commit 7e078ae

Please sign in to comment.