From 9db4afd222ffd18d905eb7c7227c4626f3a9ce7d Mon Sep 17 00:00:00 2001 From: Mark Harrah Date: Wed, 23 Feb 2011 19:19:44 -0500 Subject: [PATCH] bring more integration tests back online with associated fixes --- compile/api/ClassToAPI.scala | 34 ++++++++++--------- main/Default.scala | 16 +++++++-- main/Package.scala | 4 +-- main/build/AggressiveCompile.scala | 9 +++-- .../compiler-project/run-test/build.sbt | 5 +++ .../run-test/project/build.properties | 3 -- .../run-test/project/build/P.scala | 8 ----- .../sbt-test/compiler-project/run-test/test | 19 +++++------ .../compiler-project/run2.8/build.sbt | 4 +++ .../run2.8/project/build.properties | 2 -- .../run2.8/project/build/A.scala | 7 ---- sbt/src/sbt-test/compiler-project/run2.8/test | 4 +-- .../java/analysis/project/build.properties | 5 --- sbt/src/sbt-test/java/analysis/test | 2 +- sbt/src/sbt-test/java/argfile/build.sbt | 12 +++++++ .../{src/ java test /a => changes}/A.java | 0 .../Test s.scala => changes/Test.scala} | 0 .../java/argfile/project/build.properties | 2 -- .../java/argfile/project/build/A.scala | 7 ---- sbt/src/sbt-test/java/argfile/test | 1 + .../java/basic/project/build.properties | 3 -- .../java/basic/src/main/java/test/R.java | 4 +++ sbt/src/sbt-test/java/basic/test | 2 +- .../java/options/project/build.properties | 5 --- .../project/build/src/JavaProject.scala | 9 ----- sbt/src/sbt-test/java/options/test | 11 +++--- .../scala-library/project/build.properties | 3 -- .../java/separate/project/build.properties | 2 -- .../project/build/src/TestProject.scala | 6 ---- .../java/separate/src/main/java/F.java | 5 --- .../java/separate/src/main/scala/Dual.scala | 11 ------ .../java/separate/src/main/scala/FImpl.scala | 3 -- sbt/src/sbt-test/java/separate/test | 4 --- .../sbt-test/java/track-anonymous/build.sbt | 11 ++++++ .../track-anonymous/project/build.properties | 2 -- .../project/build/AnonTest.scala | 13 ------- sbt/src/sbt-test/java/track-anonymous/test | 8 ++--- .../lazy-name/project/build.properties | 4 --- .../lazy-name/project/build/Test.scala | 6 ---- sbt/src/sbt-test/package/lazy-name/test | 17 ++++++++-- sbt/src/sbt-test/package/manifest/build.sbt | 22 ++++++++++++ .../package/manifest/project/build.properties | 4 --- .../build/src/ManifestTestProject.scala | 15 -------- sbt/src/sbt-test/package/resources/build.sbt | 16 +++++++++ .../resources/project/build.properties | 4 --- .../build/src/ManifestTestProject.scala | 15 -------- 46 files changed, 147 insertions(+), 202 deletions(-) create mode 100644 sbt/src/sbt-test/compiler-project/run-test/build.sbt delete mode 100644 sbt/src/sbt-test/compiler-project/run-test/project/build.properties delete mode 100644 sbt/src/sbt-test/compiler-project/run-test/project/build/P.scala create mode 100644 sbt/src/sbt-test/compiler-project/run2.8/build.sbt delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/project/build.properties delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/project/build/A.scala delete mode 100644 sbt/src/sbt-test/java/analysis/project/build.properties create mode 100644 sbt/src/sbt-test/java/argfile/build.sbt rename sbt/src/sbt-test/java/argfile/{src/ java test /a => changes}/A.java (100%) rename sbt/src/sbt-test/java/argfile/{src/ scala test /Test s.scala => changes/Test.scala} (100%) delete mode 100644 sbt/src/sbt-test/java/argfile/project/build.properties delete mode 100644 sbt/src/sbt-test/java/argfile/project/build/A.scala delete mode 100644 sbt/src/sbt-test/java/basic/project/build.properties delete mode 100644 sbt/src/sbt-test/java/options/project/build.properties delete mode 100644 sbt/src/sbt-test/java/options/project/build/src/JavaProject.scala delete mode 100644 sbt/src/sbt-test/java/scala-library/project/build.properties delete mode 100644 sbt/src/sbt-test/java/separate/project/build.properties delete mode 100644 sbt/src/sbt-test/java/separate/project/build/src/TestProject.scala delete mode 100644 sbt/src/sbt-test/java/separate/src/main/java/F.java delete mode 100644 sbt/src/sbt-test/java/separate/src/main/scala/Dual.scala delete mode 100644 sbt/src/sbt-test/java/separate/src/main/scala/FImpl.scala delete mode 100644 sbt/src/sbt-test/java/separate/test create mode 100644 sbt/src/sbt-test/java/track-anonymous/build.sbt delete mode 100644 sbt/src/sbt-test/java/track-anonymous/project/build.properties delete mode 100644 sbt/src/sbt-test/java/track-anonymous/project/build/AnonTest.scala delete mode 100755 sbt/src/sbt-test/package/lazy-name/project/build.properties delete mode 100644 sbt/src/sbt-test/package/lazy-name/project/build/Test.scala create mode 100644 sbt/src/sbt-test/package/manifest/build.sbt delete mode 100644 sbt/src/sbt-test/package/manifest/project/build.properties delete mode 100644 sbt/src/sbt-test/package/manifest/project/build/src/ManifestTestProject.scala create mode 100644 sbt/src/sbt-test/package/resources/build.sbt delete mode 100644 sbt/src/sbt-test/package/resources/project/build.properties delete mode 100644 sbt/src/sbt-test/package/resources/project/build/src/ManifestTestProject.scala diff --git a/compile/api/ClassToAPI.scala b/compile/api/ClassToAPI.scala index c2e6af2d5..8f2d68ec7 100644 --- a/compile/api/ClassToAPI.scala +++ b/compile/api/ClassToAPI.scala @@ -24,23 +24,24 @@ object ClassToAPI def toDefinitions(c: Class[_]): Seq[api.ClassLike] = { import api.DefinitionType.{ClassDef, Module, Trait} + val enclPkg = packageName(c) val mods = modifiers(c.getModifiers) - val acc = access(c.getModifiers) + val acc = access(c.getModifiers, enclPkg) val annots = annotations(c.getAnnotations) val name = c.getName val tpe = if(Modifier.isInterface(c.getModifiers)) Trait else ClassDef - lazy val (static, instance) = structure(c) + lazy val (static, instance) = structure(c, enclPkg) val cls = new api.ClassLike(tpe, strict(Empty), lzy(instance), typeParameters(c.getTypeParameters), name, acc, mods, annots) def makeStatic(s: api.Structure) = new api.ClassLike(Module, strict(Empty), strict(s), Array(), name, acc, mods, annots) cls :: static.map(makeStatic).toList } - def structure(c: Class[_]): (Option[api.Structure], api.Structure) = + def structure(c: Class[_], enclPkg: Option[String]): (Option[api.Structure], api.Structure) = { - val methods = mergeMap(c, c.getMethods, c.getDeclaredMethods, methodToDef) - val fields = mergeMap(c, c.getFields, c.getDeclaredFields, fieldToDef) - val constructors = mergeMap(c, c.getConstructors, c.getDeclaredConstructors, constructorToDef) + val methods = mergeMap(c, c.getMethods, c.getDeclaredMethods, methodToDef(enclPkg)) + val fields = mergeMap(c, c.getFields, c.getDeclaredFields, fieldToDef(enclPkg)) + val constructors = mergeMap(c, c.getConstructors, c.getDeclaredConstructors, constructorToDef(enclPkg)) val classes = merge[Class[_]](c, c.getClasses, c.getDeclaredClasses, toDefinitions, (_: Seq[Class[_]]).partition(isStatic), _.getEnclosingClass != c) val all = (methods ++ fields ++ constructors ++ classes) val parentTypes = parents(c) @@ -59,30 +60,30 @@ object ClassToAPI def upperBounds(ts: Array[Type]): api.Type = new api.Structure(lzy(types(ts)), emptyDefArray, emptyDefArray) - def fieldToDef(f: Field): api.FieldLike = + def fieldToDef(enclPkg: Option[String])(f: Field): api.FieldLike = { val name = f.getName - val accs = access(f.getModifiers) + val accs = access(f.getModifiers, enclPkg) val mods = modifiers(f.getModifiers) val annots = annotations(f.getDeclaredAnnotations) val tpe = reference(f.getGenericType) if(mods.isFinal) new api.Val(tpe, name, accs, mods, annots) else new api.Var(tpe, name, accs, mods, annots) } - def methodToDef(m: Method): api.Def = - defLike(m.getName, m.getModifiers, m.getDeclaredAnnotations, m.getTypeParameters, m.getParameterAnnotations, m.getGenericParameterTypes, Some(m.getGenericReturnType), m.getGenericExceptionTypes, m.isVarArgs) + def methodToDef(enclPkg: Option[String])(m: Method): api.Def = + defLike(m.getName, m.getModifiers, m.getDeclaredAnnotations, m.getTypeParameters, m.getParameterAnnotations, m.getGenericParameterTypes, Some(m.getGenericReturnType), m.getGenericExceptionTypes, m.isVarArgs, enclPkg) - def constructorToDef(c: Constructor[_]): api.Def = - defLike("", c.getModifiers, c.getDeclaredAnnotations, c.getTypeParameters, c.getParameterAnnotations, c.getGenericParameterTypes, None, c.getGenericExceptionTypes, c.isVarArgs) + def constructorToDef(enclPkg: Option[String])(c: Constructor[_]): api.Def = + defLike("", c.getModifiers, c.getDeclaredAnnotations, c.getTypeParameters, c.getParameterAnnotations, c.getGenericParameterTypes, None, c.getGenericExceptionTypes, c.isVarArgs, enclPkg) - def defLike[T <: GenericDeclaration](name: String, mods: Int, annots: Array[Annotation], tps: Array[TypeVariable[T]], paramAnnots: Array[Array[Annotation]], paramTypes: Array[Type], retType: Option[Type], exceptions: Array[Type], varArgs: Boolean): api.Def = + def defLike[T <: GenericDeclaration](name: String, mods: Int, annots: Array[Annotation], tps: Array[TypeVariable[T]], paramAnnots: Array[Array[Annotation]], paramTypes: Array[Type], retType: Option[Type], exceptions: Array[Type], varArgs: Boolean, enclPkg: Option[String]): api.Def = { val varArgPosition = if(varArgs) paramTypes.length - 1 else -1 val isVarArg = List.tabulate(paramTypes.length)(_ == varArgPosition) val pa = (paramAnnots, paramTypes, isVarArg).zipped map { case (a,p,v) => parameter(a,p,v) } val params = new api.ParameterList(pa, false) val ret = retType match { case Some(rt) => reference(rt); case None => Empty } - new api.Def(Array(params), ret, typeParameters(tps), name, access(mods), modifiers(mods), annotations(annots) ++ exceptionAnnotations(exceptions)) + new api.Def(Array(params), ret, typeParameters(tps), name, access(mods, enclPkg), modifiers(mods), annotations(annots) ++ exceptionAnnotations(exceptions)) } def exceptionAnnotations(exceptions: Array[Type]): Array[api.Annotation] = @@ -140,10 +141,10 @@ object ClassToAPI import Modifier.{isAbstract, isFinal} new api.Modifiers( isAbstract(i), false, isFinal(i), false, false, false) } - def access(i: Int): api.Access = + def access(i: Int, pkg: Option[String]): api.Access = { import Modifier.{isPublic, isPrivate, isProtected} - if(isPublic(i)) Public else if(isPrivate(i)) Private else if(isProtected(i)) Protected else error("Invalid modifiers " + i + " : no access flag set") + if(isPublic(i)) Public else if(isPrivate(i)) Private else if(isProtected(i)) Protected else packagePrivate(pkg) } def annotations(a: Array[Annotation]): Array[api.Annotation] = a map annotation @@ -209,6 +210,7 @@ object ClassToAPI val Private = new api.Private(Unqualified) val Protected = new api.Protected(Unqualified) val Unqualified = new api.Unqualified + def packagePrivate(pkg: Option[String]): api.Access = new api.Private(new api.IdQualifier(pkg getOrElse "")) val ArrayRef = reference("scala.Array") val Throws = reference("scala.throws") diff --git a/main/Default.scala b/main/Default.scala index 11fdd7ca5..e7a093803 100755 --- a/main/Default.scala +++ b/main/Default.scala @@ -328,11 +328,21 @@ object Default private[this] val allSubpaths = (_: File).###.***.xx.toSeq - def packageBin = (CompileInputs, CompileTask) map { (in, _) => allSubpaths(in.config.classesDirectory) } + def packageBin = concat(classMappings, resourceMappings) def packageDoc = DocTask map allSubpaths - def packageSrc = (Resources, ResourceDirectories, Sources, SourceDirectories, Base) map { - (rs, rds, srcs, sds, base) => ( (rs x relativeTo(rds)) ++ (srcs x (relativeTo(sds)|relativeTo(base)) ) ).toSeq + def packageSrc = concat(resourceMappings, sourceMappings) + + private type Mappings = Initialize[Task[Seq[(File, String)]]] + def concat(as: Mappings, bs: Mappings) = (as zipWith bs)( (a,b) => (a :^: b :^: KNil) map { case a :+: b :+: HNil => a ++ b } ) + def classMappings = (CompileInputs, CompileTask) map { (in, _) => allSubpaths(in.config.classesDirectory) } + // drop base directories, since there are no valid mappings for these + def sourceMappings = (Sources, SourceDirectories, Base) map { (srcs, sdirs, base) => + ( (srcs --- sdirs --- base) x (relativeTo(sdirs)|relativeTo(base))) toSeq } + def resourceMappings = (Resources, ResourceDirectories) map { (rs, rdirs) => + (rs --- rdirs) x relativeTo(rdirs) toSeq + } + def jarName = JarName <<= (ModuleName, Version, ScalaVersion, CrossPaths) { (n,v, sv, withCross) => ArtifactName(base = n, version = v, config = "", tpe = "", ext = "jar", cross = if(withCross) sv else "") } diff --git a/main/Package.scala b/main/Package.scala index 81b6de24f..b48d64cfe 100644 --- a/main/Package.scala +++ b/main/Package.scala @@ -34,7 +34,7 @@ object Package } def mergeAttributes(a1: Attributes, a2: Attributes) = a1 ++= a2 - // merges m2 into m1 (mutating m1 in the process) + // merges `mergeManifest` into `manifest` (mutating `manifest` in the process) def mergeManifests(manifest: Manifest, mergeManifest: Manifest) { mergeAttributes(manifest.getMainAttributes, mergeManifest.getMainAttributes) @@ -87,7 +87,7 @@ object Package } def makeJar(sources: Seq[(File, String)], jar: File, manifest: Manifest) { - println("Packaging...") + println("Packaging " + jar.getAbsolutePath + " ...") IO.delete(jar) IO.jar(sources, jar, manifest) println("Done packaging.") diff --git a/main/build/AggressiveCompile.scala b/main/build/AggressiveCompile.scala index becfdbf6e..65f000788 100644 --- a/main/build/AggressiveCompile.scala +++ b/main/build/AggressiveCompile.scala @@ -55,10 +55,13 @@ class AggressiveCompile(cacheDirectory: File) val compile0 = (include: Set[File], callback: AnalysisCallback) => { IO.createDirectory(outputDirectory) val incSrc = sources.filter(include) + val (javaSrcs, scalaSrcs) = incSrc partition javaOnly println("Compiling:\n\t" + incSrc.mkString("\n\t")) - val arguments = cArgs(incSrc, classpath, outputDirectory, options.options) - compiler.compile(arguments, callback, maxErrors, log) - val javaSrcs = incSrc.filter(javaOnly) + if(!scalaSrcs.isEmpty) + { + val arguments = cArgs(incSrc, classpath, outputDirectory, options.options) + compiler.compile(arguments, callback, maxErrors, log) + } if(!javaSrcs.isEmpty) { import Path._ diff --git a/sbt/src/sbt-test/compiler-project/run-test/build.sbt b/sbt/src/sbt-test/compiler-project/run-test/build.sbt new file mode 100644 index 000000000..b82222124 --- /dev/null +++ b/sbt/src/sbt-test/compiler-project/run-test/build.sbt @@ -0,0 +1,5 @@ +LibraryDependencies ++= Seq( + "com.novocode" % "junit-interface" % "0.5" % "test", + "junit" % "junit" % "4.8" % "test", + "org.scala-lang" % "scala-compiler" % "2.8.1" +) diff --git a/sbt/src/sbt-test/compiler-project/run-test/project/build.properties b/sbt/src/sbt-test/compiler-project/run-test/project/build.properties deleted file mode 100644 index 0d1673349..000000000 --- a/sbt/src/sbt-test/compiler-project/run-test/project/build.properties +++ /dev/null @@ -1,3 +0,0 @@ -project.organization=test -project.name=Interpreter Project Test -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run-test/project/build/P.scala b/sbt/src/sbt-test/compiler-project/run-test/project/build/P.scala deleted file mode 100644 index baa8bad30..000000000 --- a/sbt/src/sbt-test/compiler-project/run-test/project/build/P.scala +++ /dev/null @@ -1,8 +0,0 @@ -import sbt._ - -class P(info: ProjectInfo) extends DefaultProject(info) -{ - val bryanjswift = "Bryan J Swift Repository" at "http://repos.bryanjswift.com/maven2/" - val junitInterface = "com.novocode" % "junit-interface" % "0.4.0" % "test" - val junit = "junit" % "junit" % "4.7" % "test" -} \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run-test/test b/sbt/src/sbt-test/compiler-project/run-test/test index 8d3b08058..9988b8016 100644 --- a/sbt/src/sbt-test/compiler-project/run-test/test +++ b/sbt/src/sbt-test/compiler-project/run-test/test @@ -1,13 +1,10 @@ -> set build.scala.versions 2.7.7 2.8.0.RC1 -> reload -> +update -> +run 1 -> +test -> +clean +> run 1 +> test:test +> clean -> +run 2 -> +test -> +clean +> run 2 +> test:test +> clean -> +run -1 -> +test \ No newline at end of file +> run -1 +> test:test \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/build.sbt b/sbt/src/sbt-test/compiler-project/run2.8/build.sbt new file mode 100644 index 000000000..dba034554 --- /dev/null +++ b/sbt/src/sbt-test/compiler-project/run2.8/build.sbt @@ -0,0 +1,4 @@ +LibraryDependencies ++= Seq( + "org.scala-tools.testing" %% "specs" % "1.6.7.2" % "test", + "org.scala-lang" % "scala-compiler" % "2.8.1" +) \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/project/build.properties b/sbt/src/sbt-test/compiler-project/run2.8/project/build.properties deleted file mode 100644 index 98dfdeae3..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -project.name=Run And Compiler -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/project/build/A.scala b/sbt/src/sbt-test/compiler-project/run2.8/project/build/A.scala deleted file mode 100644 index dfbe135a9..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/project/build/A.scala +++ /dev/null @@ -1,7 +0,0 @@ -import sbt._ - -class A(info: ProjectInfo) extends DefaultProject(info) -{ - val snaps = ScalaToolsSnapshots - val specs28 = "org.scala-tools.testing" %% "specs" % "1.6.5-SNAPSHOT" % "test" -} \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/test b/sbt/src/sbt-test/compiler-project/run2.8/test index fa479e2b1..7c6f9c539 100644 --- a/sbt/src/sbt-test/compiler-project/run2.8/test +++ b/sbt/src/sbt-test/compiler-project/run2.8/test @@ -1,3 +1 @@ -> ++2.8.0.RC2 -> update -> test \ No newline at end of file +> test:test \ No newline at end of file diff --git a/sbt/src/sbt-test/java/analysis/project/build.properties b/sbt/src/sbt-test/java/analysis/project/build.properties deleted file mode 100644 index 274d96c88..000000000 --- a/sbt/src/sbt-test/java/analysis/project/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Project properties -#Sat Apr 18 15:26:14 EDT 2009 -project.organization=empty -project.name=Java Dependency Analysis -project.version=1.0 diff --git a/sbt/src/sbt-test/java/analysis/test b/sbt/src/sbt-test/java/analysis/test index 3641069b7..73a68203f 100644 --- a/sbt/src/sbt-test/java/analysis/test +++ b/sbt/src/sbt-test/java/analysis/test @@ -1 +1 @@ -> +compile \ No newline at end of file +> compile \ No newline at end of file diff --git a/sbt/src/sbt-test/java/argfile/build.sbt b/sbt/src/sbt-test/java/argfile/build.sbt new file mode 100644 index 000000000..2f0f9513c --- /dev/null +++ b/sbt/src/sbt-test/java/argfile/build.sbt @@ -0,0 +1,12 @@ +ScalaSource in Configurations.Compile <<= Source( _ / " scala test " ) + +JavaSource in Configurations.Compile <<= Source( _ / " java test " ) + +TaskKey("init") <<= (ScalaSource in Configurations.Compile, JavaSource in Configurations.Compile) map { (ss, js) => + import IO._ + createDirectories(ss :: js :: Nil) + copyFile(file("changes") / "Test.scala", ss / " Test s.scala") + copyFile(file("changes") / "A.java", js / "a" / "A.java") + delete(file("changes")) +} + \ No newline at end of file diff --git a/sbt/src/sbt-test/java/argfile/src/ java test /a/A.java b/sbt/src/sbt-test/java/argfile/changes/A.java similarity index 100% rename from sbt/src/sbt-test/java/argfile/src/ java test /a/A.java rename to sbt/src/sbt-test/java/argfile/changes/A.java diff --git a/sbt/src/sbt-test/java/argfile/src/ scala test /Test s.scala b/sbt/src/sbt-test/java/argfile/changes/Test.scala similarity index 100% rename from sbt/src/sbt-test/java/argfile/src/ scala test /Test s.scala rename to sbt/src/sbt-test/java/argfile/changes/Test.scala diff --git a/sbt/src/sbt-test/java/argfile/project/build.properties b/sbt/src/sbt-test/java/argfile/project/build.properties deleted file mode 100644 index f176ee56f..000000000 --- a/sbt/src/sbt-test/java/argfile/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -project.name=Arg File Test -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/java/argfile/project/build/A.scala b/sbt/src/sbt-test/java/argfile/project/build/A.scala deleted file mode 100644 index af3ae5f5a..000000000 --- a/sbt/src/sbt-test/java/argfile/project/build/A.scala +++ /dev/null @@ -1,7 +0,0 @@ -import sbt._ - -class A(info: ProjectInfo) extends DefaultProject(info) -{ - override def mainScalaSourcePath = sourcePath / " scala test " - override def mainJavaSourcePath = sourcePath / " java test " -} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/argfile/test b/sbt/src/sbt-test/java/argfile/test index 9e4c2371c..75991e02e 100644 --- a/sbt/src/sbt-test/java/argfile/test +++ b/sbt/src/sbt-test/java/argfile/test @@ -1 +1,2 @@ +> init > run \ No newline at end of file diff --git a/sbt/src/sbt-test/java/basic/project/build.properties b/sbt/src/sbt-test/java/basic/project/build.properties deleted file mode 100644 index 43f4b082f..000000000 --- a/sbt/src/sbt-test/java/basic/project/build.properties +++ /dev/null @@ -1,3 +0,0 @@ -project.organization=empty -project.name=Java Test -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/java/basic/src/main/java/test/R.java b/sbt/src/sbt-test/java/basic/src/main/java/test/R.java index aef73327d..7db88433b 100644 --- a/sbt/src/sbt-test/java/basic/src/main/java/test/R.java +++ b/sbt/src/sbt-test/java/basic/src/main/java/test/R.java @@ -3,4 +3,8 @@ package test; public final class R { public static final int y = 4; public static int x = (new stest.S()).y(); + public static void main(String[] args) + { + assert(args[0] == "1"); + } } diff --git a/sbt/src/sbt-test/java/basic/test b/sbt/src/sbt-test/java/basic/test index 3641069b7..9065560d4 100644 --- a/sbt/src/sbt-test/java/basic/test +++ b/sbt/src/sbt-test/java/basic/test @@ -1 +1 @@ -> +compile \ No newline at end of file +> run 1 \ No newline at end of file diff --git a/sbt/src/sbt-test/java/options/project/build.properties b/sbt/src/sbt-test/java/options/project/build.properties deleted file mode 100644 index 3a234a13f..000000000 --- a/sbt/src/sbt-test/java/options/project/build.properties +++ /dev/null @@ -1,5 +0,0 @@ -#Project properties -#Sat Apr 18 15:22:08 EDT 2009 -project.organization=empty -project.name=Java Test -project.version=1.0 diff --git a/sbt/src/sbt-test/java/options/project/build/src/JavaProject.scala b/sbt/src/sbt-test/java/options/project/build/src/JavaProject.scala deleted file mode 100644 index 5dbd40e0a..000000000 --- a/sbt/src/sbt-test/java/options/project/build/src/JavaProject.scala +++ /dev/null @@ -1,9 +0,0 @@ -import sbt._ - -// verify that javaCompileOptions are used -class JavaProject(info: ProjectInfo) extends DefaultProject(info) -{ - // make the source target 1.4 so that we get an error when these options are used - override def javaCompileOptions = ("-source" :: "1.4" :: Nil).map(JavaCompileOption(_)) - println(FileUtilities.classLocationFile[JavaProject]) -} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/options/test b/sbt/src/sbt-test/java/options/test index aa3abd024..b9a67c285 100644 --- a/sbt/src/sbt-test/java/options/test +++ b/sbt/src/sbt-test/java/options/test @@ -1,7 +1,4 @@ -# need explicit versions here because we want: -# fail forall versions -# and not -# fail for any version --> ++2.7.7 compile --> ++2.8.0-SNAPSHOT compile --> ++2.7.2 compile \ No newline at end of file +> 'set JavacOptions :== Nil' +> compile +> 'set JavacOptions ++= Seq("-source", "1.4")' +-> compile \ No newline at end of file diff --git a/sbt/src/sbt-test/java/scala-library/project/build.properties b/sbt/src/sbt-test/java/scala-library/project/build.properties deleted file mode 100644 index 43f4b082f..000000000 --- a/sbt/src/sbt-test/java/scala-library/project/build.properties +++ /dev/null @@ -1,3 +0,0 @@ -project.organization=empty -project.name=Java Test -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/java/separate/project/build.properties b/sbt/src/sbt-test/java/separate/project/build.properties deleted file mode 100644 index cefcdcae9..000000000 --- a/sbt/src/sbt-test/java/separate/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -project.name=Test -project.version=1.0 diff --git a/sbt/src/sbt-test/java/separate/project/build/src/TestProject.scala b/sbt/src/sbt-test/java/separate/project/build/src/TestProject.scala deleted file mode 100644 index 6f01635ae..000000000 --- a/sbt/src/sbt-test/java/separate/project/build/src/TestProject.scala +++ /dev/null @@ -1,6 +0,0 @@ -import sbt._ - -class TestProject(info: ProjectInfo) extends DefaultProject(info) -{ - override def compileOrder = CompileOrder.JavaThenScala -} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/separate/src/main/java/F.java b/sbt/src/sbt-test/java/separate/src/main/java/F.java deleted file mode 100644 index 2564e13b2..000000000 --- a/sbt/src/sbt-test/java/separate/src/main/java/F.java +++ /dev/null @@ -1,5 +0,0 @@ -package fj; - -public interface F { - B f(A a); -} diff --git a/sbt/src/sbt-test/java/separate/src/main/scala/Dual.scala b/sbt/src/sbt-test/java/separate/src/main/scala/Dual.scala deleted file mode 100644 index 89d5e538a..000000000 --- a/sbt/src/sbt-test/java/separate/src/main/scala/Dual.scala +++ /dev/null @@ -1,11 +0,0 @@ -package scalaz - -trait Dual[A] { - val value : A -} - -object Dual { - implicit def dual[A](a: A) = new Dual[A] { - val value = a - } -} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/separate/src/main/scala/FImpl.scala b/sbt/src/sbt-test/java/separate/src/main/scala/FImpl.scala deleted file mode 100644 index ac3778aee..000000000 --- a/sbt/src/sbt-test/java/separate/src/main/scala/FImpl.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test - -trait FImpl[A,B] extends fj.F[A,B] \ No newline at end of file diff --git a/sbt/src/sbt-test/java/separate/test b/sbt/src/sbt-test/java/separate/test deleted file mode 100644 index 1796e8a3d..000000000 --- a/sbt/src/sbt-test/java/separate/test +++ /dev/null @@ -1,4 +0,0 @@ -> clean -> test -# this will fail if the sources are recompiled again (see the project definition) -> test \ No newline at end of file diff --git a/sbt/src/sbt-test/java/track-anonymous/build.sbt b/sbt/src/sbt-test/java/track-anonymous/build.sbt new file mode 100644 index 000000000..ed5b4a37a --- /dev/null +++ b/sbt/src/sbt-test/java/track-anonymous/build.sbt @@ -0,0 +1,11 @@ +import sbt.complete.DefaultParsers._ + +InputKey("check-output") <<= { + val parser = token(Space ~> ( ("exists" ^^^ true) | ("absent" ^^^ false) ) ) + def action(result: TaskKey[Boolean]) = + (ClassDirectory in Configurations.Compile, result) map { (dir, shouldExist) => + if((dir / "Anon.class").exists != shouldExist) error("Top level class incorrect" ) + else if( (dir / "Anon$1.class").exists != shouldExist) error("Inner class incorrect" ) + } + InputTask(s => parser)(action) +} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/track-anonymous/project/build.properties b/sbt/src/sbt-test/java/track-anonymous/project/build.properties deleted file mode 100644 index 2b4d7e5a1..000000000 --- a/sbt/src/sbt-test/java/track-anonymous/project/build.properties +++ /dev/null @@ -1,2 +0,0 @@ -project.name=Test -project.version=1.0 \ No newline at end of file diff --git a/sbt/src/sbt-test/java/track-anonymous/project/build/AnonTest.scala b/sbt/src/sbt-test/java/track-anonymous/project/build/AnonTest.scala deleted file mode 100644 index bc8b8342a..000000000 --- a/sbt/src/sbt-test/java/track-anonymous/project/build/AnonTest.scala +++ /dev/null @@ -1,13 +0,0 @@ -import sbt._ -class AnonTest(info: ProjectInfo) extends DefaultProject(info) -{ - override def compileOrder = CompileOrder.JavaThenScala - lazy val checkOutput = task { args => println(args.mkString); checkOutputTask(args(0) == "exists") } - private def checkOutputTask(shouldExist: Boolean) = - task - { - if((mainCompilePath / "Anon.class").exists != shouldExist) Some("Top level class incorrect" ) - else if( (mainCompilePath / "Anon$1.class").exists != shouldExist) Some("Inner class incorrect" ) - else None - } -} \ No newline at end of file diff --git a/sbt/src/sbt-test/java/track-anonymous/test b/sbt/src/sbt-test/java/track-anonymous/test index ebdf4ee0a..f196c06a0 100644 --- a/sbt/src/sbt-test/java/track-anonymous/test +++ b/sbt/src/sbt-test/java/track-anonymous/test @@ -1,6 +1,6 @@ $ copy-file changes/Anon.java src/main/java/Anon.java -> +compile -> +check-output exists +> compile +> check-output exists $ delete src/main/java/Anon.java -> +compile -> +check-output absent \ No newline at end of file +> compile +> check-output absent \ No newline at end of file diff --git a/sbt/src/sbt-test/package/lazy-name/project/build.properties b/sbt/src/sbt-test/package/lazy-name/project/build.properties deleted file mode 100755 index 8bf006b1e..000000000 --- a/sbt/src/sbt-test/package/lazy-name/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Project properties -#Tue Feb 03 14:28:27 EST 2009 -project.name=Lazy Package Name -project.version=0.1.1 diff --git a/sbt/src/sbt-test/package/lazy-name/project/build/Test.scala b/sbt/src/sbt-test/package/lazy-name/project/build/Test.scala deleted file mode 100644 index 7e621723c..000000000 --- a/sbt/src/sbt-test/package/lazy-name/project/build/Test.scala +++ /dev/null @@ -1,6 +0,0 @@ -import sbt._ - -class Test(info: ProjectInfo) extends DefaultProject(info) -{ - override def disableCrossPaths = true -} \ No newline at end of file diff --git a/sbt/src/sbt-test/package/lazy-name/test b/sbt/src/sbt-test/package/lazy-name/test index 97a9b3104..de79d3195 100755 --- a/sbt/src/sbt-test/package/lazy-name/test +++ b/sbt/src/sbt-test/package/lazy-name/test @@ -1,11 +1,22 @@ +# 'lazy-name' is not an appropriate name anymore +# This test verifies that package uses the updated name +# after changing the version. It no longer serves +# much purpose other than checking that the 'set' command +# re-evaluates the project data. + +> 'set Name :== "lazy-package-name"' +> set CrossPaths :== false + +> 'set Version :== "0.1.1"' > package $ exists "target/lazy-package-name-0.1.1.jar" > clean -> increment-version +> 'set Version :== "0.1.2"' > package $ exists "target/lazy-package-name-0.1.2.jar" +> clean -> increment-version +> 'set Version :== "0.1.3"' > package -$ exists "target/lazy-package-name-0.1.3.jar" \ No newline at end of file +$ exists "target/lazy-package-name-0.1.3.jar" diff --git a/sbt/src/sbt-test/package/manifest/build.sbt b/sbt/src/sbt-test/package/manifest/build.sbt new file mode 100644 index 000000000..b783bb48b --- /dev/null +++ b/sbt/src/sbt-test/package/manifest/build.sbt @@ -0,0 +1,22 @@ + import java.util.jar.{Attributes, Manifest} + import Path.makeString + import Keys.{Package, ScalaInstance} + import Configurations.Compile + +Name :== "Jar Manifest Test" + +Version :== "0.2" + +CrossPaths :== false + +MainClass :== Some("jartest.Main") + +PackageOptions in (Compile, Package) <<= (PackageOptions in (Compile, Package), ScalaInstance) map { (opts, si) => + def manifestExtra = + { + val mf = new Manifest + mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, makeString(si.libraryJar :: Nil) ) + mf + } + opts :+ sbt.Package.JarManifest(manifestExtra) +} diff --git a/sbt/src/sbt-test/package/manifest/project/build.properties b/sbt/src/sbt-test/package/manifest/project/build.properties deleted file mode 100644 index e273be069..000000000 --- a/sbt/src/sbt-test/package/manifest/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Project properties -#Mon Feb 02 20:49:59 EST 2009 -project.name=Jar Manifest Test -project.version=0.2 diff --git a/sbt/src/sbt-test/package/manifest/project/build/src/ManifestTestProject.scala b/sbt/src/sbt-test/package/manifest/project/build/src/ManifestTestProject.scala deleted file mode 100644 index a3b3387fe..000000000 --- a/sbt/src/sbt-test/package/manifest/project/build/src/ManifestTestProject.scala +++ /dev/null @@ -1,15 +0,0 @@ -import sbt._ - -class ManifestTestProject(info: ProjectInfo) extends DefaultProject(info) -{ - override def mainClass = Some("jartest.Main") - def manifestExtra = - { - import java.util.jar._ - val mf = new Manifest - mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, buildScalaInstance.libraryJar.getAbsolutePath) - mf - } - override def packageOptions = JarManifest(manifestExtra) :: super.packageOptions.toList - override def disableCrossPaths = true -} \ No newline at end of file diff --git a/sbt/src/sbt-test/package/resources/build.sbt b/sbt/src/sbt-test/package/resources/build.sbt new file mode 100644 index 000000000..d9d93011a --- /dev/null +++ b/sbt/src/sbt-test/package/resources/build.sbt @@ -0,0 +1,16 @@ +Name :== "Main Resources Test" + +Version :== "0.1" + +CrossPaths :== false + +PackageOptions <<= (PackageOptions, Keys.ScalaInstance) map { (opts, si) => + def manifestExtra = + { + import java.util.jar._ + val mf = new Manifest + mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, si.libraryJar.getAbsolutePath) + mf + } + sbt.Package.JarManifest(manifestExtra) +: opts +} \ No newline at end of file diff --git a/sbt/src/sbt-test/package/resources/project/build.properties b/sbt/src/sbt-test/package/resources/project/build.properties deleted file mode 100644 index 2c43d1a10..000000000 --- a/sbt/src/sbt-test/package/resources/project/build.properties +++ /dev/null @@ -1,4 +0,0 @@ -#Project properties -#Mon Feb 02 20:49:59 EST 2009 -project.name=Main Resources Test -project.version=0.1 diff --git a/sbt/src/sbt-test/package/resources/project/build/src/ManifestTestProject.scala b/sbt/src/sbt-test/package/resources/project/build/src/ManifestTestProject.scala deleted file mode 100644 index a3b3387fe..000000000 --- a/sbt/src/sbt-test/package/resources/project/build/src/ManifestTestProject.scala +++ /dev/null @@ -1,15 +0,0 @@ -import sbt._ - -class ManifestTestProject(info: ProjectInfo) extends DefaultProject(info) -{ - override def mainClass = Some("jartest.Main") - def manifestExtra = - { - import java.util.jar._ - val mf = new Manifest - mf.getMainAttributes.put(Attributes.Name.CLASS_PATH, buildScalaInstance.libraryJar.getAbsolutePath) - mf - } - override def packageOptions = JarManifest(manifestExtra) :: super.packageOptions.toList - override def disableCrossPaths = true -} \ No newline at end of file