Skip to content

Segregate scala2-interop-tests and add to CI #9990

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 4 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:

- name: Test
run: |
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;configureIDE"
./project/scripts/sbt ";dotty-bootstrapped/compile ;dotty-bootstrapped/test;sjsSandbox/run;sjsSandbox/test;sjsJUnitTests/test;sjsCompilerTests/test ;scala2-interop-tests/scripted ;configureIDE"
./project/scripts/bootstrapCmdTests


Expand Down
1 change: 1 addition & 0 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ val `scala-reflect` = Build.`scala-reflect`
val scalap = Build.scalap
val dist = Build.dist
val `community-build` = Build.`community-build`
val `scala2-interop-tests` = Build.`scala2-interop-tests`

val sjsSandbox = Build.sjsSandbox
val sjsJUnitTests = Build.sjsJUnitTests
Expand Down
33 changes: 33 additions & 0 deletions project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1126,6 +1126,39 @@ object Build {
libraryDependencies := Seq("org.scala-lang" % "scalap" % stdlibVersion(Bootstrapped))
)

lazy val `scala2-interop-tests` = project.in(file("tests/scala2-interop")).
enablePlugins(SbtPlugin).
settings(commonSettings).
settings(
sbtTestDirectory := baseDirectory.value / "sbt-test",
scriptedLaunchOpts ++= Seq(
"-Dplugin.version=" + sbtDottyVersion,
"-Dplugin.scalaVersion=" + dottyVersion,
"-Dplugin.scala2Version=" + stdlibVersion(Bootstrapped),
"-Dsbt.boot.directory=" + ((baseDirectory in ThisBuild).value / ".sbt-scripted").getAbsolutePath // Workaround sbt/sbt#3469
),
// Pass along ivy home and repositories settings to sbt instances run from the tests
scriptedLaunchOpts ++= {
val repositoryPath = (io.Path.userHome / ".sbt" / "repositories").absolutePath
s"-Dsbt.repository.config=$repositoryPath" ::
ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList
},
scriptedBufferLog := true,
scripted := scripted.dependsOn(
publishLocal in `dotty-sbt-bridge`,
publishLocal in `dotty-interfaces`,
publishLocal in `dotty-compiler-bootstrapped`,
publishLocal in `dotty-library-bootstrapped`,
publishLocal in `dotty-library-bootstrappedJS`,
publishLocal in `tasty-core-bootstrapped`,
publishLocal in `dotty-tasty-inspector`,
publishLocal in `scala-library`,
publishLocal in `scala-reflect`,
publishLocal in `dotty-doc-bootstrapped`,
publishLocal in `dotty-bootstrapped`,
publishLocal in `sbt-dotty`
).evaluated
)

// sbt plugin to use Dotty in your own build, see
// https://github.com/lampepfl/dotty-example-project for usage.
Expand Down
4 changes: 4 additions & 0 deletions tests/scala2-interop/sbt-test/3rdparty/finagle/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scalaVersion := sys.props("plugin.scalaVersion")

libraryDependencies +=
("com.twitter" %% "finagle-core" % "20.9.0").withDottyCompat(scalaVersion.value)
10 changes: 10 additions & 0 deletions tests/scala2-interop/sbt-test/3rdparty/finagle/i9916.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
import com.twitter.finagle.Stack
import com.twitter.finagle.liveness.FailureAccrualFactory

trait T {
def p: FailureAccrualFactory.Param
}

class A {
val t = Stack.Param[FailureAccrualFactory.Param](FailureAccrualFactory.Param(???))
}
1 change: 1 addition & 0 deletions tests/scala2-interop/sbt-test/3rdparty/finagle/pending
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> compile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
15 changes: 15 additions & 0 deletions tests/scala2-interop/sbt-test/pos/i9916a/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
val scala3Version = sys.props("plugin.scalaVersion")
val scala2Version = sys.props("plugin.scala2Version")

lazy val `i9916a-lib` = (project in file ("lib"))
.settings(scalaVersion := scala2Version)

lazy val `i9916a-test` = (project in file ("main"))
.dependsOn(`i9916a-lib`)
.settings(
scalaVersion := scala3Version,
// https://github.com/sbt/sbt/issues/5369
projectDependencies := {
projectDependencies.value.map(_.withDottyCompat(scalaVersion.value))
}
)
7 changes: 7 additions & 0 deletions tests/scala2-interop/sbt-test/pos/i9916a/lib/i9916a-lib.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package i9916a

object Lib {
trait P
object P
def P(x: Int): P = ???
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import i9916a.Lib

trait Test {
def foo: Lib.P
}
1 change: 1 addition & 0 deletions tests/scala2-interop/sbt-test/pos/i9916a/pending
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> i9916a-test/compile
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
15 changes: 15 additions & 0 deletions tests/scala2-interop/sbt-test/pos/i9916b/build.sbt
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
val scala3Version = sys.props("plugin.scalaVersion")
val scala2Version = sys.props("plugin.scala2Version")

lazy val `i9916b-lib` = (project in file ("lib"))
.settings(scalaVersion := scala2Version)

lazy val `i9916b-test` = (project in file ("main"))
.dependsOn(`i9916b-lib`)
.settings(
scalaVersion := scala3Version,
// https://github.com/sbt/sbt/issues/5369
projectDependencies := {
projectDependencies.value.map(_.withDottyCompat(scalaVersion.value))
}
)
7 changes: 7 additions & 0 deletions tests/scala2-interop/sbt-test/pos/i9916b/lib/i9916b-lib.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package i9916b

trait T {
class A
object A
def A(x: Int): Unit = ???
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
import i9916b.T

trait Test {
def foo: T
}
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
addSbtPlugin("ch.epfl.lamp" % "sbt-dotty" % sys.props("plugin.version"))
1 change: 1 addition & 0 deletions tests/scala2-interop/sbt-test/pos/i9916b/test
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
> i9916b-test/compile