jadams-tresys commented on code in PR #96: URL: https://github.com/apache/daffodil-sbt/pull/96#discussion_r1975544021
########## src/main/java/org/apache/daffodil/DaffodilSaver.java: ########## @@ -0,0 +1,187 @@ +/* + * 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 org.apache.daffodil; + +import java.lang.reflect.Method; +import java.nio.channels.FileChannel; +import java.nio.channels.WritableByteChannel; +import java.nio.file.Paths; +import java.nio.file.StandardOpenOption; +import java.net.URI; +import java.net.URL; +import java.util.List; + +import javax.xml.parsers.DocumentBuilderFactory; +import javax.xml.parsers.DocumentBuilder; + +import org.w3c.dom.Document; +import org.w3c.dom.NodeList; +import org.w3c.dom.Node; + +// We need a special customized classpath, and the easiest way to do that within SBT is by +// forking. But the only thing that can save a parser via forking is the Daffodil CLI, which we +// do not publish. So instead we create this class that has a static main that we can fork to +// compile and save schemas using the version of Daffodil that is on the classpath. Note that it +// also uses reflection so that it is not tied to any specific version of Daffodil. This is +// fragile, but the Daffodil Jave API is pretty set in stone at this point, so this reflection Review Comment: It will help avoiding similar issues when converting to Scala 3, though I guess there is some compatibility between 2.13 and 3 as far as libraries and dependencies go I think. -- 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]
