You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@daffodil.apache.org by "stevedlawrence (via GitHub)" <gi...@apache.org> on 2023/06/02 13:54:03 UTC

[GitHub] [daffodil] stevedlawrence commented on a diff in pull request #1022: Store Daffodil version in a file instead of in the manifest

stevedlawrence commented on code in PR #1022:
URL: https://github.com/apache/daffodil/pull/1022#discussion_r1214412980


##########
daffodil-lib/src/main/scala/org/apache/daffodil/lib/util/Misc.scala:
##########
@@ -250,12 +251,9 @@ object Misc {
    * Returns the primary version of daffodil from the jar
    */
   def getDaffodilVersion: String = {
-    val implVersion = this.getClass.getPackage.getImplementationVersion
-    if (implVersion == null) {
-      ""
-    } else {
-      implVersion
-    }
+    val uri = getRequiredResource("org/apache/daffodil/lib/VERSION")
+    val version = Source.fromInputStream(uri.toURL.openStream, "UTF-8").mkString
+    version

Review Comment:
   Yep. To be a little bit more exact, the new `genVersion` task writes the version to `daffodil-lib/resource_managed/main/org/apache/daffodil/lib/VERSION`, which sbt copies to `daffodil-lib/target/classes/org/apache/daffodil/lib/` before it generates the jar. 
   
   Both the `resource_managed` and `target` directories are in the .gitignore so the file is never committed, its just generated for every build.



-- 
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: commits-unsubscribe@daffodil.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org