-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
If a file has a compile problem, and then another file is modified that compiles correctly dev mode will restart and ignore the original compile error. This changes the compilation so that the timestamps are only updated on a sucessful compile, so files that failed to compile will always be recompiled. (cherry picked from commit 0fcde15)
- Loading branch information
1 parent
8cdda6b
commit 1bbbe60
Showing
4 changed files
with
84 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
...http/deployment/src/test/java/io/quarkus/vertx/http/devmode/CompileCorrectlyEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.vertx.http.devmode; | ||
|
||
import javax.enterprise.event.Observes; | ||
|
||
import io.vertx.ext.web.Router; | ||
|
||
public class CompileCorrectlyEndpoint { | ||
|
||
void addConfigRoute(@Observes Router router) { | ||
router.route("/correct") | ||
.produces("text/plain") | ||
.handler(rc -> rc.response().end("correct")); | ||
} | ||
} |
14 changes: 14 additions & 0 deletions
14
...rtx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/CompileErrorEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package io.quarkus.vertx.http.devmode; | ||
|
||
import javax.enterprise.event.Observes; | ||
|
||
import io.vertx.ext.web.Router; | ||
|
||
public class CompileErrorEndpoint { | ||
|
||
void addConfigRoute(@Observes Router router) { | ||
router.route("/error") | ||
.produces("text/plain") | ||
.handler(rc -> rc.response().end("error")); | ||
} | ||
} |
39 changes: 39 additions & 0 deletions
39
...vertx-http/deployment/src/test/java/io/quarkus/vertx/http/devmode/CompileProblemTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package io.quarkus.vertx.http.devmode; | ||
|
||
import static org.hamcrest.Matchers.equalTo; | ||
|
||
import org.jboss.shrinkwrap.api.ShrinkWrap; | ||
import org.jboss.shrinkwrap.api.spec.JavaArchive; | ||
import org.junit.jupiter.api.Test; | ||
import org.junit.jupiter.api.extension.RegisterExtension; | ||
|
||
import io.quarkus.test.QuarkusDevModeTest; | ||
import io.restassured.RestAssured; | ||
|
||
/** | ||
* Tests that once a file has a compile error restart will not happen until it is fixed, even if | ||
* other files are subsequently modified that do compile. | ||
*/ | ||
public class CompileProblemTest { | ||
|
||
@RegisterExtension | ||
static final QuarkusDevModeTest test = new QuarkusDevModeTest() | ||
.setArchiveProducer(() -> ShrinkWrap.create(JavaArchive.class) | ||
.addClasses(CompileErrorEndpoint.class, CompileCorrectlyEndpoint.class)); | ||
|
||
@Test | ||
public void test() { | ||
RestAssured.get("/error").then().body(equalTo("error")); | ||
RestAssured.get("/correct").then().body(equalTo("correct")); | ||
test.modifySourceFile(CompileErrorEndpoint.class, s -> s.replace("\"error\"", "\"compile error")); | ||
RestAssured.get("/error").then().statusCode(500); | ||
RestAssured.get("/correct").then().statusCode(500); | ||
test.modifySourceFile(CompileCorrectlyEndpoint.class, s -> s.replace("\"correct\"", "\"compiled correctly\"")); | ||
//make sure that we are still in an error state, as CompileErrorEndpoint is broken | ||
RestAssured.get("/error").then().statusCode(500); | ||
RestAssured.get("/correct").then().statusCode(500); | ||
test.modifySourceFile(CompileErrorEndpoint.class, s -> s.replace("compile error", "compile error fixed\"")); | ||
RestAssured.get("/error").then().body(equalTo("compile error fixed")); | ||
RestAssured.get("/correct").then().body(equalTo("compiled correctly")); | ||
} | ||
} |