File tree Expand file tree Collapse file tree 7 files changed +55
-25
lines changed Expand file tree Collapse file tree 7 files changed +55
-25
lines changed Original file line number Diff line number Diff line change 1
1
package dotc
2
2
3
+ import dotty .Jars
3
4
import dotty .tools .dotc .CompilerTest
4
5
import org .junit .{Before , Test }
5
6
@@ -32,18 +33,28 @@ class tests extends CompilerTest {
32
33
)
33
34
34
35
val classPath = {
35
- val paths = List (
36
- " ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar" ,
37
- " ./target/scala-2.11/dotty-compiler_2.11-0.1-SNAPSHOT.jar" ,
38
- " ../interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
39
- ).map { p =>
36
+ val paths = Jars .dottyTestDeps map { p =>
40
37
val file = new JFile (p)
41
38
assert(
42
39
file.exists,
43
- s """ File " $p" couldn't be found. Run `packageAll` from build tool before testing """
40
+ s """ |File " $p" couldn't be found. Run `packageAll` from build tool before
41
+ |testing.
42
+ |
43
+ |If running without sbt, test paths need to be setup with sys.props:
44
+ |
45
+ | - dotty.jars.library
46
+ | - dotty.jars.compiler
47
+ | - dotty.jars.interfaces
48
+ | - dotty.jars.extras
49
+ |
50
+ |Where these all contain locations, except extras which is a comma
51
+ |separated list of jars.
52
+ |
53
+ |When compiling with eclipse, you need the sbt-interfaces jar, but
54
+ |it in extras. """
44
55
)
45
56
file.getAbsolutePath
46
- }. mkString(" :" )
57
+ } mkString (" :" )
47
58
48
59
List (" -classpath" , paths)
49
60
}
Original file line number Diff line number Diff line change
1
+ package dotty
2
+
3
+ /** Jars used when compiling test, defaults to sbt locations */
4
+ object Jars {
5
+ val dottyLib : String = sys.props.get(" dotty.jars.library" ) getOrElse {
6
+ " ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
7
+ }
8
+
9
+ val dottyCompiler : String = sys.props.get(" dotty.jars.compiler" ) getOrElse {
10
+ " ./target/scala-2.11/dotty-compiler_2.11-0.1-SNAPSHOT.jar"
11
+ }
12
+
13
+ val dottyInterfaces : String = sys.props.get(" dotty.jars.interfaces" ) getOrElse {
14
+ " ../interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
15
+ }
16
+
17
+ val dottyExtras : List [String ] = sys.props.get(" dotty.jars.extras" )
18
+ .map(_.split(" ," ).toList).getOrElse(Nil )
19
+
20
+ val dottyTestDeps : List [String ] =
21
+ dottyLib :: dottyCompiler :: dottyInterfaces :: dottyExtras
22
+ }
Original file line number Diff line number Diff line change @@ -23,10 +23,7 @@ class DottyTest extends ContextEscapeDetection{
23
23
import base .settings ._
24
24
val ctx = base.initialCtx.fresh
25
25
ctx.setSetting(ctx.settings.encoding, " UTF8" )
26
- ctx.setSetting(
27
- ctx.settings.classpath,
28
- " ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
29
- )
26
+ ctx.setSetting(ctx.settings.classpath, Jars .dottyLib)
30
27
// when classpath is changed in ctx, we need to re-initialize to get the
31
28
// correct classpath from PathResolver
32
29
base.initialize()(ctx)
Original file line number Diff line number Diff line change 1
- package dotty .tools
1
+ package dotty
2
+ package tools
2
3
3
4
import dotc .core ._
4
5
import dotc .core .Contexts ._
@@ -18,8 +19,7 @@ class ShowClassTests extends DottyTest {
18
19
ctx.setSetting(ctx.settings.encoding, " UTF8" )
19
20
ctx.setSetting(
20
21
ctx.settings.classpath,
21
- " ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar" +
22
- " :../interfaces/target/dotty-interfaces-0.1-SNAPSHOT.jar"
22
+ Jars .dottyLib + " :" + Jars .dottyInterfaces
23
23
)
24
24
base.initialize()(ctx)
25
25
ctx
Original file line number Diff line number Diff line change 1
- package dotty .tools
1
+ package dotty
2
+ package tools
2
3
package dotc
3
4
4
5
import org .junit .Test
@@ -20,9 +21,9 @@ class EntryPointsTest {
20
21
private val sources =
21
22
List (" ../tests/pos/HelloWorld.scala" ).map(p => new java.io.File (p).getPath())
22
23
private val dottyInterfaces =
23
- new java.io.File (" ../interfaces/dotty-interfaces-0.1-SNAPSHOT.jar " ).getPath
24
+ new java.io.File (Jars .dottyInterfaces ).getPath
24
25
private val dottyLibrary =
25
- new java.io.File (" ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar " ).getPath
26
+ new java.io.File (Jars .dottyLib ).getPath
26
27
private val args =
27
28
sources ++
28
29
List (" -d" , " ../out/" ) ++
Original file line number Diff line number Diff line change 1
- package dotty .tools .dotc
1
+ package dotty
2
+ package tools .dotc
2
3
3
4
import org .junit .Test
4
5
import org .junit .Assert ._
@@ -21,9 +22,9 @@ class InterfaceEntryPointTest {
21
22
val sources =
22
23
List (" ../tests/pos/HelloWorld.scala" ).map(p => new java.io.File (p).getPath())
23
24
val dottyInterfaces =
24
- new java.io.File (" ../interfaces/dotty-interfaces-0.1-SNAPSHOT.jar " ).getPath
25
+ new java.io.File (Jars .dottyInterfaces ).getPath
25
26
val dottyLibrary =
26
- new java.io.File (" ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar " ).getPath
27
+ new java.io.File (Jars .dottyLib ).getPath
27
28
28
29
val args =
29
30
sources ++
Original file line number Diff line number Diff line change 1
- package dotty .tools .dotc
1
+ package dotty
2
+ package tools .dotc
2
3
package repl
3
4
4
5
import core .Contexts .Context
@@ -23,10 +24,7 @@ class TestREPL(script: String) extends REPL {
23
24
override def context (ctx : Context ) = {
24
25
val fresh = ctx.fresh
25
26
fresh.setSetting(ctx.settings.color, " never" )
26
- fresh.setSetting(
27
- ctx.settings.classpath,
28
- " ../library/target/scala-2.11/dotty-library_2.11-0.1-SNAPSHOT.jar"
29
- )
27
+ fresh.setSetting(ctx.settings.classpath, Jars .dottyLib)
30
28
fresh.initialize()(fresh)
31
29
fresh
32
30
}
You can’t perform that action at this time.
0 commit comments