[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 <cfmcgrady@gmail.com>
Signed-off-by: mingji <fengmingxiao.fmx@alibaba-inc.com>
This commit is contained in:
Fu Chen 2024-10-21 11:05:38 +08:00 committed by mingji
parent a94147cd9d
commit 24b9b24712
2 changed files with 9 additions and 1 deletions

View File

@ -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"),

View File

@ -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")