diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/changes/Client.scala b/sbt/src/sbt-test/source-dependencies/inherited-macros/changes/Client.scala new file mode 100644 index 000000000..19633db64 --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/changes/Client.scala @@ -0,0 +1,7 @@ +package macro + +object Client { + object RealClient extends Provider { + // Some comment... + } +} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt new file mode 100644 index 000000000..75588e23c --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt @@ -0,0 +1,9 @@ +// Check that a file has not been recompiled during last compilation +InputKey[Unit]("check-not-recompiled") <<= inputTask { (argTask: TaskKey[Seq[String]]) => + (argTask, compile in Compile) map { (args: Seq[String], a: sbt.inc.Analysis) => + assert(args.size == 1) + val fileCompilation = a.apis.internal.collect { case (file, src) if file.name.endsWith(args(0)) => src.compilation }.head + val lastCompilation = a.compilations.allCompilations.last + assert(fileCompilation.startTime != lastCompilation.startTime, "File has been recompiled during last compilation.") + } +} \ No newline at end of file diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Client.scala b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Client.scala new file mode 100644 index 000000000..6351461a7 --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Client.scala @@ -0,0 +1,7 @@ +package macro + +object Client { + object RealClient extends Provider { + + } +} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Foo.scala b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Foo.scala new file mode 100644 index 000000000..be7a40427 --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Foo.scala @@ -0,0 +1,5 @@ +package macro + +object Foo { + val c = Client.RealClient +} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-provider/src/main/scala/Provider.scala b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-provider/src/main/scala/Provider.scala new file mode 100644 index 000000000..14523f149 --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-provider/src/main/scala/Provider.scala @@ -0,0 +1,7 @@ +package macro +import scala.language.experimental.macros +import scala.reflect.macros._ + +abstract class Provider { + def notImplementedMacro = macro ??? +} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/pending b/sbt/src/sbt-test/source-dependencies/inherited-macros/pending new file mode 100644 index 000000000..9a6e7dfcf --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/pending @@ -0,0 +1,12 @@ +> macro-provider/compile + +> macro-client/compile + +# Introduce a comment in Client, which inherits a macro from Provider +$ copy-file changes/Client.scala macro-client/src/main/scala/Client.scala + +> macro-client/compile + +# Object Foo depends on Client via composition, thus a whitespace change to +# Client shouldn't trigger its recompilation +> check-not-recompiled Foo.scala diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/project/build.scala b/sbt/src/sbt-test/source-dependencies/inherited-macros/project/build.scala new file mode 100644 index 000000000..27a684ef8 --- /dev/null +++ b/sbt/src/sbt-test/source-dependencies/inherited-macros/project/build.scala @@ -0,0 +1,29 @@ +import sbt._ +import Keys._ + +object build extends Build { + val defaultSettings = Seq( + libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ )//, + //incOptions := incOptions.value.withNameHashing(true) + ) + + lazy val root = Project( + base = file("."), + id = "macro", + aggregate = Seq(macroProvider, macroClient), + settings = Defaults.defaultSettings ++ defaultSettings + ) + + lazy val macroProvider = Project( + base = file("macro-provider"), + id = "macro-provider", + settings = Defaults.defaultSettings ++ defaultSettings + ) + + lazy val macroClient = Project( + base = file("macro-client"), + id = "macro-client", + dependencies = Seq(macroProvider), + settings = Defaults.defaultSettings ++ defaultSettings + ) +}