stevedlawrence opened a new issue, #146:
URL: https://github.com/apache/daffodil-sbt/issues/146

   In some cases, it could be useful to add a published saved parser (created 
with `daffodilPackageBin`) as a dependency so that the bin file can be 
downloaded by SBT and more easily used, rather than having to build the bin 
file every time its needed. SBT doesn't make this easy, but it is doable:
   
   ```scala
   // Add the bin file as a dependency
   libraryDependencies ++= Seq(
     "com.example" % "dfdl-fmt" % "0.0.1" artifacts Artifact("dfdl-fmt", 
"parser", "bin", "daffodil400")
   )
   
   // add a custom task that can be used to find an reference the downloaded 
paths
   val daffodilBinDependencies = taskKey[Seq[File]]("List dependencies that are 
daffodil bin parsers")
   
   daffodilBinDependencies := {
     update.value.matching(artifactFilter(`type` = "parser"))
   }
   ```
   
   Note that adding the bin file to libraryDependencies has duplicate 
information (the "dfdl-fmt" name) and has information that should never change 
("parser" and "bin"). We might see if we can add a feature to the ModuleID to 
allow something like this isntead:
   ```scala
   libraryDependencies ++= Seq(
     "com.example" % "dfdl-fmt" % "0.0.1" daffodilBin("4.0.0")
   )
   ```
   This is much more compact and makes it clear you want the daffodil 4.0.0 bin 
file.
   
   We could also add the `daffodilBinDependencies` task so it becomes part of 
the plugin. There might be other features needed too, like make it so bin 
dependencies could be copied somewhere useful. Though, maybe this one setting 
is enough, and other settings could use this as needed. For example, you could 
modify `dependencyClasspath` to add `daffodilBinDependencies.value` to the 
classpath if you wanted it on the classpath. It's hard to know exactly how 
these files want to be used, so maybe just added the setting is the right 
approach. 
   


-- 
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]

Reply via email to