Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
wants to merge 3 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ target
**/build/
**/generated/
examples/**/build/
build-cache/

# Eclipse #
###########
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
17 changes: 17 additions & 0 deletions docs/contributing/running-tests.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,23 @@ 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.

### Ignoring warnings in tests

During local development, you may want to ignore warnings in 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
- will use a local build cache, which can speed up the build

The local build cache is also useful for other commands, such as `./gradlew spotlessApply -Ddev=true`.

## Smoke tests

The smoke tests are not run as part of a global `test` task run since they take a long time and are
Expand Down
11 changes: 9 additions & 2 deletions settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,15 @@ if (useScansGradleCom) {
}

buildCache {
remote(develocity.buildCache) {
isPush = isCI && geAccessKey.isNotEmpty()
if (System.getProperty("dev") == "true") {
local {
directory = File(rootDir, "build-cache")
removeUnusedEntriesAfterDays = 30
}
} else {
remote(develocity.buildCache) {
isPush = isCI && geAccessKey.isNotEmpty()
}
}
}
}
Expand Down