mirror of https://github.com/sbt/sbt.git
* Added source-dependency tests created when testing build manager
* Updated remaining scripted tests for 0.6.x and new scripted framework- test/* tests need to be rewritten * removed FileUtilities.sbtJar since sbt is no longer one jar * updated PluginProject to work with 0.6.x
This commit is contained in:
parent
4ee8c92bec
commit
5b1e26660c
|
|
@ -53,7 +53,7 @@ class SbtProject(info: ProjectInfo) extends DefaultProject(info) with test.SbtSc
|
|||
//testing
|
||||
val scalacheck = "org.scala-tools.testing" %% "scalacheck" % "1.6"
|
||||
|
||||
val ivy = "org.apache.ivy" % "ivy" % "2.0.0" intransitive()
|
||||
val ivy = "org.apache.ivy" % "ivy" % "2.1.0" intransitive()
|
||||
val jsch = "com.jcraft" % "jsch" % "0.1.31" intransitive()
|
||||
val jetty = "org.mortbay.jetty" % "jetty" % "6.1.14" % "optional"
|
||||
|
||||
|
|
|
|||
|
|
@ -210,7 +210,9 @@ class PluginDefinition(val info: ProjectInfo) extends InternalProject with Basic
|
|||
}
|
||||
class PluginProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def unmanagedClasspath = super.unmanagedClasspath +++ Path.lazyPathFinder(Path.fromFile(FileUtilities.sbtJar) :: Nil)
|
||||
override def moduleID = normalizedName
|
||||
override def buildScalaVersion = defScalaVersion.value
|
||||
override def unmanagedClasspath = super.unmanagedClasspath +++ Path.lazyPathFinder(info.app.mainClasspath.map(Path.fromFile))
|
||||
override def packageAction = packageSrc dependsOn(test)
|
||||
override def packageSrcJar = jarPath
|
||||
override def useMavenConfigurations = true
|
||||
|
|
|
|||
|
|
@ -806,8 +806,6 @@ object FileUtilities
|
|||
def classLocation[T](implicit mf: scala.reflect.Manifest[T]): URL = classLocation(mf.erasure)
|
||||
def classLocationFile[T](implicit mf: scala.reflect.Manifest[T]): File = classLocationFile(mf.erasure)
|
||||
|
||||
/** The location of the jar containing this class.*/
|
||||
lazy val sbtJar: File = classLocationFile(getClass)
|
||||
lazy val scalaLibraryJar: File = classLocationFile[scala.ScalaObject]
|
||||
lazy val scalaCompilerJar: File = classLocationFile[scala.tools.nsc.Settings]
|
||||
def scalaJars: Iterable[File] = List(scalaLibraryJar, scalaCompilerJar)
|
||||
|
|
|
|||
|
|
@ -33,7 +33,7 @@ class JettyRunner(configuration: JettyConfiguration) extends ExitHook
|
|||
val baseLoader = this.getClass.getClassLoader
|
||||
val classpathURLs = jettyClasspath.get.map(_.asURL).toSeq
|
||||
val loader: ClassLoader = new java.net.URLClassLoader(classpathURLs.toArray, baseLoader)
|
||||
val lazyLoader = new LazyFrameworkLoader(implClassName, Array(FileUtilities.sbtJar.toURI.toURL), loader, baseLoader)
|
||||
val lazyLoader = new LazyFrameworkLoader(implClassName, Array(FileUtilities.classLocation[Stoppable].toURI.toURL), loader, baseLoader)
|
||||
val runner = ModuleUtilities.getObject(implClassName, lazyLoader).asInstanceOf[JettyRun]
|
||||
runner(configuration)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +0,0 @@
|
|||
import sbt._
|
||||
|
||||
class TestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def unmanagedClasspath = super.unmanagedClasspath +++ Path.fromFile(FileUtilities.sbtJar)
|
||||
}
|
||||
|
|
@ -10,6 +10,7 @@ import scala.tools.nsc.{Interpreter, Settings}
|
|||
class Foo {
|
||||
val settings = new Settings()
|
||||
settings.classpath.value = location(classOf[Holder])
|
||||
settings.bootclasspath.value = settings.bootclasspath.value + File.pathSeparator + location(classOf[ScalaObject])
|
||||
val inter = new Interpreter(settings)
|
||||
|
||||
def eval(code: String): Any = {
|
||||
|
|
|
|||
|
|
@ -5,7 +5,7 @@ class TestUse(info: ProjectInfo) extends DefaultProject(info)
|
|||
{
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)(Patterns(false, Resolver.mavenStyleBasePattern))
|
||||
val mavenC = "org.example" % "test-ivy" % "1.0"
|
||||
val mavenT = "org.example" % "test-ivy" % "1.0" % "test"
|
||||
val mavenR = "org.example" % "test-ivy" % "1.0" % "runtime"
|
||||
val mavenC = "org.example" %% "test-ivy" % "1.0"
|
||||
val mavenT = "org.example" %% "test-ivy" % "1.0" % "test"
|
||||
val mavenR = "org.example" %% "test-ivy" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=test-ivy
|
||||
project.organization=org.example
|
||||
project.version=1.0
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=test-ivy-use
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -4,7 +4,7 @@ import sbt._
|
|||
class TestUse(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
val publishTo = Resolver.file("test-repo", path("repo").asFile)
|
||||
val mavenC = "org.example" % "test" % "1.0"
|
||||
val mavenT = "org.example" % "test" % "1.0" % "test"
|
||||
val mavenR = "org.example" % "test" % "1.0" % "runtime"
|
||||
val mavenC = "org.example" %% "test" % "1.0"
|
||||
val mavenT = "org.example" %% "test" % "1.0" % "test"
|
||||
val mavenR = "org.example" %% "test" % "1.0" % "runtime"
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=test-use
|
||||
project.organization=test
|
||||
project.version=1.0
|
||||
|
|
@ -2,12 +2,14 @@
|
|||
|
||||
$ copy-file changes/maven/Published.scala src/main/scala/Published.scala
|
||||
> publish
|
||||
$ delete src project lib_managed
|
||||
|
||||
|
||||
# get and compile against each published jar with managedStyle = ManagedStyle.Maven
|
||||
|
||||
> set project.name test-use
|
||||
> set project.organization test
|
||||
$ delete src project/build lib_managed
|
||||
$ copy-file changes/maven/TestUse.scala project/build/TestUse.scala
|
||||
$ copy-file changes/maven/use.build.properties project/build.properties
|
||||
> reload
|
||||
$ copy-file changes/maven/Use.scala src/main/scala/Use.scala
|
||||
|
||||
|
|
@ -15,12 +17,12 @@ $ copy-file changes/maven/Use.scala src/main/scala/Use.scala
|
|||
|
||||
> update
|
||||
> compile
|
||||
$ delete src project lib_managed repo
|
||||
|
||||
|
||||
# publish a jar with PublishedIvy with managedStyle = ManagedStyle.Ivy
|
||||
|
||||
$ copy-file changes/ivy/publish.build.properties project/build.properties
|
||||
> set project.name test-ivy
|
||||
> set project.organization org.example
|
||||
$ delete src project/build lib_managed repo
|
||||
$ copy-file changes/ivy/TestPublish.scala project/build/TestPublish.scala
|
||||
> reload
|
||||
$ copy-file changes/ivy/Published.scala src/main/scala/Published.scala
|
||||
|
|
@ -28,9 +30,10 @@ $ copy-file changes/ivy/Published.scala src/main/scala/Published.scala
|
|||
|
||||
# get and compile against each published jar with managedStyle = ManagedStyle.Ivy
|
||||
|
||||
$ delete src project lib_managed
|
||||
> set project.name test-ivy-use
|
||||
> set project.organization test
|
||||
$ delete src project/build lib_managed
|
||||
$ copy-file changes/ivy/TestUse.scala project/build/TestUse.scala
|
||||
$ copy-file changes/ivy/use.build.properties project/build.properties
|
||||
> reload
|
||||
$ copy-file changes/ivy/Use.scala src/main/scala/Use.scala
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
# and check that they are not downloaded
|
||||
|
||||
$ touch transitive
|
||||
$ reload
|
||||
> reload
|
||||
|
||||
> update
|
||||
|
||||
|
|
|
|||
|
|
@ -9,6 +9,6 @@ class UseColor(info: ProjectInfo) extends DefaultProject(info)
|
|||
val repo = Resolver.file("test-repo", ("repo" / "test").asFile)
|
||||
def color = FileUtilities.readString("color".asFile, log).right.getOrElse(error("No color specified"))
|
||||
override def libraryDependencies = Set(
|
||||
"org.scala-tools.sbt" % "test-ivy-extra" %"1.0" extra("e:color" -> color)
|
||||
"org.scala-tools.sbt" %% "test-ivy-extra" %"1.0" extra("e:color" -> color)
|
||||
)
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
project.name=UseColor
|
||||
project.version=1.0
|
||||
project.organization=org.scala-tools.sbt
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
> publish
|
||||
> set project.name UseColor
|
||||
|
||||
$ delete project/build/
|
||||
$ copy-file changes/UseColor.scala project/build/UseColor.scala
|
||||
$ copy-file changes/blue color
|
||||
$ copy-file changes/build.properties project/build.properties
|
||||
> reload
|
||||
|
||||
-> update
|
||||
|
|
|
|||
|
|
@ -1,21 +1,21 @@
|
|||
# This should fail because the sub project declares a dependency that exists in an extra repository, which we haven't declared
|
||||
> update
|
||||
-> update
|
||||
|
||||
# Copy the project definition with the extra repository declared in the parent and reload
|
||||
$ copy-file changes/CorrectProject.scala project/build/src/TestProject.scala
|
||||
$ reload
|
||||
> reload
|
||||
|
||||
# Try updating again, which should work because the repository declared in the parent should be inherited by the child
|
||||
> update
|
||||
|
||||
# Copy the project definition with the extra repository declared in the child and parent and reload
|
||||
$ copy-file changes/CorrectProject2.scala project/build/src/TestProject.scala
|
||||
$ reload
|
||||
> reload
|
||||
|
||||
> update
|
||||
|
||||
# Copy the project definition with the extra repository declared in the child and reload
|
||||
$ copy-file changes/CorrectProject3.scala project/build/src/TestProject.scala
|
||||
$ reload
|
||||
> reload
|
||||
|
||||
> update
|
||||
|
|
@ -21,7 +21,7 @@
|
|||
$ touch useDefaultConfigurations
|
||||
|
||||
# Reload for change to take effect
|
||||
$ reload
|
||||
> reload
|
||||
|
||||
|
||||
## Rerun test with useDefaultConfigurations=true
|
||||
|
|
|
|||
|
|
@ -11,4 +11,6 @@ class Test(info: ProjectInfo) extends DefaultProject(info)
|
|||
|
||||
val uniqueScala = "org.scala-lang" % "scala-compiler" % "2.8.0-20091017.011744-240"
|
||||
val otherDep = "org.scala-tools.sxr" % "sxr_2.7.5" % "0.2.3"
|
||||
|
||||
override def checkExplicitScalaDependencies = false
|
||||
}
|
||||
|
|
@ -2,13 +2,13 @@
|
|||
> clean
|
||||
|
||||
$ copy-file changes/WrongOrg.scala project/build/Test.scala
|
||||
$ reload
|
||||
> reload
|
||||
-> update
|
||||
|
||||
$ copy-file changes/WrongVersion.scala project/build/Test.scala
|
||||
$ reload
|
||||
> reload
|
||||
-> update
|
||||
|
||||
$ copy-file changes/WrongPattern.scala project/build/Test.scala
|
||||
$ reload
|
||||
> reload
|
||||
-> update
|
||||
|
|
|
|||
|
|
@ -3,4 +3,5 @@ import sbt._
|
|||
class LibTestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
lazy val useJar = task { injar.Test.other; None }
|
||||
override def disableCrossPaths = true
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import sbt._
|
||||
|
||||
class LibTestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def disableCrossPaths = true
|
||||
override def buildScalaVersion = defScalaVersion.value
|
||||
}
|
||||
|
|
@ -1,19 +1,14 @@
|
|||
# this step builds a test jar for use by the project definition
|
||||
> package
|
||||
[success]
|
||||
|
||||
$ delete project/build
|
||||
$ copy-file target/definition-lib-forname-test-1.0.jar project/build/lib/test.jar
|
||||
[success]
|
||||
|
||||
$ copy-file changes/LibTestProject.scala project/build/src/LibTestProject.scala
|
||||
[success]
|
||||
|
||||
# the copied project definition depends on the Test module in test.jar and will
|
||||
# fail to compile if sbt did not put the jars in project/build/lib/ on the compile classpath
|
||||
$ reload
|
||||
[success]
|
||||
> reload
|
||||
|
||||
# The project definition uses the class in test.jar and will fail here if sbt did not put the
|
||||
# jars in project/build/lib on the runtime classpath
|
||||
> use-jar
|
||||
[success]
|
||||
> use-jar
|
||||
|
|
@ -3,7 +3,7 @@ import sbt._
|
|||
class FlatProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def useMavenConfigurations = true
|
||||
val sc = "org.scalacheck" % "scalacheck" % "1.5" % "test->default"
|
||||
val sc = "org.scalacheck" % "scalacheck" % "1.5" % "test"
|
||||
|
||||
def sourceFilter = "*.java" | "*.scala"
|
||||
override def mainSources = descendents(sourcePath ##, sourceFilter)
|
||||
|
|
|
|||
|
|
@ -1,25 +1,19 @@
|
|||
> ++2.7.7
|
||||
|
||||
# This test verifies that sbt works after the source hierarchy has been flattened and merged
|
||||
# so that resources and Java and Scala sources are side by side under src/
|
||||
|
||||
> update
|
||||
[success]
|
||||
|
||||
> test
|
||||
[success]
|
||||
|
||||
# This part verifies that the package-src action works properly under a flattened/merged source hierarchy
|
||||
|
||||
> package-project
|
||||
[success]
|
||||
|
||||
$ delete src
|
||||
[success]
|
||||
|
||||
> test
|
||||
[failure]
|
||||
-> test
|
||||
|
||||
> unpackage-project
|
||||
[success]
|
||||
|
||||
> test
|
||||
[success]
|
||||
|
|
|
|||
|
|
@ -2,5 +2,7 @@ import sbt._
|
|||
|
||||
class LibTestProject(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def disableCrossPaths = true
|
||||
override def buildScalaVersion = defScalaVersion.value
|
||||
lazy val useJar = task { injar.Test.foo }
|
||||
}
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
import sbt._
|
||||
|
||||
class Test(info: ProjectInfo) extends DefaultProject(info)
|
||||
{
|
||||
override def disableCrossPaths = true
|
||||
override def buildScalaVersion = defScalaVersion.value
|
||||
}
|
||||
|
|
@ -1,19 +1,14 @@
|
|||
# this step builds a test jar for use by the project definition
|
||||
> package
|
||||
[success]
|
||||
|
||||
$ delete project/build
|
||||
$ copy-file target/definition-lib-test-1.0.jar project/build/lib/test.jar
|
||||
[success]
|
||||
|
||||
$ copy-file changes/LibTestProject.scala project/build/src/LibTestProject.scala
|
||||
[success]
|
||||
|
||||
# the copied project definition depends on the Test module in test.jar and will
|
||||
# fail to compile if sbt did not put the jars in project/build/lib/ on the compile classpath
|
||||
$ reload
|
||||
[success]
|
||||
> reload
|
||||
|
||||
# The project definition uses the class in test.jar and will fail here if sbt did not put the
|
||||
# jars in project/build/lib on the runtime classpath
|
||||
> use-jar
|
||||
[success]
|
||||
> use-jar
|
||||
|
|
@ -6,4 +6,4 @@ class TestProject(info: ProjectInfo) extends DefaultProject(info)
|
|||
|
||||
trait NotAProject extends Project
|
||||
abstract class AnotherNonProject extends Project
|
||||
object YetAnotherNonProject extends DefaultProject(ProjectInfo(new java.io.File("."), Nil, None)(new ConsoleLogger))
|
||||
object YetAnotherNonProject extends DefaultProject(error("Shouldn't be called"))
|
||||
|
|
@ -1,31 +1,16 @@
|
|||
# There should be no ambiguity with a single project definition
|
||||
|
||||
$ copy-file changes/SingleProject.scala project/build/src/TestProject.scala
|
||||
[success]
|
||||
|
||||
$ reload
|
||||
[success]
|
||||
> reload
|
||||
|
||||
# Again, no ambiguity with a single project definition and any number of abstract classes/traits implementing Project
|
||||
|
||||
$ copy-file changes/SingleAndTraitProject.scala project/build/src/TestProject.scala
|
||||
[success]
|
||||
|
||||
$ reload
|
||||
[success]
|
||||
|
||||
# Multiple public projects should be an error
|
||||
|
||||
$ copy-file changes/MultiProject.scala project/build/src/TestProject.scala
|
||||
[success]
|
||||
|
||||
$ reload
|
||||
[failure]
|
||||
> reload
|
||||
|
||||
# One public project and any number of non-public projects should not be an error
|
||||
|
||||
$ copy-file changes/SinglePublicProject.scala project/build/src/TestProject.scala
|
||||
[success]
|
||||
> reload
|
||||
|
||||
$ reload
|
||||
[success]
|
||||
# Multiple public projects should be an error
|
||||
$ copy-file changes/MultiProject.scala project/build/src/TestProject.scala
|
||||
-> reload
|
||||
|
|
@ -1,2 +1 @@
|
|||
> check
|
||||
[success]
|
||||
> check
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
import sbt._
|
||||
|
||||
class Plugins(info: ProjectInfo) extends PluginDefinition(info)
|
||||
{
|
||||
def ivyCacheDirectory = outputPath / "ivy-cache"
|
||||
override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
|
||||
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
def projectRoot = Path.fromFile(info.projectPath.asFile.getParentFile.getParentFile)
|
||||
val publishTo = Resolver.file("test-repo", (projectRoot /"repo" / "test").asFile)
|
||||
|
||||
val plug = "test" % "plugins-test" % "1.0"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
import sbt._
|
||||
|
||||
trait TestPlugin extends DefaultProject
|
||||
{
|
||||
lazy val check = task { log.info("Test action"); None }
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
import sbt._
|
||||
|
||||
class UsePlugin(info: ProjectInfo) extends DefaultProject(info) with TestPlugin
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.version=1.0
|
||||
project.name=Plugins Test
|
||||
project.organization=test
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
import sbt._
|
||||
|
||||
class DefinePlugin(info: ProjectInfo) extends PluginProject(info)
|
||||
{
|
||||
def ivyCacheDirectory = outputPath / "ivy-cache"
|
||||
override def updateOptions = CacheDirectory(ivyCacheDirectory) :: super.updateOptions.toList
|
||||
|
||||
override def managedStyle = ManagedStyle.Ivy
|
||||
val publishTo = Resolver.file("test-repo", ("repo" / "test").asFile)
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
$ copy-file changes/TestPlugin.scala src/main/scala/TestPlugin.scala
|
||||
> publish
|
||||
|
||||
> set project.name use-plugin-test
|
||||
$ delete project/build
|
||||
$ copy-file changes/Plugins.scala project/plugins/Plugins.scala
|
||||
$ copy-file changes/UsePlugin.scala project/build/UsePlugin.scala
|
||||
|
||||
> reload
|
||||
> check
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait A {
|
||||
type S[_]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait B extends A {
|
||||
type F = S[Int]
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait A {
|
||||
type S
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=abstract-type
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
> +compile
|
||||
|
||||
# remove type arguments from S
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# Both A.scala and B.scala should be recompiled, producing a compile error
|
||||
-> +compile
|
||||
|
|
@ -3,37 +3,26 @@
|
|||
|
||||
# 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]
|
||||
> +compile
|
||||
|
||||
|
||||
# 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]
|
||||
-> +compile
|
||||
|
||||
|
||||
# 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]
|
||||
> +compile
|
||||
|
||||
|
||||
# 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]
|
||||
> compile
|
||||
[failure]
|
||||
-> +compile
|
||||
|
||||
# verify this was the correct result by doing a clean+compile
|
||||
>clean
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
> +clean
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A
|
||||
{
|
||||
def x(i: => String) = ()
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B
|
||||
{
|
||||
val x = A.x("3")
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A
|
||||
{
|
||||
def x(i: Function0[String]) = ()
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=by-name
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
> +compile
|
||||
|
||||
# change => Int to Function0
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# Both A.scala and B.scala need to be recompiled because the type has changed
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
object A
|
||||
{
|
||||
def x(f: String, g: Int): Int = g
|
||||
def x(f: Int, g: Int = 3): Int = g
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B
|
||||
{
|
||||
val y = A.x(5)
|
||||
}
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
object A
|
||||
{
|
||||
def x(f: String, g: Int = 3): Int = g
|
||||
def x(f: Int, g: Int): Int = g
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=default-params
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,11 @@
|
|||
# default parameters are only in 2.8
|
||||
> ++2.8.0-SNAPSHOT
|
||||
> compile
|
||||
|
||||
# switch which 'x' method has a default for the second parameter in A
|
||||
# this change is selected because of the encoding of default method names
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# Both A.scala and B.scala need to be recompiled because the parameter needs to be explicitly provided
|
||||
# and it should be a compile error
|
||||
-> compile
|
||||
|
|
@ -1,41 +1,19 @@
|
|||
$ copy-file changes/A.scala src/main/scala/A.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
$ copy-file changes/A2.scala src/main/scala/A.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
$ copy-file changes/B.scala src/main/scala/B.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[failure]
|
||||
-> +compile
|
||||
|
||||
$ copy-file changes/A.scala src/main/scala/A.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
$ delete src/main/scala/B.scala
|
||||
[success]
|
||||
|
||||
$ copy-file changes/A2.scala src/main/scala/A.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
$ copy-file changes/A.scala src/main/scala/A.scala
|
||||
[success]
|
||||
|
||||
$ copy-file changes/B.scala src/main/scala/B.scala
|
||||
[success]
|
||||
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object A {
|
||||
def x: List[Int] = List(3)
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object B {
|
||||
val y: List[Int] = A.x
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object A {
|
||||
def x: List[String] = List("3")
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=erasure
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
> +compile
|
||||
|
||||
$ copy-file changes/A.scala A.scala
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A {
|
||||
val x = 3
|
||||
val z: Int = B.y
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object B {
|
||||
val y = A.x
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object A {
|
||||
val x = "3"
|
||||
val z: String = B.y
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=no-false-error
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,5 @@
|
|||
> +compile
|
||||
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
> +compile
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
class A
|
||||
{
|
||||
implicit def e: E = new E
|
||||
def x(i: Int)(implicit y: E): String = ""
|
||||
}
|
||||
class E
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B extends A
|
||||
{
|
||||
val y = x(3)
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
class A
|
||||
{
|
||||
implicit def e: E = new E
|
||||
def x(i: Int)(y: E): String = ""
|
||||
}
|
||||
class E
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=implicit-params
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
> +compile
|
||||
|
||||
# make implicit parameters in A.x be explicit
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# Both A.scala and B.scala need to be recompiled because the parameter section is no longer implicit
|
||||
# and it should be a compile error
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class A
|
||||
{
|
||||
implicit def x(i: Int): String = i.toString
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B extends A
|
||||
{
|
||||
val x: String = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class A
|
||||
{
|
||||
def x(i: Int): String = i.toString
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=implicit
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
> +compile
|
||||
|
||||
# change A.x to be implicit
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# Both A.scala and B.scala need to be recompiled because a new implicit is available
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1 @@
|
|||
package a.b
|
||||
|
|
@ -0,0 +1 @@
|
|||
import a.b
|
||||
|
|
@ -0,0 +1 @@
|
|||
package a
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=import
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,8 @@
|
|||
> +compile
|
||||
|
||||
# shorten the package defined in A from 'a.b' to 'a'.
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
# 'import a.b' should now fail in B.scala
|
||||
# disabled because scalac doesn't track this dependency
|
||||
#-> +compile
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
object A
|
||||
{
|
||||
def x = 3
|
||||
//def x: String = 3
|
||||
//def x: String = "3"
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
object B
|
||||
{
|
||||
val y: Int = A.x
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
object A
|
||||
{
|
||||
//def x = 3
|
||||
def x: String = 3
|
||||
//def x: String = "3"
|
||||
}
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
object A
|
||||
{
|
||||
//def x = 3
|
||||
//def x: String = 3
|
||||
def x: String = "3"
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=intermediate-error
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,7 @@
|
|||
> +compile
|
||||
|
||||
$ copy-file changes/A2.scala A.scala
|
||||
-> +compile
|
||||
|
||||
$ copy-file changes/A3.scala A.scala
|
||||
-> +compile
|
||||
|
|
@ -2,60 +2,43 @@
|
|||
|
||||
# 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
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +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
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
# This adds B, another basic Java file with no dependencies
|
||||
$ copy-file changes/B1.java src/main/java/a/b/B.java
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +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
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +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
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +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
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
-> +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
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> run
|
||||
[failure]
|
||||
> +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
|
||||
[success]
|
||||
> run
|
||||
[success]
|
||||
> +run
|
||||
|
|
@ -9,24 +9,16 @@
|
|||
|
||||
# add and compile the Java source
|
||||
$ copy-file changes/J1.java src/main/java/J.java
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
# add and compile the Scala source
|
||||
$ copy-file changes/S.scala src/main/scala/S.scala
|
||||
[success]
|
||||
> compile
|
||||
[success]
|
||||
> +compile
|
||||
|
||||
# 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]
|
||||
-> +compile
|
||||
|
||||
# verify it should have failed by doing a full recompilation
|
||||
> clean
|
||||
[success]
|
||||
> compile
|
||||
[failure]
|
||||
> +clean
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class A
|
||||
{
|
||||
val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class B extends A
|
||||
{
|
||||
override val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
class A
|
||||
{
|
||||
lazy val x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=lazy-val
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
> +compile
|
||||
|
||||
# replace val x with lazy val x
|
||||
$ copy-file changes/A.scala A.scala
|
||||
|
||||
-> +compile
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait A {
|
||||
def x = 3
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait B extends A {
|
||||
override def x = super.x * 2
|
||||
}
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
trait C extends A {
|
||||
override def x = super.x + 5
|
||||
}
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// define the order
|
||||
trait D extends C with B
|
||||
|
|
@ -0,0 +1,2 @@
|
|||
// put a level in between D and its concrete class
|
||||
trait E extends D
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
object F extends E {
|
||||
def main(args: Array[String]) = assert(x == args(0).toInt, x)
|
||||
}
|
||||
|
|
@ -0,0 +1 @@
|
|||
trait D extends B with C
|
||||
|
|
@ -0,0 +1,3 @@
|
|||
project.name=lazy-val
|
||||
project.version=1.0
|
||||
project.scratch=true
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue