Fix warnings in scripted tests

This commit is contained in:
xuwei-k 2026-04-11 14:35:45 +09:00
parent f8a8742dbe
commit 8dfb93e3c3
57 changed files with 81 additions and 81 deletions

View File

@ -15,7 +15,7 @@ def completionsParser(state: State) =
{
val notQuoted = (NotQuoted ~ any.*) map { case (nq, s) => (nq +: s).mkString }
val quotedOrUnquotedSingleArgument = Space ~> (StringVerbatim | StringEscapable | notQuoted)
applyEffect(token(quotedOrUnquotedSingleArgument ?? "" examples ("", " ")))(runCompletions(state))
applyEffect(token((quotedOrUnquotedSingleArgument ?? "").examples("", " ")))(runCompletions(state))
}
def runCompletions(state: State)(input: String): State = {
val xs = Parser.completions(state.combinedParser, input, 9).get map {

View File

@ -5,7 +5,7 @@ lazy val bar = taskKey[Unit]("Runs the bar task")
def makeFoo(config: Configuration): Setting[?] =
config / foo := IO.write(file(s"${config.name}-foo"), "foo")
lazy val PerformanceTest = (config("pt") extend Test)
lazy val PerformanceTest = config("pt").extend(Test)
lazy val root = (project in file("."))
.configs(PerformanceTest)

View File

@ -2,7 +2,7 @@
import sbt.TupleSyntax.*
lazy val root = (project in file(".")).settings(
a := (baseDirectory mapN (b => if ((b / "succeed").exists) () else sys.error("fail"))).value,
a := baseDirectory.mapN(b => if ((b / "succeed").exists) () else sys.error("fail")).value,
// deprecated?
// b := (a.task(at => nop dependsOn(at))).value,
c := (a mapN { _ => () }).value,

View File

@ -17,7 +17,7 @@ val aResolver = Def.setting {
val bResolver = Def.setting {
val dir = (ThisBuild / baseDirectory).value / "b-repo"
Resolver.file("b-resolver", dir)(Resolver.defaultIvyPatterns)
Resolver.file("b-resolver", dir)(using Resolver.defaultIvyPatterns)
}
val apiBaseSetting = apiURL := Some(apiBase(name.value))

View File

@ -14,11 +14,11 @@ val check = inputKey[Unit]("")
val sample = AttributeKey[Int]("demo-key")
val dummyKey = taskKey[Unit]("")
def updateDemoInit = state map { s => (s get sample getOrElse 9) + 1 }
def updateDemoInit = state map { s => s.get(sample).getOrElse(9) + 1 }
lazy val root = (project in file(".")).
settings(
updateDemo := (updateDemoInit updateState demoState).value,
updateDemo := updateDemoInit.updateState(demoState).value,
check := checkInit.evaluated,
inMemorySetting,
persistedSetting,
@ -27,19 +27,19 @@ lazy val root = (project in file(".")).
dummyKey := (),
)
def demoState(s: State, i: Int): State = s put (sample, i + 1)
def demoState(s: State, i: Int): State = s.put(sample, i + 1)
def checkInit: Initialize[InputTask[Unit]] = Def inputTask {
val key = (token(Space ~> IntBasic) ~ token(Space ~> IntBasic).?).parsed
val (curExpected, prevExpected) = key
val value = updateDemo.value
val prev = state.value get sample
val prev = state.value.get(sample)
assert(value == curExpected, s"Expected current value to be $curExpected, got $value")
assert(prev == prevExpected, s"Expected previous value to be $prevExpected, got $prev")
}
def inMemorySetting = keep := (getPrevious(keep) map { case None => 3; case Some(x) => x + 1} keepAs(keep)).value
def persistedSetting = persist := (loadPrevious(persist) map { case None => 17; case Some(x) => x + 1} storeAs(persist)).value
def inMemorySetting = keep := getPrevious(keep) .map { case None => 3; case Some(x) => x + 1}.keepAs(keep).value
def persistedSetting = persist := loadPrevious(persist).map { case None => 17; case Some(x) => x + 1}.storeAs(persist).value
def inMemoryCheck = checkKeep := (inputCheck( (ctx, s) => Space ~> str( getFromContext( keep, ctx, s)) )).evaluated
def persistedCheck = checkPersist := (inputCheck( (ctx, s) => Space ~> str(loadFromContext(persist, ctx, s)) )).evaluated

View File

@ -63,7 +63,7 @@ def org = "test"
def mainArtifact = Artifact(artifactID, tpe, ext, classifier)
// define the IDs to use for publishing and retrieving
def publishedID = org % artifactID % vers artifacts(mainArtifact)
def publishedID = (org % artifactID % vers).artifacts(mainArtifact)
def retrieveID = org % "test-retrieve" % "2.0"
// check that the test class is on the compile classpath, either because it was compiled or because it was properly retrieved
@ -80,5 +80,5 @@ def checkTask(classpath: TaskKey[Classpath]) =
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
Resolver.file("User Local", ivyHome / "local")(using Resolver.defaultIvyPatterns)
}

View File

@ -33,5 +33,5 @@ val a = project
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
Resolver.file("User Local", ivyHome / "local")(using Resolver.defaultIvyPatterns)
}

View File

@ -2,7 +2,7 @@ lazy val check = taskKey[Unit]("check classifier in update report")
lazy val root = (project in file(".")).settings(
scalaVersion := "2.13.16",
libraryDependencies += "io.netty" % "netty-transport-native-epoll" % "4.1.118.Final" classifier "linux-x86_64",
libraryDependencies += ("io.netty" % "netty-transport-native-epoll" % "4.1.118.Final").classifier("linux-x86_64"),
check := {
val report = update.value
val modules = report.configurations.flatMap(_.modules)

View File

@ -1,4 +1,4 @@
ivyPaths := IvyPaths(baseDirectory.value.toString, Some(((ThisBuild / baseDirectory).value / "ivy" / "cache").toString))
ThisBuild / csrCacheDirectory := (ThisBuild / baseDirectory).value / "coursier-cache"
libraryDependencies += "org.testng" % "testng" % "5.7" classifier "jdk15"
libraryDependencies += ("org.testng" % "testng" % "5.7").classifier("jdk15")

View File

@ -1,2 +1,2 @@
ThisBuild / scalaVersion := "2.11.12"
libraryDependencies += "org.jclouds.api" % "nova" % "1.5.9" classifier "tests"
libraryDependencies += ("org.jclouds.api" % "nova" % "1.5.9").classifier("tests")

View File

@ -10,8 +10,8 @@ libraryDependencies += "bad" % "mvn" % "1.0"
TaskKey[Unit]("check") := {
val cp = (Compile / fullClasspath).value
def isTestJar(n: String): Boolean =
(n contains "scalacheck") ||
(n contains "specs2")
n.contains("scalacheck") ||
n.contains("specs2")
val testLibs = cp map (_.data.name) filter isTestJar
assert(testLibs.isEmpty, s"Compile Classpath has test libs:\n * ${testLibs.mkString("\n * ")}")
}

View File

@ -1,4 +1,4 @@
resolvers += Resolver.file("buggy", file("repo"))(
resolvers += Resolver.file("buggy", file("repo"))(using
Patterns(
ivyPatterns = Vector("[organization]/[module]/[revision]/ivy.xml"),
artifactPatterns = Vector("[organization]/[module]/[revision]/[artifact].[ext]"),
@ -8,5 +8,5 @@ resolvers += Resolver.file("buggy", file("repo"))(
)
)
libraryDependencies += "a" % "b" % "1.0.0" % "compile->runtime" artifacts(Artifact("b1", "jar", "jar"))
libraryDependencies += "a" % "b" % "1.0.0" % "test->runtime" artifacts(Artifact("b1", "jar", "jar"))
libraryDependencies += ("a" % "b" % "1.0.0" % "compile->runtime").artifacts(Artifact("b1", "jar", "jar"))
libraryDependencies += ("a" % "b" % "1.0.0" % "test->runtime").artifacts(Artifact("b1", "jar", "jar"))

View File

@ -61,5 +61,5 @@ val use2 = project
// use the user local resolver to fetch the SNAPSHOT version of the compiler-bridge
def userLocalFileResolver(appConfig: AppConfiguration): Resolver = {
val ivyHome = appConfig.provider.scalaProvider.launcher.ivyHome
Resolver.file("User Local", ivyHome / "local")(Resolver.defaultIvyPatterns)
Resolver.file("User Local", ivyHome / "local")(using Resolver.defaultIvyPatterns)
}

View File

@ -1,3 +1,3 @@
libraryDependencies += "org.vaadin" % "dontpush-addon-ozonelayer" % "0.4.6" exclude("org.atmosphere", "atmosphere-compat-jetty")
libraryDependencies += ("org.vaadin" % "dontpush-addon-ozonelayer" % "0.4.6").exclude("org.atmosphere", "atmosphere-compat-jetty")
resolvers += "asdf" at "https://maven.vaadin.com/vaadin-addons"

View File

@ -15,7 +15,7 @@ def check(className: String): Def.Initialize[Task[Unit]] =
import sbt.TupleSyntax.*
(Compile / fullClasspath, fileConverter.toTaskable) mapN { (cp, c) =>
given FileConverter = c
val existing = cp.files.filter(_.toFile.getName contains "scala-library")
val existing = cp.files.filter(_.toFile.getName.contains("scala-library"))
println("Full classpath: " + cp.mkString("\n\t", "\n\t", ""))
println("scala-library.jar: " + existing.mkString("\n\t", "\n\t", ""))
val loader = ClasspathUtilities.toLoader(existing.map(_.toFile()))

View File

@ -19,7 +19,7 @@ def libraryDeps(base: File) = {
def check(ver: String) =
(Compile / dependencyClasspath) map { jars =>
val log4j = jars map (_.data) collect {
case f if f.name contains "log4j-" => f.name
case f if f.name.contains("log4j-") => f.name
}
if (log4j.size != 1 || !log4j.head.contains(ver))
sys.error("Did not download the correct jar.")

View File

@ -13,7 +13,7 @@ val publishPort = 3030
// Publish to HTTP server (localhost) - ivyless publish uses PUT
// Resolver.url expects java.net.URL; in build.sbt "url" is sbt.URI, so use java.net.URL explicitly
publishTo := Some(
Resolver.url("test-repo", new java.net.URI(s"http://localhost:$publishPort/").toURL)(Resolver.ivyStylePatterns)
Resolver.url("test-repo", new java.net.URI(s"http://localhost:$publishPort/").toURL)(using Resolver.ivyStylePatterns)
.withAllowInsecureProtocol(true)
)

View File

@ -9,7 +9,7 @@ scalaVersion := "3.8.3"
val publishRepoBase = settingKey[File]("Base directory for publish repo")
publishRepoBase := baseDirectory.value / "repo"
publishTo := Some(Resolver.file("test-repo", publishRepoBase.value)(Resolver.ivyStylePatterns))
publishTo := Some(Resolver.file("test-repo", publishRepoBase.value)(using Resolver.ivyStylePatterns))
useIvy := false

View File

@ -12,7 +12,7 @@ version := ( if(stable.value) "1.0" else "1.1-SNAPSHOT" )
publishTo := {
val base = baseDirectory.value / ( if(stable.value) "stable" else "snapshot" )
Some( Resolver.file("local-" + base, base)(Resolver.ivyStylePatterns) )
Some( Resolver.file("local-" + base, base)(using Resolver.ivyStylePatterns) )
}
publishMavenStyle := false

View File

@ -1,6 +1,6 @@
addSbtPlugin("org.example" % "def" % "latest.integration")
resolvers ++= {
def r(tpe: String) = Resolver.file(s"local-$tpe", baseDirectory.value / ".." / tpe)(Resolver.ivyStylePatterns)
def r(tpe: String) = Resolver.file(s"local-$tpe", baseDirectory.value / ".." / tpe)(using Resolver.ivyStylePatterns)
r("snapshot") :: r("stable") :: Nil
}

View File

@ -1,6 +1,6 @@
import scala.xml._
lazy val root = (project in file(".")) settings (
lazy val root = (project in file(".")).settings(
readPom := Def.uncached {
val vf = makePom.value
val converter = fileConverter.value
@ -71,7 +71,7 @@ lazy val checkPom = Def.task {
val writtenRepositories = repositories.map(read).distinct
val mavenStyleRepositories = (ivyRepositories.collect {
case x: MavenRepository
if (x.name != "public") && (x.name != "jcenter") && !(x.root startsWith "file:") =>
if (x.name != "public") && (x.name != "jcenter") && !(x.root.startsWith("file:")) =>
normalize(x)
}).distinct

View File

@ -10,7 +10,7 @@ TaskKey[Unit]("checkName") := Def.uncached {
val path = converter.toPath(vf).toAbsolutePath.toString
val module = moduleName.value
val n = name.value
assert(path contains module, s"Path $path did not contain module name $module")
assert(path.contains(module), s"Path $path did not contain module name $module")
assert(!path.contains(n), s"Path $path contained $n")
()
}

View File

@ -1,5 +1,5 @@
libraryDependencies ++= Seq("natives-windows", "natives-linux", "natives-osx") map ( c =>
"org.lwjgl.lwjgl" % "lwjgl-platform" % "2.8.2" classifier c
("org.lwjgl.lwjgl" % "lwjgl-platform" % "2.8.2").classifier(c)
)
autoScalaLibrary := false

View File

@ -7,7 +7,7 @@ def commonSettings: Seq[Def.Setting[?]] =
scalaVersion := "2.10.4",
ThisBuild / organization := "org.example",
ThisBuild / version := "1.0-SNAPSHOT",
resolvers += Resolver.file("old-local", file(sys.props("user.home") + "/.ivy2/local"))(Resolver.ivyStylePatterns)
resolvers += Resolver.file("old-local", file(sys.props("user.home") + "/.ivy2/local"))(using Resolver.ivyStylePatterns)
)
lazy val main = project.

View File

@ -7,7 +7,7 @@ lazy val root = (project in file("."))
dependencyOverrides += "org.webjars.npm" % "is-number" % "5.0.0",
check := {
val cp = (Compile / externalDependencyClasspath).value.map {_.data.name}.sorted
if (!(cp contains "is-number-5.0.0.jar")) {
if (!cp.contains("is-number-5.0.0.jar")) {
sys.error("is-number-5.0.0 not found when it should be included: " + cp.toString)
}
}

View File

@ -29,7 +29,7 @@ def pomIncludeRepository(base: File, prev: MavenRepository => Boolean): MavenRep
}
def addSlash(s: String): String = s match {
case s if s endsWith "/" => s
case s if s.endsWith("/") => s
case _ => s + "/"
}

View File

@ -4,7 +4,7 @@ lazy val root = (project in file("."))
.settings(
scalaVersion := "2.13.16",
autoScalaLibrary := false,
libraryDependencies += "org.eclipse.jetty" % "jetty-webapp" % "11.0.15" artifacts (Artifact("jetty-webapp", "war", "war")),
libraryDependencies += ("org.eclipse.jetty" % "jetty-webapp" % "11.0.15").artifacts(Artifact("jetty-webapp", "war", "war")),
libraryDependencies += "com.typesafe" % "config" % "1.4.3",
// classified artifact with non-default type: both <type> and <classifier> must appear
libraryDependencies += ("com.example" % "classified-war" % "1.0")

View File

@ -1,8 +1,8 @@
val root = project in file(".")
val subJar = project in file("subJar")
def warArtifact = (Compile / packageBin / artifact) ~= (_ withType "war" withExtension "war")
val subWar = project in file("subWar") settings warArtifact
val subParent = project in file("subParent") settings ((Compile / publishArtifact) := false)
def warArtifact = (Compile / packageBin / artifact) ~= (_.withType("war").withExtension("war"))
val subWar = project.in(file("subWar")).settings(warArtifact)
val subParent = project.in(file("subParent")).settings((Compile / publishArtifact) := false)
val checkPom = taskKey[Unit]("")
(ThisBuild / checkPom) := {

View File

@ -15,8 +15,8 @@ lazy val root = (project in file(".")).
"d" % "d" % "1.0" % "test",
"e" % "e" % "1.0" % Custom,
"f" % "f" % "1.0" % "custom,optional,runtime",
"g" % "g" % "1.0" % "custom,runtime" classifier "foo",
"h" % "h" % "1.0" % "custom,optional,runtime" classifier "foo"
("g" % "g" % "1.0" % "custom,runtime").classifier("foo"),
("h" % "h" % "1.0" % "custom,optional,runtime").classifier("foo")
)
)

View File

@ -27,7 +27,7 @@ lazy val root = (project in file(".")).
)
def checkServletAPI(paths: Seq[File], shouldBeIncluded: Boolean, label: String) = {
val servletAPI = paths.find(_.getName contains "servlet-api")
val servletAPI = paths.find(_.getName.contains("servlet-api"))
if (shouldBeIncluded) {
if (servletAPI.isEmpty) sys.error(s"Servlet API should have been included in $label.")
} else

View File

@ -7,7 +7,7 @@ lazy val root = (project in file(".")).
organization := "A",
version := "1.0",
ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value,
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(using Resolver.ivyStylePatterns) :: Nil }).value
)),
mavenStyle,
interProject,

View File

@ -5,7 +5,7 @@ lazy val root = (project in file(".")).
organization := "A",
version := "1.0",
ivyPaths := baseDirectory( dir => IvyPaths(dir, Some(dir / "ivy" / "cache")) ).value,
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(Resolver.ivyStylePatterns) :: Nil }).value
externalResolvers := (baseDirectory map { base => Resolver.file("local", base / "ivy" / "local" asFile)(using Resolver.ivyStylePatterns) :: Nil }).value
)),
mavenStyle,
name := "Retrieve Test",

View File

@ -17,11 +17,11 @@ libraryDependencies += "org.scala-lang" % "scala-actors" % "2.11.12"
lazy val check = taskKey[Unit]("Runs the check")
check := {
val lastLog = BuiltinCommands lastLogFile state.value
val lastLog = BuiltinCommands.lastLogFile(state.value)
val last = IO read lastLog.get
def containsWarn1 = last contains "Binary version (1.1.0) for dependency org.scala-lang#scala-actors-migration_2.11;1.1.0"
def containsWarn2 = last contains "Binary version (0.9.1) for dependency org.scala-lang#scala-pickling_2.11;0.9.1"
def containsWarn3 = last contains "differs from Scala binary version in project (2.11)."
def containsWarn1 = last.contains("Binary version (1.1.0) for dependency org.scala-lang#scala-actors-migration_2.11;1.1.0")
def containsWarn2 = last.contains("Binary version (0.9.1) for dependency org.scala-lang#scala-pickling_2.11;0.9.1")
def containsWarn3 = last.contains("differs from Scala binary version in project (2.11).")
if (containsWarn1 && containsWarn3) sys error "scala-actors-migration isn't exempted from the Scala binary version check"
if (containsWarn2 && containsWarn3) sys error "scala-pickling isn't exempted from the Scala binary version check"
}

View File

@ -7,7 +7,7 @@ def localCache =
lazy val sharedResolver: Resolver = {
val r = Resolver.defaultShared
r withConfiguration (r.configuration withIsLocal false)
r.withConfiguration(r.configuration.withIsLocal(false))
//MavenRepository("example-shared-repo", "file:///tmp/shared-maven-repo-bad-example")
//Resolver.file("example-shared-repo", repoDir)(Resolver.defaultPatterns)
}

View File

@ -9,7 +9,7 @@ def localCache =
lazy val sharedResolver: Resolver = {
val r = Resolver.defaultShared
r withConfiguration (r.configuration withIsLocal false)
r.withConfiguration(r.configuration.withIsLocal(false))
//MavenRepository("example-shared-repo", "file:///tmp/shared-maven-repo-bad-example")
//Resolver.file("example-shared-repo", repoDir)(Resolver.defaultPatterns)
}

View File

@ -5,8 +5,8 @@ lazy val root = (project in file("."))
autoScalaLibrary := false,
managedScalaInstance := false,
transitiveClassifiers := Seq("sources"),
TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value,
TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value,
TaskKey[Unit]("checkSources") := updateClassifiers.map(checkSources).value,
TaskKey[Unit]("checkBinaries") := update.map(checkBinaries).value,
)
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )

View File

@ -3,8 +3,8 @@ ThisBuild / scalaVersion := "2.12.12"
lazy val root = (project in file("."))
.settings(
libraryDependencies += "com.typesafe.akka" %% "akka-actor" % "2.5.22",
TaskKey[Unit]("checkSources") := (updateClassifiers map checkSources).value,
TaskKey[Unit]("checkBinaries") := (update map checkBinaries).value
TaskKey[Unit]("checkSources") := updateClassifiers.map(checkSources).value,
TaskKey[Unit]("checkBinaries") := update.map(checkBinaries).value
)
def getSources(report: UpdateReport) = report.matching(artifactFilter(`classifier` = "sources") )

View File

@ -1,3 +1,3 @@
libraryDependencies += "org.example" % "def" % "2.0" classifier("tests")
libraryDependencies += ("org.example" % "def" % "2.0").classifier("tests")
externalResolvers := Seq("example" at (baseDirectory.value / "ivy-repo").toURI.toString)

View File

@ -9,9 +9,9 @@ libraryDependencies += "exclude.test" % "app" % "1.0.0"
val checkDependencies = taskKey[Unit]("Checks that dependencies are correct.")
checkDependencies := {
val hasBadJar = (Compile / fullClasspath).value.exists { jar => jar.data.name contains "bottom-1.0.0.jar"}
val hasBadJar = (Compile / fullClasspath).value.exists { jar => jar.data.name.contains("bottom-1.0.0.jar")}
val errorJarString = (Compile / fullClasspath).value.map(_.data.name).mkString(" * ", "\n * ", "")
val hasBadMiddleJar = (Compile / fullClasspath).value.exists { jar => jar.data.name contains "middle-1.0.0.jar"}
val hasBadMiddleJar = (Compile / fullClasspath).value.exists { jar => jar.data.name.contains("middle-1.0.0.jar")}
assert(!hasBadMiddleJar, s"Failed to exclude excluded dependency on classpath!\nFound:\n$errorJarString")
assert(!hasBadJar, s"Failed to exclude transitive excluded dependency on classpath!\nFound:\n$errorJarString")
val modules =

View File

@ -1,3 +1,3 @@
ThisBuild / scalaVersion := "2.11.12"
libraryDependencies += "ccl.northwestern.edu" % "netlogo" % "5.3.1" % "provided" from s"https://github.com/NetLogo/NetLogo/releases/download/5.3.1/NetLogo.jar"
libraryDependencies += ("ccl.northwestern.edu" % "netlogo" % "5.3.1" % "provided").from(s"https://github.com/NetLogo/NetLogo/releases/download/5.3.1/NetLogo.jar")

View File

@ -8,7 +8,7 @@ def localCache =
lazy val root = (project in file(".")).
settings(
localCache,
libraryDependencies += "org.jsoup" % "jsoup" % "1.9.1" % Test from "https://jsoup.org/packages/jsoup-1.9.1.jar",
libraryDependencies += ("org.jsoup" % "jsoup" % "1.9.1" % Test).from("https://jsoup.org/packages/jsoup-1.9.1.jar"),
ivyLoggingLevel := UpdateLogging.Full,
TaskKey[Unit]("checkInTest") := checkClasspath(Test).value,
TaskKey[Unit]("checkInCompile") := checkClasspath(Compile).value

View File

@ -14,7 +14,7 @@ val commonSettings = Seq[Def.Setting[?]](
lazy val bippy = project settings (
commonSettings,
resolvers += Resolver
.file("ivy-local", file(sys.props("user.home")) / ".ivy2" / "local")(Resolver.ivyStylePatterns),
.file("ivy-local", file(sys.props("user.home")) / ".ivy2" / "local")(using Resolver.ivyStylePatterns),
publishTo := Some(Resolver.file("local-repo", localRepo.value))
)
@ -40,6 +40,6 @@ InputKey[Unit]("check") := {
val s = IO readStream jar.getInputStream(jar.getJarEntry("Bippy.scala"))
val expected = s"def release = $n"
assert(s contains expected, s"""Bippy should contain $expected, contents:\n$s""")
assert(s.contains(expected), s"""Bippy should contain $expected, contents:\n$s""")
()
}

View File

@ -1 +1 @@
resolvers += Resolver.file("ivy-local", file(sys.props("user.home")) / ".ivy2" / "local")(Resolver.ivyStylePatterns)
resolvers += Resolver.file("ivy-local", file(sys.props("user.home")) / ".ivy2" / "local")(using Resolver.ivyStylePatterns)

View File

@ -31,10 +31,10 @@ lazy val root = (project in file(".")).
val acp = (a / Compile / externalDependencyClasspath).value.sortBy {_.data.name}
val bcp = (b / Compile / externalDependencyClasspath).value.sortBy {_.data.name}
if (acp exists { _.data.name contains "slf4j-api-1.7.5.jar" }) {
if (acp exists { _.data.name.contains("slf4j-api-1.7.5.jar") }) {
sys.error("slf4j-api-1.7.5.jar found when it should NOT be included: " + acp.toString)
}
if (bcp exists { _.data.name contains "dispatch-core_2.11-0.11.1.jar" }) {
if (bcp exists { _.data.name.contains("dispatch-core_2.11-0.11.1.jar") }) {
sys.error("dispatch-core_2.11-0.11.1.jar found when it should NOT be included: " + bcp.toString)
}

View File

@ -10,7 +10,7 @@ lazy val b = project
lazy val bResolver = Def.setting {
val dir = (ThisBuild / baseDirectory).value / "b-repo"
Resolver.file("b-resolver", dir)(Resolver.defaultIvyPatterns)
Resolver.file("b-resolver", dir)(using Resolver.defaultIvyPatterns)
}
lazy val check = taskKey[Unit]("")

View File

@ -1,2 +1,2 @@
scalaVersion := "2.12.8"
libraryDependencies += "org.jclouds.api" % "nova" % "1.5.9" classifier "tests"
libraryDependencies += ("org.jclouds.api" % "nova" % "1.5.9").classifier("tests")

View File

@ -1,3 +1,3 @@
scalaVersion := "2.12.21"
libraryDependencies += "ccl.northwestern.edu" % "netlogo" % "5.3.1" % "provided" from s"https://github.com/NetLogo/NetLogo/releases/download/5.3.1/NetLogo.jar"
libraryDependencies += ("ccl.northwestern.edu" % "netlogo" % "5.3.1" % "provided").from(s"https://github.com/NetLogo/NetLogo/releases/download/5.3.1/NetLogo.jar")

View File

@ -1,3 +1,3 @@
scalaVersion := "2.12.8"
resolvers += Resolver.file("space-repo", file(raw"/tmp/space the final frontier/repo"))(Resolver.ivyStylePatterns)
resolvers += Resolver.file("space-repo", file(raw"/tmp/space the final frontier/repo"))(using Resolver.ivyStylePatterns)

View File

@ -10,7 +10,7 @@ mainClass := Some("jartest.Main")
Compile / packageBin / packageOptions := {
def manifestExtra = {
val mf = new Manifest
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(scalaInstance.value.libraryJars))
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(scalaInstance.value.libraryJars.toSeq))
mf
}
(Compile / packageBin / packageOptions).value :+ Package.JarManifest(manifestExtra)

View File

@ -9,7 +9,7 @@ packageOptions := {
def manifestExtra = {
import java.util.jar._
val mf = new Manifest
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(scalaInstance.value.libraryJars))
mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(scalaInstance.value.libraryJars.toSeq))
mf
}
Package.JarManifest(manifestExtra) +: packageOptions.value

View File

@ -1,4 +1,4 @@
val test123 = project in file(".") enablePlugins TestP settings(
val test123 = project.in(file(".")).enablePlugins(TestP).settings(
Compile / resourceGenerators += Def.task {
streams.value.log.info("resource generated in settings")
Seq.empty[File]
@ -6,9 +6,9 @@ val test123 = project in file(".") enablePlugins TestP settings(
)
TaskKey[Unit]("check") := {
val last = IO read (BuiltinCommands lastLogFile state.value).get
val last = IO.read(BuiltinCommands.lastLogFile(state.value).get)
def assertContains(expectedString: String) =
if (!(last contains expectedString)) sys error s"Expected string $expectedString to be present"
if (!last.contains(expectedString)) sys error s"Expected string $expectedString to be present"
assertContains("resource generated in settings")
assertContains("resource generated in plugin")
}

View File

@ -2,7 +2,7 @@ val root = (project in file("."))
TaskKey[Unit]("checkScalaVersion", "test") := Def.uncached {
val sv = scalaVersion.value
assert(sv startsWith "3.", s"Found $sv!")
assert(sv.startsWith("3."), s"Found $sv!")
}
TaskKey[Unit]("checkArtifacts", "test") := Def.uncached {

View File

@ -2,7 +2,7 @@
val loadCount = AttributeKey[Int]("load-count")
val unloadCount = AttributeKey[Int]("unload-count")
def f(key: AttributeKey[Int]) = (s: State) => {
val previous = s get key getOrElse 0
val previous = s.get(key)getOrElse(0)
s.put(key, previous + 1)
}
Seq(
@ -14,7 +14,7 @@
InputKey[Unit]("checkCount") := {
val s = state.value
val args = Def.spaceDelimited().parsed
def get(label: String) = s get AttributeKey[Int](label) getOrElse 0
def get(label: String) = s.get(AttributeKey[Int](label)).getOrElse(0)
val loadCount = get("load-count")
val unloadCount = get("unload-count")
val expectedLoad = args(0).toInt

View File

@ -21,7 +21,7 @@ object Common {
val UpdateK3 = Command.command("UpdateK3"): (st: State) =>
val ex = Project extract st
val ex = Project.extract(st)
import ex._
val session2 = BuiltinCommands.setThis(ex, Seq(k3 := {}), """k3 := {
|//

View File

@ -15,7 +15,7 @@ lazy val commonSettings = Seq(
val ivyHome = Classpaths.bootIvyHome(appConfiguration.value) getOrElse sys.error(
"Launcher did not provide the Ivy home directory."
)
Resolver.file("real-local", ivyHome / "local")(Resolver.ivyStylePatterns)
Resolver.file("real-local", ivyHome / "local")(using Resolver.ivyStylePatterns)
},
resolvers += Resolver.mavenLocal,
resolvers += ("test-repo" at ((ThisBuild / baseDirectory).value / "repo/").asURL.toString)

View File

@ -1,2 +1,2 @@
lazy val a = project in file(".") dependsOn(b)
lazy val a = project.in(file(".")).dependsOn(b)
lazy val b = project

View File

@ -4,5 +4,5 @@ lazy val dep = project
lazy val use = project.
settings(
(Compile / unmanagedJars) += ((dep / Compile / packageBin) map Attributed.blank).value
(Compile / unmanagedJars) += (dep / Compile / packageBin).map(Attributed.blank).value
)