This repository has been archived by the owner on Nov 22, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Setup Whitesource in tools * fix
- Loading branch information
Showing
4 changed files
with
38 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
import sbt._ | ||
import sbt.Keys._ | ||
import sbtwhitesource.WhiteSourcePlugin.autoImport._ | ||
import sbtwhitesource._ | ||
import scala.sys.process.Process | ||
import scala.util.Try | ||
|
||
object Whitesource extends AutoPlugin { | ||
private lazy val gitCurrentBranch = | ||
Try(Process("git rev-parse --abbrev-ref HEAD").!!.replaceAll("\\s", "")).recover { | ||
case e => sys.error(s"Couldn't determine git branch for Whitesource: $e") | ||
}.toOption | ||
|
||
override def requires = WhiteSourcePlugin | ||
|
||
override def trigger = allRequirements | ||
|
||
override lazy val projectSettings = Seq( | ||
// do not change the value of whitesourceProduct | ||
whitesourceProduct := "cloudflow", | ||
whitesourceAggregateProjectName := { | ||
"cloudflow-tools-" + ( | ||
if (isSnapshot.value) | ||
if (gitCurrentBranch.contains("master")) "master" | ||
else "adhoc" | ||
else majorMinor((LocalRootProject / version).value).map(_ + "-stable").getOrElse("adhoc") | ||
) | ||
}, | ||
whitesourceForceCheckAllDependencies := true, | ||
whitesourceFailOnError := true) | ||
|
||
private def majorMinor(version: String): Option[String] = """\d+\.\d+""".r.findFirstIn(version) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters