Pil0tXia commented on code in PR #4719:
URL: https://github.com/apache/eventmesh/pull/4719#discussion_r1562018612
##########
build.gradle:
##########
@@ -160,50 +211,46 @@ task zip(type: Zip) {
}
}
-task installPlugin() {
- if (!new File("${rootDir}/dist").exists()) {
- return
+tasks.register('installPlugin') {
+ var pluginProjects = subprojects.findAll {
+ it.file('gradle.properties').exists()
+ && it.properties.containsKey('pluginType')
+ && it.properties.containsKey('pluginName')
+ }
+ pluginProjects.
+ forEach(subProject -> {
+ var pluginType = subProject.properties.get('pluginType')
+ var pluginName = subProject.properties.get('pluginName')
+ dependsOn("${subProject.path}:jar")
Review Comment:
>You can not be sure that `dist` has already been executed, since
`installPlugin` does not have a dependency on `dist`. These dependencies ensure
that those JARs are ready.
Then `installPlugin` should also depend on the `dist` task, not the `jar`
task. The `installPlugin` task won't get the full result if the `dist` task
hasn't been executed.
However, if the `installPlugin` depends on the `dist` task, the user will
not be able to load their own jar file, losing the flexibility of the
`installPlugin` task.
Considering that both the `dist` task and the `installPlugin` task will be
executed (and should be) anyway, I don't think the `installPlugin` task should
depend on the `dist` task.
>If multiple tasks in the build depend on task `foo`, the task will be
executed only once (or most probably its result will be retrieved from the
cache).
When testing your branch on my own PC, sometimes the `installPlugin` task
executes a long `compileJava` task and outputs some deprecated warnings, even
though the `dist` task has already been executed. This problem may be worse on
less powerful machines. So I feel that the dependency of the `installPlugin`
task on the `dist` task introduces some unnecessary performance overhead.
>I could do this in another PR.
If I need to load a custom closed-source plugin, maybe I would manually copy
the jar package to the specified location in the file explorer after having run
the `dist` task, and then run the `installPlugin` task.
A new task brings some flexibility, however another concern I have is that
renaming `installPlugin` to
`installPlugins` and then adding a new `installPlugin` task that is not the
same will confuse other developers in the community.
@xwm1992 What do you think?
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]