From 893267785f314ceb80d3e962991a42aacd2251f9 Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 4 May 2016 12:29:01 +0200 Subject: [PATCH 01/23] Update to util 0.1.0-M11 --- project/Dependencies.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/Dependencies.scala b/project/Dependencies.scala index afb755d1c..ecdf8451b 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,7 +9,7 @@ object Dependencies { lazy val scala211 = "2.11.8" // sbt modules - val utilVersion = "0.1.0-M10" + val utilVersion = "0.1.0-M11" val ioVersion = "1.0.0-M3" val incrementalcompilerVersion = "0.1.0-M3" val librarymanagementVersion = "0.1.0-M7" From c70c9989e5e1dff71d71b94e863eb1633e3ba7be Mon Sep 17 00:00:00 2001 From: Martin Duhem Date: Wed, 4 May 2016 16:44:31 +0200 Subject: [PATCH 02/23] Upgrade to latest zinc --- build.sbt | 4 ++-- main/actions/src/main/scala/sbt/DotGraph.scala | 2 +- main/actions/src/main/scala/sbt/Tests.scala | 12 +++++++++++- main/src/main/scala/sbt/Defaults.scala | 16 ++++++++-------- project/Dependencies.scala | 18 +++++++++--------- 5 files changed, 31 insertions(+), 21 deletions(-) diff --git a/build.sbt b/build.sbt index d07e182b5..775183496 100644 --- a/build.sbt +++ b/build.sbt @@ -154,7 +154,7 @@ lazy val actionsProj = (project in mainPath / "actions"). testedBaseSettings, name := "Actions", libraryDependencies ++= Seq(compilerClasspath, utilCompletion, compilerApiInfo, - incrementalcompiler, compilerIvyIntegration, compilerInterface, + zinc, compilerIvyIntegration, compilerInterface, sbtIO, utilLogging, utilRelation, libraryManagement, utilTracking) ) @@ -184,7 +184,7 @@ lazy val mainProj = (project in mainPath). testedBaseSettings, name := "Main", libraryDependencies ++= scalaXml.value ++ Seq(launcherInterface, compilerInterface, - sbtIO, utilLogging, utilLogic, libraryManagement, incrementalcompilerCompile) + sbtIO, utilLogging, utilLogic, libraryManagement, zincCompile) ) // Strictly for bringing implicits and aliases from subsystems into the top-level sbt namespace through a single package object diff --git a/main/actions/src/main/scala/sbt/DotGraph.scala b/main/actions/src/main/scala/sbt/DotGraph.scala index bef29a293..17adac2dc 100644 --- a/main/actions/src/main/scala/sbt/DotGraph.scala +++ b/main/actions/src/main/scala/sbt/DotGraph.scala @@ -30,7 +30,7 @@ object DotGraph { def apply(relations: Relations, outputDir: File, sourceToString: File => String, externalToString: File => String): Unit = { def file(name: String) = new File(outputDir, name) IO.createDirectory(outputDir) - generateGraph(file("int-source-deps"), "dependencies", relations.internalSrcDep, sourceToString, sourceToString) + generateGraph(file("int-source-deps"), "dependencies", relations.internalClassDep, identity[String], identity[String]) generateGraph(file("binary-dependencies"), "externalDependencies", relations.binaryDep, externalToString, sourceToString) } diff --git a/main/actions/src/main/scala/sbt/Tests.scala b/main/actions/src/main/scala/sbt/Tests.scala index 1aab7ada9..79f29de01 100644 --- a/main/actions/src/main/scala/sbt/Tests.scala +++ b/main/actions/src/main/scala/sbt/Tests.scala @@ -273,7 +273,17 @@ object Tests { def discover(frameworks: Seq[Framework], analysis: CompileAnalysis, log: Logger): (Seq[TestDefinition], Set[String]) = discover(frameworks flatMap TestFramework.getFingerprints, allDefs(analysis), log) - def allDefs(analysis: CompileAnalysis) = analysis match { case analysis: Analysis => analysis.apis.internal.values.flatMap(_.api.definitions).toSeq } + def allDefs(analysis: CompileAnalysis) = analysis match { + case analysis: Analysis => + analysis.apis.internal.values.flatMap { ac => + val companions = ac.api + val all = + companions.classApi.structure.declared ++ companions.classApi.structure.inherited ++ + companions.objectApi.structure.declared ++ companions.objectApi.structure.inherited + + all + }.toSeq + } def discover(fingerprints: Seq[Fingerprint], definitions: Seq[Definition], log: Logger): (Seq[TestDefinition], Set[String]) = { val subclasses = fingerprints collect { case sub: SubclassFingerprint => (sub.superclassName, sub.isModule, sub) }; diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 15fa89681..a8626ed0d 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -508,18 +508,18 @@ object Defaults extends BuildCommon { (cp, s) => val ans: Seq[Analysis] = cp.flatMap(_.metadata get Keys.analysis) map { case a0: Analysis => a0 } val succeeded = TestStatus.read(succeededFile(s.cacheDirectory)) - val stamps = collection.mutable.Map.empty[File, Long] + val stamps = collection.mutable.Map.empty[String, Long] def stamp(dep: String): Long = { - val stamps = for (a <- ans; f <- a.relations.definesClass(dep)) yield intlStamp(f, a, Set.empty) + val stamps = for (a <- ans) yield intlStamp(dep, a, Set.empty) if (stamps.isEmpty) Long.MinValue else stamps.max } - def intlStamp(f: File, analysis: Analysis, s: Set[File]): Long = { - if (s contains f) Long.MinValue else - stamps.getOrElseUpdate(f, { + def intlStamp(c: String, analysis: Analysis, s: Set[String]): Long = { + if (s contains c) Long.MinValue else + stamps.getOrElseUpdate(c, { import analysis.{ relations => rel, apis } - rel.internalSrcDeps(f).map(intlStamp(_, analysis, s + f)) ++ - rel.externalDeps(f).map(stamp) + - apis.internal(f).compilation.startTime + rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++ + rel.externalDeps(c).map(stamp) + + apis.internal(c).compilation.startTime }.max) } def noSuccessYet(test: String) = succeeded.get(test) match { diff --git a/project/Dependencies.scala b/project/Dependencies.scala index ecdf8451b..42ff99bcd 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -11,8 +11,8 @@ object Dependencies { // sbt modules val utilVersion = "0.1.0-M11" val ioVersion = "1.0.0-M3" - val incrementalcompilerVersion = "0.1.0-M3" - val librarymanagementVersion = "0.1.0-M7" + val zincVersion = "0.1.0-M3-84942e08e7b11c6ef831c6443fc31bbff19ed3c2-SNAPSHOT" + val librarymanagementVersion = "0.1.0-27bf18f7a3d945d84f72bb0e0e4aa98151417609-SNAPSHOT" lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion lazy val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion @@ -30,13 +30,13 @@ object Dependencies { lazy val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0-M1" lazy val testInterface = "org.scala-sbt" % "test-interface" % "1.0" - lazy val incrementalcompiler = "org.scala-sbt" %% "incrementalcompiler" % incrementalcompilerVersion - lazy val incrementalcompilerCompile = "org.scala-sbt" %% "incrementalcompiler-compile" % incrementalcompilerVersion - lazy val compilerInterface = "org.scala-sbt" % "compiler-interface" % incrementalcompilerVersion - lazy val compilerBrdige = "org.scala-sbt" %% "compiler-bridge" % incrementalcompilerVersion - lazy val compilerClasspath = "org.scala-sbt" %% "incrementalcompiler-classpath" % incrementalcompilerVersion - lazy val compilerApiInfo = "org.scala-sbt" %% "incrementalcompiler-apiinfo" % incrementalcompilerVersion - lazy val compilerIvyIntegration = "org.scala-sbt" %% "incrementalcompiler-ivy-integration" % incrementalcompilerVersion + lazy val zinc = "org.scala-sbt" %% "zinc" % zincVersion + lazy val zincCompile = "org.scala-sbt" %% "zinc-compile" % zincVersion + lazy val compilerInterface = "org.scala-sbt" % "compiler-interface" % zincVersion + lazy val compilerBrdige = "org.scala-sbt" %% "compiler-bridge" % zincVersion + lazy val compilerClasspath = "org.scala-sbt" %% "zinc-classpath" % zincVersion + lazy val compilerApiInfo = "org.scala-sbt" %% "zinc-apiinfo" % zincVersion + lazy val compilerIvyIntegration = "org.scala-sbt" %% "zinc-ivy-integration" % zincVersion lazy val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.11.4" lazy val specs2 = "org.specs2" %% "specs2" % "2.3.11" From fd7c162ea802008cf3586943c0ba9d862a677502 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 14:38:24 -0400 Subject: [PATCH 03/23] Bumping up dependencies --- .travis.yml | 1 - MIGRATION.md | 6 ++ build.sbt | 22 +++---- .../actions/src/main/scala/sbt/CacheIvy.scala | 8 +-- main/actions/src/main/scala/sbt/Doc.scala | 2 +- main/actions/src/main/scala/sbt/Package.scala | 2 +- .../src/main/scala/sbt/RawCompileLike.scala | 2 +- .../main/scala/sbt/BasicCommandStrings.scala | 2 +- .../command/src/main/scala/sbt/MainLoop.scala | 2 +- .../src/main/scala/sbt/Structure.scala | 2 +- main/src/main/scala/sbt/BuildPaths.scala | 2 +- main/src/main/scala/sbt/BuildStructure.scala | 2 +- main/src/main/scala/sbt/BuildUtil.scala | 2 +- main/src/main/scala/sbt/CommandStrings.scala | 2 +- main/src/main/scala/sbt/Defaults.scala | 4 +- main/src/main/scala/sbt/Main.scala | 2 +- main/src/main/scala/sbt/Opts.scala | 5 +- main/src/main/scala/sbt/internal/Load.scala | 4 +- project/Dependencies.scala | 12 ++-- sbt/src/main/scala/Import.scala | 13 ++-- sbt/src/main/scala/ProcessExtra.scala | 6 +- sbt/src/main/scala/package.scala | 45 +------------ sbt/src/main/scala/syntax.scala | 64 +++++++++++++++++++ .../actions/aggregate/project/Marker.scala | 4 +- .../compile-time-only/changes/A1.scala | 3 +- .../compile-time-only/changes/A3.scala | 3 +- sbt/src/sbt-test/actions/state/build.sbt | 1 - .../project/auto-plugins/project/Q.scala | 4 +- .../binary-plugin/changes/define/A.scala | 4 +- .../project/Common.scala | 4 +- .../src/main/scala/sbt/ScriptedPlugin.scala | 4 +- .../main/scala/sbt/test/ScriptedTests.scala | 2 +- .../src/main/scala/sbt/std/Streams.scala | 2 +- 33 files changed, 128 insertions(+), 115 deletions(-) create mode 100644 sbt/src/main/scala/syntax.scala diff --git a/.travis.yml b/.travis.yml index 4a9e3a500..69ade0192 100644 --- a/.travis.yml +++ b/.travis.yml @@ -35,7 +35,6 @@ env: - SBT_CMD="scripted source-dependencies/*3of3" - SBT_CMD="scripted tests/*" - SBT_CMD="scripted project-load/*" - - SBT_CMD="checkBuildScala211" - SBT_CMD="repoOverrideTest:scripted dependency-management/*" notifications: diff --git a/MIGRATION.md b/MIGRATION.md index d6db3bcec..c9e38e23b 100644 --- a/MIGRATION.md +++ b/MIGRATION.md @@ -3,3 +3,9 @@ Migration notes - `project/Build.scala` style based on `sbt.Build` is removed. Migrate to `build.sbt`. - `Project(...)` constructor is limited to just two parameters. + +- change import in auto plugin to: + +```scala +import sbt._, syntax._, Keys._ +``` diff --git a/build.sbt b/build.sbt index 775183496..2a9d906b4 100644 --- a/build.sbt +++ b/build.sbt @@ -11,8 +11,11 @@ import com.typesafe.tools.mima.plugin.MimaPlugin.mimaDefaultSettings def buildLevelSettings: Seq[Setting[_]] = inThisBuild(Seq( organization := "org.scala-sbt", version := "1.0.0-SNAPSHOT", - bintrayOrganization := Some(if (publishStatus.value == "releases") "typesafe" else "sbt"), - bintrayRepository := s"ivy-${publishStatus.value}", + bintrayOrganization := Some("sbt"), + bintrayRepository := { + if (isSnapshot.value) "maven-releases" + else "maven-snapshots" + }, bintrayPackage := "sbt", bintrayReleaseOnPublish := false, resolvers += Resolver.mavenLocal @@ -21,7 +24,6 @@ def buildLevelSettings: Seq[Setting[_]] = inThisBuild(Seq( def commonSettings: Seq[Setting[_]] = Seq[SettingsDefinition]( scalaVersion := scala211, publishArtifact in packageDoc := false, - publishMavenStyle := false, componentID := None, resolvers += Resolver.typesafeIvyRepo("releases"), resolvers += Resolver.sonatypeRepo("snapshots"), @@ -30,7 +32,7 @@ def commonSettings: Seq[Setting[_]] = Seq[SettingsDefinition]( testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), javacOptions in compile ++= Seq("-target", "6", "-source", "6", "-Xlint", "-Xlint:-serial"), incOptions := incOptions.value.withNameHashing(true), - crossScalaVersions := Seq(scala211), + crossScalaVersions := Seq(scala211, scala210), bintrayPackage := (bintrayPackage in ThisBuild).value, bintrayRepository := (bintrayRepository in ThisBuild).value, mimaDefaultSettings, @@ -99,6 +101,9 @@ lazy val testingProj = (project in file("testing")). lazy val testAgentProj = (project in file("testing") / "agent"). settings( minimalSettings, + crossScalaVersions := Seq(scala211), + crossPaths := false, + autoScalaLibrary := false, name := "Test Agent", libraryDependencies += testInterface ) @@ -318,15 +323,6 @@ def customCommands: Seq[Setting[_]] = Seq( s"""set scalaVersion in ThisBuild := "$scala211" """ :: state }, - // This is invoked by Travis - commands += Command.command("checkBuildScala211") { state => - s"++ $scala211" :: - // First compile everything before attempting to test - "all compile test:compile" :: - // Now run known working tests. - safeUnitTests.key.label :: - state - }, safeUnitTests := { test.all(safeProjects).value }, diff --git a/main/actions/src/main/scala/sbt/CacheIvy.scala b/main/actions/src/main/scala/sbt/CacheIvy.scala index 1e0fa0c13..2f7561e08 100644 --- a/main/actions/src/main/scala/sbt/CacheIvy.scala +++ b/main/actions/src/main/scala/sbt/CacheIvy.scala @@ -140,23 +140,21 @@ object CacheIvy { } import L5._ - implicit def inlineIvyIC: InputCache[InlineIvyConfiguration] = wrapIn implicit def moduleSettingsIC: InputCache[ModuleSettings] = - unionInputCache[ModuleSettings, PomConfiguration :+: InlineConfiguration :+: InlineConfigurationWithExcludes :+: IvyFileConfiguration :+: HNil] + unionInputCache[ModuleSettings, PomConfiguration :+: InlineConfiguration :+: IvyFileConfiguration :+: HNil] implicit def ivyConfigurationIC: InputCache[IvyConfiguration] = unionInputCache[IvyConfiguration, InlineIvyConfiguration :+: ExternalIvyConfiguration :+: HNil] object L4 { - implicit val inlineWithExcludesToHL = (c: InlineConfigurationWithExcludes) => + implicit val inlineToHL = (c: InlineConfiguration) => c.module :+: c.dependencies :+: c.ivyXML :+: c.configurations :+: c.defaultConfiguration.map(_.name) :+: c.ivyScala :+: c.validate :+: c.overrides :+: c.excludes :+: HNil implicit def moduleConfToHL = (m: ModuleConfiguration) => m.organization :+: m.name :+: m.revision :+: m.resolver :+: HNil - implicit def inlineToHL = (c: InlineConfiguration) => c.module :+: c.dependencies :+: c.ivyXML :+: c.configurations :+: c.defaultConfiguration.map(_.name) :+: c.ivyScala :+: c.validate :+: c.overrides :+: HNil + // implicit def inlineToHL = (c: InlineConfiguration) => c.module :+: c.dependencies :+: c.ivyXML :+: c.configurations :+: c.defaultConfiguration.map(_.name) :+: c.ivyScala :+: c.validate :+: c.overrides :+: HNil } import L4._ - implicit def inlineWithExcludesIC: InputCache[InlineConfigurationWithExcludes] = wrapIn implicit def inlineIC: InputCache[InlineConfiguration] = wrapIn implicit def moduleConfIC: InputCache[ModuleConfiguration] = wrapIn diff --git a/main/actions/src/main/scala/sbt/Doc.scala b/main/actions/src/main/scala/sbt/Doc.scala index 7a71825c2..bbcde8a64 100644 --- a/main/actions/src/main/scala/sbt/Doc.scala +++ b/main/actions/src/main/scala/sbt/Doc.scala @@ -8,7 +8,7 @@ import sbt.internal.inc.{ AnalyzingCompiler, JavaCompiler } import Predef.{ conforms => _, _ } import sbt.internal.util.Types.:+: -import sbt.io.Path._ +import sbt.io.syntax._ import sbt.io.IO import sbinary.DefaultProtocol.FileFormat diff --git a/main/actions/src/main/scala/sbt/Package.scala b/main/actions/src/main/scala/sbt/Package.scala index 1f3c1c694..776fc3baa 100644 --- a/main/actions/src/main/scala/sbt/Package.scala +++ b/main/actions/src/main/scala/sbt/Package.scala @@ -8,7 +8,7 @@ import java.io.File import java.util.jar.{ Attributes, Manifest } import collection.JavaConversions._ import sbt.internal.util.Types.:+: -import sbt.io.Path._ +import sbt.io.syntax._ import sbt.io.IO import sbinary.{ DefaultProtocol, Format } diff --git a/main/actions/src/main/scala/sbt/RawCompileLike.scala b/main/actions/src/main/scala/sbt/RawCompileLike.scala index 61588ab4b..5791b6601 100644 --- a/main/actions/src/main/scala/sbt/RawCompileLike.scala +++ b/main/actions/src/main/scala/sbt/RawCompileLike.scala @@ -7,7 +7,7 @@ import java.io.File import sbt.internal.inc.{ AnalyzingCompiler, ClasspathOptions, JavaCompiler, RawCompiler, ScalaInstance } import Predef.{ conforms => _, _ } -import sbt.io.Path._ +import sbt.io.syntax._ import sbt.io.IO import sbinary.DefaultProtocol.FileFormat diff --git a/main/command/src/main/scala/sbt/BasicCommandStrings.scala b/main/command/src/main/scala/sbt/BasicCommandStrings.scala index 389386c20..d85f13f01 100644 --- a/main/command/src/main/scala/sbt/BasicCommandStrings.scala +++ b/main/command/src/main/scala/sbt/BasicCommandStrings.scala @@ -8,7 +8,7 @@ import sbt.internal.util.complete.HistoryCommands import scala.annotation.tailrec import java.io.File -import sbt.io.Path._ +import sbt.io.syntax._ object BasicCommandStrings { val HelpCommand = "help" diff --git a/main/command/src/main/scala/sbt/MainLoop.scala b/main/command/src/main/scala/sbt/MainLoop.scala index 1ac6ccf23..7aaaf0c4f 100644 --- a/main/command/src/main/scala/sbt/MainLoop.scala +++ b/main/command/src/main/scala/sbt/MainLoop.scala @@ -7,7 +7,7 @@ import scala.annotation.tailrec import java.io.{ File, PrintWriter } import jline.TerminalFactory -import sbt.internal.io.Using +import sbt.io.Using import sbt.internal.util.{ ErrorHandling, GlobalLogBacking, GlobalLogging } import sbt.util.{ AbstractLogger, Logger } diff --git a/main/settings/src/main/scala/sbt/Structure.scala b/main/settings/src/main/scala/sbt/Structure.scala index cd1a84e61..8a49af2cd 100644 --- a/main/settings/src/main/scala/sbt/Structure.scala +++ b/main/settings/src/main/scala/sbt/Structure.scala @@ -11,7 +11,7 @@ import java.net.URI import ConcurrentRestrictions.Tag import Def.{ Initialize, KeyedInitialize, ScopedKey, Setting, setting } import sbt.io.{ FileFilter, Path, PathFinder } -import Path._ +import sbt.io.syntax._ import std.TaskExtra.{ task => mktask, _ } import Task._ import sbt.internal.util.Types._ diff --git a/main/src/main/scala/sbt/BuildPaths.scala b/main/src/main/scala/sbt/BuildPaths.scala index 1070ac57f..1a4c44178 100644 --- a/main/src/main/scala/sbt/BuildPaths.scala +++ b/main/src/main/scala/sbt/BuildPaths.scala @@ -18,7 +18,7 @@ object BuildPaths { val stagingDirectory = AttributeKey[File]("staging-directory", "The directory for staging remote projects.", DSetting) val dependencyBaseDirectory = AttributeKey[File]("dependency-base-directory", "The base directory for caching dependency resolution.", DSetting) - import Path._ + import sbt.io.syntax._ def getGlobalBase(state: State): File = { val default = defaultVersionedGlobalBase(binarySbtVersion(state)) diff --git a/main/src/main/scala/sbt/BuildStructure.scala b/main/src/main/scala/sbt/BuildStructure.scala index e88f27f1a..217233a54 100644 --- a/main/src/main/scala/sbt/BuildStructure.scala +++ b/main/src/main/scala/sbt/BuildStructure.scala @@ -10,7 +10,7 @@ import BuildPaths.outputDirectory import Scope.GlobalScope import BuildStreams.Streams import sbt.internal.{ BuildDef, Load, OldPlugin } -import sbt.io.Path._ +import sbt.io.syntax._ import sbt.internal.util.{ Attributed, AttributeEntry, AttributeKey, AttributeMap, Settings } import sbt.internal.util.Attributed.data import sbt.util.Logger diff --git a/main/src/main/scala/sbt/BuildUtil.scala b/main/src/main/scala/sbt/BuildUtil.scala index 31989f28f..297e50a13 100644 --- a/main/src/main/scala/sbt/BuildUtil.scala +++ b/main/src/main/scala/sbt/BuildUtil.scala @@ -72,7 +72,7 @@ object BuildUtil { } } - def baseImports: Seq[String] = "import scala.xml.{TopScope=>$scope}" :: "import sbt._, Keys._, dsl._, Import._" :: Nil + def baseImports: Seq[String] = "import scala.xml.{TopScope=>$scope}" :: "import sbt._, Keys._, dsl._, syntax._" :: Nil def getImports(unit: BuildUnit): Seq[String] = unit.plugins.detected.imports ++ unit.definitions.dslDefinitions.imports diff --git a/main/src/main/scala/sbt/CommandStrings.scala b/main/src/main/scala/sbt/CommandStrings.scala index 7bbda44d1..94d23526e 100644 --- a/main/src/main/scala/sbt/CommandStrings.scala +++ b/main/src/main/scala/sbt/CommandStrings.scala @@ -284,7 +284,7 @@ defaults """ import java.io.File - import Path._ + import sbt.io.syntax._ def sbtRCs(s: State): Seq[File] = (Path.userHome / sbtrc) :: diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index a8626ed0d..2e721a798 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -50,6 +50,7 @@ import sbt.internal.io.WatchState import sbt.io.{ AllPassFilter, FileFilter, GlobFilter, HiddenFileFilter, IO, NameFilter, NothingFilter, Path, PathFinder, SimpleFileFilter, DirectoryFilter } import Path._ +import sbt.io.syntax._ import Keys._ object Defaults extends BuildCommon { @@ -1046,7 +1047,6 @@ object Defaults extends BuildCommon { } object Classpaths { - import Path._ import Keys._ import Scope.ThisScope import Defaults._ @@ -1341,7 +1341,7 @@ object Classpaths { new IvySbt(conf) } def moduleSettings0: Initialize[Task[ModuleSettings]] = Def.task { - new InlineConfigurationWithExcludes(projectID.value, projectInfo.value, allDependencies.value, dependencyOverrides.value, excludeDependencies.value, + new InlineConfiguration(projectID.value, projectInfo.value, allDependencies.value, dependencyOverrides.value, excludeDependencies.value, ivyXML.value, ivyConfigurations.value, defaultConfiguration.value, ivyScala.value, ivyValidate.value, conflictManager.value) } diff --git a/main/src/main/scala/sbt/Main.scala b/main/src/main/scala/sbt/Main.scala index d899587e6..8c2dd791c 100644 --- a/main/src/main/scala/sbt/Main.scala +++ b/main/src/main/scala/sbt/Main.scala @@ -16,7 +16,7 @@ import Project.LoadAction import scala.annotation.tailrec import sbt.io.IO -import sbt.io.Path._ +import sbt.io.syntax._ import StandardMain._ import java.io.File diff --git a/main/src/main/scala/sbt/Opts.scala b/main/src/main/scala/sbt/Opts.scala index 4f5e1e19d..201eb3bbf 100644 --- a/main/src/main/scala/sbt/Opts.scala +++ b/main/src/main/scala/sbt/Opts.scala @@ -9,6 +9,7 @@ import java.io.File import java.net.URL import sbt.io.Path +import Path._ /** Options for well-known tasks. */ object Opts { @@ -30,7 +31,7 @@ object Opts { mappings.map { case (f, u) => s"${f.getAbsolutePath}#${u.toExternalForm}" }.mkString("-doc-external-doc:", ",", "") :: Nil } object resolver { - import Path._ + import sbt.io.syntax._ val sonatypeReleases = Resolver.sonatypeRepo("releases") val sonatypeSnapshots = Resolver.sonatypeRepo("snapshots") val sonatypeStaging = new MavenRepository("sonatype-staging", "https://oss.sonatype.org/service/local/staging/deploy/maven2") @@ -40,7 +41,7 @@ object Opts { object DefaultOptions { import Opts._ - import Path._ + import sbt.io.syntax._ import BuildPaths.{ getGlobalBase, getGlobalSettingsDirectory } import Project.{ extract, richInitializeTask } import Def.Setting diff --git a/main/src/main/scala/sbt/internal/Load.scala b/main/src/main/scala/sbt/internal/Load.scala index a7a6213d0..f02d566ef 100755 --- a/main/src/main/scala/sbt/internal/Load.scala +++ b/main/src/main/scala/sbt/internal/Load.scala @@ -274,7 +274,7 @@ private[sbt] object Load { // put cleanups there, perhaps. if (keepSet.nonEmpty) { def keepFile(f: File) = keepSet(f.getCanonicalPath) - import Path._ + import sbt.io.syntax._ val existing = (baseTarget.allPaths.get).filterNot(_.isDirectory) val toDelete = existing.filterNot(keepFile) if (toDelete.nonEmpty) { @@ -799,7 +799,7 @@ private[sbt] object Load { def hasDefinition(dir: File) = { - import Path._ + import sbt.io.syntax._ (dir * -GlobFilter(DefaultTargetName)).get.nonEmpty } def noPlugins(dir: File, config: LoadBuildConfiguration): sbt.LoadedPlugins = diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 42ff99bcd..9e7677a42 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -9,10 +9,10 @@ object Dependencies { lazy val scala211 = "2.11.8" // sbt modules - val utilVersion = "0.1.0-M11" - val ioVersion = "1.0.0-M3" - val zincVersion = "0.1.0-M3-84942e08e7b11c6ef831c6443fc31bbff19ed3c2-SNAPSHOT" - val librarymanagementVersion = "0.1.0-27bf18f7a3d945d84f72bb0e0e4aa98151417609-SNAPSHOT" + val ioVersion = "1.0.0-M5" + val utilVersion = "0.1.0-M12" + val librarymanagementVersion = "0.1.0-M8" + val zincVersion = "1.0.0-M1" lazy val sbtIO = "org.scala-sbt" %% "io" % ioVersion lazy val utilCollection = "org.scala-sbt" %% "util-collection" % utilVersion lazy val utilLogging = "org.scala-sbt" %% "util-logging" % utilVersion @@ -26,8 +26,8 @@ object Dependencies { lazy val utilTracking = "org.scala-sbt" %% "util-tracking" % utilVersion lazy val utilScripted = "org.scala-sbt" %% "util-scripted" % utilVersion lazy val libraryManagement = "org.scala-sbt" %% "librarymanagement" % librarymanagementVersion - lazy val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0-M1" - lazy val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0-M1" + lazy val launcherInterface = "org.scala-sbt" % "launcher-interface" % "1.0.0" + lazy val rawLauncher = "org.scala-sbt" % "launcher" % "1.0.0" lazy val testInterface = "org.scala-sbt" % "test-interface" % "1.0" lazy val zinc = "org.scala-sbt" %% "zinc" % zincVersion diff --git a/sbt/src/main/scala/Import.scala b/sbt/src/main/scala/Import.scala index d8d293a35..10285ce9a 100644 --- a/sbt/src/main/scala/Import.scala +++ b/sbt/src/main/scala/Import.scala @@ -1,6 +1,13 @@ package sbt -object Import { +trait Import { + type Setting[T] = Def.Setting[T] + type ScopedKey[T] = Def.ScopedKey[T] + type SettingsDefinition = Def.SettingsDefinition + type File = java.io.File + type URI = java.net.URI + type URL = java.net.URL + // sbt.io val AllPassFilter = sbt.io.AllPassFilter val DirectoryFilter = sbt.io.DirectoryFilter @@ -17,10 +24,8 @@ object Import { type NameFilter = sbt.io.NameFilter val NothingFilter = sbt.io.NothingFilter val Path = sbt.io.Path - type PathExtra = sbt.io.PathExtra val PathFinder = sbt.io.PathFinder type PathFinder = sbt.io.PathFinder - type PathLow = sbt.io.PathLow type PatternFilter = sbt.io.PatternFilter type RichFile = sbt.io.RichFile type SimpleFileFilter = sbt.io.SimpleFileFilter @@ -362,8 +367,6 @@ object Import { type ModuleSettings = sbt.internal.librarymanagement.ModuleSettings val InlineConfiguration = sbt.internal.librarymanagement.InlineConfiguration type InlineConfiguration = sbt.internal.librarymanagement.InlineConfiguration - val InlineConfigurationWithExcludes = sbt.internal.librarymanagement.InlineConfigurationWithExcludes - type InlineConfigurationWithExcludes = sbt.internal.librarymanagement.InlineConfigurationWithExcludes type InlineIvyConfiguration = sbt.internal.librarymanagement.InlineIvyConfiguration type InvalidComponent = sbt.internal.librarymanagement.InvalidComponent val IvyActions = sbt.internal.librarymanagement.IvyActions diff --git a/sbt/src/main/scala/ProcessExtra.scala b/sbt/src/main/scala/ProcessExtra.scala index 9a3c020c4..1645c6147 100644 --- a/sbt/src/main/scala/ProcessExtra.scala +++ b/sbt/src/main/scala/ProcessExtra.scala @@ -1,6 +1,8 @@ package sbt import java.lang.{ Process => JProcess, ProcessBuilder => JProcessBuilder } +import java.net.URL +import java.io.File trait ProcessExtra { import scala.sys.process._ @@ -8,8 +10,8 @@ trait ProcessExtra { implicit def builderToProcess(builder: JProcessBuilder): ProcessBuilder = apply(builder) implicit def fileToProcess(file: File): ProcessBuilder.FileBuilder = apply(file) implicit def urlToProcess(url: URL): ProcessBuilder.URLBuilder = apply(url) - @deprecated("Use string interpolation", "0.13.0") - implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command) + // @deprecated("Use string interpolation", "0.13.0") + // implicit def xmlToProcess(command: scala.xml.Elem): ProcessBuilder = apply(command) implicit def buildersToProcess[T](builders: Seq[T])(implicit convert: T => ProcessBuilder.Source): Seq[ProcessBuilder.Source] = applySeq(builders) implicit def stringToProcess(command: String): ProcessBuilder = apply(command) diff --git a/sbt/src/main/scala/package.scala b/sbt/src/main/scala/package.scala index 48f00804a..71288c370 100644 --- a/sbt/src/main/scala/package.scala +++ b/sbt/src/main/scala/package.scala @@ -1,47 +1,4 @@ /* sbt -- Simple Build Tool * Copyright 2010, 2011 Mark Harrah */ -package object sbt extends sbt.std.TaskExtra with sbt.internal.util.Types with sbt.ProcessExtra - with sbt.internal.librarymanagement.impl.DependencyBuilders with sbt.io.PathExtra with sbt.ProjectExtra - with sbt.internal.librarymanagement.DependencyFilterExtra with sbt.BuildExtra with sbt.TaskMacroExtra - with sbt.ScopeFilter.Make { - type Setting[T] = Def.Setting[T] - type ScopedKey[T] = Def.ScopedKey[T] - type SettingsDefinition = Def.SettingsDefinition - type File = java.io.File - type URI = java.net.URI - type URL = java.net.URL - - object CompileOrder { - val JavaThenScala = xsbti.compile.CompileOrder.JavaThenScala - val ScalaThenJava = xsbti.compile.CompileOrder.ScalaThenJava - val Mixed = xsbti.compile.CompileOrder.Mixed - } - type CompileOrder = xsbti.compile.CompileOrder - - implicit def maybeToOption[S](m: xsbti.Maybe[S]): Option[S] = - if (m.isDefined) Some(m.get) else None - def uri(s: String): URI = new URI(s) - def file(s: String): File = new File(s) - def url(s: String): URL = new URL(s) - - final val ThisScope = Scope.ThisScope - final val GlobalScope = Scope.GlobalScope - - import sbt.librarymanagement.{ Configuration, Configurations => C } - final val Compile = C.Compile - final val Test = C.Test - final val Runtime = C.Runtime - final val IntegrationTest = C.IntegrationTest - final val Default = C.Default - final val Provided = C.Provided - // java.lang.System is more important, so don't alias this one - // final val System = C.System - final val Optional = C.Optional - def config(s: String): Configuration = C.config(s) - - import language.experimental.macros - def settingKey[T](description: String): SettingKey[T] = macro std.KeyMacro.settingKeyImpl[T] - def taskKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T] - def inputKey[T](description: String): InputKey[T] = macro std.KeyMacro.inputKeyImpl[T] -} +package object sbt extends Import diff --git a/sbt/src/main/scala/syntax.scala b/sbt/src/main/scala/syntax.scala new file mode 100644 index 000000000..838eb123a --- /dev/null +++ b/sbt/src/main/scala/syntax.scala @@ -0,0 +1,64 @@ +package sbt + +object syntax extends syntax + +abstract class syntax extends IOSyntax0 with sbt.std.TaskExtra with sbt.internal.util.Types with sbt.ProcessExtra + with sbt.internal.librarymanagement.impl.DependencyBuilders with sbt.ProjectExtra + with sbt.internal.librarymanagement.DependencyFilterExtra with sbt.BuildExtra with sbt.TaskMacroExtra + with sbt.ScopeFilter.Make { + + // IO + def uri(s: String): URI = new URI(s) + def file(s: String): File = new File(s) + def url(s: String): URL = new URL(s) + implicit def fileToRichFile(file: File): sbt.io.RichFile = new sbt.io.RichFile(file) + implicit def filesToFinder(cc: Traversable[File]): sbt.io.PathFinder = sbt.io.PathFinder.strict(cc) + + // others + + object CompileOrder { + val JavaThenScala = xsbti.compile.CompileOrder.JavaThenScala + val ScalaThenJava = xsbti.compile.CompileOrder.ScalaThenJava + val Mixed = xsbti.compile.CompileOrder.Mixed + } + type CompileOrder = xsbti.compile.CompileOrder + + implicit def maybeToOption[S](m: xsbti.Maybe[S]): Option[S] = + if (m.isDefined) Some(m.get) else None + + final val ThisScope = Scope.ThisScope + final val GlobalScope = Scope.GlobalScope + + import sbt.{ Configurations => C } + final val Compile = C.Compile + final val Test = C.Test + final val Runtime = C.Runtime + final val IntegrationTest = C.IntegrationTest + final val Default = C.Default + final val Provided = C.Provided + // java.lang.System is more important, so don't alias this one + // final val System = C.System + final val Optional = C.Optional + def config(s: String): Configuration = C.config(s) + + import language.experimental.macros + def settingKey[T](description: String): SettingKey[T] = macro std.KeyMacro.settingKeyImpl[T] + def taskKey[T](description: String): TaskKey[T] = macro std.KeyMacro.taskKeyImpl[T] + def inputKey[T](description: String): InputKey[T] = macro std.KeyMacro.inputKeyImpl[T] +} + +// Todo share this this io.syntax +private[sbt] trait IOSyntax0 extends IOSyntax1 { + implicit def alternative[A, B](f: A => Option[B]): Alternative[A, B] = + new Alternative[A, B] { + def |(g: A => Option[B]) = + (a: A) => f(a) orElse g(a) + } +} +private[sbt] trait Alternative[A, B] { + def |(g: A => Option[B]): A => Option[B] +} + +private[sbt] trait IOSyntax1 { + implicit def singleFileFinder(file: File): sbt.io.PathFinder = sbt.io.PathFinder(file) +} diff --git a/sbt/src/sbt-test/actions/aggregate/project/Marker.scala b/sbt/src/sbt-test/actions/aggregate/project/Marker.scala index c4624579a..72f47b8fa 100644 --- a/sbt/src/sbt-test/actions/aggregate/project/Marker.scala +++ b/sbt/src/sbt-test/actions/aggregate/project/Marker.scala @@ -1,6 +1,4 @@ -import sbt._ -import Keys._ -import Import._ +import sbt._, syntax._, Keys._ import Def.Initialize object Marker extends AutoPlugin { diff --git a/sbt/src/sbt-test/actions/compile-time-only/changes/A1.scala b/sbt/src/sbt-test/actions/compile-time-only/changes/A1.scala index 40e72ac6e..d83a42865 100644 --- a/sbt/src/sbt-test/actions/compile-time-only/changes/A1.scala +++ b/sbt/src/sbt-test/actions/compile-time-only/changes/A1.scala @@ -1,5 +1,4 @@ -import sbt._ -import Import._ +import sbt._, syntax._, Keys._ import Def.Initialize import complete.{DefaultParsers, Parser} diff --git a/sbt/src/sbt-test/actions/compile-time-only/changes/A3.scala b/sbt/src/sbt-test/actions/compile-time-only/changes/A3.scala index 09913bebc..8a4a3a849 100644 --- a/sbt/src/sbt-test/actions/compile-time-only/changes/A3.scala +++ b/sbt/src/sbt-test/actions/compile-time-only/changes/A3.scala @@ -1,5 +1,4 @@ -import sbt._ -import Import._ +import sbt._, syntax._, Keys._ import Def.Initialize import complete.{DefaultParsers, Parser} diff --git a/sbt/src/sbt-test/actions/state/build.sbt b/sbt/src/sbt-test/actions/state/build.sbt index 7b57aac9e..fa3b59606 100644 --- a/sbt/src/sbt-test/actions/state/build.sbt +++ b/sbt/src/sbt-test/actions/state/build.sbt @@ -1,4 +1,3 @@ -import Import._ import complete.Parser import complete.DefaultParsers._ import sbinary.DefaultProtocol._ diff --git a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala index bc3461b14..9819d5fda 100644 --- a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala +++ b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala @@ -1,8 +1,6 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ - import sbt._ - import Import._ - import sbt.Keys.{name, resolvedScoped, organization } + import sbt._, syntax._, Keys._ import java.util.concurrent.atomic.{AtomicInteger => AInt} object Imports diff --git a/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala b/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala index c1293a3cf..352643e3c 100644 --- a/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala +++ b/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala @@ -1,8 +1,6 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ -import sbt._ -import Keys._ -import Import._ +import sbt._, syntax._, Keys._ object C extends AutoPlugin { object autoImport { diff --git a/sbt/src/sbt-test/project/session-update-from-cmd/project/Common.scala b/sbt/src/sbt-test/project/session-update-from-cmd/project/Common.scala index 4d9fc6660..94f7f2a81 100644 --- a/sbt/src/sbt-test/project/session-update-from-cmd/project/Common.scala +++ b/sbt/src/sbt-test/project/session-update-from-cmd/project/Common.scala @@ -1,6 +1,4 @@ -import sbt._ -import Keys._ -import Import._ +import sbt._, syntax._, Keys._ object Common { lazy val k1 = taskKey[Unit]("") diff --git a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala index e74a8d365..1a663350d 100644 --- a/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala +++ b/scripted/plugin/src/main/scala/sbt/ScriptedPlugin.scala @@ -11,9 +11,7 @@ import sbt.internal.inc.ModuleUtilities import java.lang.reflect.{ InvocationTargetException, Method } import java.util.Properties -import sbt.librarymanagement.Configuration - -import sbt.io.{ AllPassFilter, PathFinder } +import sbt.syntax._ object ScriptedPlugin extends AutoPlugin { override def requires = plugins.JvmPlugin diff --git a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala index 24755030a..ed53c7f6d 100644 --- a/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala +++ b/scripted/sbt/src/main/scala/sbt/test/ScriptedTests.scala @@ -29,7 +29,7 @@ final class ScriptedTests(resourceBaseDirectory: File, bufferLog: Boolean, launc def scriptedTest(group: String, name: String, log: Logger): Seq[() => Option[String]] = scriptedTest(group, name, emptyCallback, log) def scriptedTest(group: String, name: String, prescripted: File => Unit, log: Logger): Seq[() => Option[String]] = { - import Path._ + import sbt.io.syntax._ import GlobFilter._ var failed = false for (groupDir <- (resourceBaseDirectory * group).get; nme <- (groupDir * name).get) yield { diff --git a/tasks/standard/src/main/scala/sbt/std/Streams.scala b/tasks/standard/src/main/scala/sbt/std/Streams.scala index 17fd19677..064ac8d7b 100644 --- a/tasks/standard/src/main/scala/sbt/std/Streams.scala +++ b/tasks/standard/src/main/scala/sbt/std/Streams.scala @@ -10,7 +10,7 @@ import java.io.{ Closeable, File, FileInputStream, FileOutputStream, InputStream import sbt.internal.io.DeferredWriter import sbt.io.IO -import sbt.io.Path._ +import sbt.io.syntax._ import sbt.util.Logger From 738e8fb2f395f79364cb450e97c50d0db0331921 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 16:11:57 -0400 Subject: [PATCH 04/23] Adjust discovery code to new Zinc --- main/actions/src/main/scala/sbt/Tests.scala | 6 ++++-- main/src/main/scala/sbt/PluginDiscovery.scala | 7 +++++-- sbt/src/sbt-test/actions/aggregate/test | 2 ++ 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/main/actions/src/main/scala/sbt/Tests.scala b/main/actions/src/main/scala/sbt/Tests.scala index 79f29de01..c0a518e4a 100644 --- a/main/actions/src/main/scala/sbt/Tests.scala +++ b/main/actions/src/main/scala/sbt/Tests.scala @@ -275,10 +275,12 @@ object Tests { def allDefs(analysis: CompileAnalysis) = analysis match { case analysis: Analysis => - analysis.apis.internal.values.flatMap { ac => + val acs: Seq[xsbti.api.AnalyzedClass] = analysis.apis.internal.values.toVector + acs.flatMap { ac => val companions = ac.api val all = - companions.classApi.structure.declared ++ companions.classApi.structure.inherited ++ + Seq(companions.classApi, companions.objectApi) ++ + companions.classApi.structure.declared ++ companions.classApi.structure.inherited ++ companions.objectApi.structure.declared ++ companions.objectApi.structure.inherited all diff --git a/main/src/main/scala/sbt/PluginDiscovery.scala b/main/src/main/scala/sbt/PluginDiscovery.scala index b1eeed519..2f8525e5b 100644 --- a/main/src/main/scala/sbt/PluginDiscovery.scala +++ b/main/src/main/scala/sbt/PluginDiscovery.scala @@ -23,7 +23,9 @@ object PluginDiscovery { final val Builds = "sbt/sbt.builds" } /** Names of top-level modules that subclass sbt plugin-related classes: [[Plugin]], [[AutoPlugin]], and [[BuildDef]]. */ - final class DiscoveredNames(val plugins: Seq[String], val autoPlugins: Seq[String], val builds: Seq[String]) + final class DiscoveredNames(val plugins: Seq[String], val autoPlugins: Seq[String], val builds: Seq[String]) { + override def toString: String = s"""DiscoveredNames($plugins, $autoPlugins, $builds)""" + } def emptyDiscoveredNames: DiscoveredNames = new DiscoveredNames(Nil, Nil, Nil) @@ -96,7 +98,8 @@ object PluginDiscovery { def sourceModuleNames(analysis: CompileAnalysis, subclasses: String*): Seq[String] = { val subclassSet = subclasses.toSet - val ds = Discovery(subclassSet, Set.empty)(Tests.allDefs(analysis)) + val defs = Tests.allDefs(analysis) + val ds = Discovery(subclassSet, Set.empty)(defs) ds.flatMap { case (definition, Discovered(subs, _, _, true)) => if ((subs & subclassSet).isEmpty) Nil else definition.name :: Nil diff --git a/sbt/src/sbt-test/actions/aggregate/test b/sbt/src/sbt-test/actions/aggregate/test index 054847bc4..223cc9476 100644 --- a/sbt/src/sbt-test/actions/aggregate/test +++ b/sbt/src/sbt-test/actions/aggregate/test @@ -1,3 +1,5 @@ +> plugins + # single project, 'mark' not defined -> mark $ absent ran From ea941545e498a50bcb83fb357e7566a4ff0e3e27 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 21:27:12 -0400 Subject: [PATCH 05/23] Fix apiinfo/show-circular-structure --- sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt index a796de4e7..53e020d63 100644 --- a/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt +++ b/sbt/src/sbt-test/apiinfo/show-circular-structure/build.sbt @@ -3,8 +3,8 @@ logLevel := Level.Debug incOptions ~= { _.withApiDebug(true) } TaskKey[Unit]("show-apis") <<= (compile in Compile, scalaSource in Compile, javaSource in Compile) map { case (a: sbt.internal.inc.Analysis, scalaSrc: java.io.File, javaSrc: java.io.File) => - val aApi = a.apis.internalAPI(scalaSrc / "A.scala").api - val jApi = a.apis.internalAPI(javaSrc / "test/J.java").api + val aApi = a.apis.internalAPI("test.A").api.classApi + val jApi = a.apis.internalAPI("test.J").api.classApi import xsbt.api.DefaultShowAPI import DefaultShowAPI._ DefaultShowAPI(aApi) From 5d8b3e7dd9881fbb70b9836e9399f1228e20e0ee Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 21:45:52 -0400 Subject: [PATCH 06/23] Remove int-ant-style test --- .../compiler-project/inc-ant-style/build.sbt | 30 ------------------- .../inc-ant-style/changes/A1.scala | 3 -- .../inc-ant-style/src/main/scala/A.scala | 5 ---- .../inc-ant-style/src/main/scala/B.scala | 3 -- .../inc-ant-style/src/main/scala/C.scala | 5 ---- .../compiler-project/inc-ant-style/test | 8 ----- 6 files changed, 54 deletions(-) delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/changes/A1.scala delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/A.scala delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/B.scala delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/C.scala delete mode 100644 sbt/src/sbt-test/compiler-project/inc-ant-style/test diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt b/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt deleted file mode 100644 index c00ed3d45..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/build.sbt +++ /dev/null @@ -1,30 +0,0 @@ -logLevel := Level.Debug - -incOptions := incOptions.value.withNameHashing(false).withAntStyle(true) - -/* Performs checks related to compilations: - * a) checks in which compilation given set of files was recompiled - * b) checks overall number of compilations performed - */ -TaskKey[Unit]("check-compilations") := { - val analysis = (compile in Compile).value match { case analysis: Analysis => analysis } - val srcDir = (scalaSource in Compile).value - def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f - val allCompilations = analysis.compilations.allCompilations - val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c => - val recompiledFiles = analysis.apis.internal.collect { - case (file, api) if api.compilation.startTime == c.startTime => relative(file) - } - recompiledFiles.toSet - } - def recompiledFilesInIteration(iteration: Int, fileNames: Set[String]) = { - val files = fileNames.map(new java.io.File(_)) - assert(recompiledFiles(iteration) == files, "%s != %s".format(recompiledFiles(iteration), files)) - } - assert(allCompilations.size == 2) - // B.scala and C.scala are compiled at the beginning, in the Ant-style incremental compilation - // they are not rebuild when A.scala. - recompiledFilesInIteration(0, Set("B.scala", "C.scala")) - // A.scala is changed and recompiled - recompiledFilesInIteration(1, Set("A.scala")) -} diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/changes/A1.scala b/sbt/src/sbt-test/compiler-project/inc-ant-style/changes/A1.scala deleted file mode 100644 index e86bab42e..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/changes/A1.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test3 - -trait A \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/A.scala b/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/A.scala deleted file mode 100644 index 4ab580616..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -package test3 - -trait A { - def foo = 1 -} diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/B.scala b/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/B.scala deleted file mode 100644 index 572e3c764..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -package test3 - -trait B extends A diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/C.scala b/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/C.scala deleted file mode 100644 index c8b935590..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/src/main/scala/C.scala +++ /dev/null @@ -1,5 +0,0 @@ -package test3 - -trait C { - def abc(a: A): Int = a.foo -} diff --git a/sbt/src/sbt-test/compiler-project/inc-ant-style/test b/sbt/src/sbt-test/compiler-project/inc-ant-style/test deleted file mode 100644 index f6d94fc14..000000000 --- a/sbt/src/sbt-test/compiler-project/inc-ant-style/test +++ /dev/null @@ -1,8 +0,0 @@ -# introduces first compile iteration -> compile -# remove A.foo method -$ copy-file changes/A1.scala src/main/scala/A.scala -# recompiles just A.scala in Ant mode so it introduces one more iteration -> compile -# check if there are only two compile iterations performed -> check-compilations From 88f72b62d9485aa1d291a402329ac647a79dbd99 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 21:46:31 -0400 Subject: [PATCH 07/23] Remove run2.8 test --- .../compiler-project/run2.8/build.sbt | 5 --- .../run2.8/src/main/scala/Foo.scala | 40 ------------------- .../run2.8/src/test/scala/ATest.scala | 14 ------- sbt/src/sbt-test/compiler-project/run2.8/test | 1 - 4 files changed, 60 deletions(-) delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/build.sbt delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/src/main/scala/Foo.scala delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/src/test/scala/ATest.scala delete mode 100644 sbt/src/sbt-test/compiler-project/run2.8/test diff --git a/sbt/src/sbt-test/compiler-project/run2.8/build.sbt b/sbt/src/sbt-test/compiler-project/run2.8/build.sbt deleted file mode 100644 index 159ac76e6..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/build.sbt +++ /dev/null @@ -1,5 +0,0 @@ -scalaVersion := "2.8.1" - -libraryDependencies += "org.scala-tools.testing" %% "specs" % "1.6.7.2" % "test" - -libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-compiler" % _) \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/src/main/scala/Foo.scala b/sbt/src/sbt-test/compiler-project/run2.8/src/main/scala/Foo.scala deleted file mode 100644 index b5ea08ac8..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/src/main/scala/Foo.scala +++ /dev/null @@ -1,40 +0,0 @@ -package foo.bar - -import java.io.File -import File.{pathSeparator => / } -import scala.io.Source - -class Holder { var value: Any = _ } - -import scala.tools.nsc.{GenericRunnerSettings, Interpreter, Settings} - -class Foo { - val g = new GenericRunnerSettings(System.err.println) - val settings = new Settings() - val loader = getClass.getClassLoader - settings.classpath.value = classpath("app", loader).getOrElse(error("Error: could not find application classpath")) - settings.bootclasspath.value = settings.bootclasspath.value + / + classpath("boot", loader).getOrElse(error("Error: could not find boot classpath")) - val inter = new Interpreter(settings) { - override protected def parentClassLoader = Foo.this.getClass.getClassLoader - } - def eval(code: String): Any = { - val h = new Holder - inter.bind("$r_", h.getClass.getName, h) - val r = inter.interpret("$r_.value = " + code) - h.value - } - - private def classpath(name: String, loader: ClassLoader) = - Option(loader.getResource(name + ".class.path")).map { cp => - Source.fromURL(cp).mkString - } -} - -object Test -{ - def main(args: Array[String]) - { - val foo = new Foo - args.foreach { arg => foo.eval(arg) == arg.toInt } - } -} \ No newline at end of file diff --git a/sbt/src/sbt-test/compiler-project/run2.8/src/test/scala/ATest.scala b/sbt/src/sbt-test/compiler-project/run2.8/src/test/scala/ATest.scala deleted file mode 100644 index 639e44adc..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/src/test/scala/ATest.scala +++ /dev/null @@ -1,14 +0,0 @@ -package foo.bar - -import org.specs._ - -class ATest extends Specification -{ - "application and boot classpath" should { - "be provided to running applications and tests" in { - val foo = new Foo - val numbers = List[Any](1,2,5, 19) - numbers.map(i => foo.eval(i.toString)) must haveTheSameElementsAs(numbers) - } - } -} \ 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 deleted file mode 100644 index 7c6f9c539..000000000 --- a/sbt/src/sbt-test/compiler-project/run2.8/test +++ /dev/null @@ -1 +0,0 @@ -> test:test \ No newline at end of file From c0da8561cb418df471bb51367845356f3e153c57 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 21:49:39 -0400 Subject: [PATCH 08/23] Fix compiler-project/semantic-errors --- sbt/src/sbt-test/compiler-project/semantic-errors/build.sbt | 4 +--- .../project/src/main/scala/sbt/TestPlugin.scala | 3 ++- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/sbt/src/sbt-test/compiler-project/semantic-errors/build.sbt b/sbt/src/sbt-test/compiler-project/semantic-errors/build.sbt index f20622620..4ce623f4f 100644 --- a/sbt/src/sbt-test/compiler-project/semantic-errors/build.sbt +++ b/sbt/src/sbt-test/compiler-project/semantic-errors/build.sbt @@ -1,5 +1,3 @@ - - TaskKey[Unit]("checkJavaFailures") := { val reporter = savedReporter.value val ignore = (compile in Compile).failure.value @@ -26,4 +24,4 @@ TaskKey[Unit]("checkScalaFailures") := { assert(file == scalaFile, s"First failure file location is not $scalaFile, $first") } -compileOrder := CompileOrder.Mixed \ No newline at end of file +compileOrder := CompileOrder.Mixed diff --git a/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala b/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala index b763b174f..4f3746d3e 100644 --- a/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala +++ b/sbt/src/sbt-test/compiler-project/semantic-errors/project/src/main/scala/sbt/TestPlugin.scala @@ -1,6 +1,7 @@ package sbt -import Keys._ +import sbt.syntax._ +import sbt.Keys._ import xsbti.{Position, Severity} object TestPlugin extends AutoPlugin { From 8875b6819fa64c6ab4018f024d7a7cf6d7cddfd6 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 22:46:14 -0400 Subject: [PATCH 09/23] Fix project/auto-import --- sbt/src/sbt-test/project/auto-import/project/P.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbt/src/sbt-test/project/auto-import/project/P.scala b/sbt/src/sbt-test/project/auto-import/project/P.scala index d2bb6389d..77be945b3 100644 --- a/sbt/src/sbt-test/project/auto-import/project/P.scala +++ b/sbt/src/sbt-test/project/auto-import/project/P.scala @@ -1,4 +1,4 @@ -import sbt._ +import sbt._, syntax._ object Q extends AutoPlugin { override val requires = plugins.JvmPlugin From d09a164c927eca075df87b427664ff3cf4b2dde2 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 22:51:42 -0400 Subject: [PATCH 10/23] Fix project/binary-plugin --- .../binary-plugin/changes/define/A.scala | 24 +++++++++---------- .../binary-plugin/changes/define/D.scala | 6 ++--- 2 files changed, 14 insertions(+), 16 deletions(-) diff --git a/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala b/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala index 352643e3c..f003b8da5 100644 --- a/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala +++ b/sbt/src/sbt-test/project/binary-plugin/changes/define/A.scala @@ -3,20 +3,20 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ import sbt._, syntax._, Keys._ object C extends AutoPlugin { - object autoImport { - object bN extends AutoPlugin { - override def trigger = allRequirements - } - lazy val check = taskKey[Unit]("Checks that the AutoPlugin and Build are automatically added.") - } + object autoImport { + // object bN extends AutoPlugin { + // override def trigger = allRequirements + // } + lazy val check = taskKey[Unit]("Checks that the AutoPlugin and Build are automatically added.") + } } - import C.autoImport._ + import C.autoImport._ object A extends AutoPlugin { - override def requires = bN - override def trigger = allRequirements - override def projectSettings = Seq( - check := {} - ) + // override def requires = bN + override def trigger = allRequirements + override def projectSettings = Seq( + check := {} + ) } diff --git a/sbt/src/sbt-test/project/binary-plugin/changes/define/D.scala b/sbt/src/sbt-test/project/binary-plugin/changes/define/D.scala index e4b47921d..1b21ad9dd 100644 --- a/sbt/src/sbt-test/project/binary-plugin/changes/define/D.scala +++ b/sbt/src/sbt-test/project/binary-plugin/changes/define/D.scala @@ -1,11 +1,9 @@ // no package declaration -import sbt._ +import sbt._, syntax._, Keys._ object D extends AutoPlugin { - object autoImport { lazy val dKey = settingKey[String]("Test key") } - -} \ No newline at end of file +} From 72e89496b5ee98b239918a4bdf410ceee93d9dec Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:16:41 -0400 Subject: [PATCH 11/23] Fix project/flatten --- sbt/src/sbt-test/project/flatten/build.sbt | 6 ++-- .../sbt-test/project/flatten/src/JavaA.java | 5 ++-- .../sbt-test/project/flatten/src/ScalaA.scala | 3 +- .../project/flatten/src/a/ScalaB.scala | 20 ++++++------- .../project/flatten/src/a/main-resource-a | 1 + .../project/flatten/src/a/test-resource-a | 1 - .../project/flatten/src/main-resource | 1 + .../project/flatten/src/test-resource | 1 - sbt/src/sbt-test/project/flatten/test | 1 + .../project/flatten/test-src/SimpleTest.scala | 20 ++++++------- .../flatten/test-src/c/ResourcesTest.scala | 30 +++++++++---------- 11 files changed, 40 insertions(+), 49 deletions(-) create mode 100644 sbt/src/sbt-test/project/flatten/src/a/main-resource-a delete mode 100644 sbt/src/sbt-test/project/flatten/src/a/test-resource-a create mode 100644 sbt/src/sbt-test/project/flatten/src/main-resource delete mode 100644 sbt/src/sbt-test/project/flatten/src/test-resource diff --git a/sbt/src/sbt-test/project/flatten/build.sbt b/sbt/src/sbt-test/project/flatten/build.sbt index 22b63a657..819170f8e 100644 --- a/sbt/src/sbt-test/project/flatten/build.sbt +++ b/sbt/src/sbt-test/project/flatten/build.sbt @@ -1,5 +1,3 @@ -import Configurations.{Compile, Test} - lazy val root = (project in file(".")). settings( forConfig(Compile, "src"), @@ -8,8 +6,8 @@ lazy val root = (project in file(".")). ) def baseSettings = Seq( - scalaVersion := "2.8.1", - libraryDependencies += "org.scala-tools.testing" %% "scalacheck" % "1.8" % "test", + scalaVersion := "2.11.8", + libraryDependencies += "org.scalacheck" %% "scalacheck" % "1.11.4" % Test, includeFilter in unmanagedSources := "*.java" | "*.scala" ) diff --git a/sbt/src/sbt-test/project/flatten/src/JavaA.java b/sbt/src/sbt-test/project/flatten/src/JavaA.java index 4b0a4410c..d18b16ba4 100644 --- a/sbt/src/sbt-test/project/flatten/src/JavaA.java +++ b/sbt/src/sbt-test/project/flatten/src/JavaA.java @@ -1,4 +1,3 @@ -public class JavaA -{ +public class JavaA { public int inc(int i) { return i+1; } -} \ No newline at end of file +} diff --git a/sbt/src/sbt-test/project/flatten/src/ScalaA.scala b/sbt/src/sbt-test/project/flatten/src/ScalaA.scala index bf212bddb..7161178b0 100644 --- a/sbt/src/sbt-test/project/flatten/src/ScalaA.scala +++ b/sbt/src/sbt-test/project/flatten/src/ScalaA.scala @@ -1,6 +1,5 @@ package a.b -class ScalaA -{ +class ScalaA { def increment(i: Int) = i + 1 } \ No newline at end of file diff --git a/sbt/src/sbt-test/project/flatten/src/a/ScalaB.scala b/sbt/src/sbt-test/project/flatten/src/a/ScalaB.scala index 590ee17bb..6ffd7130f 100644 --- a/sbt/src/sbt-test/project/flatten/src/a/ScalaB.scala +++ b/sbt/src/sbt-test/project/flatten/src/a/ScalaB.scala @@ -1,16 +1,14 @@ package b -class ScalaB -{ - def decrement(i: Int) = i - 1 +class ScalaB { + def decrement(i: Int) = i - 1 } object ScalaC { - def loadResources() - { - resource("/main-resource") - resource("main-resource-a") - resource("/a/main-resource-a") - } - def resource(s: String) = assert(getClass.getResource(s) != null, "Could not find resource '" + s + "'") -} \ No newline at end of file + def loadResources(): Unit = { + resource("/main-resource") + resource("/a/main-resource-a") + } + def resource(s: String): Unit = + assert(getClass.getResource(s) != null, "Could not find resource '" + s + "'") +} diff --git a/sbt/src/sbt-test/project/flatten/src/a/main-resource-a b/sbt/src/sbt-test/project/flatten/src/a/main-resource-a new file mode 100644 index 000000000..46f1b8897 --- /dev/null +++ b/sbt/src/sbt-test/project/flatten/src/a/main-resource-a @@ -0,0 +1 @@ +This is a main resource. \ No newline at end of file diff --git a/sbt/src/sbt-test/project/flatten/src/a/test-resource-a b/sbt/src/sbt-test/project/flatten/src/a/test-resource-a deleted file mode 100644 index 9754de6ae..000000000 --- a/sbt/src/sbt-test/project/flatten/src/a/test-resource-a +++ /dev/null @@ -1 +0,0 @@ -This is a test resource. \ No newline at end of file diff --git a/sbt/src/sbt-test/project/flatten/src/main-resource b/sbt/src/sbt-test/project/flatten/src/main-resource new file mode 100644 index 000000000..46f1b8897 --- /dev/null +++ b/sbt/src/sbt-test/project/flatten/src/main-resource @@ -0,0 +1 @@ +This is a main resource. \ No newline at end of file diff --git a/sbt/src/sbt-test/project/flatten/src/test-resource b/sbt/src/sbt-test/project/flatten/src/test-resource deleted file mode 100644 index 9754de6ae..000000000 --- a/sbt/src/sbt-test/project/flatten/src/test-resource +++ /dev/null @@ -1 +0,0 @@ -This is a test resource. \ No newline at end of file diff --git a/sbt/src/sbt-test/project/flatten/test b/sbt/src/sbt-test/project/flatten/test index 0050e4f28..cc8a49a88 100644 --- a/sbt/src/sbt-test/project/flatten/test +++ b/sbt/src/sbt-test/project/flatten/test @@ -1,6 +1,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/ +> compile > test > test:run diff --git a/sbt/src/sbt-test/project/flatten/test-src/SimpleTest.scala b/sbt/src/sbt-test/project/flatten/test-src/SimpleTest.scala index 7ef0dc97e..1a1134845 100644 --- a/sbt/src/sbt-test/project/flatten/test-src/SimpleTest.scala +++ b/sbt/src/sbt-test/project/flatten/test-src/SimpleTest.scala @@ -1,15 +1,13 @@ - import org.scalacheck._ - import Prop._ + import org.scalacheck._ + import Prop._ -class SimpleTest extends Properties("Simple") -{ - property("increment scala") = forAll( (i: Int) => (new a.b.ScalaA).increment(i) == i+1) - property("increment java") = forAll( (i: Int) => (new JavaA).inc(i) == i+1) +class SimpleTest extends Properties("Simple") { + property("increment scala") = forAll( (i: Int) => (new a.b.ScalaA).increment(i) == i+1) + property("increment java") = forAll( (i: Int) => (new JavaA).inc(i) == i+1) - property("decrement scala") = forAll( (i: Int) => (new b.ScalaB).decrement(i) == i+1) - property("decrement java") = forAll( (i: Int) => (new a.JavaB).dec(i) == i+1) + // property("decrement scala") = forAll( (i: Int) => (new b.ScalaB).decrement(i) == i+1) + // property("decrement java") = forAll( (i: Int) => (new a.JavaB).dec(i) == i+1) } -object MainTest -{ - def main(args: Array[String]): Unit = () +object MainTest { + def main(args: Array[String]): Unit = () } diff --git a/sbt/src/sbt-test/project/flatten/test-src/c/ResourcesTest.scala b/sbt/src/sbt-test/project/flatten/test-src/c/ResourcesTest.scala index 914d4ba4c..0b02b0f1a 100644 --- a/sbt/src/sbt-test/project/flatten/test-src/c/ResourcesTest.scala +++ b/sbt/src/sbt-test/project/flatten/test-src/c/ResourcesTest.scala @@ -1,20 +1,18 @@ package d - import org.scalacheck._ - import Prop._ + import org.scalacheck._ + import Prop._ -class ResourcesTest extends Properties("Resources") -{ - property("load main resources ok") = forAll( (a: Boolean) => { b.ScalaC.loadResources(); true }) - property("load test resources ok") = forAll( (a: Boolean) => { ScalaD.loadResources(); true }) +class ResourcesTest extends Properties("Resources") { + property("load main resources ok") = forAll( (a: Boolean) => { b.ScalaC.loadResources(); true }) + property("load test resources ok") = forAll( (a: Boolean) => { ScalaD.loadResources(); true }) +} + +object ScalaD { + def loadResources(): Unit = { + resource("/test-resource") + resource("/c/test-resource-c") + } + def resource(s: String): Unit = + assert(getClass.getResource(s) != null, s"Could not find resource '$s'") } -object ScalaD -{ - def loadResources() - { - resource("/test-resource") - resource("test-resource-c") - resource("/c/test-resource-c") - } - def resource(s: String) = assert(getClass.getResource(s) != null, "Could not find resource '" + s + "'") -} \ No newline at end of file From a39295bdaf9d597d602fb578447ef421d587eff2 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:26:04 -0400 Subject: [PATCH 12/23] Fix project/global-plugin --- sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala b/sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala index bbf9fc243..d22df4753 100644 --- a/sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala +++ b/sbt/src/sbt-test/project/global-plugin/global/plugins/A.scala @@ -1,6 +1,6 @@ package test -import sbt._ +import sbt._, syntax._, Keys._ object Global { val x = 3 From 0eba0c35ca9232eddcc5105de6a2246cb15705d6 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:26:29 -0400 Subject: [PATCH 13/23] Fix project/isolated-build-definitions --- .../project/isolated-build-definitions/generator/build.sbt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/sbt/src/sbt-test/project/isolated-build-definitions/generator/build.sbt b/sbt/src/sbt-test/project/isolated-build-definitions/generator/build.sbt index cbc8c6c17..4b1c3536a 100644 --- a/sbt/src/sbt-test/project/isolated-build-definitions/generator/build.sbt +++ b/sbt/src/sbt-test/project/isolated-build-definitions/generator/build.sbt @@ -1,4 +1,4 @@ -lazy val project = (sbt.project in file(".")). +lazy val project = (sbt.syntax.project in file(".")). settings( name := "project", scalaVersion := "2.11.7", From c4ca5b0fd7dce938ef0e8c3f63ca8f93f9c42695 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:30:32 -0400 Subject: [PATCH 14/23] Fix source-dependencies/cross-source --- .../cross-source/src/main/scala-2.9.3/B.scala | 3 --- sbt/src/sbt-test/source-dependencies/cross-source/test | 9 --------- 2 files changed, 12 deletions(-) delete mode 100644 sbt/src/sbt-test/source-dependencies/cross-source/src/main/scala-2.9.3/B.scala diff --git a/sbt/src/sbt-test/source-dependencies/cross-source/src/main/scala-2.9.3/B.scala b/sbt/src/sbt-test/source-dependencies/cross-source/src/main/scala-2.9.3/B.scala deleted file mode 100644 index b1d5f8d3a..000000000 --- a/sbt/src/sbt-test/source-dependencies/cross-source/src/main/scala-2.9.3/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B { - def show(what: String): String = "String interpolation is " + what.toUpperCase -} diff --git a/sbt/src/sbt-test/source-dependencies/cross-source/test b/sbt/src/sbt-test/source-dependencies/cross-source/test index d7964677f..a0fa20837 100644 --- a/sbt/src/sbt-test/source-dependencies/cross-source/test +++ b/sbt/src/sbt-test/source-dependencies/cross-source/test @@ -5,12 +5,3 @@ # A.scala needs B.scala, it would be in source list > ++2.10.4 > compile - -# A.scala needs B.scala, it would be in source list -> ++2.9.3 -> compile - -# Injecting the wrong B.scala in source list -$ copy-file src/main/scala-2.10/B.scala src/main/scala-2.9.3/B.scala -> ++2.9.3 --> compile From 8e7ab495941712ba94fd5695a45e8ab144df1418 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:32:13 -0400 Subject: [PATCH 15/23] Disable source-dependencies/import-class --- .../sbt-test/source-dependencies/import-class/{test => disabled} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename sbt/src/sbt-test/source-dependencies/import-class/{test => disabled} (100%) diff --git a/sbt/src/sbt-test/source-dependencies/import-class/test b/sbt/src/sbt-test/source-dependencies/import-class/disabled similarity index 100% rename from sbt/src/sbt-test/source-dependencies/import-class/test rename to sbt/src/sbt-test/source-dependencies/import-class/disabled From e3560e4ed6ca153e3027542f07ad4298d86408ac Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:37:31 -0400 Subject: [PATCH 16/23] Old incremental compiler is no more --- .../inherited-dependencies/A.scala | 4 --- .../inherited-dependencies/B.scala | 19 ---------- .../inherited-dependencies/C.scala | 1 - .../inherited-dependencies/D.scala | 1 - .../inherited-dependencies/E.scala | 1 - .../inherited-dependencies/F.scala | 3 -- .../inherited-dependencies/G.scala | 1 - .../inherited-dependencies/J.scala | 1 - .../inherited-dependencies/build.sbt | 36 ------------------- .../inherited-dependencies/test | 1 - .../inherited-deps-java/A.java | 1 - .../inherited-deps-java/B.java | 11 ------ .../inherited-deps-java/C.java | 1 - .../inherited-deps-java/D.java | 1 - .../inherited-deps-java/E.java | 1 - .../inherited-deps-java/F.java | 3 -- .../inherited-deps-java/G.java | 3 -- .../inherited-deps-java/J.java | 1 - .../inherited-deps-java/build.sbt | 30 ---------------- .../inherited-deps-java/test | 1 - .../inherited-macros/build.sbt | 22 ------------ .../inherited-macros/changes/Client.scala | 7 ---- .../inherited-macros/macro-client/build.sbt | 9 ----- .../macro-client/src/main/scala/Client.scala | 7 ---- .../macro-client/src/main/scala/Foo.scala | 5 --- .../src/main/scala/Provider.scala | 7 ---- .../source-dependencies/inherited-macros/test | 12 ------- 27 files changed, 190 deletions(-) delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/A.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/B.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/C.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/D.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/E.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/F.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/G.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/J.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-dependencies/test delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/A.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/B.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/C.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/D.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/E.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/F.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/G.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/J.java delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-deps-java/test delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/build.sbt delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/changes/Client.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Client.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Foo.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/macro-provider/src/main/scala/Provider.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/inherited-macros/test diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/A.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/A.scala deleted file mode 100644 index 30853bb78..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/A.scala +++ /dev/null @@ -1,4 +0,0 @@ -// T is a type constructor [x]C -// C extends D -// E verifies the core type gets pulled out -trait A extends B.T[Int] with (E[Int] @unchecked) diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/B.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/B.scala deleted file mode 100644 index 48082cf78..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/B.scala +++ /dev/null @@ -1,19 +0,0 @@ -object B { - type T[x] = C -} - -class B { - // not public, so this shouldn't be tracked as an inherited dependency - private[this] class X extends D with E[Int] - - def x(i: Int): Unit = { - // not public, not an inherited dependency - trait Y extends D - } - - def y(j: Int): Unit = { - // not public - val w: D { def length: Int } = ??? - () - } -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/C.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/C.scala deleted file mode 100644 index 360899d9f..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/C.scala +++ /dev/null @@ -1 +0,0 @@ -trait C extends D diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/D.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/D.scala deleted file mode 100644 index 804e77004..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/D.scala +++ /dev/null @@ -1 +0,0 @@ -trait D extends G.P diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/E.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/E.scala deleted file mode 100644 index fa7c94867..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/E.scala +++ /dev/null @@ -1 +0,0 @@ -trait E[T] diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/F.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/F.scala deleted file mode 100644 index 8c26474b5..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/F.scala +++ /dev/null @@ -1,3 +0,0 @@ -class F { - def q: C { def length: Int } = ??? -} \ No newline at end of file diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/G.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/G.scala deleted file mode 100644 index 1fd92c068..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/G.scala +++ /dev/null @@ -1 +0,0 @@ -object G { trait P extends J } \ No newline at end of file diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/J.scala b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/J.scala deleted file mode 100644 index 62eeb6c96..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/J.scala +++ /dev/null @@ -1 +0,0 @@ -class J \ No newline at end of file diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt deleted file mode 100644 index 5bab26a24..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/build.sbt +++ /dev/null @@ -1,36 +0,0 @@ -// this test is specific to the old incremental compilation algorithm -incOptions := incOptions.value.withNameHashing(false) - -lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted") - -verifyDeps := { - val a = compile.in(Compile).value match { case a: Analysis => a } - val baseDir = baseDirectory.value - def relative(f: java.io.File): java.io.File = f.relativeTo(baseDir) getOrElse f - def toFile(s: String) = relative(baseDir / (s + ".scala")) - def inheritedDeps(name: String): Set[File] = { - val file = (baseDir / (name + ".scala")).getAbsoluteFile - val absoluteFiles = a.relations.publicInherited.internal.forward(file) - absoluteFiles.map(relative) - } - val ADeps = Set("C", "D", "E", "G", "J").map(toFile) - same(inheritedDeps("A"), ADeps) - val BDeps = Set.empty[File] - same(inheritedDeps("B"), BDeps) - val CDeps = Set("D", "G", "J").map(toFile) - same(inheritedDeps("C"), CDeps) - val DDeps = Set("G", "J").map(toFile) - same(inheritedDeps("D"), DDeps) - val EDeps = Set.empty[File] - same(inheritedDeps("E"), EDeps) - val FDeps = Set("C", "D", "G", "J").map(toFile) - same(inheritedDeps("F"), FDeps) - val GDeps = Set("J").map(toFile) - same(inheritedDeps("G"), GDeps) - val JDeps = Set.empty[File] - same(inheritedDeps("J"), JDeps) -} - -def same[T](x: T, y: T): Unit = { - assert(x == y, s"\nActual: $x, \nExpected: $y") -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/test b/sbt/src/sbt-test/source-dependencies/inherited-dependencies/test deleted file mode 100644 index e5d477601..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-dependencies/test +++ /dev/null @@ -1 +0,0 @@ -> verifyDeps diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/A.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/A.java deleted file mode 100644 index 894125a7e..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/A.java +++ /dev/null @@ -1 +0,0 @@ -class A implements B.T, E {} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/B.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/B.java deleted file mode 100644 index 6b54edc7d..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/B.java +++ /dev/null @@ -1,11 +0,0 @@ -public class B { - static interface T extends C {} - - // not public, so this shouldn't be tracked as an inherited dependency - private class Q implements E {} - - public void x(int i) { - // not public, not an inherited dependency - D j = new D() {}; - } -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/C.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/C.java deleted file mode 100644 index 6c06f4033..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/C.java +++ /dev/null @@ -1 +0,0 @@ -interface C extends D {} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/D.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/D.java deleted file mode 100644 index 9455ef5b0..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/D.java +++ /dev/null @@ -1 +0,0 @@ -interface D extends G.P {} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/E.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/E.java deleted file mode 100644 index d5e4d6517..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/E.java +++ /dev/null @@ -1 +0,0 @@ -public interface E {} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/F.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/F.java deleted file mode 100644 index e205778d5..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/F.java +++ /dev/null @@ -1,3 +0,0 @@ -public class F { - public C q() { return null; } -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/G.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/G.java deleted file mode 100644 index ed3429f8c..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/G.java +++ /dev/null @@ -1,3 +0,0 @@ -public class G { - static interface P extends J {} -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/J.java b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/J.java deleted file mode 100644 index 8aeeb05b6..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/J.java +++ /dev/null @@ -1 +0,0 @@ -public interface J {} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt deleted file mode 100644 index da70e229f..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/build.sbt +++ /dev/null @@ -1,30 +0,0 @@ -// this test is specific to the old incremental compilation algorithm -incOptions := incOptions.value.withNameHashing(false) - -lazy val verifyDeps = taskKey[Unit]("verify inherited dependencies are properly extracted") - -verifyDeps := { - val a = compile.in(Compile).value match { case a: Analysis => a } - same(a.relations.publicInherited.internal.forwardMap, expectedDeps.forwardMap) -} - -lazy val expected = Seq( - "A" -> Seq("C", "D", "E", "G", "J"), - "B" -> Seq("C", "D", "G", "J"), - "C" -> Seq("D", "G", "J"), - "D" -> Seq("G", "J"), - "E" -> Seq(), - "F" -> Seq(), - "G" -> Seq("J"), - "J" -> Seq() -) -lazy val pairs = - expected.map { case (from,tos) => - (toFile(from), tos.map(toFile)) - } -lazy val expectedDeps = (Relation.empty[File,File] /: pairs) { case (r, (x,ys)) => r + (x,ys) } -def toFile(s: String) = file(s + ".java").getAbsoluteFile - -def same[T](x: T, y: T): Unit = { - assert(x == y, s"\nActual: $x, \nExpected: $y") -} diff --git a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/test b/sbt/src/sbt-test/source-dependencies/inherited-deps-java/test deleted file mode 100644 index e5d477601..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-deps-java/test +++ /dev/null @@ -1 +0,0 @@ -> verifyDeps diff --git a/sbt/src/sbt-test/source-dependencies/inherited-macros/build.sbt b/sbt/src/sbt-test/source-dependencies/inherited-macros/build.sbt deleted file mode 100644 index 85676b5fa..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/build.sbt +++ /dev/null @@ -1,22 +0,0 @@ -val defaultSettings = Seq( - scalaVersion := "2.10.6", - libraryDependencies <+= scalaVersion("org.scala-lang" % "scala-reflect" % _ )//, - //incOptions := incOptions.value.withNameHashing(true) -) - -lazy val root = (project in file(".")). - aggregate(macroProvider, macroClient). - settings( - defaultSettings - ) - -lazy val macroProvider = (project in file("macro-provider")). - settings( - defaultSettings - ) - -lazy val macroClient = (project in file("macro-client")). - dependsOn(macroProvider). - settings( - defaultSettings - ) 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 deleted file mode 100644 index 19633db64..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/changes/Client.scala +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index 03a7c3fe5..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/build.sbt +++ /dev/null @@ -1,9 +0,0 @@ -// 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 { case (args: Seq[String], a: 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 deleted file mode 100644 index 6351461a7..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Client.scala +++ /dev/null @@ -1,7 +0,0 @@ -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 deleted file mode 100644 index be7a40427..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-client/src/main/scala/Foo.scala +++ /dev/null @@ -1,5 +0,0 @@ -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 deleted file mode 100644 index 14523f149..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/macro-provider/src/main/scala/Provider.scala +++ /dev/null @@ -1,7 +0,0 @@ -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/test b/sbt/src/sbt-test/source-dependencies/inherited-macros/test deleted file mode 100644 index 4a755b5b2..000000000 --- a/sbt/src/sbt-test/source-dependencies/inherited-macros/test +++ /dev/null @@ -1,12 +0,0 @@ -> macroProvider/compile - -> macroClient/compile - -# Introduce a comment in Client, which inherits a macro from Provider -$ copy-file changes/Client.scala macro-client/src/main/scala/Client.scala - -> macroClient/compile - -# Object Foo depends on Client via composition, thus a whitespace change to -# Client shouldn't trigger its recompilation -> check-not-recompiled Foo.scala From f2ad99594eb0c1fb01191f4d6394ab07117b6bde Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:44:11 -0400 Subject: [PATCH 17/23] Remove trait-private-var test from sbt/sbt --- .../source-dependencies/trait-private-var/A.scala | 3 --- .../source-dependencies/trait-private-var/B.scala | 3 --- .../trait-private-var/changes/A.scala | 5 ----- .../source-dependencies/trait-private-var/test | 14 -------------- 4 files changed, 25 deletions(-) delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-private-var/A.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-private-var/B.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-private-var/changes/A.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-private-var/test diff --git a/sbt/src/sbt-test/source-dependencies/trait-private-var/A.scala b/sbt/src/sbt-test/source-dependencies/trait-private-var/A.scala deleted file mode 100644 index cf57bdb33..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-private-var/A.scala +++ /dev/null @@ -1,3 +0,0 @@ -trait A { - def bar: Int = 0 -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-private-var/B.scala b/sbt/src/sbt-test/source-dependencies/trait-private-var/B.scala deleted file mode 100644 index a0bb35627..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-private-var/B.scala +++ /dev/null @@ -1,3 +0,0 @@ -object B extends A { - def main(args: Array[String]): Unit = println(bar) -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-private-var/changes/A.scala b/sbt/src/sbt-test/source-dependencies/trait-private-var/changes/A.scala deleted file mode 100644 index 3eb53d77c..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-private-var/changes/A.scala +++ /dev/null @@ -1,5 +0,0 @@ -trait A { - private var foo = 12 - // we need to access foo to trigger AbstractMethodError - def bar: Int = foo -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-private-var/test b/sbt/src/sbt-test/source-dependencies/trait-private-var/test deleted file mode 100644 index d928246a9..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-private-var/test +++ /dev/null @@ -1,14 +0,0 @@ -# compile and run for the first time to verify that everything works -> run - -# introduce private var and refer to it in a trait that we inherit from -# there'll be pair of getters and setters generated for private var that -# has to be implemented by a class (where you can declare corresponding field) -$ copy-file changes/A.scala A.scala - -# this fails with AbstractMethodError because getters and setters for -# a private var are not generated because introduction of a private var -# does not trigger recompilation of B -# B is not recompiled because incremental compiler tracks only public -# interace (members visible from outside of given trait/class) -> run From ee6af2c06d794c448fb954a7c97e13939036f79d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Thu, 5 May 2016 23:59:30 -0400 Subject: [PATCH 18/23] Remove trait-super test from sbt/sbt --- .../sbt-test/source-dependencies/trait-super/A.scala | 6 ------ .../sbt-test/source-dependencies/trait-super/B.scala | 6 ------ .../source-dependencies/trait-super/Main.scala | 10 ---------- .../source-dependencies/trait-super/changes/B2.scala | 6 ------ .../source-dependencies/trait-super/changes/B3.scala | 6 ------ .../sbt-test/source-dependencies/trait-super/test | 12 ------------ 6 files changed, 46 deletions(-) delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/A.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/B.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/Main.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/changes/B2.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/changes/B3.scala delete mode 100644 sbt/src/sbt-test/source-dependencies/trait-super/test diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/A.scala b/sbt/src/sbt-test/source-dependencies/trait-super/A.scala deleted file mode 100644 index 52ad7e6a0..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/A.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait A { - def x: Int -} -class E extends A { - def x = 19 -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/B.scala b/sbt/src/sbt-test/source-dependencies/trait-super/B.scala deleted file mode 100644 index cba4cc427..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/B.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait B extends A { - abstract override def x = 1 -} -trait C extends A { - abstract override def x = 3 -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/Main.scala b/sbt/src/sbt-test/source-dependencies/trait-super/Main.scala deleted file mode 100644 index 37d821d9d..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/Main.scala +++ /dev/null @@ -1,10 +0,0 @@ -class X extends E with C with B - -object Main { - - def main(args: Array[String]): Unit = { - val x = new X - val expected = args(0).toInt - assert(x.x == expected, "Expected " + expected + ", got " + x.x) - } -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/changes/B2.scala b/sbt/src/sbt-test/source-dependencies/trait-super/changes/B2.scala deleted file mode 100644 index c89acd3ae..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/changes/B2.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait B extends A { - abstract override def x = super.x + 2 -} -trait C extends A { - abstract override def x = 3 -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/changes/B3.scala b/sbt/src/sbt-test/source-dependencies/trait-super/changes/B3.scala deleted file mode 100644 index 2a7ba55ec..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/changes/B3.scala +++ /dev/null @@ -1,6 +0,0 @@ -trait B extends A { - abstract override def x = super.x + 2 -} -trait C extends A { - abstract override def x = super.x -} diff --git a/sbt/src/sbt-test/source-dependencies/trait-super/test b/sbt/src/sbt-test/source-dependencies/trait-super/test deleted file mode 100644 index 19cb22fd2..000000000 --- a/sbt/src/sbt-test/source-dependencies/trait-super/test +++ /dev/null @@ -1,12 +0,0 @@ -# This test verifies that adding/removing calls to super in traits properly -# recompiles subclasses. super calls introduce accessors that are not in -# the public API, so this is not picked up by the usual API change detection. - -> run 1 - -$ copy-file changes/B2.scala B.scala -> run 5 - -$ copy-file changes/B3.scala B.scala -> run 21 - From 28c37d10143acf64b851f37c2e53fa7e5c2cb7a8 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 6 May 2016 00:12:07 -0400 Subject: [PATCH 19/23] Fixes source-dependencies/transitive-memberRef --- .../source-dependencies/transitive-memberRef/build.sbt | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt b/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt index e3f040678..1c79eebbe 100644 --- a/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt +++ b/sbt/src/sbt-test/source-dependencies/transitive-memberRef/build.sbt @@ -16,10 +16,13 @@ TaskKey[Unit]("check-compilations") := { val analysis = (compile in Compile).value match { case a: Analysis => a } val srcDir = (scalaSource in Compile).value def relative(f: java.io.File): java.io.File = f.relativeTo(srcDir) getOrElse f + def findFile(className: String): File = { + relative(analysis.relations.definesClass(className).head) + } val allCompilations = analysis.compilations.allCompilations val recompiledFiles: Seq[Set[java.io.File]] = allCompilations map { c => val recompiledFiles = analysis.apis.internal.collect { - case (file, api) if api.compilation.startTime == c.startTime => relative(file) + case (cn, api) if api.compilation.startTime == c.startTime => findFile(cn) } recompiledFiles.toSet } From 18ef703386e28f6056095dfdfb40a9e1d0c4a63d Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 6 May 2016 00:34:12 -0400 Subject: [PATCH 20/23] Fix test framework tests --- sbt/src/sbt-test/tests/fork-parallel/build.sbt | 4 ++-- sbt/src/sbt-test/tests/fork-uncaught/build.sbt | 8 +++++--- sbt/src/sbt-test/tests/fork/build.sbt | 7 +++++-- .../sbt-test/tests/junit-xml-report/build.sbt | 4 ++-- sbt/src/sbt-test/tests/nested-subproc/build.sbt | 17 ++++++++++------- sbt/src/sbt-test/tests/specs-run/build.sbt | 5 +++-- sbt/src/sbt-test/tests/t543/build.sbt | 7 +++++-- 7 files changed, 32 insertions(+), 20 deletions(-) diff --git a/sbt/src/sbt-test/tests/fork-parallel/build.sbt b/sbt/src/sbt-test/tests/fork-parallel/build.sbt index bfa90d309..d46339550 100644 --- a/sbt/src/sbt-test/tests/fork-parallel/build.sbt +++ b/sbt/src/sbt-test/tests/fork-parallel/build.sbt @@ -5,8 +5,8 @@ val check = taskKey[Unit]("Check that tests are executed in parallel") lazy val root = (project in file(".")). settings( - scalaVersion := "2.9.2", - libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", + scalaVersion := "2.11.8", + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, fork in Test := true, check := { val nbProc = java.lang.Runtime.getRuntime().availableProcessors() diff --git a/sbt/src/sbt-test/tests/fork-uncaught/build.sbt b/sbt/src/sbt-test/tests/fork-uncaught/build.sbt index 111c25103..dd42de86e 100644 --- a/sbt/src/sbt-test/tests/fork-uncaught/build.sbt +++ b/sbt/src/sbt-test/tests/fork-uncaught/build.sbt @@ -1,4 +1,4 @@ -scalaVersion := "2.9.2" +scalaVersion := "2.11.8" organization := "org.example" @@ -6,5 +6,7 @@ name := "fork-uncaught" fork := true -libraryDependencies += "org.scalatest" % "scalatest_2.9.2" % "2.0.M3" % "test" intransitive() - +libraryDependencies ++= List( + "org.scala-lang.modules" %% "scala-xml" % "1.0.1", + "org.scalatest" %% "scalatest" % "2.2.6" % Test intransitive() +) diff --git a/sbt/src/sbt-test/tests/fork/build.sbt b/sbt/src/sbt-test/tests/fork/build.sbt index 1b13dcba2..575b2b261 100755 --- a/sbt/src/sbt-test/tests/fork/build.sbt +++ b/sbt/src/sbt-test/tests/fork/build.sbt @@ -11,7 +11,7 @@ def groupPrefix(idx: Int) = groupId(idx) + "_file_" lazy val root = (project in file(".")). settings( - scalaVersion := "2.9.2", + scalaVersion := "2.11.8", testGrouping in Test <<= definedTests in Test map { tests => assert(tests.size == 3) for (idx <- 0 until groups) yield @@ -27,5 +27,8 @@ lazy val root = (project in file(".")). sys.error("Files were not created:\n\t" + absent.mkString("\n\t")) }, concurrentRestrictions := Tags.limit(Tags.ForkedTestGroup, 2) :: Nil, - libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % Test + libraryDependencies ++= List( + "org.scala-lang.modules" %% "scala-xml" % "1.0.1", + "org.scalatest" %% "scalatest" % "2.2.6" % Test + ) ) diff --git a/sbt/src/sbt-test/tests/junit-xml-report/build.sbt b/sbt/src/sbt-test/tests/junit-xml-report/build.sbt index 9ae00779f..18e504dd6 100644 --- a/sbt/src/sbt-test/tests/junit-xml-report/build.sbt +++ b/sbt/src/sbt-test/tests/junit-xml-report/build.sbt @@ -10,8 +10,8 @@ val failingReportFile = "target/test-reports/another.pkg.FailingTest.xml" lazy val root = (project in file(".")). settings( - scalaVersion := "2.9.2", - libraryDependencies += "com.novocode" % "junit-interface" % "0.10" % "test", + scalaVersion := "2.11.8", + libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % Test, // TODO use matchers instead of sys.error checkReport := { diff --git a/sbt/src/sbt-test/tests/nested-subproc/build.sbt b/sbt/src/sbt-test/tests/nested-subproc/build.sbt index d972521bc..3302653bd 100644 --- a/sbt/src/sbt-test/tests/nested-subproc/build.sbt +++ b/sbt/src/sbt-test/tests/nested-subproc/build.sbt @@ -1,7 +1,10 @@ -scalaVersion := "2.10.1" - -libraryDependencies += "org.scalatest" %% "scalatest" % "2.0.M6-SNAP28" - -testOptions in Test += Tests.Argument("-r", "custom.CustomReporter") - -fork := true \ No newline at end of file +lazy val root = (project in file(".")). + settings( + scalaVersion := "2.11.8", + libraryDependencies ++= List( + "org.scala-lang.modules" %% "scala-xml" % "1.0.1", + "org.scalatest" %% "scalatest" % "2.2.6" + ), + testOptions in Test += Tests.Argument("-r", "custom.CustomReporter"), + fork := true + ) diff --git a/sbt/src/sbt-test/tests/specs-run/build.sbt b/sbt/src/sbt-test/tests/specs-run/build.sbt index c6b41db8d..c9f3e0f04 100644 --- a/sbt/src/sbt-test/tests/specs-run/build.sbt +++ b/sbt/src/sbt-test/tests/specs-run/build.sbt @@ -1,3 +1,4 @@ -scalaVersion := "2.9.1" +lazy val specs2 = "org.specs2" %% "specs2" % "2.3.11" +scalaVersion := "2.11.8" -libraryDependencies += "org.specs2" %% "specs2" % "1.7.1" % "test" +libraryDependencies += specs2 % Test diff --git a/sbt/src/sbt-test/tests/t543/build.sbt b/sbt/src/sbt-test/tests/t543/build.sbt index b136fe30c..9d48c0433 100755 --- a/sbt/src/sbt-test/tests/t543/build.sbt +++ b/sbt/src/sbt-test/tests/t543/build.sbt @@ -7,8 +7,11 @@ val check = TaskKey[Unit]("check", "Check correct error has been returned.") lazy val root = (project in file(".")). settings( - libraryDependencies += "org.scalatest" %% "scalatest" % "1.8" % Test, - scalaVersion := "2.9.2", + libraryDependencies ++= List( + "org.scala-lang.modules" %% "scala-xml" % "1.0.1", + "org.scalatest" %% "scalatest" % "2.2.6" + ), + scalaVersion := "2.11.8", fork := true, testListeners += new TestReportListener { def testEvent(event: TestEvent): Unit = { From f8ef4497891cb8b7defd10fb6fadee457e3390af Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 6 May 2016 01:30:35 -0400 Subject: [PATCH 21/23] Fix test quick --- main/src/main/scala/sbt/Defaults.scala | 20 +++++++++++++++----- sbt/src/sbt-test/tests/test-quick/build.sbt | 7 +++++-- 2 files changed, 20 insertions(+), 7 deletions(-) diff --git a/main/src/main/scala/sbt/Defaults.scala b/main/src/main/scala/sbt/Defaults.scala index 2e721a798..56287d41f 100755 --- a/main/src/main/scala/sbt/Defaults.scala +++ b/main/src/main/scala/sbt/Defaults.scala @@ -512,16 +512,26 @@ object Defaults extends BuildCommon { val stamps = collection.mutable.Map.empty[String, Long] def stamp(dep: String): Long = { val stamps = for (a <- ans) yield intlStamp(dep, a, Set.empty) - if (stamps.isEmpty) Long.MinValue else stamps.max + if (stamps.isEmpty) Long.MinValue + else stamps.max } def intlStamp(c: String, analysis: Analysis, s: Set[String]): Long = { - if (s contains c) Long.MinValue else - stamps.getOrElseUpdate(c, { + if (s contains c) Long.MinValue + else { + val x = { import analysis.{ relations => rel, apis } rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++ rel.externalDeps(c).map(stamp) + - apis.internal(c).compilation.startTime - }.max) + (apis.internal.get(c) match { + case Some(x) => x.compilation.startTime + case _ => Long.MinValue + }) + }.max + if (x != Long.MinValue) { + stamps(c) = x + } + x + } } def noSuccessYet(test: String) = succeeded.get(test) match { case None => true diff --git a/sbt/src/sbt-test/tests/test-quick/build.sbt b/sbt/src/sbt-test/tests/test-quick/build.sbt index 3d05c8130..8efb08911 100755 --- a/sbt/src/sbt-test/tests/test-quick/build.sbt +++ b/sbt/src/sbt-test/tests/test-quick/build.sbt @@ -1,6 +1,9 @@ lazy val root = (project in file(".")). settings( - scalaVersion := "2.10.6", - libraryDependencies += "org.scalatest" %% "scalatest" % "1.9.1" % Test, + scalaVersion := "2.11.8", + libraryDependencies ++= List( + "org.scala-lang.modules" %% "scala-xml" % "1.0.1", + "org.scalatest" %% "scalatest" % "2.2.6" + ), parallelExecution in test := false ) From 03c3c5cf083c15cabcc4591149ba75b0b82afe06 Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 6 May 2016 01:39:13 -0400 Subject: [PATCH 22/23] Fixes project/auto-plugins and add pending test for nested There seems to be an issue with the discovery of auto plugins in an inner nested class. The error you would get is: [info] java.lang.ClassNotFoundException: sbttest.Imports.A$ [info] at java.net.URLClassLoader$1.run(URLClassLoader.java:202) [info] at java.security.AccessController.doPrivileged(Native Method) [info] at java.net.URLClassLoader.findClass(URLClassLoader.java:190) [info] at java.lang.ClassLoader.loadClass(ClassLoader.java:306) [info] at java.lang.ClassLoader.loadClass(ClassLoader.java:247) [info] at java.lang.Class.forName0(Native Method) [info] at java.lang.Class.forName(Class.java:249) [info] at sbt.internal.inc.ModuleUtilities$.getObject(ModuleUtilities.scala:16) [info] at sbt.internal.inc.ModuleUtilities$.getCheckedObject(ModuleUtilities.scala :22) [info] at sbt.internal.inc.ModuleUtilities$$anonfun$getCheckedObjects$1.apply(Modu leUtilities.scala:25) [info] at sbt.internal.inc.ModuleUtilities$$anonfun$getCheckedObjects$1.apply(Modu leUtilities.scala:25) [info] at scala.collection.immutable.Stream.map(Stream.scala:418) [info] at sbt.internal.inc.ModuleUtilities$.getCheckedObjects(ModuleUtilities.scal a:25) [info] at sbt.PluginDiscovery$.loadModules(PluginDiscovery.scala:138) [info] at sbt.PluginDiscovery$.binarySourceModules(PluginDiscovery.scala:132) [info] at sbt.PluginDiscovery$.discover$1(PluginDiscovery.scala:36) [info] at sbt.PluginDiscovery$.discoverAll(PluginDiscovery.scala:45) [info] at sbt.internal.Load$.loadPlugins(Load.scala:856) --- sbt/src/sbt-test/project/auto-plugins-nested/pending | 1 + .../sbt-test/project/auto-plugins-nested/project/Q.scala | 6 ++++++ sbt/src/sbt-test/project/auto-plugins/project/A.scala | 3 +-- sbt/src/sbt-test/project/auto-plugins/project/Q.scala | 4 ++-- 4 files changed, 10 insertions(+), 4 deletions(-) create mode 100644 sbt/src/sbt-test/project/auto-plugins-nested/pending create mode 100644 sbt/src/sbt-test/project/auto-plugins-nested/project/Q.scala diff --git a/sbt/src/sbt-test/project/auto-plugins-nested/pending b/sbt/src/sbt-test/project/auto-plugins-nested/pending new file mode 100644 index 000000000..003ee6843 --- /dev/null +++ b/sbt/src/sbt-test/project/auto-plugins-nested/pending @@ -0,0 +1 @@ +> plugins diff --git a/sbt/src/sbt-test/project/auto-plugins-nested/project/Q.scala b/sbt/src/sbt-test/project/auto-plugins-nested/project/Q.scala new file mode 100644 index 000000000..19af35308 --- /dev/null +++ b/sbt/src/sbt-test/project/auto-plugins-nested/project/Q.scala @@ -0,0 +1,6 @@ +package sbttest +import sbt._, syntax._, Keys._ + +object Imports { + object A extends AutoPlugin +} diff --git a/sbt/src/sbt-test/project/auto-plugins/project/A.scala b/sbt/src/sbt-test/project/auto-plugins/project/A.scala index 3121216c5..7871676de 100644 --- a/sbt/src/sbt-test/project/auto-plugins/project/A.scala +++ b/sbt/src/sbt-test/project/auto-plugins/project/A.scala @@ -1,8 +1,7 @@ // no package // plugins declared within no package should be visible to other plugins in the _root_ package -import sbt._ -import sbt.Keys._ +import sbt._, syntax._, Keys._ object TopLevelImports { lazy val topLevelDemo = settingKey[String]("A top level demo setting.") diff --git a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala index 9819d5fda..277f9b5c6 100644 --- a/sbt/src/sbt-test/project/auto-plugins/project/Q.scala +++ b/sbt/src/sbt-test/project/auto-plugins/project/Q.scala @@ -3,12 +3,12 @@ package sbttest // you need package http://stackoverflow.com/questions/9822008/ import sbt._, syntax._, Keys._ import java.util.concurrent.atomic.{AtomicInteger => AInt} -object Imports -{ object A extends AutoPlugin object B extends AutoPlugin object E extends AutoPlugin +object Imports +{ lazy val q = config("q") lazy val p = config("p").extend(q) From 60fa2b842a283d98af84f5778c0c0d5131e0f63a Mon Sep 17 00:00:00 2001 From: Eugene Yokota Date: Fri, 6 May 2016 01:41:17 -0400 Subject: [PATCH 23/23] Renamed per review --- main/actions/src/main/scala/sbt/DotGraph.scala | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/main/actions/src/main/scala/sbt/DotGraph.scala b/main/actions/src/main/scala/sbt/DotGraph.scala index 17adac2dc..852e25335 100644 --- a/main/actions/src/main/scala/sbt/DotGraph.scala +++ b/main/actions/src/main/scala/sbt/DotGraph.scala @@ -30,7 +30,7 @@ object DotGraph { def apply(relations: Relations, outputDir: File, sourceToString: File => String, externalToString: File => String): Unit = { def file(name: String) = new File(outputDir, name) IO.createDirectory(outputDir) - generateGraph(file("int-source-deps"), "dependencies", relations.internalClassDep, identity[String], identity[String]) + generateGraph(file("int-class-deps"), "dependencies", relations.internalClassDep, identity[String], identity[String]) generateGraph(file("binary-dependencies"), "externalDependencies", relations.binaryDep, externalToString, sourceToString) }