Skip to content

Commit c488e01

Browse files
authored
Merge pull request #1636 from dotty-staging/topic/restructure-attempt2
Restructuring repo and issues
2 parents 34d64f3 + 9222af0 commit c488e01

File tree

1,158 files changed

+1261
-1159
lines changed

Some content is hidden

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

1,158 files changed

+1261
-1159
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
*.log
44
*.swp
55
*~
6+
tags
67

78
# sbt specific
89
dist/*
@@ -31,6 +32,7 @@ classes/
3132

3233
# Partest
3334
dotty.jar
35+
dotty-lib.jar
3436
tests/partest-generated/
3537
tests/locks/
3638
/test-classes/

bench/src/test/scala/Benchmarks.scala renamed to bench/test/dotty/tools/benchmarks/Benchmarks.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
package dotty.tools.benchmarks
22

3-
43
import org.scalameter.Key.reports._
54
import org.scalameter.PerformanceTest.OnlineRegressionReport
65
import org.scalameter.api._
76
import org.scalameter.{Context, History, currentContext, persistence}
87
import org.scalameter.reporting.RegressionReporter.Tester
9-
import test.CompilerTest
8+
import dotty.tools.dotc.CompilerTest
109

1110
import scala.io.Source
1211

@@ -46,13 +45,14 @@ object BenchTests extends OnlineRegressionReport {
4645
implicit val defaultOptions = List("-d", outputDir)
4746
val scala2mode = List("-language:Scala2")
4847

49-
val dottyDir = "./src/dotty/"
48+
val dottyDir = "../compiler/src/dotty/"
5049

51-
val stdlibFiles = Source.fromFile("./test/dotc/scala-collections.whitelist", "UTF8").getLines()
50+
val stdlibFiles = Source.fromFile("../compiler/test/dotc/scala-collections.whitelist", "UTF8").getLines()
5251
.map(_.trim) // allow identation
5352
.filter(!_.startsWith("#")) // allow comment lines prefixed by #
5453
.map(_.takeWhile(_ != '#').trim) // allow comments in the end of line
5554
.filter(_.nonEmpty)
55+
.map("." + _)
5656
.toList
5757

5858
def stdLib = compiler.compileList("compileStdLib", stdlibFiles, "-migration" :: scala2mode)

bin/common

Lines changed: 17 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ function build_jar {
5858

5959
local sedjar="$3"
6060
if [ "$sedjar" == "" ]; then
61-
sedjar="/.*\.jar/p"
61+
sedjar="/tests/d; /javadoc/d; /.*\.jar/p"
6262
fi
6363

6464
if [ "$jar" == "" ]; then
@@ -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,12 +85,16 @@ function build_all {
8485
INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)
8586
printf "done\n"
8687

87-
printf "Building dotty..."
88-
MAIN_JAR=$(build_jar package "target/scala-$SCALA_BINARY_VERSION")
88+
printf "Building dotty-compiler..."
89+
MAIN_JAR=$(build_jar dotty-compiler/package "compiler/target/scala-$SCALA_BINARY_VERSION")
90+
printf "done\n"
91+
92+
printf "Building dotty library..."
93+
DOTTY_LIB_JAR=$(build_jar dotty-library/package "library/target/scala-$SCALA_BINARY_VERSION")
8994
printf "done\n"
9095

9196
printf "Building tests..."
92-
TEST_JAR=$(build_jar test:package "target/scala-$SCALA_BINARY_VERSION" '/dotty.*-tests\.jar/p')
97+
TEST_JAR=$(build_jar test:package "compiler/target/scala-$SCALA_BINARY_VERSION" '/dotty.*-tests\.jar/p')
9398
printf "done\n"
9499

95100
update_packages
@@ -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
@@ -118,15 +124,17 @@ function check_jar {
118124
local new_files="$(find "$DOTTY_ROOT/$3" \( -iname "*.scala" -o -iname "*.java" \) -newer "$2")"
119125
if [ ! -z "$new_files" ]; then
120126
printf "New files detected in $1, rebuilding..."
127+
rm $2
121128
eval "$4"
122129
printf "done\n"
123130
update_packages
124131
fi
125132
}
126133

127-
check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
128-
check_jar "dotty" $MAIN_JAR "src" 'MAIN_JAR=$(build_jar package target/scala-$SCALA_BINARY_VERSION)'
129-
check_jar "dotty-tests" $TEST_JAR "test" 'TEST_JAR=$(build_jar test:package target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
134+
check_jar "dotty-interfaces" $INTERFACES_JAR "interfaces/src" 'INTERFACES_JAR=$(build_jar dotty-interfaces/package interfaces/target)'
135+
check_jar "dotty-compiler" $MAIN_JAR "compiler/src" 'MAIN_JAR=$(build_jar dotty-compiler/package compiler/target/scala-$SCALA_BINARY_VERSION)'
136+
check_jar "dotty-library" $DOTTY_LIB_JAR "library/src" 'DOTTY_LIB_JAR=$(build_jar dotty-library/package library/target/scala-$SCALA_BINARY_VERSION)'
137+
check_jar "dotty-tests" $TEST_JAR "compiler/test" 'TEST_JAR=$(build_jar dotty-compiler/test:package compiler/target/scala-$SCALA_BINARY_VERSION /dotty.*-tests\.jar/p)'
130138

131139
# Autodetecting the scala-library location, in case it wasn't provided by an environment variable
132140
if [ "$SCALA_LIBRARY_JAR" == "" ]; then

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

bin/dotr

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,7 @@ DOTTY_ROOT="$( cd "$DOTTY_ROOT" >& /dev/null && pwd )/.." # absolute
1111
# Load common functions and variables
1212
source $DOTTY_ROOT/bin/common
1313

14-
# CLASS_PATH is derived from the DOTTY_ROOT and SCALA_LIBRARY_JAR
15-
CLASS_PATH="-Xbootclasspath/a:.:$DOTTY_ROOT/target/scala-$SCALA_BINARY_VERSION/classes/:.:$SCALA_LIBRARY_JAR"
14+
CLASS_PATH="-classpath .:$DOTTY_LIB_JAR:.:$SCALA_LIBRARY_JAR"
1615

1716
function runMain {
1817
local jbin=$(which "java")

test/scripts/TestDotc.scala renamed to bin/test/TestScripts.scala

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ import scala.io.Source
77
import scala.sys.process.{Process, ProcessLogger}
88
import java.io.{File => JFile, FileNotFoundException}
99

10-
class TestDotc {
10+
class TestScripts {
1111
private val lineSep = util.Properties.lineSeparator
1212
private def doUnlessWindows(op: => Unit) =
1313
if (!System.getProperty("os.name").toLowerCase.contains("windows"))
@@ -28,11 +28,13 @@ class TestDotc {
2828
}
2929

3030
try {
31-
for (jar <- Source.fromFile(".packages").getLines())
31+
for (jar <- Source.fromFile("./.packages").getLines())
3232
delete(jar)
3333

34-
delete(".packages")
35-
delete("src/dotty/tools/dotc/Dummy.scala")
34+
delete("./.packages")
35+
delete("./compiler/src/dotty/tools/dotc/Dummy.scala")
36+
delete("./HelloWorld.class")
37+
delete("./HelloWorld$.class")
3638
} catch {
3739
case _: FileNotFoundException => ()
3840
}
@@ -45,15 +47,15 @@ class TestDotc {
4547
* execute it using dotr
4648
*/
4749
@Test def buildAndRunHelloWorld = doUnlessWindows {
48-
val (retDotc, dotcOutput) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
50+
val (retDotc, dotcOutput) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
4951

5052
// Check correct output of building and running dotc
5153
assert(
5254
retDotc == 0,
5355
s"bin/dotc script did not run properly. Output:$lineSep$dotcOutput"
5456
)
5557

56-
val (retDotr, dotrOutput) = executeScript("bin/dotr HelloWorld")
58+
val (retDotr, dotrOutput) = executeScript("./bin/dotr HelloWorld")
5759
assert(
5860
retDotr == 0 && dotrOutput == "hello world",
5961
s"Running hello world exited with status: $retDotr and output: $dotrOutput"
@@ -64,24 +66,24 @@ class TestDotc {
6466
* rebuild dotty if needed
6567
*/
6668
@Test def rebuildIfNecessary = doUnlessWindows {
67-
val (retFirstBuild, _) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
68-
assert(retFirstBuild == 0, "building dotc failed")
69+
val (retFirstBuild, out1) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
70+
assert(retFirstBuild == 0, s"building dotc failed: $out1")
6971

70-
// Create a new file
71-
new JFile("src/dotty/tools/dotc/Dummy.scala").createNewFile()
72+
// Create a new file to force rebuild
73+
new JFile("./compiler/src/dotty/tools/dotc/Dummy.scala").createNewFile()
7274

73-
val (retSecondBuild, output) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
75+
val (retSecondBuild, output) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
7476
assert(
7577
retSecondBuild == 0 && output.contains("rebuilding"),
7678
s"Rebuilding the tool should result in jar files being rebuilt. Status: $retSecondBuild, output:$lineSep$output")
7779
}
7880

7981
/** if no changes to dotty, dotc script should be fast */
8082
@Test def beFastOnNoChanges = doUnlessWindows {
81-
val (retFirstBuild, _) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
83+
val (retFirstBuild, _) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
8284
assert(retFirstBuild == 0, "building dotc failed")
8385

84-
val (ret, output) = executeScript("bin/dotc tests/pos/HelloWorld.scala")
86+
val (ret, output) = executeScript("./bin/dotc ./tests/pos/HelloWorld.scala")
8587
assert(
8688
ret == 0 && !output.contains("rebuilding"),
8789
s"Project recompiled when it didn't need to be. Status $ret, output:$lineSep$output")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)