Skip to content

Conversation

bric3
Copy link
Contributor

@bric3 bric3 commented Nov 19, 2024

This PR converts groovy build scripts of gradle module to Kotlin (fixes #3445).

Currently the script are written in Groovy (the Gradle Groovy DSL), because kotlin DSL was not a thing back then. But over time Kotlin script is getting the preferred option. The stronger type system improves significantly the developer experience, especially in IntelliJ IDEA.

https://docs.gradle.org/current/userguide/kotlin_dsl.html

Most project were straightforward to convert. Osgi related modules required more attention, due to low expertise on osgi and bnd tooling and, for tests due to some unusual setup. I decided to consolidate some script as it made it easier to grasp the build script.

For mockito-core and mockito-junit-jupiter in particular the produced manifest was compared to previous release.

Fixed: Java 21 tests some customized tests tasks where not executed.

Checklist

  • Read the contributing guide
  • PR should be motivated, i.e. what does it fix, why, and if relevant how
  • If possible / relevant include an example in the description, that could help all readers
    including project members to get a better picture of the change
  • Avoid other runtime dependencies
  • Meaningful commit history ; intention is important please rebase your commit history so that each
    commit is meaningful and help the people that will explore a change in 2 years
  • The pull request follows coding style
  • Mention Fixes #<issue number> in the description if relevant
  • At least one commit should mention Fixes #<issue number> if relevant

@codecov-commenter
Copy link

codecov-commenter commented Nov 19, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 85.54%. Comparing base (ebec7f2) to head (927231a).
Report is 22 commits behind head on main.

Additional details and impacted files
@@             Coverage Diff              @@
##               main    #3514      +/-   ##
============================================
- Coverage     85.59%   85.54%   -0.05%     
+ Complexity     2952     2951       -1     
============================================
  Files           341      341              
  Lines          8967     8967              
  Branches       1114     1114              
============================================
- Hits           7675     7671       -4     
- Misses         1007     1010       +3     
- Partials        285      286       +1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bric3 bric3 force-pushed the convert-to-kotlin-script branch 3 times, most recently from 388986f to 2685c34 Compare November 26, 2024 12:19
testUtil made its usage prone to implicit dependencies, which gradle don't like (for good reason).
In particular when related to our mockito-extension test configuration (creates config file before then deletes them after).
This line was problematic: `testUtil(sourceSets.test.get().output)` because tasks like `removeTestResources` modified its content.
@bric3 bric3 marked this pull request as ready for review November 29, 2024 21:08
@bric3 bric3 force-pushed the convert-to-kotlin-script branch from 2685c34 to 927231a Compare November 29, 2024 21:08
@TimvdLippe
Copy link
Contributor

I looked at these changes and tbh, it is difficult to carefully review these as the changes are both syntax as well as behavioral changes. I don't see anything obvious that is wrong, but I also haven't been able to thoroughly review it. So I trust your expertise and due diligence on it, and thus I am okay with merging as-is.

@bric3
Copy link
Contributor Author

bric3 commented Dec 2, 2024

I understand, I propose to merge, and fix anything asap that is broken if any. Thanks for taking the time to look at it !

Since there were a few library update, I need to update those before merging.

@TimvdLippe TimvdLippe merged commit 3819ca8 into main Dec 4, 2024
18 checks passed
@TimvdLippe TimvdLippe deleted the convert-to-kotlin-script branch December 4, 2024 13:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Convert build script to kotlin
3 participants