You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by ji...@apache.org on 2021/03/30 15:15:24 UTC

[daffodil] 08/09: Fix compilation errors after rebase

This is an automated email from the ASF dual-hosted git repository.

jinterrante pushed a commit to branch runtime2-2202
in repository https://gitbox.apache.org/repos/asf/daffodil.git

commit 57b3c89bbf3ca4f0f16334bfe185f7f5e1089cc6
Author: John Interrante <in...@research.ge.com>
AuthorDate: Sat Mar 27 11:09:21 2021 -0400

    Fix compilation errors after rebase
    
    Rebase runtime2-2202 on latest commits from asf/master.  Fix
    compilation errors in Main.c due to changes in scallop API.  Fix
    compilation errors in DataProcessor.scala due to rebase conflicts.
---
 daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala   | 12 +++++-------
 .../scala/org/apache/daffodil/processors/DataProcessor.scala |  3 +--
 2 files changed, 6 insertions(+), 9 deletions(-)

diff --git a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
index 75a0a0c..3891195 100644
--- a/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
+++ b/daffodil-cli/src/main/scala/org/apache/daffodil/Main.scala
@@ -502,7 +502,7 @@ class CLIConf(arguments: Array[String]) extends scallop.ScallopConf(arguments)
   }
 
   // Generate Subcommand Options
-  val generate = new scallop.Subcommand("generate") {
+  object generate extends scallop.Subcommand("generate") {
     descr("generate <language> code from a DFDL schema")
 
     banner("""|Usage: daffodil [GLOBAL_OPTS] generate <language> [SUBCOMMAND_OPTS]
@@ -511,7 +511,7 @@ class CLIConf(arguments: Array[String]) extends scallop.ScallopConf(arguments)
     footer("""|
               |Run 'daffodil generate <language> --help' for subcommand specific options""".stripMargin)
 
-    val c = new scallop.Subcommand("c") {
+    object c extends scallop.Subcommand("c") {
       banner("""|Usage: daffodil generate c -s <schema> [-r [{namespace}]<root>]
                 |                           [-c <file>] [outputDir]
                 |
@@ -526,13 +526,11 @@ class CLIConf(arguments: Array[String]) extends scallop.ScallopConf(arguments)
       val schema = opt[URI]("schema", required = true, argName = "file", descr = "the annotated DFDL schema to use to generate source code.")
       val rootNS = opt[RefQName]("root", argName = "node", descr = "the root element of the XML file to use.  An optional namespace may be provided. This needs to be one of the top-level elements of the DFDL schema defined with --schema. Requires --schema. If not supplied uses the first element of the first schema")
       val tunables = props[String]('T', keyName = "tunable", valueName = "value", descr = "daffodil tunable to be used when compiling schema.")
-      val config = opt[String](short = 'c', argName = "file", descr = "path to file containing configuration items.")
+      val config = opt[File](short = 'c', argName = "file", descr = "path to file containing configuration items.")
       val outputDir = trailArg[String](required = false, descr = "output directory in which to generate source code. If not specified, uses current directory.")
 
-      validateOpt(schema) {
-        case None => Left("No schemas specified using the --schema option")
-        case _ => Right(Unit)
-      }
+      requireOne(schema) // --schema must be provided
+      validateFileIsFile(config) // --config must be a file that exists
     }
     addSubcommand(c)
   }
diff --git a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
index 903ff08..f1bd90b 100644
--- a/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
+++ b/daffodil-runtime1/src/main/scala/org/apache/daffodil/processors/DataProcessor.scala
@@ -27,7 +27,6 @@ import java.nio.file.Files
 import java.util.zip.GZIPOutputStream
 
 import scala.collection.immutable.Queue
-import scala.collection.mutable
 
 import org.apache.daffodil.Implicits._; object INoWarn4 {
   ImplicitsSuppressUnusedImportWarning() }
@@ -67,7 +66,7 @@ import org.apache.daffodil.processors.unparsers.UnparseError
 import org.apache.daffodil.util.Maybe
 import org.apache.daffodil.util.Maybe._
 import org.apache.daffodil.util.Misc
-
+import org.apache.daffodil.validation.XercesValidatorFactory
 
 /**
  * Implementation mixin - provides simple helper methods