aboutsummaryrefslogtreecommitdiff
path: root/sbt-bridge/bridge/src/sbt-test/source-dependencies/java-basic/test
blob: 9dac4073510ccca9529da14530d87840dea8e50c (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# Basic test for Java dependency tracking
> 'eval System.setProperty("xsbt.inc.debug", "true")'

# A is a basic Java file with no dependencies.  Just a basic check for Java compilation
$ copy-file changes/A.java src/main/java/a/A.java
> compile

# A2 is a basic Java file with no dependencies.  This is added to verify
# that classes are properly mapped back to their source.
# (There are two files named A.java now, one in a/ and one in a/b)
$ copy-file changes/A2.java src/main/java/a/b/A.java
> compile

# This adds B, another basic Java file with no dependencies
$ copy-file changes/B1.java src/main/java/a/b/B.java
> compile

# Now, modify B so that it depends on a.A
# This ensures that dependencies on a source not included in the compilation
# (a/A.java has not changed) are tracked
$ copy-file changes/B2.java src/main/java/a/b/B.java
> compile

# Remove a.b.A and there should be no problem compiling, since B should
# have recorded a dependency on a.A and not a.b.A
$ delete src/main/java/a/b/A.java
> compile

# Remove a.A and B should be recompiled if the dependency on a.A was properly
# recorded.  This should be a compile error, since we haven't updated B to not
# depend on A
$ delete src/main/java/a/A.java
-> compile

# Replace B with a new B that doesn't depend on a.A and so it should compile
# It shouldn't run though, because it doesn't have a main method
$ copy-file changes/B1.java src/main/java/a/b/B.java
> compile
-> run


# Replace B with a new B that has a main method and should therefore run
# if the main method was properly detected
$ copy-file changes/B3.java src/main/java/a/b/B.java
> run