diff options
Diffstat (limited to 'sbt-bridge/src/sbt-test/source-dependencies/java-basic')
7 files changed, 92 insertions, 0 deletions
diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A.java b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A.java new file mode 100644 index 000000000..c84f997f4 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A.java @@ -0,0 +1,6 @@ +package a; + +public class A +{ + public static int x() { return 3; } +}
\ No newline at end of file diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A2.java b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A2.java new file mode 100644 index 000000000..36270f805 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/A2.java @@ -0,0 +1,6 @@ +package a.b; + +public class A +{ + public static int x() { return 3; } +}
\ No newline at end of file diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B1.java b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B1.java new file mode 100644 index 000000000..ec9a67e1a --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B1.java @@ -0,0 +1,6 @@ +package a.b; + +public class B +{ + public int y() { return 3; } +}
\ No newline at end of file diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B2.java b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B2.java new file mode 100644 index 000000000..551900114 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B2.java @@ -0,0 +1,6 @@ +package a.b; + +public class B +{ + public int y() { return a.A.x(); } +}
\ No newline at end of file diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B3.java b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B3.java new file mode 100644 index 000000000..1ec729b74 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/changes/B3.java @@ -0,0 +1,6 @@ +package a.b; + +public class B +{ + public static void main(String[] args) {} +}
\ No newline at end of file diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/project/DottyInjectedPlugin.scala b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/project/DottyInjectedPlugin.scala new file mode 100644 index 000000000..3433779b6 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/project/DottyInjectedPlugin.scala @@ -0,0 +1,17 @@ +import sbt._ +import Keys._ + +object DottyInjectedPlugin extends AutoPlugin { + override def requires = plugins.JvmPlugin + override def trigger = allRequirements + + override val projectSettings = Seq( + scalaVersion := "0.1-SNAPSHOT", + scalaOrganization := "ch.epfl.lamp", + scalacOptions += "-language:Scala2", + scalaBinaryVersion := "2.11", + autoScalaLibrary := false, + libraryDependencies ++= Seq("org.scala-lang" % "scala-library" % "2.11.5"), + scalaCompilerBridgeSource := ("ch.epfl.lamp" % "dotty-bridge" % "0.1.1-SNAPSHOT" % "component").sources() + ) +} diff --git a/sbt-bridge/src/sbt-test/source-dependencies/java-basic/test b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/test new file mode 100644 index 000000000..9dac40735 --- /dev/null +++ b/sbt-bridge/src/sbt-test/source-dependencies/java-basic/test @@ -0,0 +1,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
\ No newline at end of file |