Skip to content

Commit 24a12d4

Browse files
authored
chore: add support for sbt-test in the new build (#23748)
This PR configures the scripted tests (`sbt-test`) to be run using the new stdlib. ~This PR should fail at the moment as we do not have the `scaladoc` artifacts yet in the build.~
2 parents 6194563 + 3d55eda commit 24a12d4

File tree

5 files changed

+47
-94
lines changed

5 files changed

+47
-94
lines changed

.github/workflows/ci.yaml

Lines changed: 2 additions & 47 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ jobs:
9797
- name: Cmd Tests
9898
run: |
9999
./project/scripts/buildScalaBinary
100-
./project/scripts/sbt ";scala3-bootstrapped/compile ;sbt-test/scripted scala2-compat/* ;scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
100+
./project/scripts/sbt ";scala3-bootstrapped/compile ;scala3-bootstrapped/publishLocal ;scala3-compiler-bootstrapped/scala3CompilerCoursierTest:test"
101101
./project/scripts/cmdTests
102102
./project/scripts/bootstrappedOnlyCmdTests
103103
@@ -339,51 +339,6 @@ jobs:
339339
if: ${{ always() }}
340340
run: cat community-build/dotty-community-build-deps || true
341341

342-
test_sbt:
343-
runs-on: [self-hosted, Linux]
344-
container:
345-
image: lampepfl/dotty:2024-10-18
346-
options: --cpu-shares 4096
347-
volumes:
348-
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
349-
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
350-
- ${{ github.workspace }}/../../cache/general:/root/.cache
351-
if: "github.event_name == 'schedule' && github.repository == 'scala/scala3'
352-
|| github.event_name == 'push'
353-
|| (
354-
github.event_name == 'pull_request'
355-
&& !contains(github.event.pull_request.body, '[skip ci]')
356-
&& !contains(github.event.pull_request.body, '[skip test_sbt]')
357-
)
358-
|| (
359-
github.event_name == 'workflow_dispatch'
360-
&& github.repository == 'scala/scala3'
361-
)"
362-
363-
steps:
364-
- name: Set JDK 17 as default
365-
run: echo "/usr/lib/jvm/java-17-openjdk-amd64/bin" >> $GITHUB_PATH
366-
367-
- name: Reset existing repo
368-
run: |
369-
git config --global --add safe.directory $GITHUB_WORKSPACE
370-
git -c "http.https://github.com/.extraheader=" fetch --recurse-submodules=no "https://github.com/scala/scala3" && git reset --hard FETCH_HEAD || true
371-
372-
- name: Checkout cleanup script
373-
uses: actions/checkout@v5
374-
375-
- name: Cleanup
376-
run: .github/workflows/cleanup.sh
377-
378-
- name: Git Checkout
379-
uses: actions/checkout@v5
380-
381-
- name: Add SBT proxy repositories
382-
run: cp -vf .github/workflows/repositories /root/.sbt/ ; true
383-
384-
- name: Test sbt
385-
run: ./project/scripts/sbt "sbt-test/scripted"
386-
387342
publish_release:
388343
permissions:
389344
contents: write # for GH CLI to create a release
@@ -395,7 +350,7 @@ jobs:
395350
- ${{ github.workspace }}/../../cache/sbt:/root/.sbt
396351
- ${{ github.workspace }}/../../cache/ivy:/root/.ivy2/cache
397352
- ${{ github.workspace }}/../../cache/general:/root/.cache
398-
needs: [test, community_build_a, community_build_b, community_build_c, test_sbt, build-sdk-package, build-msi-package]
353+
needs: [test, community_build_a, community_build_b, community_build_c, build-sdk-package, build-msi-package]
399354
if: "github.event_name == 'push'
400355
&& startsWith(github.event.ref, 'refs/tags/')"
401356

.github/workflows/scaladoc.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,9 +62,6 @@ jobs:
6262
- name: Generate Scala 3 documentation
6363
run: ./project/scripts/sbt scaladoc/generateScalaDocumentation
6464

65-
- name: Generate documentation for example project using dotty-sbt
66-
run: ./project/scripts/sbt "sbt-test/scripted sbt-dotty/scaladoc"
67-
6865
stdlib-sourcelinks-test:
6966
runs-on: ubuntu-latest
7067
# if false - disable flaky test

.github/workflows/stdlib.yaml

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -546,3 +546,20 @@ jobs:
546546
- name: Scala.js JUnit tests with WebAssembly
547547
run: ./project/scripts/sbt ";sjsJUnitTests/clean ;set sjsJUnitTests/scalaJSLinkerConfig ~= switchToLatestESVersion ;set Global/enableWebAssembly := true; sjsJUnitTests/test"
548548
# TODO Scala.js on Windows
549+
550+
scripted-tests:
551+
runs-on: ubuntu-latest
552+
needs: [scala3-compiler-bootstrapped, tasty-core-bootstrapped, scala3-staging, scala3-tasty-inspector, scala-library-sjs, scaladoc]
553+
steps:
554+
- name: Git Checkout
555+
uses: actions/checkout@v5
556+
557+
- name: Set up JDK 17
558+
uses: actions/setup-java@v5
559+
with:
560+
distribution: 'temurin'
561+
java-version: 17
562+
cache: 'sbt'
563+
- uses: sbt/setup-sbt@v1
564+
- name: Run SBT scripted tests
565+
run: ./project/scripts/sbt scala3-bootstrapped-new/scripted

build.sbt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,5 @@ val sjsSandbox = Build.sjsSandbox
5454
val sjsJUnitTests = Build.sjsJUnitTests
5555
val sjsCompilerTests = Build.sjsCompilerTests
5656

57-
val `sbt-test` = Build.`sbt-test`
58-
5957
inThisBuild(Build.thisBuildSettings)
6058
inScope(Global)(Build.globalSettings)

project/Build.scala

Lines changed: 28 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -1473,6 +1473,7 @@ object Build {
14731473
// ==============================================================================================
14741474

14751475
lazy val `scala3-bootstrapped-new` = project
1476+
.enablePlugins(ScriptedPlugin)
14761477
.aggregate(`scala3-interfaces`, `scala3-library-bootstrapped-new` , `scala-library-bootstrapped`,
14771478
`tasty-core-bootstrapped-new`, `scala3-compiler-bootstrapped-new`, `scala3-sbt-bridge-bootstrapped`,
14781479
`scala3-staging-new`, `scala3-tasty-inspector-new`, `scala-library-sjs`, `scala3-library-sjs`, `scaladoc-new`)
@@ -1559,7 +1560,33 @@ object Build {
15591560
(if (args1.nonEmpty) " -Ddotty.tests.filter=" + args1.mkString(" ") else "")
15601561
(`scala3-compiler-bootstrapped-new` / Test / testOnly).toTask(cmd)
15611562
}
1562-
}.evaluated
1563+
}.evaluated,
1564+
// ================================ SBT SCRIPT TEST SETTINGS ================================
1565+
sbtTestDirectory := (ThisBuild / baseDirectory).value / "sbt-test",
1566+
// The batch mode accidentally became the default with no way to disable
1567+
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
1568+
// We enable it explicitly here to make it clear that we're using it.
1569+
scriptedBatchExecution := true,
1570+
scriptedLaunchOpts ++= Seq(
1571+
s"-Dplugin.scalaVersion=${dottyVersion}",
1572+
s"-Dplugin.scala2Version=${stdlibVersion(Bootstrapped)}",
1573+
s"-Dplugin.scalaJSVersion=${scalaJSVersion}",
1574+
),
1575+
scriptedBufferLog := true,
1576+
scripted := scripted.dependsOn(
1577+
(`scala3-sbt-bridge-bootstrapped` / publishLocalBin),
1578+
(`scala3-interfaces` / publishLocalBin),
1579+
(`scala3-compiler-bootstrapped-new` / publishLocalBin),
1580+
(`scala3-library-bootstrapped-new` / publishLocalBin),
1581+
(`scala-library-bootstrapped` / publishLocalBin),
1582+
(`scala-library-sjs` / publishLocalBin),
1583+
(`scala3-library-sjs` / publishLocalBin),
1584+
(`tasty-core-bootstrapped-new` / publishLocalBin),
1585+
(`scala3-staging-new` / publishLocalBin),
1586+
(`scala3-tasty-inspector-new` / publishLocalBin),
1587+
(`scaladoc-new` / publishLocalBin),
1588+
publishLocalBin,
1589+
).evaluated,
15631590
)
15641591

