diff --git a/main-actions/src/test/scala/sbt/CacheIvyTest.scala b/main-actions/src/test/scala/sbt/CacheIvyTest.scala index 64ebe5507..963f97c51 100644 --- a/main-actions/src/test/scala/sbt/CacheIvyTest.scala +++ b/main-actions/src/test/scala/sbt/CacheIvyTest.scala @@ -38,7 +38,7 @@ class CacheIvyTest extends Properties("CacheIvy") { content = converter.toJsonUnsafe(value) } - private def testCache[T: JsonFormat, U]( + private def testCache[T, U]( f: (SingletonCache[T], CacheStore) => U )(using cache: SingletonCache[T]): U = { val store = new InMemoryStore(Converter) diff --git a/main-settings/src/main/scala/sbt/Def.scala b/main-settings/src/main/scala/sbt/Def.scala index 63f62a043..2f12d4e7f 100644 --- a/main-settings/src/main/scala/sbt/Def.scala +++ b/main-settings/src/main/scala/sbt/Def.scala @@ -298,7 +298,7 @@ object Def extends BuildSyntax with Init with InitializeImplicits: ) } - inline def cachedTask[A1: JsonFormat](inline a1: A1): Def.Initialize[Task[A1]] = + inline def cachedTask[A1](inline a1: A1): Def.Initialize[Task[A1]] = ${ TaskMacro.taskMacroImpl[A1]('a1, cached = true) } inline def task[A1](inline a1: A1): Def.Initialize[Task[A1]] = diff --git a/main/src/main/scala/sbt/internal/Compiler.scala b/main/src/main/scala/sbt/internal/Compiler.scala index f306b4fec..706ed5694 100644 --- a/main/src/main/scala/sbt/internal/Compiler.scala +++ b/main/src/main/scala/sbt/internal/Compiler.scala @@ -165,8 +165,7 @@ object Compiler: state: State, topLoader: ClassLoader, ): ScalaInstance = - import sbt.State.* - val classLoaderCache = state.extendedClassLoaderCache + val classLoaderCache = State.StateOpsImpl(state).extendedClassLoaderCache val compilerJars = allCompilerJars.filterNot(libraryJars.contains).distinct.toArray val docJars = allDocJars .filterNot(jar => libraryJars.contains(jar) || compilerJars.contains(jar)) diff --git a/main/src/main/scala/sbt/internal/InMemoryCacheStore.scala b/main/src/main/scala/sbt/internal/InMemoryCacheStore.scala index 66b2b219d..5f0359952 100644 --- a/main/src/main/scala/sbt/internal/InMemoryCacheStore.scala +++ b/main/src/main/scala/sbt/internal/InMemoryCacheStore.scala @@ -27,12 +27,10 @@ private[sbt] object InMemoryCacheStore { .maximumWeight(maxSize) .weigher(weigher) .build() - def get[T](path: Path): Option[(T, Long)] = { - files.getIfPresent(path) match { - case null => None - case (value: T @unchecked, lastModified, _) => Some((value, lastModified)) - } - } + def get[A1](path: Path): Option[(A1, Long)] = + files.getIfPresent(path) match + case null => None + case (value, lastModified, _) => Some((value.asInstanceOf[A1], lastModified)) def put(path: Path, value: Any, lastModified: Long): Unit = { try { if (lastModified > 0) { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 4c49f44eb..cb80e1497 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -4,7 +4,7 @@ import Keys.* object Dependencies { // WARNING: Please Scala update versions in PluginCross.scala too val scala213 = "2.13.16" - val scala3 = "3.6.4" + val scala3 = "3.7.0" val checkPluginCross = settingKey[Unit]("Make sure scalaVersion match up") val baseScalaVersion = scala3 def nightlyVersion: Option[String] = diff --git a/sbt-app/src/sbt-test/actions/input-task-dyn/build.sbt b/sbt-app/src/sbt-test/actions/input-task-dyn/build.sbt index f730e5919..7fa6ddece 100644 --- a/sbt-app/src/sbt-test/actions/input-task-dyn/build.sbt +++ b/sbt-app/src/sbt-test/actions/input-task-dyn/build.sbt @@ -5,7 +5,7 @@ import complete.Parser val runFoo = inputKey[Unit]("Runs Foo with passed arguments") val check = taskKey[Unit]("") -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" lazy val root = (project in file(".")). settings( diff --git a/sbt-app/src/sbt-test/cache/cached-compile/build.sbt b/sbt-app/src/sbt-test/cache/cached-compile/build.sbt index 0b0bb3f4b..557a646f2 100644 --- a/sbt-app/src/sbt-test/cache/cached-compile/build.sbt +++ b/sbt-app/src/sbt-test/cache/cached-compile/build.sbt @@ -4,7 +4,7 @@ lazy val checkMiss = taskKey[Unit]("") Global / localCacheDirectory := baseDirectory.value / "diskcache" -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" checkMiss := { val s = streams.value val config = Def.cacheConfiguration.value diff --git a/sbt-app/src/sbt-test/cache/cached-test/build.sbt b/sbt-app/src/sbt-test/cache/cached-test/build.sbt index 922abb89c..c6de7d205 100644 --- a/sbt-app/src/sbt-test/cache/cached-test/build.sbt +++ b/sbt-app/src/sbt-test/cache/cached-test/build.sbt @@ -5,7 +5,7 @@ lazy val verify = "com.eed3si9n.verify" %% "verify" % "1.0.0" Global / localCacheDirectory := baseDirectory.value / "diskcache" -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" libraryDependencies += verify % Test testFrameworks += new TestFramework("verify.runner.Framework") diff --git a/sbt-app/src/sbt-test/project/nested-macro/build.sbt b/sbt-app/src/sbt-test/project/nested-macro/build.sbt index a6d00c01d..8cd03bacc 100644 --- a/sbt-app/src/sbt-test/project/nested-macro/build.sbt +++ b/sbt-app/src/sbt-test/project/nested-macro/build.sbt @@ -1,6 +1,6 @@ lazy val a1 = settingKey[Boolean]("") -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" a1 := true Compile / sourceGenerators += { diff --git a/sbt-app/src/sbt-test/tests/incremental-object-deps/build.sbt b/sbt-app/src/sbt-test/tests/incremental-object-deps/build.sbt index d37f0123e..cb3ac4205 100644 --- a/sbt-app/src/sbt-test/tests/incremental-object-deps/build.sbt +++ b/sbt-app/src/sbt-test/tests/incremental-object-deps/build.sbt @@ -1,3 +1,3 @@ -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" libraryDependencies += "com.eed3si9n.verify" %% "verify" % "1.0.0" % Test testFrameworks += new TestFramework("verify.runner.Framework") diff --git a/server-test/src/server-test/client/build.sbt b/server-test/src/server-test/client/build.sbt index 36a9a9ab0..2b3f2477f 100644 --- a/server-test/src/server-test/client/build.sbt +++ b/server-test/src/server-test/client/build.sbt @@ -1,4 +1,4 @@ -scalaVersion := "3.6.4" +scalaVersion := "3.7.0" TaskKey[Unit]("willSucceed") := println("success") diff --git a/tasks-standard/src/main/scala/sbt/std/TaskExtra.scala b/tasks-standard/src/main/scala/sbt/std/TaskExtra.scala index f198fad22..ceffdedb4 100644 --- a/tasks-standard/src/main/scala/sbt/std/TaskExtra.scala +++ b/tasks-standard/src/main/scala/sbt/std/TaskExtra.scala @@ -9,6 +9,7 @@ package sbt package std +import scala.annotation.nowarn import scala.sys.process.{ BasicIO, ProcessIO, ProcessBuilder } import sbt.internal.util.AttributeMap @@ -205,7 +206,10 @@ trait TaskExtra extends TaskExtra0 { extension [Key]( in: Task[?] - )(using streams: Task[TaskStreams[Key]], key: Task[?] => Key) { + )(using + @nowarn("msg=unused") streams: Task[TaskStreams[Key]], + @nowarn("msg=unused") key: Task[?] => Key + ) { def binary[T](f: BufferedInputStream => T): Task[T] = pipeBinary(None, f) def binary[T](sid: String)(f: BufferedInputStream => T): Task[T] = pipeBinary(Some(sid), f) diff --git a/util-cache/src/main/scala/sbt/util/ActionCache.scala b/util-cache/src/main/scala/sbt/util/ActionCache.scala index 60252e3a3..ee554a10b 100644 --- a/util-cache/src/main/scala/sbt/util/ActionCache.scala +++ b/util-cache/src/main/scala/sbt/util/ActionCache.scala @@ -34,7 +34,7 @@ object ActionCache: * - config: The configuration that's used to store where the cache backends are. * - action: The actual action to be cached. */ - def cache[I: HashWriter, O: JsonFormat: ClassTag]( + def cache[I: HashWriter, O: JsonFormat]( key: I, codeContentHash: Digest, extraHash: Digest, @@ -81,7 +81,7 @@ object ActionCache: /** * Retrieves the cached value. */ - def get[I: HashWriter, O: JsonFormat: ClassTag]( + def get[I: HashWriter, O: JsonFormat]( key: I, codeContentHash: Digest, extraHash: Digest, diff --git a/util-cache/src/main/scala/sbt/util/SeparatedCache.scala b/util-cache/src/main/scala/sbt/util/SeparatedCache.scala index 3fa11229c..53682274f 100644 --- a/util-cache/src/main/scala/sbt/util/SeparatedCache.scala +++ b/util-cache/src/main/scala/sbt/util/SeparatedCache.scala @@ -12,6 +12,7 @@ import scala.util.Try import sjsonnew.JsonFormat import sjsonnew.support.murmurhash.Hasher +import scala.annotation.nowarn import CacheImplicits.* @@ -37,6 +38,7 @@ object SingletonCache { } /** A lazy `SingletonCache` */ + @nowarn("msg=unused") def lzy[A: JsonFormat](mkCache: => SingletonCache[A]): SingletonCache[A] = new SingletonCache[A] { lazy val cache = mkCache diff --git a/util-tracking/src/main/scala/sbt/util/Tracked.scala b/util-tracking/src/main/scala/sbt/util/Tracked.scala index 0c340dde0..b2e7ca8a4 100644 --- a/util-tracking/src/main/scala/sbt/util/Tracked.scala +++ b/util-tracking/src/main/scala/sbt/util/Tracked.scala @@ -16,6 +16,7 @@ import sbt.internal.util.EmptyCacheError import sjsonnew.{ JsonFormat, JsonWriter } import sjsonnew.support.murmurhash.Hasher +import scala.annotation.nowarn object Tracked { @@ -199,6 +200,7 @@ object Tracked { * cachedDoc(inputs)(() => exists(outputDirectory.allPaths.get.toSet)) * }}} */ + @nowarn("msg=unused") def inputChanged[I: JsonFormat: SingletonCache, O](store: CacheStore)( f: (Boolean, I) => O ): I => O =