This is an automated email from the ASF dual-hosted git repository.
slawrence pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil-sbt.git
The following commit(s) were added to refs/heads/main by this push:
new 6427564 Add support for creating cross daffodil version projects
6427564 is described below
commit 642756421a793f957da606eaaf7b174bf0385903
Author: Steve Lawrence <[email protected]>
AuthorDate: Wed Oct 1 13:10:35 2025 -0400
Add support for creating cross daffodil version projects
Adds a new implicitly callable .daffodilProject() function to convert a
normal SBT project to one that enables the daffodil plugin and changes a
number of settings to make building/test/etc. easier, including support
building with multiple Daffodil versions.
Deprecation/Backwards Compatability:
We now recommend the use of the more modern SBT project definition
syntax and the `.daffodilProject()` function. This adds a number of
enhancements that follow best practices, and includes imporoved support
for building/testing/etc. with multiple Daffodil versions. When using
this function, existing settings can be used except for
`daffodilProjectVersionInfos`, which is ignored if specified.
Tests are all updated to the recommended syntax, though the changes are
backwards compatible so any projects using the old syntax should work
exactly the same as before.
Closes #125
---
.github/workflows/main.yml | 6 +-
README.md | 174 +++++++++++----
.../scala/org/apache/daffodil/DaffodilPlugin.scala | 242 +++++++++++++++++++--
.../sbt-daffodil/builds-charset-01/build.sbt | 20 +-
.../sbt-daffodil/builds-charset-01/test.script | 4 +-
.../sbt-daffodil/builds-layer-01/build.sbt | 20 +-
.../sbt-daffodil/builds-layer-01/test.script | 4 +-
src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt | 20 +-
.../sbt-daffodil/builds-udf-01/test.script | 4 +-
.../sbt-daffodil/common-settings-01/build.sbt | 17 +-
.../{builds-udf-01 => cross-versions-01}/build.sbt | 20 +-
.../cross-versions-01/project/plugins.sbt | 20 ++
.../main/scala-daffodil-3.10.0/OnlyScala212.scala} | 15 +-
.../main/scala-daffodil-3.11.0/OnlyScala213.scala} | 16 +-
.../main/scala-daffodil-4.0.0/OnlyScala3.scala} | 15 +-
.../src/main/scala/AllScala.scala} | 16 +-
.../sbt-daffodil/cross-versions-01/test.script | 56 +++++
.../{builds-udf-01 => cross-versions-02}/build.sbt | 23 +-
.../cross-versions-02/project/plugins.sbt | 20 ++
.../src/main/resources/com/example/test.dfdl.xsd | 37 ++++
.../src/test/resources/com/example/test.tdml | 36 +++
.../src/test/scala/com/example/test.scala} | 22 +-
.../test.script | 36 ++-
.../build.sbt | 36 +--
.../plugin/src/main/scala/Test.scala} | 10 +-
.../cross-versions-03/project/plugins.sbt | 20 ++
.../src/main/resources/com/example/test.dfdl.xsd | 37 ++++
.../src/test/resources/com/example/test.tdml | 36 +++
.../schema/src/test/scala/com/example/test.scala} | 22 +-
.../test.script | 19 +-
src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt | 20 +-
.../sbt-daffodil/saved-parsers-01/build.sbt | 28 +--
.../sbt-daffodil/saved-parsers-01/test.script | 9 +-
.../sbt-daffodil/saved-parsers-02/build.sbt | 30 ++-
.../sbt-daffodil/saved-parsers-02/test.script | 6 +-
.../sbt-daffodil/saved-parsers-03/build.sbt | 32 ++-
.../sbt-daffodil/saved-parsers-03/test.script | 6 +-
.../sbt-daffodil/saved-parsers-04/build.sbt | 23 +-
.../sbt-daffodil/saved-parsers-05/build.sbt | 37 ++--
.../sbt-daffodil/saved-parsers-05/test.script | 6 +-
.../sbt-daffodil/saved-parsers-06/build.sbt | 29 +--
src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt | 14 +-
.../sbt-daffodil/tdml-saved-parser-01/build.sbt | 31 ++-
.../sbt-daffodil/tdml-saved-parser-01/test.script | 12 +-
src/sbt-test/sbt-daffodil/versions-01/build.sbt | 23 +-
45 files changed, 937 insertions(+), 392 deletions(-)
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml
index f846d90..b6445c1 100644
--- a/.github/workflows/main.yml
+++ b/.github/workflows/main.yml
@@ -39,15 +39,11 @@ jobs:
fail-fast: false
matrix:
java_distribution: [ temurin ]
- java_version: [ 8, 11, 17, 21 ]
+ java_version: [ 17, 21 ]
scala_version: [ 2.12.18 ]
os: [ ubuntu-22.04, windows-2022, macos-14 ]
exclude:
# only run macos on java 17
- - os: macos-14
- java_version: 8
- - os: macos-14
- java_version: 11
- os: macos-14
java_version: 21
include:
diff --git a/README.md b/README.md
index f9456e5..845c104 100644
--- a/README.md
+++ b/README.md
@@ -27,10 +27,13 @@ To enable the plugin, add the following to
`project/plugins.sbt`:
addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" % "<version>")
```
-And add the following to `build.sbt`:
+And define a project using the modern SBT project syntax in `build.sbt`,
+followed by a call to `daffodilProject()`:
```scala
-enablePlugins(DaffodilPlugin)
+val format = (project in file("."))
+ .settings(...)
+ .daffodilProject()
```
## Features
@@ -143,35 +146,18 @@ daffodilPackageBinInfos := Seq(
)
```
-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:
-
-```scala
-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:
+directory. For example, assuming a schema project with `name := "format"`,
+`version := "1.0"`, and `daffodilVersion := "3.5.0"`, and the above
+configuration, 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.
-
-If used, one may want to use the first value of this setting to configure
-`daffodilVersion`, e.g.:
-
-```scala
-daffodilVersion := daffodilPackageBinVersions.value.head
-```
+The saved parser 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 new artifacts.
@@ -237,20 +223,18 @@ is referenced like this:
<parserTestCase ... model="/format-file.bin">
```
-Note that only saved parsers for `daffodilVersion` can be referenced. For this
-reason, `daffodilVersion` must also be defined in `daffodilPackageBinVersions`
-if `daffodilTdmlUsesPackageBin` is `true`.
-
-This is implemented using a SBT resource generator which some IDE's, like
+This is implemented using a SBT resource generator which some IDEs, like
IntelliJ, do not trigger during builds. So you must either run `sbt
Test/compile`
to manually trigger the resource generator, or let SBT handle builds by
enabling the "Use SBT shell for builds" option.
-### Charsets, Layers, and User Defined Functions
+### Daffodil Plugins
+
+#### Projects that Build Plugins
If your schema project builds a Daffodil charset, layer, or user defined
-function, then set the `daffodilBuildsCharset`, `daffodilBuildsLayer`, or
-`daffodilBuildsUDF` setting to true, respectively. For example:
+function plugin, then set the `daffodilBuildsCharset`, `daffodilBuildsLayer`,
+or `daffodilBuildsUDF` setting to true, respectively. For example:
```scala
daffodilBuildsCharset := true
@@ -263,17 +247,33 @@ daffodilBuildsUDF := true
Setting any of these values to true adds additional dependencies needed to
build the component.
-Note that this also sets the SBT `crossPaths` setting to `true`, which causes
-the Scala version to be included in the jar file name, since charsets, layers,
-and UDF jars may be implemented in Scala and are specific to the Scala version
-used to build them. However, if your schema project implements
-charsets/layers/UDFs using only Java, you can override this in build.sbt and
-remove the Scala version from the jar name, for example:
+The classifer of plugin jars is set to `daffodilXYZ`, where `XYZ` indicates the
+version of Daffodil it was compiled with. This is important since plugins might
+not be compatible with all Daffodil versions due to Scala or Daffodil API
+differences.
+
+See [Cross-Building](#cross-building) to build plugins in support of multiple
+versions of Daffodil.
+
+#### Projects that Use Plugins
+
+Projects that use Daffodil charset, layer, or user defined function plugin
+should specify the dependency using the `daffodilPluginDependencies` setting.
+Note that the `daffodilXYZ` classifier should not be included and `%%` should
+not be used even if the plugin is written in Scala. For example:
```scala
-crossPaths := false
+daffodilPluginDependencies := Seq(
+ "org.example" % "daffodil-layer-plugin" % "1.0.0"
+)
```
+The appropriate `daffodilXYZ` classifier will be added to the dependency based
+on the `daffodilVersion` of the project. The plugin dependency will also be
+added in the `"provided"` scope--this avoids potential issues with transitive
+dependencies, but does mean that if a schema project depends on a plugin, even
+transitively, it must specify it in `daffodilPluginDependencies`.
+
### Flat Directory Layout
Instead of using the standard `src/{main,test}/{scala,resources}/` directory
@@ -290,11 +290,103 @@ root `src/` directory, and all test source and resource
files to be in a root
`test/` directory. Source files are those that end with `*.scala` or `*.java`,
and resource files are anything else.
-## Testing
+### Cross-Building
+
+In some cases it is helpful to have a single SBT project that supports the
+ability to build/test/generate saved parsers/etc. for multiple versions of
+Daffodil. To do so, define a project as normal and call `.daffodilProject()`
+passing in a `Seq` of additional daffodil versions to support. For example:
+
+```scala
+val format = project in file(".")
+ .settings(
+ ...
+ daffodilVersion := "3.10.0"
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.11.0", "4.0.0"))
+```
+
+Note that the `daffodilVersion` in the root project should not be listed in the
+`crossDaffodilVersions` sequence.
+
+For each Daffodil version defined in `crossDaffodilVersions`, a subproject is
+created that is a copy of the root project but with `_daffodilXYZ` appended to
+the project ID. For example, the example above creates three projects:
+`format`, `format_daffodil3110`, `and format_daffodil400`. Each of these
+projects has the DaffodilPlugin enabled and is configured to
+build/test/publish/etc. with their respective daffodil versions. Additional
+changes made to the projects described below.
+
+#### Source Files
+
+The root project and subprojects share the same `src/` and `lib/` directories.
+Additionally, source files specific to a particular version of Daffodil can be
+placed in `src/{main,test}/{scala,java}-daffodil-<daffodilVersion>`. This is
+useful in cases where plugins or tests require different code for different
+Daffodil versions, usually due to Scala or Daffodil API changes.
+
+#### Build Artifacts
+
+Build artifacts (e.g. compiled plugin classes, saved parsers) are stored in the
+`target/daffodilXYZ` directory. For example, saved parsrs might be these
+locations:
+
+```
+target/format-1.0-daffodil3100.bin
+target/daffodil3110/format-1.0-file-daffodil3110.bin
+target/daffodil400/format-1.0-file-daffodil400.bin
+```
+
+#### Publishing
+
+Publishing from subprojects is disabled. Instead, all subproject artifacts
+(e.g. compiled plugins, saved parsers, javadocs, sources) are published as
+artifacts to the root project, using classifiers for differentiation.
+
+#### Aggregation
+
+The root project does aggregate the subprojects, but sets the `aggregate`
+setting to `false`. This means that sbt tasks are only evaluated on the root
+project by default.
+
+To run tasks on a subproject you can explicitly specify the project:
+
+```bash
+# run tests for only Daffodil 4.0.0
+sbt format_daffodil400/test
+```
+
+Or change the `aggregate` setting to `true` before running the task. Note that
+aggregated tasks run in parallel. With many cross versions, this can require
+very large amounts of memory--it may be useful to disable parallel execution
+for the more resource intensive tasks like packageDaffodilBin or tests:
+
+```bash
+# run tests for root and all subprojects, disabling parallel execution of tests
+# and creating saved parsers
+sbt "set aggregate:= true" \
+ "set packageDaffodilBin / parallelExecution := false" \
+ "set test / parallelExecution := false" \
+ "test"
+```
+
+#### Different Subproject Settings
+
+In rare cases it could be necessary to change a subproject setting to something
+different than that of the root project. This can be done by getting a
+reference to the subproject by calling `.daffodil(<version>)` on the root
+project and modifying the settings as usual. For example, to disable publishing
+of only the "4.0.0" saved parser:
+
+```scala
+format.daffodil("4.0.0") / packageDaffodilBin / publishArtifact := false
+```
+
+## Plugin Testing
This plugin use the [scripted test framework] for testing. Each directory in
`src/sbt-test/sbt-daffodil/` is a small SBT project the uses this plugin, and
-defines a `test.script` file that lists sbt commandss and file system checks to
+defines a `test.script` file that lists sbt commands and file system checks to
run.
To run all tests, run either of these commands:
diff --git a/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
b/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
index 3ad142d..4b6cb87 100644
--- a/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
+++ b/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
@@ -24,6 +24,7 @@ import scala.util.Properties
import sbt.Keys._
import sbt._
import sbt.internal.CommandStrings.ExportStream
+import sbt.librarymanagement.Artifact.{ DocClassifier, SourceClassifier }
object DaffodilPlugin extends AutoPlugin {
@@ -32,7 +33,8 @@ object DaffodilPlugin extends AutoPlugin {
"Information used to create compiled parsers"
)
val daffodilPackageBinVersions = settingKey[Seq[String]](
- "Versions of daffodil to create saved parsers for"
+ "Version of daffodil to create saved parsers for. Should only contain a
single version--" +
+ "specifying multiple versions is deprecated in favor of
.daffodilProject(crossDaffodilVersions = ...)"
)
val packageDaffodilBin = taskKey[Seq[File]](
"Package daffodil saved parsers"
@@ -49,12 +51,21 @@ object DaffodilPlugin extends AutoPlugin {
val daffodilBuildsUDF = settingKey[Boolean](
"Whether or not the project builds a user defined function"
)
+ val daffodilBuildsPlugin = Def.setting {
+ // this is a helper to check if a project builds any kind of plugin.
This can be accessed
+ // like a setting but users cannot change the value. Instead they should
change one or
+ // more of the daffildBuilds* settings
+ daffodilBuildsCharset.value || daffodilBuildsLayer.value ||
daffodilBuildsUDF.value
+ }
val daffodilFlatLayout = settingKey[Boolean](
"Whether or not to use a flat schema project layout that uses src/ and
test/ root directories containing a mix of sources and resources"
)
val daffodilTdmlUsesPackageBin = settingKey[Boolean](
"Whether or not TDML files use the saved parsers created by
daffodilPackageBin"
)
+ val daffodilPluginDependencies = settingKey[Seq[ModuleID]](
+ "Dependendies to Daffodil plugins. This should not include the Daffodil
version suffix"
+ )
/**
* Class to define daffodilPackageBinInfos, auto-imported to simplify sbt
configs
@@ -77,6 +88,17 @@ object DaffodilPlugin extends AutoPlugin {
name = t._3
)
}
+
+ /**
+ * Allows calling .daffodilProject(...) on an existing SBT Project to
convert it to a
+ * Daffodil project. This enables the DaffodilPlugin for the project, sets
a number of
+ * settings, and adds support for daffodil cross versioned subprojects
+ */
+ implicit class DaffodilProjectOps(val root: Project) extends AnyVal {
+ def daffodilProject(crossDaffodilVersions: Seq[String] = Nil):
DaffodilProject = {
+ DaffodilProject(root, crossDaffodilVersions)
+ }
+ }
}
/**
@@ -93,19 +115,20 @@ object DaffodilPlugin extends AutoPlugin {
import autoImport._
/**
- * Generate a daffodil version specific ivy configuration string by removing
everything
- * except for alphanumeric characters
+ * Generate string based on a daffodil version that can be used to identify
something intended
+ * for a use with a specific version of daffodil. This can be used in many
places with
+ * different limitations, so we remove non alphanumeric characters and make
it lowerse.
*/
- def ivyConfigName(daffodilVersion: String): String = {
- "daffodil" + daffodilVersion.replaceAll("[^a-zA-Z0-9]", "")
+ def daffodilVersionId(daffodilVersion: String): String = {
+ "daffodil" + daffodilVersion.replaceAll("[^a-zA-Z0-9]", "").toLowerCase
}
/**
* generate an artifact classifier name using the optional name and daffodil
version
*/
def classifierName(optName: Option[String], daffodilVersion: String): String
= {
- val cfg = ivyConfigName(daffodilVersion)
- (optName.toSeq ++ Seq(cfg)).mkString("-")
+ val versionId = daffodilVersionId(daffodilVersion)
+ (optName.toSeq ++ Seq(versionId)).mkString("-")
}
/**
@@ -319,15 +342,32 @@ object DaffodilPlugin extends AutoPlugin {
}
},
+ /**
+ * Modify libraryDependencies to add dependencies to Daffodil plugins this
project has. The
+ * plugin dependencies are modified to use a version compatible with
daffodilVersion by
+ * specifying the appropriate classifer based on the daffodil version. It
also adds plugin
+ * dependencies to the "provided" scope so that other schema projects can
depend on this
+ * schema project with a potentially different version of Daffodil and the
plugins. This
+ * does mean that if schema project A depends on plugin Foo, and schema
project B depends on
+ * project A, then project B must also list Foo as a
daffodilPluginDependency.
+ */
+ libraryDependencies ++= {
+ daffodilPluginDependencies.value.map { pluginModuleID =>
+ pluginModuleID
+ .classifier(daffodilVersionId(daffodilVersion.value))
+ .withConfigurations(Some("provided"))
+ }
+ },
+
/**
* DFDL schemas are not scala version specific since they just contain
resources, so we
* disable crossPaths so that published jars do not contain a scala
version. However, if a
- * project builds layers or UDFs, then we do need to enable crossPaths
since those might be
- * implemented in Scala and so is version dependent. If they are
implemented purely in Java,
- * projects can override this and change the setting to false if they
don't want the scala
- * version in the jar name.
+ * project builds any plugins (i.e. charset, layers, UDFs) then we do need
to enable
+ * crossPaths since those might be implemented in Scala and so is version
dependent. If they
+ * are implemented purely in Java, projects can override this and change
the setting to
+ * false if they don't want the scala version in the jar name.
*/
- crossPaths := (daffodilBuildsCharset.value || daffodilBuildsLayer.value ||
daffodilBuildsUDF.value),
+ crossPaths := daffodilBuildsPlugin.value,
/**
* Enable verbose logging for junit tests
@@ -345,17 +385,22 @@ object DaffodilPlugin extends AutoPlugin {
daffodilPackageBinInfos := Seq(),
daffodilPackageBinVersions := Seq(),
+ /**
+ * Default to no Daffodil plugins
+ */
+ daffodilPluginDependencies := Seq(),
+
/**
* define and configure a custom Ivy configuration with dependencies to
the Daffodil
* versions we need, getting us easy access to the Daffodil jars and its
dependencies
*/
ivyConfigurations ++= daffodilPackageBinVersions.value.map {
daffodilVersion =>
- val cfg = ivyConfigName(daffodilVersion)
+ val cfg = daffodilVersionId(daffodilVersion)
Configuration.of(cfg.capitalize, cfg)
}.toSeq,
libraryDependencies ++= {
daffodilPackageBinVersions.value.flatMap { binDaffodilVersion =>
- val cfg = ivyConfigName(binDaffodilVersion)
+ val cfg = daffodilVersionId(binDaffodilVersion)
// the Daffodil dependency must ignore the scalaVersion setting and
instead use
// the specific version of scala used for the binDaffodilVersion.
val daffodilToPackageBinDep = Map(
@@ -378,6 +423,12 @@ object DaffodilPlugin extends AutoPlugin {
* define the artifacts, products, and the packageDaffodilBin task that
creates the artifacts/products
*/
packageDaffodilBin / artifacts := {
+ val logger = sLog.value
+ if (daffodilPackageBinVersions.value.length > 1) {
+ logger.warn(
+ "Specifying multiple values for daffodilPackageBinVersions is
deprecated. Instead use .daffodilProject(crossDaffodilVersions = ...)"
+ )
+ }
daffodilPackageBinVersions.value.flatMap { daffodilVersion =>
daffodilPackageBinInfos.value.map { dbi =>
// each artifact has the same name as the jar, in the "parser" type,
"bin" extension,
@@ -436,7 +487,7 @@ object DaffodilPlugin extends AutoPlugin {
val targetFiles = daffodilPackageBinVersions.value.flatMap {
daffodilVersion =>
// get all the Daffodil jars and dependencies for the version of
Daffodil associated with
// this ivy config
- val ivyCfg = ivyConfigs.find { _.name ==
ivyConfigName(daffodilVersion) }.get
+ val ivyCfg = ivyConfigs.find { _.name ==
daffodilVersionId(daffodilVersion) }.get
val daffodilJars = Classpaths.managedJars(ivyCfg, classpathTypesVal,
updateVal).files
// Note that order matters here. The projectClasspath might have
daffodil jars on it if
@@ -596,7 +647,7 @@ object DaffodilPlugin extends AutoPlugin {
/**
* If daffodilTdmlUsesPackageBin is true, we create a resource generator to
build the saved
- * parsers and add them as a resource for the TDML files to find and use.
Note that we use a
+ * parsers and adds them as a resource for the TDML files to find and use.
Note that we use a
* resourceGenerator since other methods make it difficult to convince
IntelliJ to put the
* files on the test classpath. See below Test/packageBin/mappings for
related changes.
*/
@@ -665,18 +716,24 @@ object DaffodilPlugin extends AutoPlugin {
* If daffodilFlatLayout is false, this returns each of the settings
unchanged.
*/
def flatLayoutSettings(dir: String) = Seq(
+ sourceDirectory := {
+ if (!daffodilFlatLayout.value) sourceDirectory.value
+ else {
+ baseDirectory.value / dir
+ }
+ },
unmanagedSourceDirectories := {
if (!daffodilFlatLayout.value) unmanagedSourceDirectories.value
else {
nonFlatWarning(Keys.sLog.value, unmanagedSourceDirectories.value)
- Seq(baseDirectory.value / dir)
+ Seq(sourceDirectory.value)
}
},
unmanagedResourceDirectories := {
if (!daffodilFlatLayout.value) unmanagedResourceDirectories.value
else {
nonFlatWarning(Keys.sLog.value, unmanagedResourceDirectories.value)
- unmanagedSourceDirectories.value
+ Seq(sourceDirectory.value)
}
},
unmanagedSources / includeFilter := {
@@ -701,4 +758,153 @@ object DaffodilPlugin extends AutoPlugin {
}
}
+ class DaffodilProject(rootProject: Project, crossProjects: Seq[Project])
+ extends CompositeProject {
+
+ /**
+ * the way to return multiple projects as a single Project to SBT is via
the
+ * componentProjects function of CompositeProject
+ */
+ def componentProjects: Seq[Project] = rootProject +: crossProjects
+
+ /**
+ * Provide a way to get a reference to a subproject based on its
daffodilVersion. This should
+ * not be needed often, but could be used to change a setting for only a
subproject, e.g.
+ *
+ * val format = (project in file("."))
+ * .settings(...)
+ * .daffodilProject(crossDaffodilVersions = Seq("4.0.0")
+ *
+ * format.daffodil("4.0.0") / packageDaffodilBin / publishArtifact :=
false
+ */
+ def daffodil(version: String): Project = {
+ val crossVersionId = rootProject.id + "_" + daffodilVersionId(version)
+ crossProjects
+ .find(_.id == crossVersionId)
+ .getOrElse(sys.error(s"No crossDaffodilVersion defined for $version"))
+ }
+ }
+
+ object DaffodilProject {
+
+ /**
+ * Converts the root SBT Project into a "daffodil project". Additionally,
for each
+ * crossVersion defined, an project is created that shares most of the
settings with the
+ * root project with minor tweaks to support
building/testing/publishing/etc. with different
+ * versions of Daffodil
+ */
+ def apply(root: Project, crossVersions: Seq[String]): DaffodilProject = {
+
+ // Settings that we will inject into both the root project and all
daffodil cross version
+ // projects
+ val sharedProjectSettings = Seq(
+ // daffodil plugin jars are tied to a specific version of Daffodil due
to API and Scala
+ // version differences. If this project builds a plugin then we add a
classifier that
+ // defines the daffodil version. This is similar to how we use
classifiers for saved
+ // parser artifacts.
+ packageBin / artifactClassifier := {
+ if (daffodilBuildsPlugin.value)
+ Some(daffodilVersionId(daffodilVersion.value))
+ else
+ None
+ },
+ packageSrc / artifactClassifier := {
+ if (daffodilBuildsPlugin.value)
+ Some(daffodilVersionId(daffodilVersion.value) + "-" +
SourceClassifier)
+ else
+ Some(SourceClassifier)
+ },
+ packageDoc / artifactClassifier := {
+ if (daffodilBuildsPlugin.value)
+ Some(daffodilVersionId(daffodilVersion.value) + "-" +
DocClassifier)
+ else
+ Some(DocClassifier)
+ },
+
+ // The above changes the name so that projects that build daffodil
plugins include the
+ // cross version id in it. We no longer need crossPaths since the
daffodil version
+ // provides enough differentiation, and each Daffodil version only
supports a single
+ // Scala version.
+ crossPaths := false,
+
+ // Add src/{main,test}/{scala,java}-daffodil-$daffodilVersion as
additional source
+ // directories. This directories can be used for Daffodil version
specific code and is
+ // only used for a single cross version project.
+ Compile / unmanagedSourceDirectories ++= (Compile /
unmanagedSourceDirectories).value
+ .map { d =>
+ d.getParentFile / (d.name + "-daffodil-" + daffodilVersion.value)
+ },
+ Test / unmanagedSourceDirectories ++= (Test /
unmanagedSourceDirectories).value.map {
+ d =>
+ d.getParentFile / (d.name + "-daffodil-" + daffodilVersion.value)
+ },
+
+ // set daffodilPackageBinVersions to the version of daffodil this
project uses. Saved
+ // parsers will only be created if daffodilPackageBinInfos is set
+ daffodilPackageBinVersions := Seq(daffodilVersion.value)
+ )
+
+ // Settings only used for cross version projects
+ val crossProjectSettings = Seq(
+ // We use the same baseDirectory as the root project so that all of
the sources are
+ // shared. However, we need a separate target directory to store
managed artifacts--we
+ // put that nested inside the target directory of the root.
+ baseDirectory := (root / baseDirectory).value,
+ target := (root / target).value /
daffodilVersionId(daffodilVersion.value),
+
+ // Disable publishing for subprojects. Subproject artificats (e.g.
cross versions
+ // plugins or saved parsers) have the same name as the root project
but with different
+ // classifiers (i.e. daffodilXYZ) and are published along with the
root project.
+ publish := {},
+ publishLocal := {},
+ publishM2 := {},
+ publish / skip := true
+ )
+
+ // create a subproject for each of the daffodil cross versions. Each
subproject is a clone
+ // of the root project with tweaks to some settings. Note that SBT
requires that each
+ // project have a different base directory. This base directory is only
used for build
+ // artifacts so we put it inside the target directory of the root project
+ val crossProjects = crossVersions.map { version =>
+ val crossVersionId = daffodilVersionId(version)
+ val crossProjectId = root.id + "_" + crossVersionId
+ val crossProjectBase = root.base.getAbsoluteFile / "target" /
crossVersionId
+ val crossProject = root
+ .withId(crossProjectId)
+ .in(crossProjectBase)
+ .settings(sharedProjectSettings: _*)
+ .settings(crossProjectSettings: _*)
+ .settings(daffodilVersion := version)
+ .enablePlugins(DaffodilPlugin)
+ crossProject
+ }
+
+ val rootProjectSettings = Seq(
+ // publish cross versioned artifacts with the root project artifacts.
This is important
+ // since all projects have the same name, differing only in
classifiers, so we cannot
+ // publish subprojects separately since most artifact repositories do
not support
+ // publishing additional artifacts after a jar has already been
published
+ crossProjects.flatMap { project =>
+ Seq(
+ artifacts ++= (project / artifacts).value,
+ packagedArtifacts ++= (project / packagedArtifacts).value
+ )
+ }
+ ).flatten
+
+ // Create the root project. We intentionally aggregate() the cross
projects, but the set
+ // the "aggregate" setting to false--this way users must either
explicitly trigger a task
+ // in a cross project or change the aggregate setting before running a
task if they want
+ // aggregation, e.g. sbt "set test/aggregate" test
+ val rootProject = root
+ .aggregate(crossProjects.map(_.project): _*)
+ .settings(aggregate := false)
+ .settings(sharedProjectSettings: _*)
+ .settings(rootProjectSettings: _*)
+ .enablePlugins(DaffodilPlugin)
+
+ new DaffodilProject(rootProject, crossProjects)
+ }
+ }
+
}
diff --git a/src/sbt-test/sbt-daffodil/builds-charset-01/build.sbt
b/src/sbt-test/sbt-daffodil/builds-charset-01/build.sbt
index 2313b65..a486b09 100644
--- a/src/sbt-test/sbt-daffodil/builds-charset-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/builds-charset-01/build.sbt
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsCharset := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ daffodilBuildsCharset := true,
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
b/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
index 854d1d6..b987bc7 100644
--- a/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
+++ b/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
@@ -17,9 +17,9 @@
##
-# builds jar, with _2.12 in the name beause charsets are scala version specific
+# builds jar, with daffodilXYZ classifier because charsets are daffodil
version specific
> package
-$ exists target/scala-2.12/test_2.12-0.1.jar
+$ exists target/test-0.1-daffodil360.jar
# expect compilation to fail without this setting
> set daffodilBuildsCharset := false
diff --git a/src/sbt-test/sbt-daffodil/builds-layer-01/build.sbt
b/src/sbt-test/sbt-daffodil/builds-layer-01/build.sbt
index 83fe048..cd3b4b9 100644
--- a/src/sbt-test/sbt-daffodil/builds-layer-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/builds-layer-01/build.sbt
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsLayer := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ daffodilBuildsLayer := true,
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/builds-layer-01/test.script
b/src/sbt-test/sbt-daffodil/builds-layer-01/test.script
index 8ffa18b..69313a7 100644
--- a/src/sbt-test/sbt-daffodil/builds-layer-01/test.script
+++ b/src/sbt-test/sbt-daffodil/builds-layer-01/test.script
@@ -17,9 +17,9 @@
##
-# builds jar, with _2.12 in the name beause layers are scala version specific
+# builds jar, with daffodilXYZ classifier because layers are daffodil version
specific
> package
-$ exists target/scala-2.12/test_2.12-0.1.jar
+$ exists target/test-0.1-daffodil360.jar
# expect compilation to fail without this setting
> set daffodilBuildsLayer := false
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
index d594d64..5ba1813 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ daffodilBuildsUDF := true,
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/test.script
b/src/sbt-test/sbt-daffodil/builds-udf-01/test.script
index 3b88fbe..1145a50 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/test.script
+++ b/src/sbt-test/sbt-daffodil/builds-udf-01/test.script
@@ -17,9 +17,9 @@
##
-# builds jar, with _2.12 in the name beause UDFs are scala version specific
+# builds jar, with daffodilXYZ classifier because udfs are daffodil version
specific
> package
-$ exists target/scala-2.12/test_2.12-0.1.jar
+$ exists target/test-0.1-daffodil360.jar
# expect compilation to fail without this setting
> set daffodilBuildsUDF := false
diff --git a/src/sbt-test/sbt-daffodil/common-settings-01/build.sbt
b/src/sbt-test/sbt-daffodil/common-settings-01/build.sbt
index 3b9d4f9..b30123b 100644
--- a/src/sbt-test/sbt-daffodil/common-settings-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/common-settings-01/build.sbt
@@ -15,12 +15,11 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/build.sbt
similarity index 74%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to src/sbt-test/sbt-daffodil/cross-versions-01/build.sbt
index d594d64..8b5c8b2 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/cross-versions-01/build.sbt
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+val test = (project in file("."))
+ .settings(
+ name := "test-plugin",
+ version := "0.1",
+ organization := "com.example",
+ daffodilVersion := "3.10.0",
+ daffodilBuildsLayer := true,
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.11.0", "4.0.0"))
diff --git a/src/sbt-test/sbt-daffodil/cross-versions-01/project/plugins.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/project/plugins.sbt
new file mode 100644
index 0000000..eaf249b
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/cross-versions-01/project/plugins.sbt
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" %
sys.props("plugin.version"))
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.10.0/OnlyScala212.scala
similarity index 76%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.10.0/OnlyScala212.scala
index d594d64..b491098 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.10.0/OnlyScala212.scala
@@ -15,14 +15,9 @@
* limitations under the License.
*/
-version := "0.1"
+// Not an actual layer. This is only used to show plugins can include Daffodil
version specific
+// files. This code should only compile on Scala 2.12 (used by Daffodil 3.10.0)
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+object OnlyScala212 {
+ val l: TraversableOnce[Int] = List(1,2,3)
+}
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.11.0/OnlyScala213.scala
similarity index 72%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.11.0/OnlyScala213.scala
index d594d64..428a5a5 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-3.11.0/OnlyScala213.scala
@@ -15,14 +15,10 @@
* limitations under the License.
*/
-version := "0.1"
+// Not an actual layer. This is only used to show plugins can include Daffodil
version specific
+// files. This code should only compile on Scala 2.13 (used by Daffodil 3.11.0)
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+object OnlyScala213 {
+ val l: LazyList[Int] = LazyList(1, 2, 3) // fails in Scala 2.12
+ val s = 'mySymbol // fails in Scala 3
+}
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-4.0.0/OnlyScala3.scala
similarity index 76%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-4.0.0/OnlyScala3.scala
index d594d64..da635cd 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala-daffodil-4.0.0/OnlyScala3.scala
@@ -15,14 +15,11 @@
* limitations under the License.
*/
-version := "0.1"
+// Not an actual layer. This is only used to show plugins can include Daffodil
version specific
+// files. This code should only compile on Scala 3 (used by Daffodil 4.0.0)
-name := "test"
+// enum is a new keyword in Scala 3
+enum OnlyScala3 {
+ case A, B, C
+}
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala/AllScala.scala
similarity index 77%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala/AllScala.scala
index d594d64..2678074 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/cross-versions-01/src/main/scala/AllScala.scala
@@ -15,14 +15,10 @@
* limitations under the License.
*/
-version := "0.1"
+// Not an actual layer. This is only used to show plugins can share scala
files.
+// This will be included for all cross versions and is compatiable accross all
versions of
+// Daffodil/Scala.
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+class AllScala {
+ val xs = Seq(1,2,3)
+}
diff --git a/src/sbt-test/sbt-daffodil/cross-versions-01/test.script
b/src/sbt-test/sbt-daffodil/cross-versions-01/test.script
new file mode 100644
index 0000000..a68e2fa
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/cross-versions-01/test.script
@@ -0,0 +1,56 @@
+## Licensed to the Apache Software Foundation (ASF) under one
+## or more contributor license agreements. See the NOTICE file
+## distributed with this work for additional information
+## regarding copyright ownership. The ASF licenses this file
+## to you under the Apache License, Version 2.0 (the
+## "License"); you may not use this file except in compliance
+## with the License. You may obtain a copy of the License at
+##
+## http://www.apache.org/licenses/LICENSE-2.0
+##
+## Unless required by applicable law or agreed to in writing,
+## software distributed under the License is distributed on an
+## "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+## KIND, either express or implied. See the License for the
+## specific language governing permissions and limitations
+## under the License.
+##
+
+> package
+$ exists target/test-plugin-0.1-daffodil3100.jar
+$ exists target/classes/OnlyScala212.class
+$ exists target/classes/AllScala.class
+
+$ absent target/daffodil3110/test-plugin-0.1-daffodil3110.jar
+$ absent target/daffodil3110/classes/OnlyScala213.class
+$ absent target/daffodil3110/classes/AllScala.class
+
+$ absent target/daffodil400/test-plugin-0.1-daffodil400.jar
+$ absent target/daffodil400/classes/OnlyScala3.class
+$ absent target/daffodil400/classes/AllScala.class
+
+> test_daffodil3110/package
+$ exists target/daffodil3110/test-plugin-0.1-daffodil3110.jar
+$ exists target/daffodil3110/classes/OnlyScala213.class
+$ exists target/daffodil3110/classes/AllScala.class
+
+> test_daffodil400/package
+$ exists target/daffodil400/test-plugin-0.1-daffodil400.jar
+$ exists target/daffodil400/classes/OnlyScala3.class
+$ exists target/daffodil400/classes/AllScala.class
+
+> clean
+> set aggregate := true
+> package
+
+$ exists target/test-plugin-0.1-daffodil3100.jar
+$ exists target/classes/OnlyScala212.class
+$ exists target/classes/AllScala.class
+
+$ exists target/daffodil3110/test-plugin-0.1-daffodil3110.jar
+$ exists target/daffodil3110/classes/OnlyScala213.class
+$ exists target/daffodil3110/classes/AllScala.class
+
+$ exists target/daffodil400/test-plugin-0.1-daffodil400.jar
+$ exists target/daffodil400/classes/OnlyScala3.class
+$ exists target/daffodil400/classes/AllScala.class
diff --git a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-02/build.sbt
similarity index 68%
copy from src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
copy to src/sbt-test/sbt-daffodil/cross-versions-02/build.sbt
index d594d64..41d754d 100644
--- a/src/sbt-test/sbt-daffodil/builds-udf-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/cross-versions-02/build.sbt
@@ -15,14 +15,15 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilBuildsUDF := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/com/example/test.dfdl.xsd")
+ ),
+ daffodilTdmlUsesPackageBin := true,
+ daffodilVersion := "3.10.0",
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.11.0", "4.0.0"))
diff --git a/src/sbt-test/sbt-daffodil/cross-versions-02/project/plugins.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-02/project/plugins.sbt
new file mode 100644
index 0000000..eaf249b
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/cross-versions-02/project/plugins.sbt
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" %
sys.props("plugin.version"))
diff --git
a/src/sbt-test/sbt-daffodil/cross-versions-02/src/main/resources/com/example/test.dfdl.xsd
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/main/resources/com/example/test.dfdl.xsd
new file mode 100644
index 0000000..dbab88c
--- /dev/null
+++
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/main/resources/com/example/test.dfdl.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:ex="http://example.com"
+ targetNamespace="http://example.com"
+ elementFormDefault="unqualified">
+
+ <include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+
+ <annotation>
+ <appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:format ref="ex:GeneralFormat" />
+ </appinfo>
+ </annotation>
+
+ <element name="test01" type="xs:string" dfdl:lengthKind="delimited" />
+
+</schema>
diff --git
a/src/sbt-test/sbt-daffodil/cross-versions-02/src/test/resources/com/example/test.tdml
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/test/resources/com/example/test.tdml
new file mode 100644
index 0000000..a910e98
--- /dev/null
+++
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/test/resources/com/example/test.tdml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<testSuite
+ xmlns="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:ex="http://example.com">
+
+ <parserTestCase name="test01" root="test01" model="/test.bin">
+ <document>
+ <documentPart type="text">testing</documentPart>
+ </document>
+ <infoset>
+ <dfdlInfoset>
+ <ex:test01>testing</ex:test01>
+ </dfdlInfoset>
+ </infoset>
+ </parserTestCase>
+
+</testSuite>
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/test/scala/com/example/test.scala
similarity index 69%
copy from src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-02/src/test/scala/com/example/test.scala
index 0e5c256..4b426ed 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-02/src/test/scala/com/example/test.scala
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-version := "0.1"
+package com.example
-name := "test"
+import org.apache.daffodil.tdml.Runner
-organization := "com.example"
+import org.junit.AfterClass
+import org.junit.Test
-enablePlugins(DaffodilPlugin)
+object TestExample {
+ lazy val runner = Runner("/com/example/", "test.tdml")
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/test.dfdl.xsd"),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
-)
+ @AfterClass def shutdown: Unit = { runner.reset() }
+}
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
+class TestExample {
+ import TestExample._
-daffodilVersion := daffodilPackageBinVersions.value.head
+ @Test def test_test01(): Unit = { runner.runOneTest("test01") }
+}
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
b/src/sbt-test/sbt-daffodil/cross-versions-02/test.script
similarity index 60%
copy from src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
copy to src/sbt-test/sbt-daffodil/cross-versions-02/test.script
index c2e7033..247f5ed 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
+++ b/src/sbt-test/sbt-daffodil/cross-versions-02/test.script
@@ -17,15 +17,35 @@
##
> packageDaffodilBin
-$ exists target/test-0.1-daffodil350.bin
-$ exists target/test-0.1-daffodil360.bin
-$ exists target/test-0.1-two-daffodil350.bin
-$ exists target/test-0.1-two-daffodil360.bin
+$ exists target/test-0.1-daffodil3100.bin
+
+$ absent target/daffodil3110/test-0.1-daffodil3110.bin
+$ absent target/daffodil400/test-0.1-daffodil400.bin
+
+> test_daffodil3110/packageDaffodilBin
+$ exists target/daffodil3110/test-0.1-daffodil3110.bin
+
+> test_daffodil400/packageDaffodilBin
+$ exists target/daffodil400/test-0.1-daffodil400.bin
+
+> clean
+> set aggregate := true
+> packageDaffodilBin
+
+$ exists target/test-0.1-daffodil3100.bin
+$ exists target/daffodil3110/test-0.1-daffodil3110.bin
+$ exists target/daffodil400/test-0.1-daffodil400.bin
+
+> clean
+> set aggregate := false
> set publishTo := Some(Resolver.file("file", new File("target/ivy-publish/")))
> publish
$ exists target/ivy-publish/com/example/test/0.1/test-0.1.jar
-$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil350.bin
-$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil360.bin
-$ exists target/ivy-publish/com/example/test/0.1/test-0.1-two-daffodil350.bin
-$ exists target/ivy-publish/com/example/test/0.1/test-0.1-two-daffodil360.bin
+$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil3100.bin
+$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil3100.bin
+$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil400.bin
+
+> test
+> test_daffodil3110/test
+> test_daffodil400/test
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-03/build.sbt
similarity index 56%
copy from src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
copy to src/sbt-test/sbt-daffodil/cross-versions-03/build.sbt
index 230e9d5..82d3f7e 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
+++ b/src/sbt-test/sbt-daffodil/cross-versions-03/build.sbt
@@ -15,22 +15,26 @@
* limitations under the License.
*/
-version := "0.1"
+val root = (project in file("."))
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := {
- val config = Some((Compile / resourceDirectory).value / "test.cfg")
- Seq(
- DaffodilBinInfo("/test.dfdl.xsd", config = config),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"), config =
config)
+val plugin = (project in file("plugin"))
+ .settings(
+ name := "test-plugin",
+ version := "0.1",
+ organization := "com.example",
+ daffodilVersion := "3.10.0",
+ daffodilBuildsCharset := true,
)
-}
+ .daffodilProject(crossDaffodilVersions = Seq("3.11.0"))
-daffodilPackageBinVersions := Seq("3.11.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+val schema = (project in file("schema"))
+ .settings(
+ name := "test-schema",
+ version := "0.1",
+ organization := "com.example",
+ daffodilVersion := "3.10.0",
+ daffodilPluginDependencies := Seq(
+ "com.example" % "test-plugin" % "0.1"
+ ),
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.11.0", "4.0.0"))
diff --git a/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-03/plugin/src/main/scala/Test.scala
similarity index 86%
copy from src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-03/plugin/src/main/scala/Test.scala
index 4fed517..de6a134 100644
--- a/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-03/plugin/src/main/scala/Test.scala
@@ -15,10 +15,8 @@
* limitations under the License.
*/
-version := "0.1"
+// Not an actual layer. This is only used to show plugins can be published and
resolved
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
+class Test {
+ val xs = Seq(1,2,3)
+}
diff --git a/src/sbt-test/sbt-daffodil/cross-versions-03/project/plugins.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-03/project/plugins.sbt
new file mode 100644
index 0000000..eaf249b
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/cross-versions-03/project/plugins.sbt
@@ -0,0 +1,20 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+addSbtPlugin("org.apache.daffodil" % "sbt-daffodil" %
sys.props("plugin.version"))
diff --git
a/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/main/resources/com/example/test.dfdl.xsd
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/main/resources/com/example/test.dfdl.xsd
new file mode 100644
index 0000000..dbab88c
--- /dev/null
+++
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/main/resources/com/example/test.dfdl.xsd
@@ -0,0 +1,37 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<schema
+ xmlns="http://www.w3.org/2001/XMLSchema"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:ex="http://example.com"
+ targetNamespace="http://example.com"
+ elementFormDefault="unqualified">
+
+ <include
schemaLocation="/org/apache/daffodil/xsd/DFDLGeneralFormat.dfdl.xsd"/>
+
+ <annotation>
+ <appinfo source="http://www.ogf.org/dfdl/">
+ <dfdl:format ref="ex:GeneralFormat" />
+ </appinfo>
+ </annotation>
+
+ <element name="test01" type="xs:string" dfdl:lengthKind="delimited" />
+
+</schema>
diff --git
a/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/resources/com/example/test.tdml
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/resources/com/example/test.tdml
new file mode 100644
index 0000000..c8d3e90
--- /dev/null
+++
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/resources/com/example/test.tdml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<testSuite
+ xmlns="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:ex="http://example.com">
+
+ <parserTestCase name="test01" root="test01"
model="/com/example/test.dfdl.xsd">
+ <document>
+ <documentPart type="text">testing</documentPart>
+ </document>
+ <infoset>
+ <dfdlInfoset>
+ <ex:test01>testing</ex:test01>
+ </dfdlInfoset>
+ </infoset>
+ </parserTestCase>
+
+</testSuite>
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/scala/com/example/test.scala
similarity index 69%
copy from src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
copy to
src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/scala/com/example/test.scala
index 0e5c256..4b426ed 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
+++
b/src/sbt-test/sbt-daffodil/cross-versions-03/schema/src/test/scala/com/example/test.scala
@@ -15,19 +15,21 @@
* limitations under the License.
*/
-version := "0.1"
+package com.example
-name := "test"
+import org.apache.daffodil.tdml.Runner
-organization := "com.example"
+import org.junit.AfterClass
+import org.junit.Test
-enablePlugins(DaffodilPlugin)
+object TestExample {
+ lazy val runner = Runner("/com/example/", "test.tdml")
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/test.dfdl.xsd"),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
-)
+ @AfterClass def shutdown: Unit = { runner.reset() }
+}
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
+class TestExample {
+ import TestExample._
-daffodilVersion := daffodilPackageBinVersions.value.head
+ @Test def test_test01(): Unit = { runner.runOneTest("test01") }
+}
diff --git a/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
b/src/sbt-test/sbt-daffodil/cross-versions-03/test.script
similarity index 60%
copy from src/sbt-test/sbt-daffodil/builds-charset-01/test.script
copy to src/sbt-test/sbt-daffodil/cross-versions-03/test.script
index 854d1d6..bb8a766 100644
--- a/src/sbt-test/sbt-daffodil/builds-charset-01/test.script
+++ b/src/sbt-test/sbt-daffodil/cross-versions-03/test.script
@@ -16,11 +16,18 @@
## under the License.
##
+# define a local file for publishing and resolving artifacts
+> set every publishTo := Some(Resolver.file("file", new
File("target/ivy-publish/")))
+> set every resolvers := Seq("file" at new
File("target/ivy-publish/").getAbsoluteFile.toURI.toString)
-# builds jar, with _2.12 in the name beause charsets are scala version specific
-> package
-$ exists target/scala-2.12/test_2.12-0.1.jar
+# publish all versions of the plugin
+> plugin/publish
-# expect compilation to fail without this setting
-> set daffodilBuildsCharset := false
--> compile
+# test only 3.10.0 with the plugin
+> schema/test
+
+# test only 3.11.0 with the plugin
+> schema_daffodil3110/test
+
+# test only 4.0.0 with the plugin, this fails because the plugin was not build
for 4.0.0
+-> schema_daffodil400/test
diff --git a/src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt
b/src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt
index 4b338be..576bfab 100644
--- a/src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/flat-layout-01/build.sbt
@@ -15,14 +15,12 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilVersion := "3.6.0"
-
-daffodilFlatLayout := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ daffodilFlatLayout := true,
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
index 0e5c256..ac10a59 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-01/build.sbt
@@ -15,19 +15,15 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/test.dfdl.xsd"),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
-)
-
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/test.dfdl.xsd"),
+ DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
+ ),
+ daffodilVersion := "3.6.0",
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.5.0"))
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-01/test.script
b/src/sbt-test/sbt-daffodil/saved-parsers-01/test.script
index b6eea51..0ecefb2 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-01/test.script
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-01/test.script
@@ -19,10 +19,10 @@
> set publishTo := Some(Resolver.file("file", new File("target/ivy-publish/")))
> publish
-$ exists target/test-0.1-daffodil350.bin
$ exists target/test-0.1-daffodil360.bin
-$ exists target/test-0.1-two-daffodil350.bin
$ exists target/test-0.1-two-daffodil360.bin
+$ exists target/daffodil350/test-0.1-daffodil350.bin
+$ exists target/daffodil350/test-0.1-two-daffodil350.bin
$ exists target/ivy-publish/com/example/test/0.1/test-0.1.jar
$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil350.bin
$ exists target/ivy-publish/com/example/test/0.1/test-0.1-daffodil360.bin
@@ -32,12 +32,13 @@ $ exists
target/ivy-publish/com/example/test/0.1/test-0.1-two-daffodil360.bin
> clean
> set packageDaffodilBin/publishArtifact := false
+> set test.daffodil("3.5.0")/packageDaffodilBin/publishArtifact := false
> publish
$ exists target/ivy-publish/com/example/test/0.1/test-0.1.jar
-$ absent target/test-0.1-daffodil350.bin
$ absent target/test-0.1-daffodil360.bin
-$ absent target/test-0.1-two-daffodil350.bin
$ absent target/test-0.1-two-daffodil360.bin
+$ absent target/daffodil350/test-0.1-daffodil350.bin
+$ absent target/daffodil350/test-0.1-two-daffodil350.bin
$ absent target/ivy-publish/com/example/test/0.1/test-0.1-daffodil350.bin
$ absent target/ivy-publish/com/example/test/0.1/test-0.1-daffodil360.bin
$ absent target/ivy-publish/com/example/test/0.1/test-0.1-two-daffodil350.bin
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-02/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-02/build.sbt
index 73606e4..8076bf7 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-02/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-02/build.sbt
@@ -15,20 +15,16 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-// same as saved-parsers-01 but uses the old tuple syntax
-daffodilPackageBinInfos := Seq(
- ("/test.dfdl.xsd", None, None),
- ("/test.dfdl.xsd", Some("test02"), Some("two"))
-)
-
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ // same as saved-parsers-01 but uses the old tuple syntax
+ daffodilPackageBinInfos := Seq(
+ ("/test.dfdl.xsd", None, None),
+ ("/test.dfdl.xsd", Some("test02"), Some("two"))
+ ),
+ daffodilVersion := "3.6.0",
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.5.0"))
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
b/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
index c2e7033..79bfc28 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-02/test.script
@@ -17,11 +17,13 @@
##
> packageDaffodilBin
-$ exists target/test-0.1-daffodil350.bin
$ exists target/test-0.1-daffodil360.bin
-$ exists target/test-0.1-two-daffodil350.bin
$ exists target/test-0.1-two-daffodil360.bin
+> test_daffodil350/packageDaffodilBin
+$ exists target/daffodil350/test-0.1-daffodil350.bin
+$ exists target/daffodil350/test-0.1-two-daffodil350.bin
+
> set publishTo := Some(Resolver.file("file", new File("target/ivy-publish/")))
> publish
$ exists target/ivy-publish/com/example/test/0.1/test-0.1.jar
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
index 230e9d5..77f4ad6 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-03/build.sbt
@@ -15,22 +15,18 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := {
- val config = Some((Compile / resourceDirectory).value / "test.cfg")
- Seq(
- DaffodilBinInfo("/test.dfdl.xsd", config = config),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"), config =
config)
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilPackageBinInfos := {
+ val config = Some((Compile / resourceDirectory).value / "test.cfg")
+ Seq(
+ DaffodilBinInfo("/test.dfdl.xsd", config = config),
+ DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"), config
= config)
+ )
+ },
+ daffodilVersion := "3.11.0",
)
-}
-
-daffodilPackageBinVersions := Seq("3.11.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+ .daffodilProject(crossDaffodilVersions = Seq("3.5.0"))
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-03/test.script
b/src/sbt-test/sbt-daffodil/saved-parsers-03/test.script
index f84fc9a..d3d28b4 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-03/test.script
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-03/test.script
@@ -17,7 +17,9 @@
##
> packageDaffodilBin
-$ exists target/test-0.1-daffodil350.bin
$ exists target/test-0.1-daffodil3110.bin
-$ exists target/test-0.1-two-daffodil350.bin
$ exists target/test-0.1-two-daffodil3110.bin
+
+> test_daffodil350/packageDaffodilBin
+$ exists target/daffodil350/test-0.1-daffodil350.bin
+$ exists target/daffodil350/test-0.1-two-daffodil350.bin
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-04/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-04/build.sbt
index e21a7cd..a19ed81 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-04/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-04/build.sbt
@@ -15,16 +15,13 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/does-not-exist.dfdl.xsd")
-)
-
-daffodilPackageBinVersions := Seq(daffodilVersion.value)
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/does-not-exist.dfdl.xsd")
+ ),
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-05/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-05/build.sbt
index bcd6692..9c8a503 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-05/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-05/build.sbt
@@ -15,24 +15,19 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-// tells SBT to build a jar and put it on the classpath instead of putting
src/main/resources on
-// the classpath. This means schema resource paths will resolve to a path
inside a jar instead
-// of to a file
-exportJars := true
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/test.dfdl.xsd"),
- DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
-)
-
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ // tells SBT to build a jar and put it on the classpath instead of putting
src/main/resources on
+ // the classpath. This means schema resource paths will resolve to a path
inside a jar instead
+ // of to a file
+ exportJars := true,
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/test.dfdl.xsd"),
+ DaffodilBinInfo("/test.dfdl.xsd", Some("test02"), Some("two"))
+ ),
+ daffodilVersion := "3.6.0",
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.5.0"))
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-05/test.script
b/src/sbt-test/sbt-daffodil/saved-parsers-05/test.script
index 76a79ef..565d899 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-05/test.script
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-05/test.script
@@ -17,7 +17,9 @@
##
> packageDaffodilBin
-$ exists target/test-0.1-daffodil350.bin
$ exists target/test-0.1-daffodil360.bin
-$ exists target/test-0.1-two-daffodil350.bin
$ exists target/test-0.1-two-daffodil360.bin
+
+> test_daffodil350/packageDaffodilBin
+$ exists target/daffodil350/test-0.1-daffodil350.bin
+$ exists target/daffodil350/test-0.1-two-daffodil350.bin
diff --git a/src/sbt-test/sbt-daffodil/saved-parsers-06/build.sbt
b/src/sbt-test/sbt-daffodil/saved-parsers-06/build.sbt
index 85c5e0b..2035bda 100644
--- a/src/sbt-test/sbt-daffodil/saved-parsers-06/build.sbt
+++ b/src/sbt-test/sbt-daffodil/saved-parsers-06/build.sbt
@@ -15,20 +15,15 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-packageDaffodilBin / javaOptions ++= Seq("-XshouldErrorIfUsed")
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/test.dfdl.xsd")
-)
-
-daffodilPackageBinVersions := Seq("3.6.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ packageDaffodilBin / javaOptions ++= Seq("-XshouldErrorIfUsed"),
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/test.dfdl.xsd")
+ ),
+ daffodilVersion := "3.6.0",
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
b/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
index 4fed517..743f70a 100644
--- a/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/tdml-junit-01/build.sbt
@@ -15,10 +15,10 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ )
+ .daffodilProject()
diff --git a/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/build.sbt
b/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/build.sbt
index 45a6902..b11de33 100644
--- a/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/build.sbt
@@ -15,21 +15,16 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/com/example/test.dfdl.xsd"),
- DaffodilBinInfo("/com/example/test.dfdl.xsd", Some("test02"), Some("two"))
-)
-
-daffodilPackageBinVersions := Seq("3.6.0", "3.5.0")
-
-daffodilVersion := daffodilPackageBinVersions.value.head
-
-daffodilTdmlUsesPackageBin := true
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilVersion := "3.6.0",
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/com/example/test.dfdl.xsd"),
+ DaffodilBinInfo("/com/example/test.dfdl.xsd", Some("test02"),
Some("two"))
+ ),
+ daffodilTdmlUsesPackageBin := true,
+ )
+ .daffodilProject(crossDaffodilVersions = Seq("3.5.0"))
diff --git a/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/test.script
b/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/test.script
index 2c8d72e..2202ee0 100644
--- a/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/test.script
+++ b/src/sbt-test/sbt-daffodil/tdml-saved-parser-01/test.script
@@ -17,9 +17,7 @@
##
> packageDaffodilBin
-$ exists target/test-0.1-daffodil350.bin
$ exists target/test-0.1-daffodil360.bin
-$ exists target/test-0.1-two-daffodil350.bin
$ exists target/test-0.1-two-daffodil360.bin
> Test/compile
@@ -27,3 +25,13 @@ $ must-mirror target/test-classes/test.bin
target/test-0.1-daffodil360.bin
$ must-mirror target/test-classes/test-two.bin
target/test-0.1-two-daffodil360.bin
> test
+
+> test_daffodil350/packageDaffodilBin
+$ exists target/daffodil350/test-0.1-daffodil350.bin
+$ exists target/daffodil350/test-0.1-two-daffodil350.bin
+
+> test_daffodil350/Test/compile
+$ must-mirror target/daffodil350/test-classes/test.bin
target/daffodil350/test-0.1-daffodil350.bin
+$ must-mirror target/daffodil350/test-classes/test-two.bin
target/daffodil350/test-0.1-two-daffodil350.bin
+
+> test_daffodil350/Test/test
diff --git a/src/sbt-test/sbt-daffodil/versions-01/build.sbt
b/src/sbt-test/sbt-daffodil/versions-01/build.sbt
index a907294..aa8e475 100644
--- a/src/sbt-test/sbt-daffodil/versions-01/build.sbt
+++ b/src/sbt-test/sbt-daffodil/versions-01/build.sbt
@@ -15,16 +15,13 @@
* limitations under the License.
*/
-version := "0.1"
-
-name := "test"
-
-organization := "com.example"
-
-enablePlugins(DaffodilPlugin)
-
-daffodilPackageBinInfos := Seq(
- DaffodilBinInfo("/com/example/test.dfdl.xsd")
-)
-
-daffodilPackageBinVersions := Seq(daffodilVersion.value)
+val test = (project in file("."))
+ .settings(
+ version := "0.1",
+ name := "test",
+ organization := "com.example",
+ daffodilPackageBinInfos := Seq(
+ DaffodilBinInfo("/com/example/test.dfdl.xsd")
+ ),
+ )
+ .daffodilProject()