Skip to content
This repository was archived by the owner on Nov 22, 2024. It is now read-only.

Commit e89c4a9

Browse files
authored
Setup whitesource tools (#1009)
* Setup Whitesource in tools * fix
1 parent 73862f1 commit e89c4a9

File tree

4 files changed

+38
-0
lines changed

4 files changed

+38
-0
lines changed

.github/workflows/build-pr.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ jobs:
2121
run: |
2222
cd core
2323
sbt "scalafmtCheckAll; scalafmtSbtCheck"
24+
cd ../tools
25+
sbt "scalafmtCheckAll; scalafmtSbtCheck"
2426
- name: Build documentation
2527
run: |
2628
sudo snap install yq

.github/workflows/build_and_publish.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ jobs:
1919
run: |
2020
cd core
2121
sbt "whitesourceCheckPolicies; whitesourceUpdate"
22+
cd ../tools
23+
sbt "whitesourceCheckPolicies; whitesourceUpdate"
2224
- name: Build documentation
2325
run: |
2426
sudo snap install yq
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
import sbt._
2+
import sbt.Keys._
3+
import sbtwhitesource.WhiteSourcePlugin.autoImport._
4+
import sbtwhitesource._
5+
import scala.sys.process.Process
6+
import scala.util.Try
7+
8+
object Whitesource extends AutoPlugin {
9+
private lazy val gitCurrentBranch =
10+
Try(Process("git rev-parse --abbrev-ref HEAD").!!.replaceAll("\\s", "")).recover {
11+
case e => sys.error(s"Couldn't determine git branch for Whitesource: $e")
12+
}.toOption
13+
14+
override def requires = WhiteSourcePlugin
15+
16+
override def trigger = allRequirements
17+
18+
override lazy val projectSettings = Seq(
19+
// do not change the value of whitesourceProduct
20+
whitesourceProduct := "cloudflow",
21+
whitesourceAggregateProjectName := {
22+
"cloudflow-tools-" + (
23+
if (isSnapshot.value)
24+
if (gitCurrentBranch.contains("master")) "master"
25+
else "adhoc"
26+
else majorMinor((LocalRootProject / version).value).map(_ + "-stable").getOrElse("adhoc")
27+
)
28+
},
29+
whitesourceForceCheckAllDependencies := true,
30+
whitesourceFailOnError := true)
31+
32+
private def majorMinor(version: String): Option[String] = """\d+\.\d+""".r.findFirstIn(version)
33+
}

tools/project/plugins.sbt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.10.0")
44
// discipline
55
addSbtPlugin("org.scalameta" % "sbt-scalafmt" % "2.4.2")
66
addSbtPlugin("de.heikoseeberger" % "sbt-header" % "5.6.0")
7+
addSbtPlugin("com.lightbend" % "sbt-whitesource" % "0.1.18")
78

89
libraryDependencies ++= Seq(
910
"org.codehaus.plexus" % "plexus-container-default" % "2.1.0",

0 commit comments

Comments
 (0)