-
Notifications
You must be signed in to change notification settings - Fork 62
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
Make Gradle tasks cacheable #295
Conversation
@casid, I'm trying to figure out how to add a test for this, though. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #295 +/- ##
============================================
- Coverage 91.21% 91.15% -0.07%
+ Complexity 1197 1196 -1
============================================
Files 76 76
Lines 3132 3132
Branches 484 484
============================================
- Hits 2857 2855 -2
- Misses 167 168 +1
- Partials 108 109 +1 ☔ View full report in Codecov by Sentry. |
297aa6d
to
9aaeaeb
Compare
I don't have time to have a detailed look, but I skimmed through and it seems good. |
This comment was marked as resolved.
This comment was marked as resolved.
This comment was marked as outdated.
This comment was marked as outdated.
Unfortunately, I'm not really a gradle expert, so I can't help much with this. :-( |
8494243
to
49b09a1
Compare
This comment was marked as duplicate.
This comment was marked as duplicate.
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.
Thank you for your contribution @marcospereira!
I left a few notes that need to be changed, so that we don't miss platform specific bugs in the future.
@edward3h could you have a quick look at the changes to the Gradle plugin, if possible? You have a lot more expertise here as I do :-)
|
||
public static Stream<Arguments> checkBuildCache() { | ||
return Stream | ||
.of(Paths.get("../jte-runtime-cp-test-models-gradle"), Paths.get("../jte-runtime-test-gradle-convention")) |
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.
Hmm, what about the other test projects?
gg.jte.GradleMatrixTest#runGradleBuild()
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.
We are only interested in testing that the tasks are cacheable and not checking every project (done in the other above).
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.
Hey @casid, fixed most of the comments and added a reply to the test selection in GradleMatrixTest
. See if this looks better for you now.
|
||
public static Stream<Arguments> checkBuildCache() { | ||
return Stream | ||
.of(Paths.get("../jte-runtime-cp-test-models-gradle"), Paths.get("../jte-runtime-test-gradle-convention")) |
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.
We are only interested in testing that the tasks are cacheable and not checking every project (done in the other above).
LGTM, would wait a few more days with the merge, so that @edward3h might have a chance to look at it. |
I'm busy this weekend, but I can take a look on Monday. |
I am happy with this change. Thanks @marcospereira ! |
Awesome! Thanks for taking the time to review, @edward3h. @casid, I guess this is good to merge/release then. 🍾 |
Thanks everyone! |
Hey @casid, just a quick check about when we can have a release with these changes. 🚀 |
@marcospereira I just released version 3.1.5 :-) |
What?
Gradle has a build cache that can be used to speed up the build process. From Gradle docs:
I noticed that the build cache for the
compileKotlin
task was not working when using jte'sgenerate
orprecompile
, because the inputs generated by those tasks were not cached. Therefore, the generated code would be considered new input forcompileKotlin
, meaning the task cannot use the build cache. I suspect the same applies tocompileJava
, but I didn't check.Local validation
Comparison when running the
compileKotlin
task with and without-Dorg.gradle.caching=true
.Before
Running with
--build-cache
multiple times has no effect since the cache is always stale:After
With no cache (
--warning-mode=none
for brevity):With a populated build-cache (notice the
FROM-CACHE
):Let's see the effect on
testClasses
after running the command above:And then, since the build cache was populated: