blob: c4c40a8250d37e2070328795bab10f07929b5ecf [file] [log] [blame] [view]
Jeff Gaston6822edc2020-02-13 18:47:32 -05001This is the buildSrc project.
2Gradle 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
4Tests 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
6To run these tests you can run `./gradlew :buildSrc-tests:test`
Jeff Gaston91268de2021-07-22 16:50:22 -04007
8For 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 Gaston3bd66342021-08-04 15:57:56 -040012
Jeff Gaston7ef9d252023-01-03 14:15:08 -050013The 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.
14Any classes that Gradle puts on the classpath for parsing build.gradle files can theoretically overwrite the implementation of tasks in those projects.
15So, 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.
16So, we move as many classes as possible off of this classpath by applying them from within a separate .gradle script instead.
17
18To 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 Gaston3bd66342021-08-04 15:57:56 -040029
30See also b/140265324 for more information.