mirror of https://github.com/sbt/sbt.git
Added tests for latest partial recompilation fixes.
git-svn-id: https://simple-build-tool.googlecode.com/svn/trunk@860 d89573ee-9141-11dd-94d4-bdf5e562f29c
This commit is contained in:
parent
6b2c36d0ef
commit
d746a13232
|
|
@ -0,0 +1,4 @@
|
|||
object A
|
||||
{
|
||||
val x: Int = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A
|
||||
{
|
||||
val x: Int = B.y
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A
|
||||
{
|
||||
val x: String = B.y
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B
|
||||
{
|
||||
val y: String = "4"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B
|
||||
{
|
||||
val y: Int = 5
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
project.name=test
|
||||
project.version=1.0
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
# This test checks that when a source file included in a partial recompilation adds a dependency on
|
||||
# a file not included in the partial recompilation, the dependency is properly recorded.
|
||||
|
||||
# B and A are independent, so both should compile successfully
|
||||
$ copy-file changes/A1.scala src/main/scala/A.scala
|
||||
[success]
|
||||
$ copy-file changes/B1.scala src/main/scala/B.scala
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
|
||||
|
||||
# A now depends on B and to check that it was recompiled, we mismatch the types, which should fail
|
||||
$ copy-file changes/A2.scala src/main/scala/A.scala
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
|
||||
|
||||
# We now correct the type so that it compiles successfully and this should introduce a dependency from A to B
|
||||
$ copy-file changes/A3.scala src/main/scala/A.scala
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
|
||||
|
||||
# If the dependency from A to B was properly introduced, changing the type of B.y to Int should make
|
||||
# the following statement in A a compiler error:
|
||||
# val x: String = B.y
|
||||
$ copy-file changes/B2.scala src/main/scala/B.scala
|
||||
[success]
|
||||
$ pause
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
|
||||
# verify this was the correct result by doing a clean+compile
|
||||
>clean
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
public class J
|
||||
{
|
||||
public static final int x = 3;
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
public class J
|
||||
{
|
||||
public static final String x = "3";
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object S
|
||||
{
|
||||
val y: Int = J.x
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
project.name=Java static test
|
||||
project.version=9.5.3
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
# When a Java class is loaded from a class file and not parsed from a source file, scalac reports
|
||||
# the statics as an object without a file and so the Analyzer must know to look for the
|
||||
# object's linked class.
|
||||
# This test verifies this happens.
|
||||
# The test compiles a Java class with a static field.
|
||||
# It then adds a Scala object that references the static field. Because the object only depends on a
|
||||
# static member and because the Java source is not included in the compilation (since it didn't change),
|
||||
# this triggers the special case above.
|
||||
|
||||
# add and compile the Java source
|
||||
$ copy-file changes/J1.java src/main/java/J.java
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
|
||||
# add and compile the Scala source
|
||||
$ copy-file changes/S.scala src/main/scala/S.scala
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
|
||||
# change the Java source so that a compile error should occur if S.scala is also recompiled (which will happen if the dependency was properly recorded)
|
||||
$ copy-file changes/J2.java src/main/java/J.java
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
|
||||
# verify it should have failed by doing a full recompilation
|
||||
> clean
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
Loading…
Reference in New Issue