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 6dfb885  Bump default daffodilVersion to 3.7.0
6dfb885 is described below

commit 6dfb88548842e44eecdb8441304f1121f8c7906d
Author: Steve Lawrence <[email protected]>
AuthorDate: Mon Apr 22 09:08:51 2024 -0400

    Bump default daffodilVersion to 3.7.0
    
    - Update readme to make it more clear daffodiLVersion is not required,
      but can be used to pin to a specific version
    - Aadd test to ensure the plugin works with all Daffodil versions 3.0.0
      and newer
    
    Closes #22
---
 README.md                                          |  8 ++-
 .../scala/org/apache/daffodil/DaffodilPlugin.scala |  2 +-
 src/sbt-test/sbt-daffodil/versions-01/build.sbt    | 28 ++++++++++
 .../sbt-daffodil/versions-01/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          | 34 +++++++++++
 src/sbt-test/sbt-daffodil/versions-01/test.script  | 65 ++++++++++++++++++++++
 8 files changed, 226 insertions(+), 4 deletions(-)

diff --git a/README.md b/README.md
index b1d8fa4..eb146fe 100644
--- a/README.md
+++ b/README.md
@@ -33,9 +33,11 @@ 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:
+daffodil-tdml-processor, junit), juint test options, and more.
+
+By default, this plugin configures the Daffodil dependency to be the latest
+version available at the time of the plugins release, but to pin to a specific
+Daffodil version set the `daffodilVersion` setting in build.sbt, for example:
 
 ```scala
 daffodilVersion := "3.6.0"
diff --git a/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala 
b/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
index a03d519..1280fe3 100644
--- a/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
+++ b/src/main/scala/org/apache/daffodil/DaffodilPlugin.scala
@@ -72,7 +72,7 @@ object DaffodilPlugin extends AutoPlugin {
     /**
      * Default Daffodil version
      */
-    daffodilVersion := "3.6.0",
+    daffodilVersion := "3.7.0",
 
     /**
      * Assume schemas do not include layers or UDFs, projects can override 
these if they do
diff --git a/src/sbt-test/sbt-daffodil/versions-01/build.sbt 
b/src/sbt-test/sbt-daffodil/versions-01/build.sbt
new file mode 100644
index 0000000..3b22cd3
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/versions-01/build.sbt
@@ -0,0 +1,28 @@
+/*
+ * 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.
+ */
+
+version := "0.1"
+
+name := "test"
+
+organization := "com.example"
+
+daffodilPackageBinInfos := Seq(
+  ("/com/example/test.dfdl.xsd", None, None),
+)
+
+daffodilPackageBinVersions := Seq(daffodilVersion.value)
diff --git a/src/sbt-test/sbt-daffodil/versions-01/project/plugins.sbt 
b/src/sbt-test/sbt-daffodil/versions-01/project/plugins.sbt
new file mode 100644
index 0000000..eaf249b
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/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/versions-01/src/main/resources/com/example/test.dfdl.xsd
 
b/src/sbt-test/sbt-daffodil/versions-01/src/main/resources/com/example/test.dfdl.xsd
new file mode 100644
index 0000000..dbab88c
--- /dev/null
+++ 
b/src/sbt-test/sbt-daffodil/versions-01/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/versions-01/src/test/resources/com/example/test.tdml
 
b/src/sbt-test/sbt-daffodil/versions-01/src/test/resources/com/example/test.tdml
new file mode 100644
index 0000000..c8d3e90
--- /dev/null
+++ 
b/src/sbt-test/sbt-daffodil/versions-01/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/versions-01/src/test/scala/com/example/test.scala 
b/src/sbt-test/sbt-daffodil/versions-01/src/test/scala/com/example/test.scala
new file mode 100644
index 0000000..85e2848
--- /dev/null
+++ 
b/src/sbt-test/sbt-daffodil/versions-01/src/test/scala/com/example/test.scala
@@ -0,0 +1,34 @@
+/*
+ * 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 com.example
+
+import org.junit.Test
+import org.apache.daffodil.tdml.Runner
+import org.junit.AfterClass
+
+object TestExample {
+  lazy val runner = Runner("/com/example/", "test.tdml")
+
+  @AfterClass def shutdown: Unit = { runner.reset }
+}
+
+class TestExample {
+  import TestExample._
+
+  @Test def test_test01() { runner.runOneTest("test01") }
+}
diff --git a/src/sbt-test/sbt-daffodil/versions-01/test.script 
b/src/sbt-test/sbt-daffodil/versions-01/test.script
new file mode 100644
index 0000000..05e0390
--- /dev/null
+++ b/src/sbt-test/sbt-daffodil/versions-01/test.script
@@ -0,0 +1,65 @@
+## 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.
+## 
+
+> set daffodilVersion := "3.7.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil370.bin
+> test
+> clean
+
+> set daffodilVersion := "3.6.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil360.bin
+> test
+> clean
+
+> set daffodilVersion := "3.5.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil350.bin
+> test
+> clean
+
+> set daffodilVersion := "3.4.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil340.bin
+> test
+> clean
+
+> set daffodilVersion := "3.3.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil330.bin
+> test
+> clean
+
+> set daffodilVersion := "3.2.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil320.bin
+> test
+> clean
+
+> set daffodilVersion := "3.1.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil310.bin
+> test
+> clean
+
+> set daffodilVersion := "3.0.0"
+> packageDaffodilBin
+$ exists target/test-0.1-daffodil300.bin
+> test
+> clean

Reply via email to