Skip to content

Commit c83f49b

Browse files
committed
chore: add support for sbt scripted tests in the new build
1 parent e3f1aa1 commit c83f49b

File tree

5 files changed

+48
-95
lines changed

5 files changed

+48
-95
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-compiler-bootstrapped/scala3CompilerCoursierTest:test"
101101
./project/scripts/cmdTests
102102
./project/scripts/bootstrappedOnlyCmdTests
103103
@@ -347,51 +347,6 @@ jobs:
347347
if: ${{ always() }}
348348
run: cat community-build/dotty-community-build-deps || true
349349

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

.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: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,4 +533,21 @@ jobs:
533533
cache: 'sbt'
534534
- uses: sbt/setup-sbt@v1
535535
- name: Test Scala.js
536-
run: ./project/scripts/sbt sjsCompilerTests/test
536+
run: ./project/scripts/sbt sjsCompilerTests/test
537+
538+
sctipted-tests:
539+
runs-on: ubuntu-latest
540+
needs: [scala3-compiler-bootstrapped, tasty-core-bootstrapped, scala3-staging, scala3-tasty-inspector, scala-library-sjs, scaladoc]
541+
steps:
542+
- name: Git Checkout
543+
uses: actions/checkout@v5
544+
545+
- name: Set up JDK 17
546+
uses: actions/setup-java@v5
547+
with:
548+
distribution: 'temurin'
549+
java-version: 17
550+
cache: 'sbt'
551+
- uses: sbt/setup-sbt@v1
552+
- name: Run SBT scripted tests
553+
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
@@ -1471,6 +1471,7 @@ object Build {
14711471
// ==============================================================================================
14721472

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

15631590
/* Configuration of the org.scala-lang:scala3-sbt-bridge:*.**.**-bootstrapped project */
@@ -3465,47 +3492,6 @@ object Build {
34653492
BuildInfoPlugin.buildInfoScopedSettings(Test),
34663493
)
34673494

3468-
// various scripted sbt tests
3469-
lazy val `sbt-test` = project.in(file("sbt-test")).
3470-
enablePlugins(ScriptedPlugin).
3471-
settings(commonSettings).
3472-
settings(
3473-
sbtTestDirectory := baseDirectory.value,
3474-
target := baseDirectory.value / ".." / "out" / name.value,
3475-
3476-
// The batch mode accidentally became the default with no way to disable
3477-
// it in sbt 1.4 (https://github.com/sbt/sbt/issues/5913#issuecomment-716003195).
3478-
// We enable it explicitly here to make it clear that we're using it.
3479-
scriptedBatchExecution := true,
3480-
3481-
scriptedLaunchOpts ++= Seq(
3482-
"-Dplugin.version=" + version.value,
3483-
"-Dplugin.scalaVersion=" + dottyVersion,
3484-
"-Dplugin.scala2Version=" + stdlibVersion(Bootstrapped),
3485-
"-Dplugin.scalaJSVersion=" + scalaJSVersion,
3486-
"-Dsbt.boot.directory=" + ((ThisBuild / baseDirectory).value / ".sbt-scripted").getAbsolutePath // Workaround sbt/sbt#3469
3487-
),
3488-
// Pass along ivy home and repositories settings to sbt instances run from the tests
3489-
scriptedLaunchOpts ++= {
3490-
val repositoryPath = (io.Path.userHome / ".sbt" / "repositories").absolutePath
3491-
s"-Dsbt.repository.config=$repositoryPath" ::
3492-
ivyPaths.value.ivyHome.map("-Dsbt.ivy.home=" + _.getAbsolutePath).toList
3493-
},
3494-
scriptedBufferLog := true,
3495-
scripted := scripted.dependsOn(
3496-
(`scala3-sbt-bridge` / publishLocalBin),
3497-
(`scala3-interfaces` / publishLocalBin),
3498-
(`scala3-compiler-bootstrapped` / publishLocalBin),
3499-
(`scala3-library-bootstrapped` / publishLocalBin),
3500-
(`scala3-library-bootstrappedJS` / publishLocalBin),
3501-
(`tasty-core-bootstrapped` / publishLocalBin),
3502-
(`scala3-staging` / publishLocalBin),
3503-
(`scala3-tasty-inspector` / publishLocalBin),
3504-
(`scaladoc` / publishLocalBin),
3505-
(`scala3-bootstrapped` / publishLocalBin) // Needed because sbt currently hardcodes the dotty artifact
3506-
).evaluated
3507-
)
3508-
35093495
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}.")
35103496

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

0 commit comments

Comments
 (0)