inductiveautomation / ignition-module-tools

Tools that help in the creation and development of Modules for Inductive Automation's Ignition.
48 stars 12 forks source link

Task deployModl fails to find assemble dependency #44

Closed benmusson closed 6 months ago

benmusson commented 6 months ago

On v0.1.1, .\gradlew deployModl fails with error Task with path ':assemble' not found in project ....

I can manually run .\gradlew assemble successfully.

benmusson commented 6 months ago

https://github.com/inductiveautomation/ignition-module-tools/blob/57a4acb72c9579a71296a7d4c2aae7cbda1206a5/gradle-module-plugin/src/main/kotlin/io/ia/sdk/gradle/modl/task/Deploy.kt#L31C1-L33C6

I don't think the dependency on assemble is actually necessary, since deploy should already have inferred dependencies on signModule and zipModule.

PerryAJ commented 6 months ago

Assemble is only'mustRunAfter, which merely insures that deploy runs after assemble if assemble is already on the task graph. It won't add it to the graph if it doesn't exist, it's an order directive, not a binding dependency.

Do you have an SSCCE you could show to reproduce the error? Do you have the base plugin applied to your root project to establish lifecycle tasks?

PerryAJ commented 6 months ago

Also, what happens when you run gradlew :assemble, which calls the assemble class explicitly on the root project? I wonder if you'll get the same error.

benmusson commented 6 months ago

Yes, calling gradlew :assemble produces the same error. If I add an assemble task to my root project with tasks.register("assemble"), I can get the deployModl task to run but then receive another error:

In plugin 'io.ia.sdk.modl' type 'io.ia.sdk.gradle.modl.task.Deploy' property 'module' has @Input annotation used on property of type 'RegularFileProperty'.

I'm running gradle 8.5.

I'll try and put together an example as a repo, and will link it back here.

benmusson commented 6 months ago

https://github.com/benmusson/ignition-module-monorepo-example

This is an example of the project structure I'm trying to use.

Expected behavior: Running gradlew deployModl at the repository root should build and deploy all included modules. Observed error:

gradlew deployModl
FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':modules:example-module:deployModl'.
> Task with path ':assemble' not found in project ':modules:example-module'.

What works:

gradlew assemble
...
BUILD SUCCESSFUL in 832ms

What doesn't work:

gradlew :assemble
FAILURE: Build failed with an exception.

* What went wrong:
Cannot locate tasks that match ':assemble' as task 'assemble' not found in root project 'ignition-module-monorepo-example'.

There shouldn't need to be an assemble task on the root project, the plugin should depend on the assemble task of the project it is applied to.

benmusson commented 6 months ago

Suggested fix in #45

benmusson commented 6 months ago

Solved by adding base plugin to my root project.