stevedlawrence commented on code in PR #13:
URL: https://github.com/apache/daffodil-sbt/pull/13#discussion_r1465159252


##########
README.md:
##########
@@ -94,6 +94,23 @@ If used, one may want to use the first value of this setting 
to configure
 daffodilVersion := daffodilPackageBinVersions.value.head
 ```
 
+## Layers and User Defined Functions
+
+If your schema project builds a Daffodil layer or user defined function, then
+set the `daffodilBuildsLayer` or `daffodilBuildsUDF` setting to true,
+respectively. For example:
+
+```scala
+daffodilBuildsLayer := true
+
+daffodilBuildsUDF := true
+```
+
+Setting either of these values to true adds additional dependencies needed to
+build the component. Note that this also sets the SBT `crossPaths` setting to
+`true`, which causes the scala version to be included in that jar file name
+since layer and UDF jars are specific to the scala version used to build them.

Review Comment:
   Of course it's not as easy as I'd guess. I would expect this to work:
   
   ```scala
       crossPaths := (Compile / sources).value.exists { 
_.getName.endsWith(".scala") }
   ```
   But that doesn't compile because `crossPaths` is a "setting" and `Compile / 
sources` is a "task", and settings can't depend on tasks.
   
   And it's actually relatively difficult if not impossible to accurately 
figure out the list of sources using just settings. We would have to use the 
`Compile / unmanagedSourceDirectories)` setting and recursively scan those 
directories for scala files. And if there are any managedSource (e.g. generated 
files), we can't know about those at all, since they generating them is a task. 
I'm not sure if it's worth the effort to figure it out.
   
   Maybe the best option is if there are layers or UDFs then we assume there 
are scala files like this PR does, and if there aren't and they are all java 
files, the project can override it by setting `crossPaths := false` in 
build.sbt. And if a project doesn't do that it doesn't hurt anything if 
crossPaths is true, it just means there's an unnecessary _2.12 in the jar name.



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