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
SOLR-15603: Activate Gradle build cache #277
Conversation
build.gradle
Outdated
@@ -20,7 +20,7 @@ import java.time.format.DateTimeFormatter | |||
|
|||
plugins { | |||
id "base" | |||
id "com.palantir.consistent-versions" version "1.14.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is a patch upgrading this plugin (and all of gradle infrastructure) here - #275. It'll conflict with your PR, once applied. I'll cherry pick relevant areas if you don't want to spend any more time on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ho, I missed this effort upgrading to 7.x, good stuff ! I can wait for your branch to be merged and I'll fix my branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm planning to merge tomorrow, sorry for not mentioning this earlier.
gradle/generate-defaults.gradle
Outdated
@@ -42,6 +42,7 @@ configure(rootProject) { | |||
"systemProp.file.encoding=UTF-8", | |||
"org.gradle.jvmargs=-Xmx3g", // TODO figure out why "gradlew check" runs out of memory if 2g | |||
"org.gradle.parallel=true", | |||
"org.gradle.caching=true", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This enables local caches, right? I'm not sure folks will be enthusiastic about their home folders increasing in size so dramatically - solr build outputs are pretty heavy.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Right, so if you're afraid of this, I can remove this setting and you can enable it through the command line when building, check after a few weeks of dev if it's acceptable. It's hard to predict the size, currently I see on my machine it's about 400Mb (after removing the cache directory and running a few solr builds)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be left commented out in the generated user defaults - let it be an opt-in. I plan to commit gradle 7.2 path tomorrow and reiterate on your patch, cherry picking the obvious parts of it. Stay tuned. :)
@@ -40,11 +41,13 @@ class CheckBrokenLinksTask extends DefaultTask { | |||
@InputFile | |||
File script = project.rootProject.file("dev-tools/scripts/checkJavadocLinks.py") | |||
|
|||
@OutputFile |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yup, this is good, thanks.
@@ -1,5 +1,5 @@ | |||
distributionBase=GRADLE_USER_HOME | |||
distributionPath=wrapper/dists | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.3-all.zip | |||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.1-bin.zip |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this alone won't work - requires a new checksum too (dont in that other PR).
abstract class PrepareSources extends DefaultTask { | ||
// Original Source files we'll be syncing <b>FROM</b> | ||
@InputDirectory | ||
public DirectoryProperty srcDir = project.objects.directoryProperty() | ||
abstract DirectoryProperty getSrcDir() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Are these abstract properties automatically injected if you declare them like this? Where is the gradle docs that explains this (and which properties can be injected like so)? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes exactly, so the docs are here but afaik it does not explain the runtime magical injection happening.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, I see it now. Yeah - it'd be good to require the Inject annotation on those abstract properties too. This would be more intuitive (to me at least).
Hi Alexis. I've rebased your patch on top of main (gradle 7.2) and cleaned up some minor noise here and there. The build currently fails though - not sure which normalization strategy would be suitable here.
|
Hi Dawid, I will rebase locally and investigate (today hopefuly) |
Hey, no rush. I don't think you need to rebase - just pull the changes? I pushed the cleanups directly to your branch (PRs allow for this). |
Ho right, I missed it, after rebasing I've managed to fix those issues locally, is it ok for you if I force push my changes with a clean commit ? |
Sure, go ahead. |
checkBrokenLinks, renderJavadoc, renderSiteJavadoc, buildLocalJavadocLinksSite, buildSite, prepareLocalJavadocLinksSiteSources, prepareSiteSources tasks are now cacheable. To take real advantage of the cache between builds, the seed property should be fixed, for example: ./gradlew clean check -Ptests.seed=DEADBEE
47647f3
to
8b60cf5
Compare
@dweiss ok it's pushed, it should be fine now |
https://issues.apache.org/jira/browse/SOLR-15603
Description
Activate gradle local build cache to take advantage of re-using past build executions on a single machine, it improves build time when switching between branches for example.
Solution
Set the gradle build cache flag, upgrade gradle to 6.9.1, upgrade a 3rd party plugin and make some tasks cacheable when easily doable. More context below:
solr:core:test
, it takes advantage of up-to-date checks and local cache if thetests.seed
property is set to a fixed value. That said it does not take advantage of remote cache because some system properties use absolute path.Using a remote cache would be interesting since you have a CI that could publish to a remote cache node, remote developpers would then have faster local builds.
checkBrokenLinks, renderJavadoc, renderSiteJavadoc, buildLocalJavadocLinksSite, buildSite, prepareLocalJavadocLinksSiteSources, prepareSiteSources
tasks are now cacheable, but still:solr:solr-ref-guide:jrubyPrepare
is always executed and quite heavy (dowloading/installing gems).Tests
Manually checked the build performance improvement:
Checklist
Please review the following and check all that apply:
main
branch../gradlew check
.