stevedlawrence commented on pull request #681:
URL: https://github.com/apache/daffodil/pull/681#issuecomment-976578694


   I've added a branch to my fork that implements what I mentioned above. Take 
a look and let me know what you think:
   
   
https://github.com/stevedlawrence/daffodil/commit/fb4d4d153b530a11ca0d34b8aab6416dd34e1e48
   
   What this does:
   
   * Move the generated files to the `tutorials/src/main/examples/` directory 
to avoid any potential cyclic dependency/modification issues
   * Modify build.sbt to fork the CLI to run the generator for the two 
examples. Some things worth pointing out:
     * To deal with the log4j messages I just used `ForkOptions` and a 
`CustomOutput` to output the fork stdout/stderr to a buffer and then just 
ignore that buffer. So the log4j warnings still exist, this just doesn't show 
them.
     * This is the magic sbt incantation to run `genExamples` when `sbt 
compile` is run:
       ```
       Compile / compile := {
         val res = (Compile / compile).value
         (Compile / genExamples).value
         res
       }
       ```
       Note that this technically only runs if you run `sbt 
daffodil-tutorials/compile` but `sbt compile` runs that because the tutorials 
subproject is part of the subproject aggregation, so it's essentially the same
     * This also includes `FileFunction.cached` so that we only regenerate 
files if either the schemas or the classpath jars change. Avoids unnecessarily 
regenerating things 
   * Add a github action to ensure the examples are updated by generating the 
examples and running git diff. I intentionally didn't commit the changes to the 
nested generated files (which I can imagine some people might unknowingly o), 
so you can see what the failure looks like here
     
https://github.com/stevedlawrence/daffodil/runs/4299971721?check_suite_focus=true
   * Update the other generators to be consistent and less verbose about 
logging, similar to the rest of sbt compilation messages
   * Update `genManaged` to list the files, so you if you run `sbt 'show 
genManaged'` it will actually show the files that are generated
   
   I didn't see your latest changes, so this is slightly different (e.g. 
running the CLI vs your new CodeGenerator class). Feel free to pick and choose 
from that what you like.


-- 
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]


Reply via email to