-
Notifications
You must be signed in to change notification settings - Fork 503
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
Setup toolchains, compile project with Java 20 only, run test on various Java versions #2120
Setup toolchains, compile project with Java 20 only, run test on various Java versions #2120
Conversation
b0cb889
to
98da6d2
Compare
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.
Thanks you so much for all explanatory comments on the changes. As I have little Gradle knowledge, I wouldn't have understand what was changed. Now at least, I have some more understanding.
My biggest concern with this change is that there are many locations where a java version is to be changed whenever a new Java version is release or whenever an LTS version is dropped. So all location should be clearly marked with something like Java version for compilation (e.g. latest release Java version)
or Supported LTS versions of Java + latest non-LTS version if applicable
.
98da6d2
to
34c5ae0
Compare
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 pushed another proposal, with less distributed config:
- Java compilation settings are now driven by versions defined in
.toml
file - Tested Java versions are now defined only within workflow file
- Java version hardcoded in workflow files still have to be kept in sync, so I added necessary comments reminding to update the value
@paul-dingemans Please let me know if this suits you any better, or if the complexity in the configuration is not worth having since source of truth for Java setup
9c5ab50
to
171790c
Compare
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.
Just saw that I had some more pending review comments.
171790c
to
2ab6b3b
Compare
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.
Welp, I couldn't create separate PR, targeting this one since this branch lives only in my forked repository :/
I pushed another set of commits, on top of old ones, but if you want to see the diff alone, it can be viewed here: mateuszkwiecinski#3 🤷
414b307
to
0e5fc2a
Compare
We have to wait till next week before @shashachu is back from holidays. I cannot change the configuration so that the remaining checks are run as well. |
@mateuszkwiecinski I am not sure whether we are both waiting for the other to proceed. As far as I know, there are still some conversations which I have not resolved because they are not fixed, but I could be wrong. |
Yes, sorry, I saw your comments and I still plan to address them as soon as I find some time. Both here and in the other PR I have opened. |
Sure, no problem. Just wanted to make sure that we are aligned. |
0e5fc2a
to
8f119c0
Compare
Oookay, I think I addressed all remaining items now. Please let me know in case I missed something 👀 If you manage to merge the new CI pipeline, I'll monitor build scans for a week or two to see if there are any bottlenecks or low-hanging fruits to improve CI build times 👀 |
I have merged #2136 earlier today. As of that a merge conflict appead in this PR. I am not sure how to resolve. So please have a look. |
If someone doesn't have required java installed Gradle will attempt to install one
The build needs less than 0.5GB of a java heap memory. There is no value in reserving more than half of available RAM just for the Gradle demon. It's better to keep Gradle daemon small and leave the memory available to other forked processes (i.e. tests)
CI doesn't modify files, there is no value in putting extra effort in efficiently tracking changed files. From test runs VFS comes with noticable performance impact on Windows build
8f119c0
to
53bd98f
Compare
I think the checks have been updated properly now. |
Looks like it. The build succeeded. I will merge. |
…ous Java versions (pinterest#2120) * Replace testing on java 19 with testing on java 20 Closes pinterest#1888 * Unify `yml` files formating * Do NOT compile the project with various Java version, instead test agains various java verstions https://jakewharton.com/build-on-latest-java-test-through-lowest-java/ * Add `-add-opens` jvmArg to prevent ignored warnings * Migrate away deprecated `java.net.URL` constructor * Setup toolchain resolver If someone doesn't have required java installed Gradle will attempt to install one * Extract common build setup + fix memory settings The build needs less than 0.5GB of a java heap memory. There is no value in reserving more than half of available RAM just for the Gradle demon. It's better to keep Gradle daemon small and leave the memory available to other forked processes (i.e. tests) * Disable VFS on CI CI doesn't modify files, there is no value in putting extra effort in efficiently tracking changed files. From test runs VFS comes with noticable performance impact on Windows build * Update comment with extra clarification * Disable automatic build scans publishing on local builds * Update kotlin dev version * Fix `-PkotlinDev` not running tests agains configured kotlin version * Fix `-PkotlinDev` artifacts version * Run `-PkotlinDev` build as a separate workflow job in parallel Co-authored-by: paul-dingemans <paul-dingemans@users.noreply.github.com>
…ous Java versions (pinterest#2120) * Replace testing on java 19 with testing on java 20 Closes pinterest#1888 * Unify `yml` files formating * Do NOT compile the project with various Java version, instead test agains various java verstions https://jakewharton.com/build-on-latest-java-test-through-lowest-java/ * Add `-add-opens` jvmArg to prevent ignored warnings * Migrate away deprecated `java.net.URL` constructor * Setup toolchain resolver If someone doesn't have required java installed Gradle will attempt to install one * Extract common build setup + fix memory settings The build needs less than 0.5GB of a java heap memory. There is no value in reserving more than half of available RAM just for the Gradle demon. It's better to keep Gradle daemon small and leave the memory available to other forked processes (i.e. tests) * Disable VFS on CI CI doesn't modify files, there is no value in putting extra effort in efficiently tracking changed files. From test runs VFS comes with noticable performance impact on Windows build * Update comment with extra clarification * Disable automatic build scans publishing on local builds * Update kotlin dev version * Fix `-PkotlinDev` not running tests agains configured kotlin version * Fix `-PkotlinDev` artifacts version * Run `-PkotlinDev` build as a separate workflow job in parallel Co-authored-by: paul-dingemans <paul-dingemans@users.noreply.github.com>
tasks.withType<JavaCompile>().configureEach { | ||
sourceCompatibility = JavaVersion.VERSION_1_8.toString() | ||
targetCompatibility = JavaVersion.VERSION_1_8.toString() | ||
val requestedJdkVersion = project.findProperty("testJdkVersion")?.toString()?.toInt() |
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 should keep using lazy APIs, https://docs.gradle.org/current/javadoc/org/gradle/api/provider/ProviderFactory.html#gradleProperty-java.lang.String-
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.
What's the value of doing extra abstraction if the property is consumed immediately, at the configuration time?
Lazy APIs are useful to take the burden off the single-threaded configuration phase and do more things during task execution time. The documentation: https://docs.gradle.org/current/userguide/lazy_configuration.html#lazy_properties doesn't mention our setup as an example use case that would benefit lazy configuration.
I'd still suggest using simpler version, as long as it's not deprecated, or adding extra complexity comes with any performance benefit 🤷
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.
It's the Gradle recommending way, I'd prefer to follow the best practice.
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.
It's the Gradle recommending way
Can you link where Gradle recommends using providers in use cases like this? I agree it's a general recommendation to:
- wire Gradle models
- wiring Task inputs & outputs
- Avoiding doing work during configuration phase
None of them are applicable here, and blindly using lazy APIs doesn't bring any value.
I can also link this: which says:
Avoid simplifying calls like obj.getProperty().get() and obj.getProperty().set(T) in your code by introducing additional getters and setters.
which is exactly what you'd have to do if you used gradleProperty()
api 🤷
An alternative approach to using native Gradle APIs (like I did), is to use kts delegates, in this case:val testJdkVersion: String? by project
, but that's a syntactic sugar and doesn't change behavior (in context of being lazy or not) 🤷
I'll be happy to be proven wrong, otherwise forcing to use lazy for properties that are consumed only during configuration phase is useless 🤷
Closes #1888
Description
I wanted to open the project, but it failed to sync for me locally (because my defaults point to Java 20), so I decided to make the build more deterministic. I'll comment out all changes in the PR since some of them require your input, but the tl;dr is:
Checklist
Before submitting the PR, please check following (checks which are not relevant may be ignored):
Closes #<xxx>
orFixes #<xxx>
(replace<xxx>
with issue number)CHANGELOG.md
is updatedDocumentation is updated. See difference between snapshot and release documentation