Skip to content

Commit 91227a8

Browse files
committed
separate lib from compiler
1 parent 54fbcaa commit 91227a8

File tree

166 files changed

+43
-31
lines changed

Some content is hidden

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

166 files changed

+43
-31
lines changed

bin/common

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ function build_jar {
7474
function update_packages {
7575
echo "$INTERFACES_JAR" > $DOTTY_ROOT/.packages
7676
echo "$MAIN_JAR" >> $DOTTY_ROOT/.packages
77+
echo "$DOTTY_LIB_JAR" >> $DOTTY_ROOT/.packages
7778
echo "$TEST_JAR" >> $DOTTY_ROOT/.packages
7879
}
7980

@@ -84,10 +85,14 @@ function build_all {
8485
INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)
8586
printf "done\n"
8687

87-
printf "Building dotty..."
88+
printf "Building dotty-compiler..."
8889
MAIN_JAR=$(build_jar package "target/scala-$SCALA_BINARY_VERSION")
8990
printf "done\n"
9091

92+
printf "Building dotty library..."
93+
DOTTY_LIB_JAR=$(build_jar dotty-library/package "library/target/scala-$SCALA_BINARY_VERSION")
94+
printf "done\n"
95+
9196
printf "Building tests..."
9297
TEST_JAR=$(build_jar test:package "target/scala-$SCALA_BINARY_VERSION" '/dotty.*-tests\.jar/p')
9398
printf "done\n"
@@ -101,10 +106,11 @@ if [ ! -f "$DOTTY_ROOT/.packages" ]; then
101106
else
102107
IFS=$'\r\n' GLOBIGNORE='*' command eval 'JARS=($(cat $DOTTY_ROOT/.packages))'
103108

104-
if [ "${#JARS[@]}" == "3" ]; then
109+
if [ "${#JARS[@]}" == "4" ]; then
105110
INTERFACES_JAR="${JARS[0]}"
106111
MAIN_JAR="${JARS[1]}"
107-
TEST_JAR="${JARS[2]}"
112+
DOTTY_LIB_JAR="${JARS[2]}"
113+
TEST_JAR="${JARS[3]}"
108114
else
109115
echo "Failed to parse .packages file"
110116
build_all
@@ -126,6 +132,7 @@ function check_jar {
126132

127133
check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
128134
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-$SCALA_BINARY_VERSION)'
135+
check_jar "dotty-library" $DOTTY_LIB_JAR "library" 'DOTTY_LIB_JAR=$(build_jar dotty-library/package library/target/scala-$SCALA_BINARY_VERSION)'
129136
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
130137

131138
# Autodetecting the scala-library location, in case it wasn't provided by an environment variable

bin/dotc

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,12 +115,12 @@ trap onExit INT
115115
classpathArgs () {
116116
if [[ "true" == $bootstrapped ]]; then
117117
check_jar "dotty-bootstrapped" $DOTTY_JAR "target" 'build_jar "test:runMain dotc.build" target' &> /dev/null
118-
toolchain="$DOTTY_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
118+
toolchain="$DOTTY_JAR:$DOTTY_LIB_JAR:$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
119119
else
120-
toolchain="$SCALA_LIBRARY_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
120+
toolchain="$SCALA_LIBRARY_JAR:$DOTTY_LIB_JAR:$SCALA_REFLECT_JAR:$SCALA_COMPILER_JAR:$SBT_INTERFACE_JAR"
121121
fi
122-
bcpJars="$INTERFACES_JAR:$MAIN_JAR"
123-
cpJars="$INTERFACES_JAR:$MAIN_JAR:$TEST_JAR"
122+
bcpJars="$INTERFACES_JAR:$MAIN_JAR:$DOTTY_LIB_JAR"
123+
cpJars="$INTERFACES_JAR:$MAIN_JAR:$DOTTY_LIB_JAR:$TEST_JAR"
124124

125125
if [[ -n "$cygwin" ]]; then
126126
if [[ "$OS" = "Windows_NT" ]] && cygpath -m .>/dev/null 2>/dev/null ; then
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

project/Build.scala

Lines changed: 29 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,15 @@ object DottyBuild extends Build {
5050
private val overrideScalaVersionSetting =
5151
ivyScala := ivyScala.value.map(_.copy(overrideScalaVersion = true))
5252

53+
// set sources to src/, tests to test/ and resources to resources/
54+
lazy val sourceStructure = Seq(
55+
scalaSource in Compile := baseDirectory.value / "src",
56+
scalaSource in Test := baseDirectory.value / "test",
57+
javaSource in Compile := baseDirectory.value / "src",
58+
javaSource in Test := baseDirectory.value / "test",
59+
resourceDirectory in Compile := baseDirectory.value / "resources"
60+
)
61+
5362
lazy val `dotty-interfaces` = project.in(file("interfaces")).
5463
settings(
5564
// Do not append Scala versions to the generated artifacts
@@ -61,20 +70,18 @@ object DottyBuild extends Build {
6170
).
6271
settings(publishing)
6372

64-
lazy val dotty = project.in(file(".")).
73+
lazy val `dotty-compiler` = project.in(file(".")).
6574
dependsOn(`dotty-interfaces`).
75+
dependsOn(`dotty-library`).
76+
settings(sourceStructure).
6677
settings(
6778
// Disable scaladoc generation, makes publishLocal much faster
6879
publishArtifact in packageDoc := false,
6980

7081
overrideScalaVersionSetting,
7182

72-
// set sources to src/, tests to test/ and resources to resources/
73-
scalaSource in Compile := baseDirectory.value / "src",
74-
javaSource in Compile := baseDirectory.value / "src",
75-
scalaSource in Test := baseDirectory.value / "test",
76-
javaSource in Test := baseDirectory.value / "test",
77-
resourceDirectory in Compile := baseDirectory.value / "resources",
83+
// necessary evil: dottydoc currently needs to be included in the dotty
84+
// project, for sbt integration
7885
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
7986
unmanagedSourceDirectories in Compile += baseDirectory.value / "dottydoc" / "src",
8087
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
@@ -132,7 +139,7 @@ object DottyBuild extends Build {
132139
val args = Def.spaceDelimited("<arg>").parsed
133140
val jars = Seq((packageBin in Compile).value.getAbsolutePath) ++
134141
getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
135-
val dottyJars = "-dottyJars " + (jars.length + 1) + " dotty.jar" + " " + jars.mkString(" ")
142+
val dottyJars = "-dottyJars " + (jars.length + 2) + " dotty.jar dotty-lib.jar" + " " + jars.mkString(" ")
136143
// Provide the jars required on the classpath of run tests
137144
runTask(Test, "dotty.partest.DPConsoleRunner", dottyJars + " " + args.mkString(" "))
138145
},
@@ -210,17 +217,26 @@ object DottyBuild extends Build {
210217
).
211218
settings(publishing)
212219

220+
lazy val `dotty-library` = project.in(file("library")).
221+
settings(sourceStructure).
222+
settings(
223+
libraryDependencies ++= Seq(
224+
"org.scala-lang" % "scala-reflect" % scalaVersion.value,
225+
"org.scala-lang" % "scala-library" % scalaVersion.value
226+
)
227+
)
228+
213229
// until sbt/sbt#2402 is fixed (https://github.com/sbt/sbt/issues/2402)
214230
lazy val cleanSbtBridge = TaskKey[Unit]("cleanSbtBridge", "delete dotty-sbt-bridge cache")
215231

216232
lazy val `dotty-sbt-bridge` = project.in(file("sbt-bridge")).
217-
dependsOn(dotty).
233+
dependsOn(`dotty-compiler`).
218234
settings(
219235
overrideScalaVersionSetting,
220236

221237
cleanSbtBridge := {
222238
val dottyBridgeVersion = version.value
223-
val dottyVersion = (version in dotty).value
239+
val dottyVersion = (version in `dotty-compiler`).value
224240
val classVersion = System.getProperty("java.class.version")
225241

226242
val sbtV = sbtVersion.value
@@ -334,11 +350,11 @@ object DottyInjectedPlugin extends AutoPlugin {
334350
)))
335351

336352
lazy val `dotty-bench` = project.in(file("bench")).
337-
dependsOn(dotty % "compile->test").
353+
dependsOn(`dotty-compiler` % "compile->test").
338354
settings(
339355
overrideScalaVersionSetting,
340356

341-
baseDirectory in (Test,run) := (baseDirectory in dotty).value,
357+
baseDirectory in (Test,run) := (baseDirectory in `dotty-compiler`).value,
342358

343359
libraryDependencies ++= Seq(
344360
scalaCompiler % Test,
@@ -473,7 +489,7 @@ object DottyInjectedPlugin extends AutoPlugin {
473489
def cpToString(cp: Seq[File]) =
474490
cp.map(_.getAbsolutePath).mkString(java.io.File.pathSeparator)
475491

476-
val compilerCp = Attributed.data((fullClasspath in (dotty, Compile)).value)
492+
val compilerCp = Attributed.data((fullClasspath in (`dotty-compiler`, Compile)).value)
477493
val cpStr = cpToString(classpath ++ compilerCp)
478494

479495
// List all my dependencies (recompile if any of these changes)

src/typedapply.scala

Lines changed: 0 additions & 11 deletions
This file was deleted.

0 commit comments

Comments
 (0)