Improve GEMINI.md and test.py documentation Change-Id: Ifbaeb34c313bfb2812f4a28d38a87210f232625d
diff --git a/GEMINI.md b/GEMINI.md index 732d22c..526a5fe 100644 --- a/GEMINI.md +++ b/GEMINI.md
@@ -7,7 +7,7 @@ * **D8:** A dexer that converts Java bytecode to DEX format. * **R8:** A shrinker and minifier that optimizes Java bytecode and converts it to DEX format. -The project is written in Java and Kotlin and uses Gradle for building. It is a multi-module project with several components, including `main`, `library_desugar`, and `test`. +The Git project is written in Java and Kotlin and uses Gradle for building. It is a multi-module project with several components, including `main`, `library_desugar`, and `test`. ## Building and Running @@ -21,6 +21,20 @@ This will produce a JAR file at `build/libs/r8.jar`. +For a lighter target that just compiles the code without building the full R8 JAR, you can use: + +```bash +tools/gradle.py classes +``` + +### Disabling Error Prone + +Compilation is usually pretty strict due to Error Prone. You can turn it off for debugging-style edits (e.g., leaving unused imports) by passing the property `-Pdisable_errorprone`: + +```bash +tools/gradle.py classes -Pdisable_errorprone +``` + ### Running D8 D8 is used to convert Java class files to the DEX format. @@ -68,6 +82,9 @@ tools/test.py --no-internal ``` +> [!NOTE] +> `test.py` invokes Gradle, so avoid running concurrent invocations of it to prevent conflicts. + By default, this runs tests using r8lib.jar, which is a bootstrapped R8. It is possible to speed up local testing by running tests with a non-bootstrapped R8: ```bash @@ -77,7 +94,13 @@ It is possible to run a single test by passing the name of the test, e.g., ```bash -tools/test.py --no-internal *ProguardConfigurationParserTest* +tools/test.py --no-internal --no-r8lib *ProguardConfigurationParserTest* +``` + +`tools/test.py` can take multiple additive filters. + +```bash +tools/test.py --no-internal --no-r8lib *ProguardConfigurationParserTest* *ClassInlinerTest* ``` ## Development Conventions
diff --git a/tools/test.py b/tools/test.py index c2b76b1..634f2ee 100755 --- a/tools/test.py +++ b/tools/test.py
@@ -289,6 +289,10 @@ help='Only compile project and tests, do not run tests', default=False, action='store_true') + result.add_argument( + 'filter', + nargs='*', + help='Test filters. They are additive and support wildcards (e.g., *).') options, args = result.parse_known_args() if options.java_max_memory_size is None: # YouTubeV1719Test OOM's with 4G, so raise xmx to 6G when running internal tests. @@ -359,7 +363,7 @@ def Main(): (options, args) = ParseOptions() - return_code = test(options, args) + return_code = test(options, options.filter) if return_code == 0 and options.land: land(options) return return_code