mbeckerle commented on code in PR #831:
URL: https://github.com/apache/daffodil/pull/831#discussion_r950547707
##########
daffodil-tdml-processor/src/main/scala/org/apache/daffodil/tdml/processor/DaffodilTDMLDFDLProcessor.scala:
##########
@@ -139,18 +139,31 @@ final class TDMLDFDLProcessorFactory private (
}
}
+
private def compileProcessor(
schemaSource: DaffodilSchemaSource,
useSerializedProcessor: Boolean,
optRootName: Option[String],
optRootNamespace: Option[String]): TDML.CompileResult = {
- val pf = compiler.compileSource(schemaSource, optRootName,
optRootNamespace)
- val diags = pf.getDiagnostics
- if (pf.isError) {
- Left(diags)
+ //
+ // if the schemaSource is not an XSD file, then we assume it is
+ // a pre-compiled DFDL schema
+ //
+ if (schemaSource.isXSD)
+ {
+ val pf = compiler.compileSource(schemaSource, optRootName,
optRootNamespace)
+ val diags = pf.getDiagnostics
+ if (pf.isError) {
+ Left(diags)
+ } else {
+ val res = this.generateProcessor(pf, useSerializedProcessor)
+ res
+ }
} else {
- val res = this.generateProcessor(pf, useSerializedProcessor)
- res
+ val chan =
Channels.newChannel(schemaSource.uriForLoading.toURL.openStream())
+ val dp = compiler.reload(chan)
+ val diags = dp.getDiagnostics
+ Right((diags, new DaffodilTDMLDFDLProcessor(dp)))
Review Comment:
Completely agree that they shouldn't be stored in repos. My use case for
this keeps them in /tmp.
The only reason there is this fake ".bin" in here is for purposes of having
a test here that exercises the code paths.
re: improving this feature further... I did think about that, but punted for
now. It's not THAT hard, there's just lots of time pressure now on other
things. But I definitely wanted to put this into Daffodil while we can rather
than write yet another non-TDML test rig to dance around this problem.
We could add the method to daffodil to allow one to get latest mod date for
any file included/imported by a schema, and use that date to decide whether to
recompile or not. Having daffodil do this avoids reinventing include/import and
resolver logic again elsewhere. I think this is pretty easy. DFDLSchemaFile
class gets a modDateTime member, and rollups doing max on that for an entire
SchemaSet.
Still doesn't deal with what if the schema is the same, but you changed
daffodil itself, but it would still be better than entirely manual.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]