Skip to content

Commit 2769e1b

Browse files
felixmuldersmarter
authored andcommitted
separate lib from compiler
1 parent 2d10c87 commit 2769e1b

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
@@ -51,6 +51,15 @@ object DottyBuild extends Build {
5151
private val overrideScalaVersionSetting =
5252
ivyScala := ivyScala.value.map(_.copy(overrideScalaVersion = true))
5353

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

65-
lazy val dotty = project.in(file(".")).
74+
lazy val `dotty-compiler` = project.in(file(".")).
6675
dependsOn(`dotty-interfaces`).
76+
dependsOn(`dotty-library`).
77+
settings(sourceStructure).
6778
settings(
6879
overrideScalaVersionSetting,
6980

70-
// set sources to src/, tests to test/ and resources to resources/
71-
scalaSource in Compile := baseDirectory.value / "src",
72-
javaSource in Compile := baseDirectory.value / "src",
73-
scalaSource in Test := baseDirectory.value / "test",
74-
javaSource in Test := baseDirectory.value / "test",
75-
resourceDirectory in Compile := baseDirectory.value / "resources",
81+
// necessary evil: dottydoc currently needs to be included in the dotty
82+
// project, for sbt integration
7683
unmanagedSourceDirectories in Compile := Seq((scalaSource in Compile).value),
7784
unmanagedSourceDirectories in Compile += baseDirectory.value / "dottydoc" / "src",
7885
unmanagedSourceDirectories in Test := Seq((scalaSource in Test).value),
@@ -130,7 +137,7 @@ object DottyBuild extends Build {
130137
val args = Def.spaceDelimited("<arg>").parsed
131138
val jars = Seq((packageBin in Compile).value.getAbsolutePath) ++
132139
getJarPaths(partestDeps.value, ivyPaths.value.ivyHome)
133-
val dottyJars = "-dottyJars " + (jars.length + 1) + " dotty.jar" + " " + jars.mkString(" ")
140+
val dottyJars = "-dottyJars " + (jars.length + 2) + " dotty.jar dotty-lib.jar" + " " + jars.mkString(" ")
134141
// Provide the jars required on the classpath of run tests
135142
runTask(Test, "dotty.partest.DPConsoleRunner", dottyJars + " " + args.mkString(" "))
136143
},
@@ -211,17 +218,26 @@ object DottyBuild extends Build {
211218
).
212219
settings(publishing)
213220

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

217233
lazy val `dotty-sbt-bridge` = project.in(file("sbt-bridge")).
218-
dependsOn(dotty).
234+
dependsOn(`dotty-compiler`).
219235
settings(
220236
overrideScalaVersionSetting,
221237

222238
cleanSbtBridge := {
223239
val dottyBridgeVersion = version.value
224-
val dottyVersion = (version in dotty).value
240+
val dottyVersion = (version in `dotty-compiler`).value
225241
val classVersion = System.getProperty("java.class.version")
226242

227243
val sbtV = sbtVersion.value
@@ -335,11 +351,11 @@ object DottyInjectedPlugin extends AutoPlugin {
335351
)))
336352

337353
lazy val `dotty-bench` = project.in(file("bench")).
338-
dependsOn(dotty % "compile->test").
354+
dependsOn(`dotty-compiler` % "compile->test").
339355
settings(
340356
overrideScalaVersionSetting,
341357

342-
baseDirectory in (Test,run) := (baseDirectory in dotty).value,
358+
baseDirectory in (Test,run) := (baseDirectory in `dotty-compiler`).value,
343359

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

477-
val compilerCp = Attributed.data((fullClasspath in (dotty, Compile)).value)
493+
val compilerCp = Attributed.data((fullClasspath in (`dotty-compiler`, Compile)).value)
478494
val cpStr = cpToString(classpath ++ compilerCp)
479495

480496
// 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)