This is an automated email from the ASF dual-hosted git repository.

slawrence pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/daffodil.git


The following commit(s) were added to refs/heads/main by this push:
     new fd7005995 Include the crossVersion in daffodil jars packaged in 
tar/zip/RPM
fd7005995 is described below

commit fd7005995850cb72af9a58e4eb1d38b30db183a8
Author: Steve Lawrence <[email protected]>
AuthorDate: Wed Jan 17 12:57:30 2024 -0500

    Include the crossVersion in daffodil jars packaged in tar/zip/RPM
    
    The sbt-native-packager plugin does not include the crossVersion in the
    Daffodil jars that it packages in tar/zip/RPM/etc. This could be useful
    for more easily comparing jars from maven (which do include the
    crossVersion) or creating a local Ivy/maven repo.
    
    The plugin does not have an configuration option to set this, so this
    directly modifies the mappings that the plugin creates to include the
    crossVersion for Daffodil jars only.
    
    For example, a package mapping that was previously this:
    
      lib/org.apache.daffodil.daffodil-lib-3.7.0.jar
    
    is now changed to this:
    
      lib/org.apache.daffodil.daffodil-lib_2.12-3.7.0.jar
    
    DAFFODIL-2849
---
 daffodil-cli/build.sbt | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

diff --git a/daffodil-cli/build.sbt b/daffodil-cli/build.sbt
index 23820583b..d336fb057 100644
--- a/daffodil-cli/build.sbt
+++ b/daffodil-cli/build.sbt
@@ -36,6 +36,22 @@ Universal / mappings ++= Seq(
   baseDirectory.value / "README.md" -> "README.md",
 )
 
+// When the sbt-native-packger plugin creates a tar/zip/RPM/etc, it does not 
include the
+// crossVersion in mapping of jars built from this project (i.e. 
org.apache.daffodil jars only).
+// There are cases where this crossVersion would be useful (e.g. consistency 
with Ivy jar names
+// that do include the crossVersion), so this modifies the mapping to include 
that. Note that
+// the name of the path already has what we need, we just need to prepend 
"lib/" and our
+// organization.
+Universal / mappings := (Universal / mappings).value.map { case (path, 
mapping) =>
+  val thisProjectJarPrefix = "lib/" + organization.value + "."
+  val newMapping =
+    if (mapping.startsWith(thisProjectJarPrefix))
+      thisProjectJarPrefix + path.getName
+    else
+      mapping
+  (path, newMapping)
+}
+
 maintainer := "Apache Daffodil <[email protected]>"
 
 //

Reply via email to