stevedlawrence commented on a change in pull request #422:
URL: https://github.com/apache/incubator-daffodil/pull/422#discussion_r499572354



##########
File path: build.sbt
##########
@@ -43,6 +46,32 @@ lazy val runtime1         = Project("daffodil-runtime1", 
file("daffodil-runtime1
                               .dependsOn(io, lib % "test->test", udf, macroLib 
% "compile-internal, test-internal")
                               .settings(commonSettings, usesMacros)
 
+val runtime2StaticLib     = Library("libruntime2.a")
+lazy val runtime2         = Project("daffodil-runtime2", 
file("daffodil-runtime2")).configs(IntegrationTest)
+                              .enablePlugins(CcPlugin)
+                              .dependsOn(tdmlProc)
+                              .settings(commonSettings)
+                              .settings(publishArtifact in (Compile, 
packageDoc) := false)
+                              .settings(
+                                Compile / ccTargets := 
ListSet(runtime2StaticLib),
+                                Compile / cSources  := Map(
+                                  runtime2StaticLib -> Seq(
+                                    baseDirectory.value / "src" / "main" / "c" 
/ "common_runtime.c",

Review comment:
       SBT has a pretty sophisticated way to match files. To do globbing, it 
looks something like this:
   ```scala
   val files = directory * GlobFilter("*.c").get
   ```
   Note that you need the .get to actually evaluate the paths/filters. A single 
astrisk will just look at children in the directory, a double asterisk (**) 
will recurse through all directories.
   
   Also note that rather doing ``baseDirectory.value`` and adding 
``src/main/``, you can use ``sourceDirectory.value``, which is essentially 
``baseDirectory.value / "src"``. Going one step further, if we get the setting 
from the ``Compile`` config like this ``(Compile / sourceDirectory).value`` we 
get the additional ``main`` directory. This compares to doing something like 
``(Test / sourceDirectory).value`` which will get you ``src/test`` instead of 
``src/main``. So the "sbt-y" way to glob source files is something like this:
   
   ```scala
   ((Compile / sourceDirectory).value / "c" / "common_runtime" * 
GlobFilter("*.c")).get
   ```




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

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to