You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ar...@apache.org on 2022/08/05 17:38:06 UTC
[daffodil-vscode] 02/28: - Add jaxb bindings to sbt build
This is an automated email from the ASF dual-hosted git repository.
arosien pushed a commit to branch daffodil-vscode-tdml
in repository https://gitbox.apache.org/repos/asf/daffodil-vscode.git
commit 6bd1e9fcff07903caa23621d8acac550301e38e1
Author: Michael Hoke <mi...@nteligen.com>
AuthorDate: Thu Jun 23 11:21:33 2022 -0400
- Add jaxb bindings to sbt build
---
bindings.xjb | 55 ++++++++++++++++++++++
build.sbt | 27 ++++++++++-
project/plugins.sbt | 3 ++
.../org.apache.daffodil.debugger.dap/Parse.scala | 21 +++++++++
4 files changed, 105 insertions(+), 1 deletion(-)
diff --git a/bindings.xjb b/bindings.xjb
new file mode 100644
index 0000000..826b0b5
--- /dev/null
+++ b/bindings.xjb
@@ -0,0 +1,55 @@
+<jxb:bindings version="2.1"
+ xmlns:tdml="http://www.ibm.com/xmlns/dfdl/testData"
+ xmlns:jxb="http://java.sun.com/xml/ns/jaxb"
+ xmlns:dfdl="http://www.ogf.org/dfdl/dfdl-1.0/"
+ xmlns:xs="http://www.w3.org/2001/XMLSchema">
+ <jxb:bindings schemaLocation="resources/xsd/DFDL_part3_model.xsd" version="1.0">
+ <jxb:bindings node="//xs:attributeGroup[@name='SetVariableAG']/xs:attribute[@name='value']">
+ <jxb:property name="ValueAttribute"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:element[@name='simpleType']">
+ <jxb:class name="simpleTypeClass"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:element[@name='group']">
+ <jxb:class name="groupClass"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:element[@name='choice']">
+ <jxb:class name="choiceClass"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:element[@name='sequence']">
+ <jxb:class name="sequenceClass"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:element[@name='element']">
+ <jxb:class name="elementClass"/>
+ </jxb:bindings>
+ </jxb:bindings>
+ <jxb:bindings schemaLocation="resources/xsd/DFDL_part2_attributes.xsd" version="1.0">
+ <jxb:bindings node="//xs:attributeGroup[@name='BaseAGQualified']/xs:attribute[@name='ref']">
+ <jxb:property name="RefAttribute"/>
+ </jxb:bindings>
+ </jxb:bindings>
+ <jxb:bindings schemaLocation="resources/xsd/DFDL_part1_simpletypes.xsd" version="1.0">
+ <jxb:bindings node="//xs:simpleType[@name='ByteOrderEnum']">
+ <jxb:typesafeEnumClass name="ByteOrderEnumType"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:simpleType[@name='BitOrderEnum']">
+ <jxb:typesafeEnumClass name="BitOrderEnumType"/>
+ </jxb:bindings>
+ </jxb:bindings>
+ <jxb:bindings schemaLocation="resources/xsd/dafext.xsd" version="1.0">
+ <jxb:bindings node="//xs:attribute[@name='parseUnparsePolicy']">
+ <jxb:property name="ParseUnparsePolicyExt"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+ <jxb:typesafeEnumClass name="PropertyNameTypeExt"/>
+ </jxb:bindings>
+ <jxb:bindings node="//xs:complexType[@name='PropertyType']">
+ <jxb:class name="PropertyTypeClass"/>
+ </jxb:bindings>
+ </jxb:bindings>
+ <jxb:bindings schemaLocation="resources/xsd/dfdlx.xsd" version="1.0">
+ <jxb:bindings node="//xs:simpleType[@name='PropertyNameType']">
+ <jxb:typesafeEnumClass name="PropertyNameTypeX"/>
+ </jxb:bindings>
+ </jxb:bindings>
+</jxb:bindings>
\ No newline at end of file
diff --git a/build.sbt b/build.sbt
index b0a64b8..62ba03f 100644
--- a/build.sbt
+++ b/build.sbt
@@ -15,6 +15,7 @@
* limitations under the License.
*/
+import com.github.retronym.sbtxjc.SbtXjcPlugin
import play.api.libs.json._
lazy val packageData = Json.parse(scala.io.Source.fromFile("./package.json").mkString).as[JsObject]
@@ -44,7 +45,8 @@ lazy val commonSettings = {
// remove the -Xcheckinit option added by the sbt tpoletcat plugin. This
// option leads to non-reproducible builds
scalacOptions --= Seq("-Xcheckinit"),
- startYear := Some(2021)
+ startYear := Some(2021),
+ javaSource := file("server/sbtXjc/target/scala-2.12/src_managed_cxf/org/apache/daffodil/tdml")
)
}
@@ -69,6 +71,8 @@ lazy val `daffodil-debugger` = project
.settings(publish / skip := true)
.dependsOn(core)
.aggregate(core)
+ .dependsOn(sbtXjcProject)
+ .aggregate(sbtXjcProject)
lazy val core = project
.in(file("server/core"))
@@ -87,3 +91,24 @@ lazy val core = project
packageName := s"${name.value}-$daffodilVer"
)
.enablePlugins(commonPlugins: _*)
+
+lazy val sbtXjcProject = project
+ .in(file("server/sbtXjc"))
+ .enablePlugins(SbtXjcPlugin)
+ .settings(
+ name := "daffodil-xjc",
+ libraryDependencies ++= Seq(
+ "javax.activation" % "activation" % "1.1.1",
+ "com.sun.xml.bind" % "jaxb-xjc" % "2.1.6",
+ // "org.relaxng" % "jing" % "20220510" % "runtime",
+
+ // "com.sun.istack" % "istack-commons-tools" % "4.1.1"
+ ),
+ xjcCommandLine += "-nv",
+ xjcCommandLine += "-p",
+ xjcCommandLine += "org.apache.daffodil.tdml",
+ xjcBindings += "bindings.xjb",
+ xjcJvmOpts += "-classpath",
+ xjcJvmOpts += s"${csrCacheDirectory.value}/https/repo1.maven.org/maven2/javax/activation/activation/1.1.1/*:${csrCacheDirectory.value}/https/repo1.maven.org/maven2/javax/activation/javax.activation-api/1.2.0/*:${csrCacheDirectory.value}/https/repo1.maven.org/maven2/org/glassfish/jaxb/txw2/2.2.11/*:${csrCacheDirectory.value}/https/repo1.maven.org/maven2/relaxngDatatype/relaxngDatatype/20020414/*:${csrCacheDirectory.value}/https/repo1.maven.org/maven2/com/sun/xsom/xsom/20140925/*:${csr [...]
+ Compile / xjc / sources := Seq(file("resources/xsd"))
+ )
diff --git a/project/plugins.sbt b/project/plugins.sbt
index 741b8d5..c3754bc 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -21,3 +21,6 @@ addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.17")
addSbtPlugin("org.musigma" % "sbt-rat" % "0.7.0")
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.3")
addSbtPlugin("com.github.battermann" % "sbt-json" % "0.5.0")
+addSbtPlugin("org.scala-sbt.plugins" % "sbt-xjc" % "0.10")
+
+// resolvers += "Java Net" at "http://download.java.net/maven/2/"
\ No newline at end of file
diff --git a/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala b/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
index 6c84f49..e613ca4 100644
--- a/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
+++ b/server/core/src/main/scala/org.apache.daffodil.debugger.dap/Parse.scala
@@ -46,6 +46,7 @@ import org.apache.daffodil.util.Misc
import org.typelevel.log4cats.Logger
import org.typelevel.log4cats.slf4j.Slf4jLogger
import scala.util.Try
+import org.apache.commons.io.output.NullOutputStream
trait Parse {
@@ -316,6 +317,26 @@ object Parse {
case ec => Logger[IO].debug(s"deliverParseData: $ec")
} ++ Stream.eval(
dapEvents.offer(None) // ensure dapEvents is terminated when the parse is terminated
+ ) ++ Stream.eval(
+ args.infosetOutput match {
+ case Debugee.LaunchArgs.InfosetOutput.File(path) =>
+ // if (Debugee.LaunchArgs.InfosetOutput.File(path))
+ /* Resource.make {
+ IO(new FileOutputStream(path.toFile()))
+ } { outStream =>
+ IO(outStream.close()).handleErrorWith(_ => IO.unit)
+ } */
+ IO(new FileOutputStream(path.toFile()))
+ // path.toString()
+ case _ =>
+ /* Resource.make {
+ IO(new ByteArrayOutputStream(0))
+ } { outStream =>
+ IO(outStream.close()).handleErrorWith(_ => IO.unit)
+ } */
+ IO(new PrintStream(NullOutputStream.NULL_OUTPUT_STREAM))
+ // ""
+ }
),
infosetChanges
).parJoinUnbounded