Skip to content

Commit 1a2140c

Browse files
committed
Prefix keys with scalaModule
1 parent 50e4866 commit 1a2140c

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

src/main/scala/ScalaModulePlugin.scala

+14-14
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import sbt.librarymanagement.{ UnresolvedWarningConfiguration, UpdateConfigurati
1212

1313
object ScalaModulePlugin extends AutoPlugin {
1414
object autoImport {
15-
val repoName = settingKey[String]("The name of the repository under github.com/scala/.")
16-
val mimaPreviousVersion = settingKey[Option[String]]("The version of this module to compare against when running MiMa.")
17-
val scalaVersionsByJvm = settingKey[Map[Int, List[(String, Boolean)]]]("For a Java major version (6, 8, 9), a list of a Scala version and a flag indicating whether to use this combination for publishing.")
18-
val enableOptimizerInlineFrom = settingKey[String]("The value passed to -opt-inline-from by `enableOptimizer` on 2.13 and higher.")
15+
val scalaModuleRepoName = settingKey[String]("The name of the repository under github.com/scala/.")
16+
val scalaModuleMimaPreviousVersion = settingKey[Option[String]]("The version of this module to compare against when running MiMa.")
17+
val scalaModuleScalaVersionsByJvm = settingKey[Map[Int, List[(String, Boolean)]]]("For a Java major version (6, 8, 9), a list of a Scala version and a flag indicating whether to use this combination for publishing.")
18+
val scalaModuleEnableOptimizerInlineFrom = settingKey[String]("The value passed to -opt-inline-from by `enableOptimizer` on 2.13 and higher.")
1919
}
2020
import autoImport._
2121

@@ -26,7 +26,7 @@ object ScalaModulePlugin extends AutoPlugin {
2626

2727
// Settings in here are implicitly `in ThisBuild`
2828
override def buildSettings: Seq[Setting[_]] = Seq(
29-
scalaVersionsByJvm := Map.empty,
29+
scalaModuleScalaVersionsByJvm := Map.empty,
3030

3131
crossScalaVersions := {
3232
val OneDot = """1\.(\d).*""".r // 1.6, 1.8
@@ -40,7 +40,7 @@ object ScalaModulePlugin extends AutoPlugin {
4040
val isTravis = Option(System.getenv("TRAVIS")).exists(_ == "true") // `contains` doesn't exist in Scala 2.10
4141
val isTravisPublishing = Option(System.getenv("TRAVIS_TAG")).exists(_.trim.nonEmpty)
4242

43-
val byJvm = scalaVersionsByJvm.value
43+
val byJvm = scalaModuleScalaVersionsByJvm.value
4444
if (byJvm.isEmpty)
4545
throw new RuntimeException(s"Make sure to define `scalaVersionsByJvm in ThisBuild` in `build.sbt` in the root project, using the `ThisBuild` scope.")
4646

@@ -59,7 +59,7 @@ object ScalaModulePlugin extends AutoPlugin {
5959
}
6060
scalaVersions
6161
},
62-
enableOptimizerInlineFrom := "<sources>",
62+
scalaModuleEnableOptimizerInlineFrom := "<sources>",
6363
scalaVersion := crossScalaVersions.value.head
6464
)
6565

@@ -72,7 +72,7 @@ object ScalaModulePlugin extends AutoPlugin {
7272
(maj.toInt, min.toInt) match {
7373
case (m, _) if m < 12 => Seq("-optimize")
7474
case (12, n) if n < 3 => Seq("-opt:l:project")
75-
case _ => Seq("-opt:l:inline", "-opt-inline-from:" + enableOptimizerInlineFrom.value)
75+
case _ => Seq("-opt:l:inline", "-opt-inline-from:" + scalaModuleEnableOptimizerInlineFrom.value)
7676
}
7777
}
7878

@@ -91,7 +91,7 @@ object ScalaModulePlugin extends AutoPlugin {
9191
* To be included in the main sbt project of a Scala module.
9292
*/
9393
lazy val scalaModuleSettings: Seq[Setting[_]] = Seq(
94-
repoName := name.value,
94+
scalaModuleRepoName := name.value,
9595

9696
organization := "org.scala-lang.modules",
9797

@@ -131,7 +131,7 @@ object ScalaModulePlugin extends AutoPlugin {
131131
},
132132

133133
publishMavenStyle := true,
134-
scmInfo := Some(ScmInfo(url(s"https://github.com/scala/${repoName.value}"),s"scm:git:git://github.com/scala/${repoName.value}.git")),
134+
scmInfo := Some(ScmInfo(url(s"https://github.com/scala/${scalaModuleRepoName.value}"),s"scm:git:git://github.com/scala/${scalaModuleRepoName.value}.git")),
135135
homepage := Some(url("http://www.scala-lang.org/")),
136136
organizationHomepage := Some(url("http://www.scala-lang.org/")),
137137
licenses := Seq("Apache-2.0" -> url("https://www.apache.org/licenses/LICENSE-2.0")),
@@ -140,7 +140,7 @@ object ScalaModulePlugin extends AutoPlugin {
140140
pomExtra := (
141141
<issueManagement>
142142
<system>GitHub</system>
143-
<url>https://github.com/scala/{repoName.value}/issues</url>
143+
<url>https://github.com/scala/{scalaModuleRepoName.value}/issues</url>
144144
</issueManagement>
145145
<developers>
146146
<developer>
@@ -172,14 +172,14 @@ object ScalaModulePlugin extends AutoPlugin {
172172
private val runMimaIfEnabled = taskKey[Unit]("Run MiMa if mimaPreviousVersion and the module can be resolved against the current scalaBinaryVersion.")
173173

174174
private lazy val mimaSettings: Seq[Setting[_]] = MimaPlugin.mimaDefaultSettings ++ Seq(
175-
mimaPreviousVersion := None,
175+
scalaModuleMimaPreviousVersion := None,
176176

177177
// We're not using `%%` here in order to support both jvm and js projects (cross version `_2.12` / `_sjs0.6_2.12`)
178-
mimaPreviousArtifacts := mimaPreviousVersion.value.map(v => organization.value % moduleName.value % v cross crossVersion.value).toSet,
178+
mimaPreviousArtifacts := scalaModuleMimaPreviousVersion.value.map(v => organization.value % moduleName.value % v cross crossVersion.value).toSet,
179179

180180
canRunMima := {
181181
val log = streams.value.log
182-
mimaPreviousVersion.value match {
182+
scalaModuleMimaPreviousVersion.value match {
183183
case None =>
184184
log.warn("MiMa will NOT run because no mimaPreviousVersion is provided.")
185185
false

0 commit comments

Comments
 (0)