15651592
/* Configuration of the org.scala-lang:scala3-sbt-bridge:*.**.**-bootstrapped project */
@@ -3516,47 +3543,6 @@ object Build {
35163543
BuildInfoPlugin.buildInfoScopedSettings(Test),
35173544
)
35183545

3519-
// various scripted sbt tests
3520-
lazy val `sbt-test` = project.in(file("sbt-test")).
3521-
enablePlugins(ScriptedPlugin).
3522-
settings(commonSettings).
3523-
settings(
3524-
sbtTestDirectory := baseDirectory.value,
3525-
target := baseDirectory.value / ".." / "out" / name.value,
3526-
3527-
// The batch mode accidentally became the default with no way to disable
3528-
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
3529-
// We enable it explicitly here to make it clear that we're using it.
3530-
scriptedBatchExecution := true,
3531-
3532-
scriptedLaunchOpts ++= Seq(
3533-
"-Dplugin.version=" + version.value,
3534-
"-Dplugin.scalaVersion=" + dottyVersion,
3535-
"-Dplugin.scala2Version=" + stdlibVersion(Bootstrapped),
3536-
"-Dplugin.scalaJSVersion=" + scalaJSVersion,
3537-
"-Dsbt.boot.directory=" + ((ThisBuild / baseDirectory).value / ".sbt-scripted").getAbsolutePath // Workaround sbt/sbt#3469
3538-
),
3539-
// Pass along ivy home and repositories settings to sbt instances run from the tests
3540-
scriptedLaunchOpts ++= {
3541-
val repositoryPath = (io.Path.userHome / ".sbt" / "repositories").absolutePath
3542-
s"-Dsbt.repository.config=$repositoryPath" ::
3543-
ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList
3544-
},
3545-
scriptedBufferLog := true,
3546-
scripted := scripted.dependsOn(
3547-
(`scala3-sbt-bridge` / publishLocalBin),
3548-
(`scala3-interfaces` / publishLocalBin),
3549-
(`scala3-compiler-bootstrapped` / publishLocalBin),
3550-
(`scala3-library-bootstrapped` / publishLocalBin),
3551-
(`scala3-library-bootstrappedJS` / publishLocalBin),
3552-
(`tasty-core-bootstrapped` / publishLocalBin),
3553-
(`scala3-staging` / publishLocalBin),
3554-
(`scala3-tasty-inspector` / publishLocalBin),
3555-
(`scaladoc` / publishLocalBin),
3556-
(`scala3-bootstrapped` / publishLocalBin) // Needed because sbt currently hardcodes the dotty artifact
3557-
).evaluated
3558-
)
3559-
35603546
val prepareCommunityBuild = taskKey[Unit]("Publish local the compiler and the sbt plugin. Also store the versions of the published local artefacts in two files, community-build/{scala3-bootstrapped.version,sbt-injected-plugins}.")
35613547

35623548
lazy val `community-build` = project.in(file("community-build")).

0 commit comments

Comments
 (0)