olabusayoT commented on code in PR #210:
URL: https://github.com/apache/daffodil-sbt/pull/210#discussion_r3807829274


##########
src/main/scala/org/apache/daffodil/DaffodilPlugin.scala:
##########
@@ -518,14 +518,30 @@ object DaffodilPlugin extends AutoPlugin {
     /**
      * JVM options used for the forked process to build saved parsers
      *
-     * Defaults to just setting various system properties to configure loggers 
that might be
-     * used by different daffodil versions
+     * Defaults to setting various system properties to configure loggers that 
might be used by
+     * different daffodil versions, plus the -Xss this sbt JVM was started 
with, if any. Since
+     * sbt users often already tune sbt's own stack size (e.g. via .sbtopts or 
.jvmopts),
+     * it's convenient to reuse that value for the forked process rather than 
requiring it to
+     * be configured again. If a project wants a different stack size just for 
this forked
+     * process, it can append its own -Xss, e.g.:
+     *
+     *   packageDaffodilBin / javaOptions += "-Xss64m"
+     *
+     * Note this relies on the JVM using the last of multiple -Xss arguments 
it is given, so an
+     * appended -Xss here correctly takes precedence over the inherited one 
below.
      */
-    packageDaffodilBin / javaOptions := Seq(
-      s"-Dorg.slf4j.simpleLogger.logFile=System.out",
-      s"-Dorg.slf4j.simpleLogger.defaultLogLevel=${(packageDaffodilBin / 
logLevel).value}",
-      s"-Dorg.apache.logging.log4j.level=${(packageDaffodilBin / 
logLevel).value}"
-    ),
+    packageDaffodilBin / javaOptions := {
+      val inheritedXss =
+        
java.lang.management.ManagementFactory.getRuntimeMXBean.getInputArguments
+          .toArray(Array.empty[String])
+          .find(_.startsWith("-Xss"))
+
+      Seq(
+        s"-Dorg.slf4j.simpleLogger.logFile=System.out",
+        s"-Dorg.slf4j.simpleLogger.defaultLogLevel=${(packageDaffodilBin / 
logLevel).value}",
+        s"-Dorg.apache.logging.log4j.level=${(packageDaffodilBin / 
logLevel).value}"
+      ) ++ inheritedXss

Review Comment:
   Hmm, how does a schema project using the daffodil sbt plugin pass it's 
sbtopts to the plugins forked process? Would seeting `packageDaffodilBin / 
javaOptions` in the project work and make sense when the project is not the one 
forking anything?
   
   I agree it's not standard, I just wasn't sure of another way to approach this



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