From fd7005995850cb72af9a58e4eb1d38b30db183a8 Mon Sep 17 00:00:00 2001 From: Steve Lawrence Date: Wed, 17 Jan 2024 12:57:30 -0500 Subject: [PATCH] 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 23820583ba..d336fb0578 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 " //