Use git from the path instead of jgit/sbt-git (#27756)

* Use git from the path instead of jgit/sbt-git
* Branch name extraction working with older git
This commit is contained in:
Johan Andrén 2019-09-19 15:37:33 +02:00 committed by Patrik Nordwall
parent 1f56807732
commit efe6d96156
2 changed files with 14 additions and 10 deletions

View file

@ -6,7 +6,7 @@ import sbt._
import sbt.Keys._ import sbt.Keys._
import sbtwhitesource.WhiteSourcePlugin.autoImport._ import sbtwhitesource.WhiteSourcePlugin.autoImport._
import sbtwhitesource._ import sbtwhitesource._
import com.typesafe.sbt.SbtGit.GitKeys._ import scala.sys.process._
object Whitesource extends AutoPlugin { object Whitesource extends AutoPlugin {
override def requires = WhiteSourcePlugin override def requires = WhiteSourcePlugin
@ -17,15 +17,20 @@ object Whitesource extends AutoPlugin {
// do not change the value of whitesourceProduct // do not change the value of whitesourceProduct
whitesourceProduct := "Lightbend Reactive Platform", whitesourceProduct := "Lightbend Reactive Platform",
whitesourceAggregateProjectName := { whitesourceAggregateProjectName := {
(moduleName in LocalRootProject).value + "-" + ( val name = (moduleName in LocalRootProject).value
if (isSnapshot.value) val wsVersionName =
if (gitCurrentBranch.value == "master") "master" if (isSnapshot.value) {
val currentGitBranch = "git rev-parse --abbrev-ref HEAD".!!.trim
if (currentGitBranch == "master") "master"
else "adhoc" else "adhoc"
else CrossVersion.partialVersion((version in LocalRootProject).value) } else
CrossVersion
.partialVersion((version in LocalRootProject).value)
.map { case (major, minor) => s"$major.$minor-stable" } .map { case (major, minor) => s"$major.$minor-stable" }
.getOrElse("adhoc")) .getOrElse("adhoc")
s"$name-$wsVersionName"
}, },
whitesourceForceCheckAllDependencies := true, whitesourceForceCheckAllDependencies := true,
whitesourceFailOnError := true, whitesourceFailOnError := true)
)
} }

View file

@ -19,7 +19,6 @@ addSbtPlugin("com.lightbend.akka" % "sbt-paradox-akka" % "0.24")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-apidoc" % "0.2") addSbtPlugin("com.lightbend.paradox" % "sbt-paradox-apidoc" % "0.2")
addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.6.5") addSbtPlugin("com.lightbend.paradox" % "sbt-paradox" % "0.6.5")
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.16") addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.16")
addSbtPlugin("com.typesafe.sbt" % "sbt-git" % "1.0.0")
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0") // for maintenance of copyright file header addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.2.0") // for maintenance of copyright file header
addSbtPlugin("com.hpe.sbt" % "sbt-pull-request-validator" % "1.0.0") addSbtPlugin("com.hpe.sbt" % "sbt-pull-request-validator" % "1.0.0")
addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0") addSbtPlugin("org.scoverage" % "sbt-scoverage" % "1.6.0")