You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "pan3793 (via GitHub)" <gi...@apache.org> on 2025/12/01 05:30:57 UTC
Re: [PR] [SPARK-54282][BUILD] Read bom version from pom in SBT [spark]
pan3793 commented on code in PR #52978:
URL: https://github.com/apache/spark/pull/52978#discussion_r2575660943
##########
project/SparkBuild.scala:
##########
@@ -1928,3 +1928,25 @@ object TestSettings {
)
}
+
+object DependencyVersions {
+ import java.util.Properties
+
+ private lazy val properties = settingKey[Properties]("Effective POM properties")
+ lazy val jacksonVersion = settingKey[String]("Jackson version")
+ lazy val jacksonModuleID = settingKey[ModuleID]("Jackson Module ID")
+ lazy val settings = Seq(
+ properties := SbtPomKeys.effectivePom.value.getProperties,
+ jacksonVersion := getVersion(properties.value, "fasterxml.jackson"),
+ jacksonModuleID := ModuleID("com.fasterxml.jackson", "jackson-bom", jacksonVersion.value),
+ )
+
+ private def getVersionFromPom(properties: Properties, property: String) : String = {
+ properties.get(property).asInstanceOf[String]
+ }
+
+ private def getVersion(properties: Properties, property: String) : String = {
+ val version = property + ".version"
+ sys.props.get(version).getOrElse(getVersionFromPom(properties, version))
+ }
Review Comment:
small suggestion, hope to make it clearer
```suggestion
private lazy val pomProps = settingKey[Properties]("Effective POM properties")
lazy val jacksonVersion = settingKey[String]("Jackson version")
lazy val jacksonBom = settingKey[ModuleID]("Jackson BOM Module ID")
lazy val settings = Seq(
pomProps := SbtPomKeys.effectivePom.value.getProperties,
jacksonVersion := getProperty(pomProps.value, "fasterxml.jackson.version"),
jacksonBom := ModuleID("com.fasterxml.jackson", "jackson-bom", jacksonVersion.value),
)
private def getProperty(pomProps: Properties, property: String) : String = {
sys.props.get(property).getOrElse(pomProps.get(property).asInstanceOf[String])
}
```
BTW, could you please move `object DependencyVersions` to line 1180?
--
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: reviews-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org