1- import explicitdeps .ModuleFilter
21import sbt .Def
32
43val scala212 = " 2.12.13"
@@ -11,21 +10,25 @@ val scoptVersion = "4.0.0"
1110val slf4jVersion = " 1.7.30"
1211val utestVersion = " 0.7.7"
1312
13+ val checkTasks = List (
14+ " scalafmtCheckAll" ,
15+ " scalastyle" ,
16+ " versionPolicyCheck" ,
17+ " githubWorkflowCheck" ,
18+ " mdocCheck" ,
19+ " evicted" ,
20+ " undeclaredCompileDependenciesTest" ,
21+ " unusedCompileDependenciesTest" ,
22+ " dependencyCheckAggregate" ,
23+ " test" ,
24+ " scripted"
25+ )
26+
1427addCommandAlias(
1528 " check" ,
16- List (
17- " scalafmtCheckAll" ,
18- " scalastyle" ,
19- " +versionPolicyCheck" ,
20- " +githubWorkflowCheck" ,
21- " mdocCheck" ,
22- " evicted" ,
23- " +undeclaredCompileDependenciesTest" ,
24- " +unusedCompileDependenciesTest" ,
25- " +dependencyCheckAggregate" ,
26- " +test" ,
27- " scripted"
28- ).mkString(" ; " )
29+ supportedScalaVersions.flatMap { version =>
30+ s " ++ $version" :: checkTasks.filterNot(_ == " scripted" && version == scala213)
31+ }.mkString(" ; " )
2932)
3033
3134addCommandAlias(
@@ -62,7 +65,12 @@ inThisBuild(
6265 ),
6366 name = Some (" Check dependencies" )
6467 ),
65- WorkflowStep .Sbt (List (" test" , " scripted" ), name = Some (" Build and test" ))
68+ WorkflowStep .Sbt (List (" test" ), name = Some (" Build and test" )),
69+ WorkflowStep .Sbt (
70+ List (" scripted" ),
71+ name = Some (" Build and test sbt plugin" ),
72+ cond = Some (s """ $$ {{ matrix.scala == " $scala212" }} """ )
73+ )
6674 ),
6775 githubWorkflowPublish := List (
6876 WorkflowStep .Sbt (
@@ -77,7 +85,10 @@ inThisBuild(
7785 ),
7886 githubWorkflowPublishTargetBranches := List (RefPredicate .StartsWith (Ref .Tag (" v" ))),
7987 githubWorkflowTargetTags ++= Seq (" v*" ),
80- versionPolicyFirstVersion := Some (" 0.1.1" ),
88+ // This needs to be set otherwise the GitHub workflow plugin gets confused about which
89+ // version to use for the publish job.
90+ scalaVersion := scala212,
91+ versionPolicyFirstVersion := Some (" 0.1.2" ),
8192 versionPolicyIntention := Compatibility .BinaryAndSourceCompatible ,
8293 versionScheme := Some (" early-semver" )
8394 )
@@ -101,9 +112,9 @@ val commonProjectSettings = List(
101112
102113val metaProjectSettings = List (
103114 crossScalaVersions := Nil ,
104- publish / skip := true ,
105115 mimaFailOnNoPrevious := false ,
106- mimaPreviousArtifacts := Set .empty
116+ mimaPreviousArtifacts := Set .empty,
117+ publish / skip := true
107118)
108119
109120val libraryProjectSettings = commonProjectSettings
@@ -158,22 +169,27 @@ lazy val sbtProject = (project in file("sbt"))
158169 .enablePlugins(SbtPlugin )
159170 .settings(commonProjectSettings)
160171 .settings(
161- libraryDependencies ++= collectionsCompatibilityDependency.value,
162- libraryDependencies ++= List (
163- " org.scala-sbt" %% " collections" % sbtVersion.value,
164- " org.scala-sbt" %% " command" % sbtVersion.value,
165- " org.scala-sbt" % " compiler-interface" % " 1.4.4" ,
166- " org.scala-sbt" %% " completion" % sbtVersion.value,
167- " org.scala-sbt" %% " core-macros" % sbtVersion.value,
168- " org.scala-sbt" %% " io" % " 1.4.0" ,
169- " org.scala-sbt" %% " librarymanagement-core" % " 1.4.3" ,
170- " org.scala-sbt" %% " main" % sbtVersion.value,
171- " org.scala-sbt" %% " main-settings" % sbtVersion.value,
172- " org.scala-sbt" % " sbt" % sbtVersion.value,
173- " org.scala-sbt" %% " task-system" % sbtVersion.value,
174- " org.scala-sbt" %% " util-logging" % sbtVersion.value,
175- " org.scala-sbt" %% " util-position" % sbtVersion.value
176- ),
172+ libraryDependencies ++= {
173+ // Don't add dependencies when the rest of the build is cross building with Scala 2.13
174+ // otherwise it will cause a whole lot of resolution failures.
175+ if ((core / isScala213).value) Nil
176+ else
177+ collectionsCompatibilityDependency.value ++ List (
178+ " org.scala-sbt" %% " collections" % sbtVersion.value,
179+ " org.scala-sbt" %% " command" % sbtVersion.value,
180+ " org.scala-sbt" % " compiler-interface" % " 1.4.4" ,
181+ " org.scala-sbt" %% " completion" % sbtVersion.value,
182+ " org.scala-sbt" %% " core-macros" % sbtVersion.value,
183+ " org.scala-sbt" %% " io" % " 1.4.0" ,
184+ " org.scala-sbt" %% " librarymanagement-core" % " 1.4.3" ,
185+ " org.scala-sbt" %% " main" % sbtVersion.value,
186+ " org.scala-sbt" %% " main-settings" % sbtVersion.value,
187+ " org.scala-sbt" % " sbt" % sbtVersion.value,
188+ " org.scala-sbt" %% " task-system" % sbtVersion.value,
189+ " org.scala-sbt" %% " util-logging" % sbtVersion.value,
190+ " org.scala-sbt" %% " util-position" % sbtVersion.value
191+ )
192+ },
177193 name := s " sbt- ${(LocalRootProject / name).value}" ,
178194 scriptedBufferLog := false ,
179195 scriptedDependencies := {
@@ -198,11 +214,7 @@ lazy val docs = (project in file("doc-templates"))
198214 // After a release we need to update the docs and do a git push.
199215 " VERSION" -> versionPolicyPreviousVersions.value.lastOption.getOrElse(versionPolicyFirstVersion.value.get)
200216 ),
201- unusedCompileDependenciesFilter -= new ModuleFilter {
202-
203- override def apply (a : ModuleID ) =
204- moduleFilter(" org.scalameta" , " mdoc_2.12.12" ).apply(a)
205- }
217+ unusedCompileDependenciesFilter -= moduleFilter(" org.scalameta" , " mdoc*" )
206218 )
207219
208220def isScala213Setting : Def .Initialize [Boolean ] = Def .setting {
0 commit comments