Jeff Gaston | 6822edc | 2020-02-13 18:47:32 -0500 | [diff] [blame] | 1 | This is the buildSrc project. |
| 2 | Gradle builds (and tests) this project before the other projects, and Gradle adds its artifacts into the classpath of the other projects when configuring them. |
| 3 | |
| 4 | Tests for the buildSrc project are located in the buildSrc-tests project, so that the build doesn't need to wait for those tests to complete |
| 5 | |
| 6 | To run these tests you can run `./gradlew :buildSrc-tests:test` |
Jeff Gaston | 91268de | 2021-07-22 16:50:22 -0400 | [diff] [blame] | 7 | |
| 8 | For information about Gradle's configuration caching, see: |
| 9 | * https://medium.com/androiddevelopers/configuration-caching-deep-dive-bcb304698070 |
| 10 | * https://docs.gradle.org/current/userguide/configuration_cache.html#config_cache:requirements:use_project_during_execution |
| 11 | * https://github.com/gradle/gradle/issues/17813 |
Jeff Gaston | 3bd6634 | 2021-08-04 15:57:56 -0400 | [diff] [blame] | 12 | |
Jeff Gaston | 7ef9d25 | 2023-01-03 14:15:08 -0500 | [diff] [blame] | 13 | The buildSrc directory is split into multiple projects based on what needs to be available on the classpath when parsing build.gradle files outside of buildSrc. |
| 14 | Any classes that Gradle puts on the classpath for parsing build.gradle files can theoretically overwrite the implementation of tasks in those projects. |
| 15 | So, if a class is on that classpath and it changes, then Gradle is not confident that the task is necessarily up-to-date and Gradle will rerun it. |
| 16 | So, we move as many classes as possible off of this classpath by applying them from within a separate .gradle script instead. |
| 17 | |
| 18 | To verify that classes in private/ don't unnecessarily affect the up-to-datedness status of tasks from outside plugins, try something like this: |
| 19 | |
| 20 | ``` |
| 21 | # run a kotlin compilation task |
| 22 | ./gradlew :core:core:compileDebugKotlin |
| 23 | # make some unrelated changes in buildSrc: |
| 24 | sed -i 's/ignoreCase = true/ignoreCase = false/g' buildSrc/private/src/main/kotlin/androidx/build/ErrorProneConfiguration.kt |
| 25 | # rerun same kotlin compilation task |
| 26 | ./gradlew :core:core:compileDebugKotlin | cat |
| 27 | # see that the tasks were up-to-date |
| 28 | ``` |
Jeff Gaston | 3bd6634 | 2021-08-04 15:57:56 -0400 | [diff] [blame] | 29 | |
| 30 | See also b/140265324 for more information. |