1

The goal is a master plugin that can decide which other plugins to run based on settings in project that uses the master plugin. It's become academic at this point and I've learned a lot.

Current implementation that is compiling has the packaging step depend on a taskDyn which either makes the key calls of the plugin (manually dug out of the plugin source and copied into the taskDyn) or calls the version of the package task that existed before the master plugin got involved. The logic and wiring is all there, when the predicate is valid, the plugin calls are made, but making the calls to the previous task is proving elusive.

The code I currently have to find the old packager introduces a cyclic dependency because the scoped artifact depends on the taskDyn and when the task suddenly wants to know about the scoped artifact (at least the way I am doing it now), boom.

val original : TaskKey[(Artifact, File)] = packagedArtifact in(Compile, packageBin) val osgiTask: Def.Initialize[Task[File]] = Def.taskDyn[File] { if (featureFile.value.exists) { addArtifact(Def.setting(Artifact(moduleName.value, "xml", "xml", "feature")), featureFile.toTask) OsgiKeys.bundle } else { Def.task(original.toTask.value._2) } }

If this is a simple problem, I just need to figure out how to get the original/default task assigned to a dependency. It may be that this problem cannot be solved – there may be no way to discover and cache the original version of a task assigned to create a scoped artifact, or it's use may be impossible without creating a cyclic dependency. If so, can you imagine another way to do this?

Current source is at https://gist.github.com/briantopping/274204cc527669baa19b80536ce8bd11.

Thanks!

Brian Topping
  • 3,235
  • 28
  • 33

0 Answers0