Configure common settings for DFDL schema project
- Add new "daffodilVersion" setting, used to specify which version of
Daffodil "sbt test" should build and run against. This is used to add
dependencies like daffodil-tdml-processor, junit, and loggers if
needed
- Set crossPaths to false--schema projects jars do not depend on
specific versions of Scala since they just contain resources. This
makes it so the _2.12 is not included in jar file names.
- Set testOptions for verbose logging with SBT JUnit interface
- Change daffodilPackageBinVersion from a Set to a Seq. This makes it so
order is deterministic and schema projects can do things like:
daffodilVersion := daffodilPackageBinVersions.head
- Remove sbtPlugin := true setting--that is already set by enabling the
SbtPlugin plugin
- Update scripted test to use new settings and remove settings the
plugin now provides.
- Ignore project/build.properties in scripted tests--when running
scripted tests manually sbt creates these files and we don't want them
Closes #9
Plugin to run Daffodil on DFDL schema projects.
To enable the plugin, add the following to project/plugins.sbt:
addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" % "<version>")
This plugin configures a number of SBT settings to have better defaults for DFDL schema projects. This includes setting dependencies for testing (e.g. daffodil-tdml-processor, junit), juint test options, and more. This requires that the plugin knows which version of Daffodil to use, which is set by adding the daffodilVersion setting to build.sbt, for example:
daffodilVersion := "3.6.0"
This plugin adds the ability to create and publish saved parsers of a schema.
For each saved parser to generate, add an entry to the daffodilPackageBinInfos setting. This setting is a Seq of 3-tuples made up of the resource path to the schema, an optional root element to use in that schema, and an optional name that is added to the artifact classifier to differentiate multiple saved parsers. If the optional root element is None, then the first element in the schemas is used. An example of this settings supporting two roots looks like this:
daffodilPackageBinInfos := Seq( ("/com/example/xsd/mainSchema.dfdl.xsd", Some("record"), None) ("/com/example/xsd/mainSchema.dfdl.xsd", Some("fileOrRecords"), Some("file")) )
You must also define which versions of Daffodil to build comptiable saved parsers using the daffodilPackageBinVersions setting. For example, to build saved parsers for Daffodil 3.6.0 and 3.5.0:
daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
Then run sbt packageDaffodilBin to generate saved parsers in the target/ directory. For example, assuming a schema project with name of “format”, version set to “1.0”, and the above configurations, the task would generate the following saved parsers:
target/format-1.0-daffodil350.bin target/format-1.0-daffodil360.bin target/format-1.0-file-daffodil350.bin target/format-1.0-file-daffodil360.bin
Note that the artifact names have the suffix “daffodilXYZ”.bin, where XYZ is the version of Daffodil the saved parser is compatible with.
The publish, publishLocal, publishM2 and related publish tasks are modified to automatically build and publish the saved parsers as a new artifacts.
If used, one may want to use the first value of this setting to configure daffodilVersion, e.g.:
daffodilVersion := daffodilPackageBinVersions.value.head
Apache Daffodil SBT Plugin is licensed under the Apache License, v2.0.