Add scripted scala3-scala-home

This commit is contained in:
Adrien Piquerez 2020-12-18 11:20:44 +01:00
parent ccb63e9eaa
commit 3d863a59f8
3 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,9 @@
scalaVersion := "3.0.0-M2"
val makeHome = taskKey[Unit]("Populates the 'home/lib' directory with Scala jars from the default ScalaInstance")
makeHome := {
val lib = baseDirectory.value / "home" / "lib"
for(jar <- scalaInstance.value.allJars)
IO.copyFile(jar, lib / jar.getName)
}

View File

@ -0,0 +1,11 @@
scalaVersion := "3.0.0-M2"
scalaHome := Some(baseDirectory.value / "home")
val checkUpdate = taskKey[Unit]("Ensures that resolved Scala artifacts are replaced with ones from the configured Scala home directory")
checkUpdate := {
val report = update.value
val lib = (scalaHome.value.get / "lib").getCanonicalFile
for(f <- report.allFiles)
assert(f.getParentFile == lib, "Artifact not in Scala home directory: " + f.getAbsolutePath)
}

View File

@ -0,0 +1,4 @@
> makeHome
$ copy-file changes/real-build.sbt build.sbt
> reload
> checkUpdate