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

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


The following commit(s) were added to refs/heads/main by this push:
     new 24b9b2471 [CELEBORN-1658] Add Git Commit Info and Build JDK Spec to 
sbt Manifest
24b9b2471 is described below

commit 24b9b247123ba75558e24024a1e169ce065a5654
Author: Fu Chen <[email protected]>
AuthorDate: Mon Oct 21 11:05:38 2024 +0800

    [CELEBORN-1658] Add Git Commit Info and Build JDK Spec to sbt Manifest
    
    ### What changes were proposed in this pull request?
    
    This PR  adding Git commit information and JVM build specifications to 
package manifest.
    
    the `META-INF/MANIFEST.MF` before this PR:
    
    ```
    Manifest-Version: 1.0
    Specification-Title: celeborn-client-spark-3-shaded
    Specification-Version: 0.6.0-SNAPSHOT
    Specification-Vendor: org.apache.celeborn
    Implementation-Title: celeborn-client-spark-3-shaded
    Implementation-Version: 0.6.0-SNAPSHOT
    Implementation-Vendor: org.apache.celeborn
    Implementation-Vendor-Id: org.apache.celeborn
    ```
    
    after this PR:
    
    ```
    Manifest-Version: 1.0
    Specification-Title: celeborn-client-spark-3-shaded
    Specification-Version: 0.6.0-SNAPSHOT
    Specification-Vendor: org.apache.celeborn
    Implementation-Title: celeborn-client-spark-3-shaded
    Implementation-Version: 0.6.0-SNAPSHOT
    Implementation-Vendor: org.apache.celeborn
    Implementation-Vendor-Id: org.apache.celeborn
    Build-Jdk-Spec: 17.0.9
    Build-Revision: 03247c19f1b38096a4080fe97e94dbeb20ebcbe9
    Build-Branch: jdk-git-spec
    Build-Time: 2024-10-18T17:53:02.723124+08:00[Asia/Shanghai]
    ```
    
    ```
    Manifest-Version: 1.0
    Specification-Title: celeborn-client-spark-3-shaded
    Specification-Version: 0.6.0-SNAPSHOT
    Specification-Vendor: org.apache.celeborn
    Implementation-Title: celeborn-client-spark-3-shaded
    Implementation-Version: 0.6.0-SNAPSHOT
    Implementation-Vendor: org.apache.celeborn
    Implementation-Vendor-Id: org.apache.celeborn
    Build-Jdk-Spec: 17.0.9
    Build-Revision: N/A
    Build-Branch:
    Build-Time: 2024-10-18T17:54:16.932121+08:00[Asia/Shanghai]
    ```
    
    ### Why are the changes needed?
    
    As title.
    
    ### Does this PR introduce _any_ user-facing change?
    
    No
    
    ### How was this patch tested?
    
    local
    
    Closes #2821 from cfmcgrady/jdk-git-spec.
    
    Authored-by: Fu Chen <[email protected]>
    Signed-off-by: mingji <[email protected]>
---
 project/CelebornBuild.scala | 8 +++++++-
 project/plugins.sbt         | 2 ++
 2 files changed, 9 insertions(+), 1 deletion(-)

diff --git a/project/CelebornBuild.scala b/project/CelebornBuild.scala
index 502799cb7..ec3050fbf 100644
--- a/project/CelebornBuild.scala
+++ b/project/CelebornBuild.scala
@@ -23,6 +23,7 @@ import scala.util.Properties
 import scala.xml._
 import scala.xml.transform._
 
+import com.github.sbt.git.SbtGit.GitKeys._
 import org.openapitools.generator.sbt.plugin.OpenApiGeneratorPlugin
 import 
org.openapitools.generator.sbt.plugin.OpenApiGeneratorPlugin.autoImport._
 import sbtassembly.AssemblyPlugin.autoImport._
@@ -242,7 +243,12 @@ object CelebornCommonSettings {
     fork := true,
     scalacOptions ++= Seq("-target:jvm-1.8"),
     javacOptions ++= Seq("-encoding", UTF_8.name(), "-source", "1.8", "-g"),
-
+    Compile / packageBin / packageOptions +=  Package.ManifestAttributes(
+      "Build-Jdk-Spec" -> System.getProperty("java.version"),
+      "Build-Revision" -> gitHeadCommit.value.getOrElse("N/A"),
+      "Build-Branch" -> gitCurrentBranch.value,
+      "Build-Time" -> 
java.time.ZonedDateTime.now().format(java.time.format.DateTimeFormatter.ISO_DATE_TIME)),
+  
     // -target cannot be passed as a parameter to javadoc. See 
https://github.com/sbt/sbt/issues/355
     Compile / compile / javacOptions ++= Seq("-target", "1.8"),
 
diff --git a/project/plugins.sbt b/project/plugins.sbt
index c592d2c2f..40374298d 100644
--- a/project/plugins.sbt
+++ b/project/plugins.sbt
@@ -22,3 +22,5 @@ addSbtPlugin("com.thesamet" % "sbt-protoc" % "1.0.6")
 addSbtPlugin("com.github.sbt" % "sbt-pgp" % "2.2.1")
 
 addSbtPlugin("org.openapitools" % "sbt-openapi-generator" % "7.8.0")
+
+addSbtPlugin("com.github.sbt" % "sbt-git" % "2.1.0")

Reply via email to