Skip to content

Commit b5af67c

Browse files
committed
Merge remote-tracking branch 'origin/main' into sbt-1.1
2 parents 508b1bd + 31e7359 commit b5af67c

File tree

105 files changed

+1914
-339
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

105 files changed

+1914
-339
lines changed

.github/Dockerfile

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,8 @@ RUN apt-get update && \
1515
openjdk-17-jdk-headless \
1616
openjdk-21-jdk-headless && \
1717
(curl -fsSL https://deb.nodesource.com/setup_18.x | bash -) && \
18-
apt-get install -y nodejs
18+
apt-get install -y nodejs && \
19+
apt-get install -y zip unzip
1920

2021

2122
# Install sbt

.github/workflows/ci.yaml

Lines changed: 221 additions & 99 deletions
Large diffs are not rendered by default.

.github/workflows/test-msi.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
###################################################################################################
2+
### THIS IS A REUSABLE WORKFLOW TO TEST SCALA WITH MSI RUNNER ###
3+
### HOW TO USE: ###
4+
### Provide optional `version` to test if installed binaries are installed with ###
5+
### correct Scala version. ###
6+
### NOTE: Requires `scala.msi` artifact uploaded within the same run ###
7+
### ###
8+
###################################################################################################
9+
10+
name: Test 'scala' MSI Package
11+
run-name: Test 'scala' (${{ inputs.version }}) MSI Package
12+
13+
on:
14+
workflow_call:
15+
inputs:
16+
version:
17+
required: true
18+
type: string
19+
java-version:
20+
required: true
21+
type : string
22+
23+
jobs:
24+
test:
25+
runs-on: windows-latest
26+
steps:
27+
- uses: actions/setup-java@v4
28+
with:
29+
distribution: temurin
30+
java-version: ${{ inputs.java-version }}
31+
- name: Download MSI artifact
32+
uses: actions/download-artifact@v4
33+
with:
34+
name: scala.msi
35+
path: .
36+
37+
# Run the MSI installer
38+
# During normal installation msiexec would modify the PATH automatically.
39+
# However, it seems not to work in GH Actions. Append the PATH manually instead.
40+
- name: Install Scala Runner
41+
shell: pwsh
42+
run: |
43+
Start-Process 'msiexec.exe' -ArgumentList '/I "scala.msi" /L*V "install.log" /qb' -Wait
44+
Get-Content 'install.log'
45+
Add-Content $env:GITHUB_PATH "C:\Program Files (x86)\scala\bin"
46+
47+
# Run tests to ensure the Scala Runner was installed and works
48+
- name: Test Scala Runner
49+
shell: pwsh
50+
run: |
51+
scala --version
52+
if (-not (scala --version | Select-String "Scala version \(default\): ${{ inputs.version }}")) {
53+
Write-Host "Invalid Scala version of MSI installed runner, expected ${{ inputs.version }}"
54+
Exit 1
55+
}
56+
- name : Test the `scalac` command
57+
shell: pwsh
58+
run: |
59+
scalac --version
60+
if (-not (scalac --version | Select-String "Scala compiler version ${{ inputs.version }}")) {
61+
Write-Host "Invalid scalac version of MSI installed runner, expected ${{ inputs.version }}"
62+
Exit 1
63+
}
64+
- name : Test the `scaladoc` command
65+
shell: pwsh
66+
run: |
67+
scaladoc --version
68+
if (-not (scaladoc --version | Select-String "Scaladoc version ${{ inputs.version }}")) {
69+
Write-Host "Invalid scaladoc version of MSI installed runner, expected ${{ inputs.version }}"
70+
Exit 1
71+
}
72+
- name : Uninstall the `scala` package
73+
shell: pwsh
74+
run: |
75+
Start-Process 'msiexec.exe' -ArgumentList '/X "scala.msi" /L*V "uninstall.log" /qb' -Wait
76+
Get-Content 'uninstall.log'
77+

community-build/src/scala/dotty/communitybuild/CommunityBuildRunner.scala

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,12 @@ object CommunityBuildRunner:
1616
* and avoid network overhead. See https://github.com/lampepfl/dotty-drone
1717
* for more infrastructural details.
1818
*/
19-
extension (self: CommunityProject) def run()(using suite: CommunityBuildRunner): Unit =
20-
if self.requiresExperimental && !compilerSupportExperimental then
21-
log(s"Skipping ${self.project} - it needs experimental features unsupported in this build.")
22-
return
23-
self.dependencies.foreach(_.publish())
24-
self.testOnlyDependencies().foreach(_.publish())
25-
suite.runProject(self)
19+
extension (self: CommunityProject)
20+
def run()(using suite: CommunityBuildRunner): Unit =
21+
self.dependencies.foreach(_.publish())
22+
self.testOnlyDependencies().foreach(_.publish())
23+
suite.runProject(self)
24+
end extension
2625

2726
trait CommunityBuildRunner:
2827

community-build/src/scala/dotty/communitybuild/Main.scala

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,7 @@ object Main:
5555
Seq("rm", "-rf", destStr).!
5656
Files.createDirectory(dest)
5757
val (toRun, ignored) =
58-
allProjects.partition( p =>
59-
p.docCommand != null
60-
&& (!p.requiresExperimental || compilerSupportExperimental)
61-
)
58+
allProjects.partition(_.docCommand != null)
6259

6360
val paths = toRun.map { project =>
6461
val name = project.project

community-build/src/scala/dotty/communitybuild/projects.scala

Lines changed: 4 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ lazy val compilerVersion: String =
1010
val file = communitybuildDir.resolve("scala3-bootstrapped.version")
1111
new String(Files.readAllBytes(file), UTF_8)
1212

13-
lazy val compilerSupportExperimental: Boolean =
14-
compilerVersion.contains("SNAPSHOT") || compilerVersion.contains("NIGHTLY")
15-
1613
lazy val sbtPluginFilePath: String =
1714
// Workaround for https://github.com/sbt/sbt/issues/4395
1815
new File(sys.props("user.home") + "/.sbt/1.0/plugins").mkdirs()
@@ -43,7 +40,6 @@ sealed trait CommunityProject:
4340
val testOnlyDependencies: () => List[CommunityProject]
4441
val binaryName: String
4542
val runCommandsArgs: List[String] = Nil
46-
val requiresExperimental: Boolean
4743
val environment: Map[String, String] = Map.empty
4844

4945
final val projectDir = communitybuildDir.resolve("community-projects").resolve(project)
@@ -53,7 +49,6 @@ sealed trait CommunityProject:
5349

5450
/** Publish this project to the local Maven repository */
5551
final def publish(): Unit =
56-
// TODO what should this do with .requiresExperimental?
5752
if !published then
5853
publishDependencies()
5954
log(s"Publishing $project")
@@ -65,11 +60,6 @@ sealed trait CommunityProject:
6560
published = true
6661

6762
final def doc(): Unit =
68-
if this.requiresExperimental && !compilerSupportExperimental then
69-
log(
70-
s"Skipping ${this.project} - it needs experimental features unsupported in this build."
71-
)
72-
return
7363
publishDependencies()
7464
log(s"Documenting $project")
7565
if docCommand eq null then
@@ -89,8 +79,7 @@ final case class MillCommunityProject(
8979
baseCommand: String,
9080
dependencies: List[CommunityProject] = Nil,
9181
testOnlyDependencies: () => List[CommunityProject] = () => Nil,
92-
ignoreDocs: Boolean = false,
93-
requiresExperimental: Boolean = false,
82+
ignoreDocs: Boolean = false
9483
) extends CommunityProject:
9584
override val binaryName: String = "./mill"
9685
override val testCommand = s"$baseCommand.test"
@@ -109,8 +98,7 @@ final case class SbtCommunityProject(
10998
testOnlyDependencies: () => List[CommunityProject] = () => Nil,
11099
sbtPublishCommand: String = null,
111100
sbtDocCommand: String = null,
112-
scalacOptions: List[String] = SbtCommunityProject.scalacOptions,
113-
requiresExperimental: Boolean = false,
101+
scalacOptions: List[String] = SbtCommunityProject.scalacOptions
114102
) extends CommunityProject:
115103
override val binaryName: String = "sbt"
116104

@@ -260,7 +248,6 @@ object projects:
260248
project = "intent",
261249
sbtTestCommand = "test",
262250
sbtDocCommand = "doc",
263-
requiresExperimental = true,
264251
)
265252

266253
lazy val scalacheck = SbtCommunityProject(
@@ -489,8 +476,8 @@ object projects:
489476

490477
lazy val scalaCollectionCompat = SbtCommunityProject(
491478
project = "scala-collection-compat",
492-
sbtTestCommand = "compat30/test",
493-
sbtPublishCommand = "compat30/publishLocal",
479+
sbtTestCommand = "compat3/test",
480+
sbtPublishCommand = "compat3/publishLocal",
494481
)
495482

496483
lazy val scalaJava8Compat = SbtCommunityProject(

compiler/src/dotty/tools/backend/jvm/BCodeSkelBuilder.scala

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -623,7 +623,13 @@ trait BCodeSkelBuilder extends BCodeHelpers {
623623
}
624624

625625
if (emitLines && tree.span.exists && !tree.hasAttachment(SyntheticUnit)) {
626-
val nr = ctx.source.offsetToLine(tree.span.point) + 1
626+
val nr =
627+
val sourcePos = tree.sourcePos
628+
(
629+
if sourcePos.exists then sourcePos.source.positionInUltimateSource(sourcePos).line
630+
else ctx.source.offsetToLine(tree.span.point) // fallback
631+
) + 1
632+
627633
if (nr != lastEmittedLineNr) {
628634
lastEmittedLineNr = nr
629635
getNonLabelNode(lastInsn) match {

compiler/src/dotty/tools/backend/sjs/JSCodeGen.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,13 @@ import dotty.tools.dotc.transform.{Erasure, ValueClasses}
2525
import dotty.tools.dotc.util.SourcePosition
2626
import dotty.tools.dotc.report
2727

28-
import org.scalajs.ir
29-
import org.scalajs.ir.{ClassKind, Position, Names => jsNames, Trees => js, Types => jstpe}
30-
import org.scalajs.ir.Names.{ClassName, MethodName, SimpleMethodName}
31-
import org.scalajs.ir.OriginalName
32-
import org.scalajs.ir.OriginalName.NoOriginalName
33-
import org.scalajs.ir.Trees.OptimizerHints
34-
import org.scalajs.ir.Version.Unversioned
28+
import dotty.tools.sjs.ir
29+
import dotty.tools.sjs.ir.{ClassKind, Position, Names => jsNames, Trees => js, Types => jstpe}
30+
import dotty.tools.sjs.ir.Names.{ClassName, MethodName, SimpleMethodName}
31+
import dotty.tools.sjs.ir.OriginalName
32+
import dotty.tools.sjs.ir.OriginalName.NoOriginalName
33+
import dotty.tools.sjs.ir.Trees.OptimizerHints
34+
import dotty.tools.sjs.ir.Version.Unversioned
3535

3636
import dotty.tools.dotc.transform.sjs.JSSymUtils.*
3737

compiler/src/dotty/tools/backend/sjs/JSEncoding.scala

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@ import StdNames.*
1515

1616
import dotty.tools.dotc.transform.sjs.JSSymUtils.*
1717

18-
import org.scalajs.ir
19-
import org.scalajs.ir.{Trees => js, Types => jstpe}
20-
import org.scalajs.ir.Names.{LocalName, LabelName, SimpleFieldName, FieldName, SimpleMethodName, MethodName, ClassName}
21-
import org.scalajs.ir.OriginalName
22-
import org.scalajs.ir.OriginalName.NoOriginalName
23-
import org.scalajs.ir.UTF8String
18+
import dotty.tools.sjs.ir
19+
import dotty.tools.sjs.ir.{Trees => js, Types => jstpe}
20+
import dotty.tools.sjs.ir.Names.{LocalName, LabelName, SimpleFieldName, FieldName, SimpleMethodName, MethodName, ClassName}
21+
import dotty.tools.sjs.ir.OriginalName
22+
import dotty.tools.sjs.ir.OriginalName.NoOriginalName
23+
import dotty.tools.sjs.ir.UTF8String
2424

2525
import dotty.tools.backend.jvm.DottyBackendInterface.symExtensions
2626

compiler/src/dotty/tools/backend/sjs/JSExportsGen.scala

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,12 +22,12 @@ import TypeErasure.ErasedValueType
2222
import dotty.tools.dotc.util.{SourcePosition, SrcPos}
2323
import dotty.tools.dotc.report
2424

25-
import org.scalajs.ir.{Position, Names => jsNames, Trees => js, Types => jstpe}
26-
import org.scalajs.ir.Names.DefaultModuleID
27-
import org.scalajs.ir.OriginalName.NoOriginalName
28-
import org.scalajs.ir.Position.NoPosition
29-
import org.scalajs.ir.Trees.OptimizerHints
30-
import org.scalajs.ir.Version.Unversioned
25+
import dotty.tools.sjs.ir.{Position, Names => jsNames, Trees => js, Types => jstpe}
26+
import dotty.tools.sjs.ir.Names.DefaultModuleID
27+
import dotty.tools.sjs.ir.OriginalName.NoOriginalName
28+
import dotty.tools.sjs.ir.Position.NoPosition
29+
import dotty.tools.sjs.ir.Trees.OptimizerHints
30+
import dotty.tools.sjs.ir.Version.Unversioned
3131

3232
import dotty.tools.dotc.transform.sjs.JSExportUtils.*
3333
import dotty.tools.dotc.transform.sjs.JSSymUtils.*
@@ -932,7 +932,7 @@ final class JSExportsGen(jsCodeGen: JSCodeGen)(using Context) {
932932
InstanceOfTypeTest(tpe.tycon.typeSymbol.typeRef)
933933

934934
case _ =>
935-
import org.scalajs.ir.Names
935+
import dotty.tools.sjs.ir.Names
936936

937937
(toIRType(tpe): @unchecked) match {
938938
case jstpe.AnyType => NoTypeTest

0 commit comments

Comments
 (0)