-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Restore scala3-tasty-management test
- Loading branch information
Showing
4 changed files
with
40 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
sbt-app/src/sbt-test/compiler-project/scala3-tasty-management/build.sbt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
import sbt.io.Using | ||
import xsbti.compile.TastyFiles | ||
|
||
ThisBuild / scalaVersion := "3.3.1" | ||
|
||
TaskKey[Unit]("check") := { | ||
assert((Compile / auxiliaryClassFiles).value == Seq(TastyFiles.instance)) | ||
assert((Test / auxiliaryClassFiles).value == Seq(TastyFiles.instance)) | ||
} | ||
|
||
TaskKey[Unit]("check2") := checkTastyFiles(true, true).value | ||
|
||
TaskKey[Unit]("check3") := checkTastyFiles(true, false).value | ||
|
||
def checkTastyFiles(aExists: Boolean, bExists: Boolean) = Def.task { | ||
val p = (Compile / packageBin).value | ||
val c = fileConverter.value | ||
Using.jarFile(false)(c.toPath(p).toFile()): jar => | ||
if aExists then assert(jar.getJarEntry("A.tasty") ne null) | ||
else assert(jar.getJarEntry("A.tasty") eq null) | ||
|
||
if bExists then assert(jar.getJarEntry("B.tasty") ne null) | ||
else assert(jar.getJarEntry("B.tasty") eq null) | ||
} |
3 changes: 3 additions & 0 deletions
3
sbt-app/src/sbt-test/compiler-project/scala3-tasty-management/src/main/scala/A.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class A { | ||
def initialized: Boolean = false | ||
} |
3 changes: 3 additions & 0 deletions
3
sbt-app/src/sbt-test/compiler-project/scala3-tasty-management/src/main/scala/B.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
class B { | ||
def foo(a: A): Boolean = a.initialized | ||
} |
10 changes: 10 additions & 0 deletions
10
sbt-app/src/sbt-test/compiler-project/scala3-tasty-management/test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
> check | ||
|
||
> check2 | ||
|
||
$ delete src/main/scala/B.scala | ||
|
||
> check3 | ||
|
||
# $ exists target/scala-3.0.0-M3/classes/A.tasty | ||
# -$ exists target/scala-3.0.0-M3/classes/B.tasty |