-
Notifications
You must be signed in to change notification settings - Fork 16
Expand file tree
/
Copy pathbuild.sbt
More file actions
109 lines (97 loc) · 3.6 KB
/
build.sbt
File metadata and controls
109 lines (97 loc) · 3.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
// SPDX-FileCopyrightText: The sbt-sbom team
//
// SPDX-License-Identifier: MIT
ThisBuild / organization := Organization.organization
ThisBuild / organizationName := Organization.organizationName
ThisBuild / organizationHomepage := Organization.organizationHomepage
val scala212 = "2.12.21"
val scala3 = "3.8.2"
ThisBuild / scalaVersion := scala212
ThisBuild / crossScalaVersions := Seq(scala212, scala3)
ThisBuild / homepage := Project.homepage
ThisBuild / developers := Project.developers
ThisBuild / licenses := Project.licenses
ThisBuild / scmInfo := Project.scmInfo
ThisBuild / description := Project.description
lazy val root = (project in file("."))
.enablePlugins(SbtPlugin, ScriptedPlugin, BuildInfoPlugin)
.settings(
name := "sbt-sbom",
libraryDependencies ++= Dependencies.library,
// Explicit Maven artifact IDs so sbt 1.6 scripted resolution requests
// sbt2-compat_2.12_1.0-0.1.0.pom (addSbtPlugin can request sbt2-compat-0.1.0.pom, which 404s).
libraryDependencies += (scalaBinaryVersion.value match {
case "2.12" => "com.github.sbt" % "sbt2-compat_2.12_1.0" % "0.1.0"
case _ => "com.github.sbt" % "sbt2-compat_sbt2_3" % "0.1.0"
}),
buildInfoPackage := "com.github.sbt.sbom",
(pluginCrossBuild / sbtVersion) := (scalaBinaryVersion.value match {
case "2.12" => "1.10.7"
case _ => "2.0.0-RC11"
}),
scriptedLaunchOpts := {
scriptedLaunchOpts.value ++ Seq(
"-Xmx1024M",
"-Dplugin.version=" + version.value,
"-Dplugin.organization=" + organization.value
)
},
scriptedBufferLog := false,
scriptedSbt := (scalaBinaryVersion.value match {
case "2.12" => "1.6.0"
case _ => "2.0.0-RC11"
}),
)
ThisBuild / pomIncludeRepository := { _ =>
false
}
ThisBuild / publishMavenStyle := true
ThisBuild / githubWorkflowBuildPreamble := Seq(
WorkflowStep.Sbt(List("scalafixAll --check"), name = Some("Linter: Scalafix checks"))
)
ThisBuild / githubWorkflowBuild := Seq(WorkflowStep.Sbt(List("test", "scripted")))
ThisBuild / githubWorkflowArtifactUpload := false
ThisBuild / githubWorkflowTargetTags ++= Seq("v*")
ThisBuild / githubWorkflowPublishTargetBranches :=
Seq(
RefPredicate.StartsWith(Ref.Tag("v")),
RefPredicate.Equals(Ref.Branch("main"))
)
ThisBuild / githubWorkflowPublish := Seq(
WorkflowStep.Sbt(
commands = List("ci-release"),
name = Some("Publish project"),
env = Map(
"PGP_PASSPHRASE" -> "${{ secrets.PGP_PASSPHRASE }}",
"PGP_SECRET" -> "${{ secrets.PGP_SECRET }}",
"SONATYPE_PASSWORD" -> "${{ secrets.SONATYPE_PASSWORD }}",
"SONATYPE_USERNAME" -> "${{ secrets.SONATYPE_USERNAME }}"
)
)
)
ThisBuild / githubWorkflowOSes := Seq("ubuntu-latest", "macos-latest", "windows-latest")
ThisBuild / githubWorkflowJavaVersions := Seq(
// Java 17 first: publish job uses the head of this list when downloading staged artifacts; sbt 2 (Scala 3 axis) needs 17+.
JavaSpec.temurin("17"),
JavaSpec.temurin("11"),
JavaSpec.temurin("8")
)
ThisBuild / githubWorkflowBuildMatrixExclusions ++= Seq(
MatrixExclude(Map("java" -> "temurin@8", "os" -> "macos-latest")),
MatrixExclude(Map("scala" -> scala3, "java" -> "temurin@8")),
MatrixExclude(Map("scala" -> scala3, "java" -> "temurin@11"))
)
ThisBuild / githubWorkflowScalaVersions := Seq(scala212, scala3)
// scalafix specific settings
inThisBuild(
List(
semanticdbEnabled := true,
semanticdbVersion := scalafixSemanticdb.revision,
scalacOptions ++= {
scalaBinaryVersion.value match {
case "2.12" => Seq("-Ywarn-unused")
case _ => Seq("-Wunused:all")
}
}
)
)