mirror of https://github.com/sbt/sbt.git
Merge pull request #2589 from eed3si9n/wip/bumptozinc
[sbt 1.0] Bumping up to Zinc 1.0.0-M1
This commit is contained in:
commit
6a9ced8eb6
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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._
|
||||
```
|
||||
|
|
|
|||
26
build.sbt
26
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
|
||||
)
|
||||
|
|
@ -154,7 +159,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 +189,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
|
||||
|
|
@ -319,15 +324,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
|
||||
},
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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-class-deps"), "dependencies", relations.internalClassDep, identity[String], identity[String])
|
||||
generateGraph(file("binary-dependencies"), "externalDependencies", relations.binaryDep, externalToString, sourceToString)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -273,7 +273,19 @@ 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 =>
|
||||
val acs: Seq[xsbti.api.AnalyzedClass] = analysis.apis.internal.values.toVector
|
||||
acs.flatMap { ac =>
|
||||
val companions = ac.api
|
||||
val all =
|
||||
Seq(companions.classApi, companions.objectApi) ++
|
||||
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) };
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
|
|
|
|||
|
|
@ -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 }
|
||||
|
||||
|
|
|
|||
|
|
@ -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._
|
||||
|
|
|
|||
|
|
@ -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))
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -284,7 +284,7 @@ defaults
|
|||
"""
|
||||
|
||||
import java.io.File
|
||||
import Path._
|
||||
import sbt.io.syntax._
|
||||
|
||||
def sbtRCs(s: State): Seq[File] =
|
||||
(Path.userHome / sbtrc) ::
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
@ -508,19 +509,29 @@ 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)
|
||||
if (stamps.isEmpty) Long.MinValue else stamps.max
|
||||
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 {
|
||||
val x = {
|
||||
import analysis.{ relations => rel, apis }
|
||||
rel.internalSrcDeps(f).map(intlStamp(_, analysis, s + f)) ++
|
||||
rel.externalDeps(f).map(stamp) +
|
||||
apis.internal(f).compilation.startTime
|
||||
}.max)
|
||||
rel.internalClassDeps(c).map(intlStamp(_, analysis, s + c)) ++
|
||||
rel.externalDeps(c).map(stamp) +
|
||||
(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
|
||||
|
|
@ -1046,7 +1057,6 @@ object Defaults extends BuildCommon {
|
|||
|
||||
}
|
||||
object Classpaths {
|
||||
import Path._
|
||||
import Keys._
|
||||
import Scope.ThisScope
|
||||
import Defaults._
|
||||
|
|
@ -1341,7 +1351,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)
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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 =
|
||||
|
|
|
|||
|
|
@ -9,10 +9,10 @@ object Dependencies {
|
|||
lazy val scala211 = "2.11.8"
|
||||
|
||||
// sbt modules
|
||||
val utilVersion = "0.1.0-M10"
|
||||
val ioVersion = "1.0.0-M3"
|
||||
val incrementalcompilerVersion = "0.1.0-M3"
|
||||
val librarymanagementVersion = "0.1.0-M7"
|
||||
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,17 +26,17 @@ 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 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"
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
}
|
||||
|
|
@ -1,6 +1,4 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
import Import._
|
||||
import sbt._, syntax._, Keys._
|
||||
import Def.Initialize
|
||||
|
||||
object Marker extends AutoPlugin {
|
||||
|
|
|
|||
|
|
@ -1,3 +1,5 @@
|
|||
> plugins
|
||||
|
||||
# single project, 'mark' not defined
|
||||
-> mark
|
||||
$ absent ran
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import sbt._
|
||||
import Import._
|
||||
import sbt._, syntax._, Keys._
|
||||
import Def.Initialize
|
||||
import complete.{DefaultParsers, Parser}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,4 @@
|
|||
import sbt._
|
||||
import Import._
|
||||
import sbt._, syntax._, Keys._
|
||||
import Def.Initialize
|
||||
import complete.{DefaultParsers, Parser}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
import Import._
|
||||
import complete.Parser
|
||||
import complete.DefaultParsers._
|
||||
import sbinary.DefaultProtocol._
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
|
|||
|
|
@ -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"))
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
package test3
|
||||
|
||||
trait A
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package test3
|
||||
|
||||
trait A {
|
||||
def foo = 1
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
package test3
|
||||
|
||||
trait B extends A
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package test3
|
||||
|
||||
trait C {
|
||||
def abc(a: A): Int = a.foo
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -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" % _)
|
||||
|
|
@ -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 }
|
||||
}
|
||||
}
|
||||
|
|
@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> test:test
|
||||
|
|
@ -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
|
||||
compileOrder := CompileOrder.Mixed
|
||||
|
|
|
|||
|
|
@ -1,6 +1,7 @@
|
|||
package sbt
|
||||
|
||||
import Keys._
|
||||
import sbt.syntax._
|
||||
import sbt.Keys._
|
||||
import xsbti.{Position, Severity}
|
||||
|
||||
object TestPlugin extends AutoPlugin {
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
import sbt._
|
||||
import sbt._, syntax._
|
||||
|
||||
object Q extends AutoPlugin {
|
||||
override val requires = plugins.JvmPlugin
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
> plugins
|
||||
|
|
@ -0,0 +1,6 @@
|
|||
package sbttest
|
||||
import sbt._, syntax._, Keys._
|
||||
|
||||
object Imports {
|
||||
object A extends AutoPlugin
|
||||
}
|
||||
|
|
@ -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.")
|
||||
|
|
|
|||
|
|
@ -1,16 +1,14 @@
|
|||
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
|
||||
{
|
||||
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)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,24 +1,22 @@
|
|||
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 {
|
||||
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 := {}
|
||||
)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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")
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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"
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,3 @@
|
|||
public class JavaA
|
||||
{
|
||||
public class JavaA {
|
||||
public int inc(int i) { return i+1; }
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,6 +1,5 @@
|
|||
package a.b
|
||||
|
||||
class ScalaA
|
||||
{
|
||||
class ScalaA {
|
||||
def increment(i: Int) = i + 1
|
||||
}
|
||||
|
|
@ -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 + "'")
|
||||
}
|
||||
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 + "'")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1 @@
|
|||
This is a main resource.
|
||||
|
|
@ -1 +0,0 @@
|
|||
This is a test resource.
|
||||
|
|
@ -0,0 +1 @@
|
|||
This is a main resource.
|
||||
|
|
@ -1 +0,0 @@
|
|||
This is a test resource.
|
||||
|
|
@ -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
|
||||
|
||||
|
|
|
|||
|
|
@ -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 = ()
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 + "'")
|
||||
}
|
||||
|
|
@ -1,6 +1,6 @@
|
|||
package test
|
||||
|
||||
import sbt._
|
||||
import sbt._, syntax._, Keys._
|
||||
|
||||
object Global {
|
||||
val x = 3
|
||||
|
|
|
|||
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
import sbt._
|
||||
import Keys._
|
||||
import Import._
|
||||
import sbt._, syntax._, Keys._
|
||||
|
||||
object Common {
|
||||
lazy val k1 = taskKey[Unit]("")
|
||||
|
|
|
|||
|
|
@ -1,3 +0,0 @@
|
|||
object B {
|
||||
def show(what: String): String = "String interpolation is " + what.toUpperCase
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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)
|
||||
|
|
@ -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 } = ???
|
||||
()
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
trait C extends D
|
||||
|
|
@ -1 +0,0 @@
|
|||
trait D extends G.P
|
||||
|
|
@ -1 +0,0 @@
|
|||
trait E[T]
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
class F {
|
||||
def q: C { def length: Int } = ???
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
object G { trait P extends J }
|
||||
|
|
@ -1 +0,0 @@
|
|||
class J
|
||||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> verifyDeps
|
||||
|
|
@ -1 +0,0 @@
|
|||
class A implements B.T<Integer>, E {}
|
||||
|
|
@ -1,11 +0,0 @@
|
|||
public class B {
|
||||
static interface T<X> extends C {}
|
||||
|
||||
// not public, so this shouldn't be tracked as an inherited dependency
|
||||
private class Q implements E<Integer> {}
|
||||
|
||||
public void x(int i) {
|
||||
// not public, not an inherited dependency
|
||||
D j = new D() {};
|
||||
}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
interface C extends D {}
|
||||
|
|
@ -1 +0,0 @@
|
|||
interface D extends G.P {}
|
||||
|
|
@ -1 +0,0 @@
|
|||
public interface E<T> {}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
public class F {
|
||||
public C q() { return null; }
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
public class G {
|
||||
static interface P extends J {}
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
public interface J {}
|
||||
|
|
@ -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")
|
||||
}
|
||||
|
|
@ -1 +0,0 @@
|
|||
> verifyDeps
|
||||
|
|
@ -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
|
||||
)
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package macro
|
||||
|
||||
object Client {
|
||||
object RealClient extends Provider {
|
||||
// Some comment...
|
||||
}
|
||||
}
|
||||
|
|
@ -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.")
|
||||
}
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package macro
|
||||
|
||||
object Client {
|
||||
object RealClient extends Provider {
|
||||
|
||||
}
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
package macro
|
||||
|
||||
object Foo {
|
||||
val c = Client.RealClient
|
||||
}
|
||||
|
|
@ -1,7 +0,0 @@
|
|||
package macro
|
||||
import scala.language.experimental.macros
|
||||
import scala.reflect.macros._
|
||||
|
||||
abstract class Provider {
|
||||
def notImplementedMacro = macro ???
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
trait A {
|
||||
def bar: Int = 0
|
||||
}
|
||||
|
|
@ -1,3 +0,0 @@
|
|||
object B extends A {
|
||||
def main(args: Array[String]): Unit = println(bar)
|
||||
}
|
||||
|
|
@ -1,5 +0,0 @@
|
|||
trait A {
|
||||
private var foo = 12
|
||||
// we need to access foo to trigger AbstractMethodError
|
||||
def bar: Int = foo
|
||||
}
|
||||
|
|
@ -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
|
||||
|
|
@ -1,6 +0,0 @@
|
|||
trait A {
|
||||
def x: Int
|
||||
}
|
||||
class E extends A {
|
||||
def x = 19
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue