add dev mode where warnings don't fail the test (#11273)

Co-authored-by: Trask Stalnaker <trask.stalnaker@gmail.com>
This commit is contained in:
Gregor Zeitlinger 2024-06-12 20:02:07 +02:00 committed by GitHub
parent c8bea45f49
commit 0259a9f5aa
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 17 additions and 4 deletions

View File

@ -72,12 +72,13 @@ tasks.withType<JavaCompile>().configureEach {
// We suppress the "options" warning because it prevents compilation on modern JDKs
"-Xlint:-options",
// jdk21 generates more serial warnings than previous versions
"-Xlint:-serial",
// Fail build on any warning
"-Werror"
"-Xlint:-serial"
)
)
if (System.getProperty("dev") != "true") {
// Fail build on any warning
compilerArgs.add("-Werror")
}
}
encoding = "UTF-8"

View File

@ -38,6 +38,18 @@ To run these tests locally, add `-PtestLatestDeps=true` to your existing `gradle
Executing `./gradlew :instrumentation:<INSTRUMENTATION_NAME>:test --tests <GROOVY TEST FILE NAME>` will run only the selected test.
### How to prevent linting and formatting warnings from failing tests
During local development, you may want to ignore lint warnings when running tests.
To ignore warnings, formatting issues, or other non-fatal issues in tests, use
```
./gradlew test -Ddev=true -x spotlessCheck -x checkstyleMain
```
The `dev` flag will ignore warnings in tests.
## Smoke tests
The smoke tests are not run as part of a global `test` task run since they take a long time and are