Closed Brownshome closed 8 months ago
I was unsure about the purpose of the exact purpose of these lines.
// This is necessary since jextract generates a compiled class file containing constants
compileClasspath += target.files(jextractTask)
runtimeClasspath += target.files(jextractTask)
To my knowledge the sourceset classpath is by default populated from the configuration classpath setup by the dependencies, so this should be redundant. (When I remove it nothing seems to break in my own project in both source and non-source mode).
If that is the case this would be a good oportunity to remove it as it would allow this implementation to be a little cleaner! I've left it in both the source and non-source cases just to be safe atm.
I used afterEvaluate
here as the dependencies and source-sets need to be adjusted after the sourceMode
variable is set. I'm not a particular fan of using afterEvaluate
, but it seemed to most pragmatic way to run logic after the sourceMode is set without greatly changing the structure of this plugin.
There are a few other ways I can try if afterEvaluate
is to be avoided. (Maybe a useSourceMode()
method?)
Hi @Brownshome,
took me some time to take a look at this, as I was traveling. Sorry!
I just tried out your changes and they work for me. I also tried avoiding afterEvaluate
in the beginning and found out about Lazy Configuration, which I used inside this project. Unfortunately, it is not suitable for executing actions based on the evaluated property value.
Since this works for now, I will merge it and push a new version to the Plugin Portal. Thanks a lot for your contribution! :slightly_smiling_face:
@Brownshome Did you change your GitHub e-mail address in the meantime? The commits in this Pull Request (and in master
) are not linked to your account anymore. I think, adding the missing e-mail address in your profile should fix this :slightly_smiling_face:
Ah, thanks for the heads up re. the email! I've added the email to my account.
Fixes #17
This changes the classpath and dependencies-specification interactions with the project to respect the
sourceMode
setting and sets-up the task dependencies so that they are derived implicitly from the setup.