Merge pull request #6711 from xuwei-k/fix-scala-2-13-warn

fix Scala 2.13 warnings
This commit is contained in:
eugene yokota
2021-11-14 21:53:57 -05:00
committed by GitHub
51 changed files with 99 additions and 99 deletions
+2 -1
View File
@@ -116,7 +116,8 @@ object BuildPaths {
private[this] def defaultGlobalZinc(globalBase: File) = globalBase / "zinc"
def configurationSources(base: File): Seq[File] =
(base * (GlobFilter("*.sbt") - ".sbt")).get
(base * (GlobFilter("*.sbt") - ".sbt"))
.get()
.sortBy(_.getName.toLowerCase(Locale.ENGLISH))
def pluginDirectory(definitionBase: File) = definitionBase / PluginsDirectoryName
+6 -6
View File
@@ -3197,8 +3197,8 @@ object Classpaths {
update / unresolvedWarningConfiguration := UnresolvedWarningConfiguration(
dependencyPositions.value
),
updateFull := (updateTask tag (Tags.Update, Tags.Network)).value,
update := (updateWithoutDetails("update") tag (Tags.Update, Tags.Network)).value,
updateFull := (updateTask.tag(Tags.Update, Tags.Network)).value,
update := (updateWithoutDetails("update").tag(Tags.Update, Tags.Network)).value,
update := {
val report = update.value
val log = streams.value.log
@@ -3209,7 +3209,7 @@ object Classpaths {
evicted / evictionWarningOptions := EvictionWarningOptions.full,
evicted := {
import ShowLines._
val report = (updateTask tag (Tags.Update, Tags.Network)).value
val report = (updateTask.tag(Tags.Update, Tags.Network)).value
val log = streams.value.log
val ew =
EvictionWarning(ivyModule.value, (evicted / evictionWarningOptions).value, report)
@@ -3701,7 +3701,7 @@ object Classpaths {
try {
val extracted = (Project extract st)
val sk = (projRef / Zero / Zero / libraryDependencies).scopedKey
val empty = extracted.structure.data set (sk.scope, sk.key, Nil)
val empty = extracted.structure.data.set(sk.scope, sk.key, Nil)
val settings = extracted.structure.settings filter { s: Setting[_] =>
(s.key.key == libraryDependencies.key) &&
(s.key.scope.project == Select(projRef))
@@ -4318,7 +4318,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
/** Constructs a setting that declares a new artifact `a` that is generated by `taskDef`. */
def addArtifact(a: Artifact, taskDef: TaskKey[File]): SettingsDefinition = {
val pkgd = packagedArtifacts := packagedArtifacts.value updated (a, taskDef.value)
val pkgd = packagedArtifacts := packagedArtifacts.value.updated(a, taskDef.value)
Seq(artifacts += a, pkgd)
}
@@ -4330,7 +4330,7 @@ trait BuildExtra extends BuildCommon with DefExtra {
val artLocal = SettingKey.local[Artifact]
val taskLocal = TaskKey.local[File]
val art = artifacts := artLocal.value +: artifacts.value
val pkgd = packagedArtifacts := packagedArtifacts.value updated (artLocal.value, taskLocal.value)
val pkgd = packagedArtifacts := packagedArtifacts.value.updated(artLocal.value, taskLocal.value)
Seq(artLocal := artifact.value, taskLocal := taskDef.value, art, pkgd)
}
@@ -80,10 +80,10 @@ object CoursierRepositoriesTasks {
result1 map {
case r: FileRepository =>
val ivyPatterns = r.patterns.ivyPatterns map {
_.replaceAllLiterally("$" + "{ivy.home}", ivyHomeUri)
_.replace("$" + "{ivy.home}", ivyHomeUri)
}
val artifactPatterns = r.patterns.artifactPatterns map {
_.replaceAllLiterally("$" + "{ivy.home}", ivyHomeUri)
_.replace("$" + "{ivy.home}", ivyHomeUri)
}
val p =
r.patterns.withIvyPatterns(ivyPatterns).withArtifactPatterns(artifactPatterns)
@@ -263,7 +263,8 @@ final class BuildUnit(
val plugins: LoadedPlugins
) {
override def toString =
if (uri.getScheme == "file") localBase.toString else (uri + " (locally: " + localBase + ")")
if (uri.getScheme == "file") localBase.toString
else (uri.toString + " (locally: " + localBase + ")")
}
final class LoadedBuild(val root: URI, val units: Map[URI, LoadedBuildUnit]) {
@@ -25,7 +25,7 @@ private[sbt] object InstallSbtn {
Def.inputKey[Unit]("install sbtn and tab completions").withRank(KeyRanks.BTask)
private[sbt] def installSbtnImpl: Def.Initialize[InputTask[Unit]] = Def.inputTask {
val inputVersion = Def.spaceDelimited("version").parsed.headOption
val version = inputVersion.getOrElse(sbtVersion.value.replaceAllLiterally("-SNAPSHOT", ""))
val version = inputVersion.getOrElse(sbtVersion.value.replace("-SNAPSHOT", ""))
val term = terminal.value
term.setMode(canonical = false, echo = false)
val baseDirectory = BuildPaths.getGlobalBase(state.value).toPath
@@ -25,7 +25,7 @@ object DagreHTML {
val graphString =
URLEncoder
.encode(dotGraph, "utf8")
.replaceAllLiterally("+", "%20")
.replace("+", "%20")
IO.write(
new File(targetDirectory, "dependencies.dot.js"),
+1 -1
View File
@@ -173,7 +173,7 @@ object ParseKey extends Properties {
.log(s"Key: ${Scope.displayPedantic(key.scope, key.key.label)}")
.log(s"Mask: $mask")
.log(s"Key string: '$s'")
.log(s"Parsed: ${parsed.right.map(displayFull)}")
.log(s"Parsed: ${parsed.map(displayFull)}")
.log(s"Structure: $structure")
)
}
@@ -41,7 +41,7 @@ class InstallSbtnSpec extends AnyFlatSpec {
val tmpDir = Files.createTempDirectory("sbtn-test").toRealPath()
Files.createDirectories(tmpDir.resolve("project"))
val foo = tmpDir.resolve("foo")
val fooPath = foo.toString.replaceAllLiterally("\\", "\\\\")
val fooPath = foo.toString.replace("\\", "\\\\")
val build = s"""TaskKey[Unit]("foo") := IO.write(file("$fooPath"), "foo")"""
IO.write(tmpDir.resolve("build.sbt").toFile, build)
IO.write(
@@ -19,7 +19,7 @@ object StressGCMonitor {
new GCMonitor(ConsoleLogger())
val deadline = Deadline.now + 10.seconds
while (!deadline.isOverdue()) {
println(deadline.timeLeft.toSeconds + " seconds left...")
println(s"${deadline.timeLeft.toSeconds} seconds left...")
list = List.fill(1000 * 1000 * 100)(Random.nextInt(100))
System.gc()
Thread.sleep(10)
@@ -51,7 +51,7 @@ abstract class TestBuild {
def tGen = genTasks(kebabIdGen, MaxDepsGen, MaxTasksGen)
class TestKeys(val env: Env, val scopes: Seq[Scope]) {
override def toString = env + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "")
override def toString = env.toString + "\n" + scopes.mkString("Scopes:\n\t", "\n\t", "")
lazy val delegated = scopes map env.delegates
}