I am trying to go from 'sbt test' to a schema I can play with from the
daffodil CLI.

The schema of interest is the DFDLSchemas envelope-payload example.

This schema depends on
* tcpMessage
* mil-std-2045
* pcap

The pcap schema in turn depends on
* ethernetIP

The ethernetIP schema defines a Daffodil layer plugin that exists in its
jar.

So far if I clone these all, and 'sbt publishLocal' all of the components,
then I can 'sbt test' in envelope-payload and it passes all tests.

So now I'd like to do 'daffodil save-parser
-s 
src/main/resources/io/github/dfdlschemas/envelopepayload/xsd/envelopePayload.dfdl.xsd
-o /tmp/envPay.bin'

By adding these to the build.sbt

daffodilPackageBinVersions := Seq(daffodilVersion.value)
daffodilPackageBinInfos := Seq(
  ("/io/github/dfdlschemas/tcpMessage/xsd/tcpMessage.dfdl.xsd",
Some("message"), None)
)

Then 'sbt packageDaffodilBin' will create a compiled schema under the
target/ directory named:

dfdl-envelope-payload-1.1.0-daffodil390.bin

So far so good.

Now the challenge.

But this can't be used with the daffodil CLI without also setting up
DAFFODIL_CLASSPATH to have at least the ethernetIP jar file.

Which is where? (yes I know in the ~/.ivy2/local cache, but there is tons
of stuff in there.)

If I want to use xerces (aka full) validation then I also have to have all
the other component schema jar files on the DAFFODIL_CLASSPATH as well.

I tried issuing 'sbt dependencyTree', but the dependency tree is not just
the schemas, but all the dependencies on daffodil and everything
transitively it uses.

This is much too hard.

Why not have the daffodil-sbt plugin output a shell script that appends to
DAFFODIL_CLASSPATH with all the necessary component schema jars.

Then users could just run that script to establish the DAFFODIL_CLASSPATH
once, and then they could use the daffodil CLI normally.

In principle, a file could also be written intended to inform the daffodil
VSCode extension of the classpath to construct for the schema.

Thoughts?

One possible alternative is to add a daffodil command to sbt via the plugin
so that one can run daffodil command lines directly from the sbt prompt:

sbt
> daffodil parse -p target/...bin foo.dat

This is really just a synonym for issuing sbt run for the Main class of the
daffodil-cli module, (after doing packageDaffodilBin) so might be very easy
to do.










Mike Beckerle
Apache Daffodil PMC | daffodil.apache.org
OGF DFDL Workgroup Co-Chair | www.ogf.org/ogf/doku.php/standards/dfdl/dfdl
Owl Cyber Defense | www.owlcyberdefense.com

Reply via email to