-
Notifications
You must be signed in to change notification settings - Fork 73
allow applying ksp to custom configs #842
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
Conversation
I think it's a good idea. The method we used was already hacky at the time of writing #647, at least something like this could solve the case where the I would try to improve the logic a bit. Does We also probably should make Finally, don't forget to run |
- use findProperty, no longer warn since gradle has a conventional precendence for regular vs extra property - put properties as in companion - write some documentation on the properties - ran
I didn't know about |
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 one small suggestion, the rest looks good, thank you very much!
target.logger.warn( | ||
"Configuration '$testKspCfg' not found. Please make sure the KSP plugin is applied.", | ||
) | ||
val overriddenConfigs = target.findProperty(PROP_KSP_CONFIGS)?.let { (it as String) }?.split(",") |
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.
Maybe we should also trim the entries in the list. When a user writes: "config1, config2", we now get the configs "config1" and " config2". I'm not sure getByName
can find it like that
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'll add it quickly so we can merge :)
Thanks for the help and for accepting :) |
Fixes #841
As described in the issue, I needed to modify the ConvenienceSchemeGeneratorPlugin again (this is sort of part 2 after #647). This PR is basically what I've been using for myself all of this time so I could correctly use dataframes in my custom source set.
I think my solution is hacky and I am not sure this PR should be accepted, but it does get the job done for me.
I allow setting custom configs as either a gradle property or an extra property. The reason why is because while in my own code I set the extra property programatically based on some custom build logic that detects if a module has both android and jvm source sets, the extra property can only be set programatically wheras the regular property can be set in a
gradle.properties
file. I only use the extra property, but I expect if this PR is merged that others might want to do it viagradle.properties
.gradle.properties
would not work for me, however, because I need to set it programatically which is only supported by extra properties. Therefore, unforunately, the best I could think of was allow both.