Skip to content
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

Simplify helper functions for native code #1435

Merged
merged 1 commit into from
Aug 10, 2024

Conversation

liblit
Copy link
Contributor

@liblit liblit commented Aug 10, 2024

The cast/helpers.kt script defines various functions that help us configure tasks that work with native code, such as natively compiled libraries. I ported these from Groovy to Kotlin when I was still fairly new to the latter. I've gotten better with Kotlin since then, and I now see how some of these functions could be simplified.

For example, judicious use of extension methods makes some functions easier to call, and also makes it easier for those functions' implementations to access properties of the receiver object. In other cases, some function parameters can be computed from other parameters, thereby making the function easier to call correctly and harder to call incorrectly.

None of this constitutes a radical change to the suite of helper functions or how they are used to configure tasks. It's just a bunch of small cleanups and simplifications from 2024-me, who knows Kotlin better than 2022-me.


Reviewer tip: ignore whitespace for a more semantic diff view.

The `cast/helpers.kt` script defines various functions that help us
configure tasks that work with native code, such as natively compiled
libraries.  I ported these from Groovy to Kotlin when I was still fairly
new to the latter.  I've gotten better with Kotlin since then, and I now
see how some of these functions could be simplified.

For example, judicious use of extension methods makes some functions
easier to call, and also makes it easier for those functions'
implementations to access properties of the receiver object.  In other
cases, some function parameters can be computed from other parameters,
thereby making the function easier to call correctly and harder to call
incorrectly.

None of this constitutes a radical change to the suite of helper
functions or how they are used to configure tasks.  It's just a bunch of
small cleanups and simplifications from 2024-me, who knows Kotlin
better than 2022-me.
@liblit liblit added gradle WALA’s Gradle build system cleanup API cleanup and refactoring labels Aug 10, 2024
@liblit liblit requested a review from msridhar August 10, 2024 16:23
@liblit liblit self-assigned this Aug 10, 2024
@liblit liblit enabled auto-merge (rebase) August 10, 2024 16:23
Copy link

Test Results

  813 files  ±0    813 suites  ±0   3h 56m 51s ⏱️ + 10m 49s
  735 tests ±0    718 ✅ ±0   17 💤 ±0  0 ❌ ±0 
5 029 runs  ±0  4 908 ✅ ±0  121 💤 ±0  0 ❌ ±0 

Results for commit e73f808. ± Comparison against base commit 96d2a96.

Copy link
Member

@msridhar msridhar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this cleanup!

@liblit liblit merged commit d98c973 into wala:master Aug 10, 2024
11 checks passed
@liblit liblit deleted the native-libraries branch August 10, 2024 17:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cleanup API cleanup and refactoring gradle WALA’s Gradle build system
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants