Open s1ck opened 1 year ago
I could verify locally that this solves the problem, but it continues with:
> Failed to apply plugin 'fr.stardustenterprises.rust.wrapper'.
> Cannot add task 'build' as a task with that name already exists.
I can successfully integrate it my project if I rename the tasks, i.e.
@Task(group = "rust", name = "buildRust")
@Task(group = "rust", name = "testRust")
@Task(group = "rust", name = "runRust")
@Task(group = "rust", name = "cleanRust")
What do you think? Should I open a PR for that change?
[edit] Seems to be somewhat the default, e.g. for the python gradle plugin:
Python tasks
------------
checkPython - Validate python environment
cleanPython - Removes existing python environment (virtualenv)
pipInstall - Install pip modules
pipList - Show all installed modules
pipUpdates - Check if new versions available for declared pip modules
Hey, thanks for the feedback!
gradle-rust works in a very odd manner right now: it bundles two Gradle plugins:
wrapper
plugin (fr.stardustenterprises.rust.wrapper
)importer
plugin (fr.stardustenterprises.rust.importer
)The wrapper
plugin was originally intended to be used in a rust-only module, to be then imported via the importer
plugin in a second Gradle subproject.
This behavior isn't ideal but was the one I deemed sufficient enough with my at-the-time limited knowledge of proper Gradle ways, to work in all cases, albeit with a bit of refactoring.
As per your proposals:
maybeCreate
for the configuration is definitely a good idea, you can PR that in right away if you'd like and I'll publish it in a day or soI'll try and look into how I can improve the developer experience with gradle-rust based on that second point (i.e. not splitting the project in two plugins), but do note that it'll probably take a bit of time as I'm taking a break from programming to handle changes and life in general :+1:
You can also try and separate your module layout to work in the current gradle-rust fashion if that's possible for your workflow; there isn't much in terms of proper documentation, only this example project which should serve as a bare-bones template.
Hey, I am trying to configure the plugin in an existing Gradle project. Your example project runs just fine. However, when I add the plugin to the existing project, I get:
Which is caused by: https://github.com/stardust-enterprises/gradle-rust/blob/91c333fc33deb0ce0d011e0e2f02181aa444517f/src/main/kotlin/fr/stardustenterprises/gradle/rust/wrapper/WrapperPlugin.kt#L24
If a default configuration already exists (which is the case here), it throws.
I am not sure if creating a configuration is strictly necessary, but if so, we could change the call to
.maybeCreate
which has create-if-not-exists semantics. wdyt?