Skip to content

Commit

Permalink
Merge pull request #21910 from glefloch/fix/21878
Browse files Browse the repository at this point in the history
Make sure quarkusGenerateCode is run before tests
  • Loading branch information
glefloch authored Dec 3, 2021
2 parents cd8fde5 + 7e078ae commit 249d155
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 249d155

Please sign in to comment.