diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index a59c16b7fc..5af1423749 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -55,6 +55,55 @@ bridge, you don't need to run these benchmarks. If you need any help, the Zinc team hangs out in [sbt/zinc-contrib][]. Feel free to ask any question. +### Getting familiar with the build + +#### Project structure + +As of now, the current project structure is not as simple as it can be and we +believe that it can be simpler in the future. However, as of now, no work is +happening in this area because it's deemed to have low impact on the overall +quality of the project. + +How is the Zinc build structured? Let's see it. + +|Project name| Project description| +|------------|--------------------| +|zincRoot| The root of the project. Aggregates all projects except the benchmarks.| +|zinc|The user-facing Zinc incremental compiler.| +|zincTesting|The project that defines testing facilities.| +|zincCompile|A thin wrapper that provides doc capabilities.| +|zincPersist|The project that persists incremental compiler's data into a binary file.| +|zincCore|The project that defines relations, analysis, stamps, and essential core utils.| +|zincBenchmarks|The project that defines the benchmarks.| +|zincIvyIntegration|The project that defines the ivy utilities to fetch compiler bridges.| +|zincCompileCore|The project that interfaces with the compiler API and provides compilation capabilities.| +|zincApiInfo|The project that defines name hashes and provides way to interpret api changes.| +|zincClassfile|The project that parses class files to provide Java incremental compilation.| +|zincClasspath|The project that provides basic utilities to load libraries with classloaders and represents Scala instances.| +|zincScripted|The project that defines the scripted logic to run Zinc's integration test suite.| +|compilerInterface|The public binary interface used to connect the bridges with the Zinc modules. It is written in Java and uses Contraband.| +|compilerBridge|The module that defines the compiler plugin phases that provide incrementality for all Scala versions.| + +If you want to visualize the relationships between the projects, have a look at +the following diagram: + +![Diagram of projects](docs/project-structure.png) + +Note: ignore `jar2`, `jar1` and `classesDep1`. + +#### Build-specific commands/keys + +The sbt build defines several keys that help contributors run and test Zinc. +Zinc's build requires the compiler bridges to be published before tests are run +(compiler bridges are compiler-specific Scala sources that need to be fetched +to perform incremental compilation). + +|Key|Use| +|---|---| +|crossTestBridges|Runs compiler bridge unit tests for all scala versions.| +|publishBridgesAndTest|Publish bridges and test the whole incremental compiler.| +|publishBridgesAndSet|Publish bridges and set the current Scala version.| + ### Benchmarking Zinc To run JMH benchmarks, run the sbt task `runBenchmarks`. By default, diff --git a/bin/run-ci.sh b/bin/run-ci.sh index d7611391d6..aad4fb1492 100755 --- a/bin/run-ci.sh +++ b/bin/run-ci.sh @@ -10,6 +10,8 @@ sbt -Dfile.encoding=UTF-8 \ +mimaReportBinaryIssues \ scalafmt::test \ test:scalafmt::test \ + headerCheck \ + test:headerCheck \ zincRoot/test:compile \ crossTestBridges \ "publishBridgesAndSet $SCALA_VERSION" \ diff --git a/build.sbt b/build.sbt index 1f57e24690..9027953ad9 100644 --- a/build.sbt +++ b/build.sbt @@ -1,103 +1,9 @@ +import BuildImplementation.{ BuildDefaults, BuildCommands } import Util._ import Dependencies._ import Scripted._ -def baseVersion = "1.1.0-SNAPSHOT" -def internalPath = file("internal") - -lazy val compilerBridgeScalaVersions = List(scala212, scala213, scala211, scala210) -lazy val compilerBridgeTestScalaVersions = List(scala212, scala211, scala210) - -def mimaSettings: Seq[Setting[_]] = Seq( - mimaPreviousArtifacts := Set( - organization.value % moduleName.value % "1.0.0" - cross (if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled) - ) -) - -def commonSettings: Seq[Setting[_]] = Seq( - scalaVersion := scala212, - // publishArtifact in packageDoc := false, - resolvers += Resolver.typesafeIvyRepo("releases"), - resolvers += Resolver.sonatypeRepo("snapshots"), - resolvers += "bintray-sbt-maven-releases" at "https://dl.bintray.com/sbt/maven-releases/", - resolvers += Resolver.url( - "bintray-sbt-ivy-snapshots", - new URL("https://dl.bintray.com/sbt/ivy-snapshots/"))(Resolver.ivyStylePatterns), - // concurrentRestrictions in Global += Util.testExclusiveRestriction, - testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), - javacOptions in compile ++= Seq("-Xlint", "-Xlint:-serial"), - crossScalaVersions := Seq(scala211, scala212), - publishArtifact in Test := false, - commands ++= Seq(publishBridgesAndTest, publishBridgesAndSet, crossTestBridges), - scalacOptions += "-YdisableFlatCpCaching" -) - -def relaxNon212: Seq[Setting[_]] = Seq( - scalacOptions := { - val old = scalacOptions.value - scalaBinaryVersion.value match { - case "2.12" => old - case _ => - old filterNot Set( - "-Xfatal-warnings", - "-deprecation", - "-Ywarn-unused", - "-Ywarn-unused-import", - "-YdisableFlatCpCaching" - ) - } - } -) - -def minimalSettings: Seq[Setting[_]] = commonSettings - -// def minimalSettings: Seq[Setting[_]] = -// commonSettings ++ customCommands ++ -// publishPomSettings ++ Release.javaVersionCheckSettings - -def baseSettings: Seq[Setting[_]] = - minimalSettings -// minimalSettings ++ baseScalacOptions ++ Licensed.settings ++ Formatting.settings - -def addBaseSettingsAndTestDeps(p: Project): Project = - p.settings(baseSettings).configure(addTestDependencies) - -val altLocalRepoName = "alternative-local" -val altLocalRepoPath = sys.props("user.home") + "/.ivy2/sbt-alternative" -lazy val altLocalResolver = Resolver.file( - altLocalRepoName, - file(sys.props("user.home") + "/.ivy2/sbt-alternative"))(Resolver.ivyStylePatterns) -lazy val altLocalPublish = - TaskKey[Unit]("alt-local-publish", "Publishes an artifact locally to an alternative location.") -def altPublishSettings: Seq[Setting[_]] = - Seq( - resolvers += altLocalResolver, - altLocalPublish := { - import sbt.librarymanagement._ - import sbt.internal.librarymanagement._ - val config = (Keys.publishLocalConfiguration).value - val moduleSettings = (Keys.moduleSettings).value - val ivy = new IvySbt((ivyConfiguration.value)) - - val module = new ivy.Module(moduleSettings) - val newConfig = config.withResolverName(altLocalRepoName).withOverwrite(false) - streams.value.log.info(s"Publishing $module to local repo: $altLocalRepoName") - IvyActions.publish(module, newConfig, streams.value.log) - } - ) - -val noPublish: Seq[Setting[_]] = List( - publish := {}, - publishLocal := {}, - publishArtifact in Compile := false, - publishArtifact in Test := false, - publishArtifact := false, - skip in publish := true, -) - lazy val zincRoot: Project = (project in file(".")) -// configs(Sxr.sxrConf). .aggregate( zinc, zincTesting, @@ -115,60 +21,22 @@ lazy val zincRoot: Project = (project in file(".")) zincScripted ) .settings( - inThisBuild( - Seq( - git.baseVersion := baseVersion, - // https://github.com/sbt/sbt-git/issues/109 - // Workaround from https://github.com/sbt/sbt-git/issues/92#issuecomment-161853239 - git.gitUncommittedChanges := { - val statusCommands = Seq( - Seq("diff-index", "--cached", "HEAD"), - Seq("diff-index", "HEAD"), - Seq("diff-files"), - Seq("ls-files", "--exclude-standard", "--others") - ) - // can't use git.runner.value because it's a task - val runner = com.typesafe.sbt.git.ConsoleGitRunner - val dir = baseDirectory.value - // sbt/zinc#334 Seemingly "git status" resets some stale metadata. - runner("status")(dir, com.typesafe.sbt.git.NullLogger) - val uncommittedChanges = statusCommands flatMap { c => - val res = runner(c: _*)(dir, com.typesafe.sbt.git.NullLogger) - if (res.isEmpty) Nil else Seq(c -> res) - } - - val un = uncommittedChanges.nonEmpty - if (un) { - uncommittedChanges foreach { - case (cmd, res) => - sLog.value debug s"""Uncommitted changes found via "${cmd mkString " "}":\n${res}""" - } - } - un - }, - version := { - val v = version.value - if (v contains "SNAPSHOT") git.baseVersion.value - else v - }, - bintrayPackage := "zinc", - scmInfo := Some(ScmInfo(url("https://github.com/sbt/zinc"), "git@github.com:sbt/zinc.git")), - description := "Incremental compiler of Scala", - homepage := Some(url("https://github.com/sbt/zinc")), - developers += - Developer("jvican", "Jorge Vicente Cantero", "@jvican", url("https://github.com/jvican")), - scalafmtOnCompile := true, - scalafmtVersion := "1.2.0", - scalafmtOnCompile in Sbt := false, - )), - minimalSettings, - otherRootSettings, - noPublish, name := "zinc Root", - customCommands + scriptedBufferLog := true, + scriptedPrescripted := BuildDefaults.addSbtAlternateResolver _, + scriptedSource := (sourceDirectory in zinc).value / "sbt-test", + scripted := + BuildDefaults.zincScripted(compilerBridge, compilerInterface, zincScripted).evaluated, + scriptedUnpublished := BuildDefaults.zincOnlyScripted(zincScripted).evaluated, + scriptedPublishAll := publishLocal.all(ScopeFilter(inAnyProject)).value, + commands in Global ++= + BuildCommands.all(compilerBridge, compilerBridgeTest, compilerInterface, zincBenchmarks), + noPublish, ) lazy val zinc = (project in file("zinc")) + .settings(name := "zinc", mimaSettings) + .configure(addTestDependencies) .dependsOn( zincCore, zincPersist, @@ -177,34 +45,23 @@ lazy val zinc = (project in file("zinc")) zincIvyIntegration % "compile->compile;test->test", zincTesting % Test ) - .configure(addBaseSettingsAndTestDeps) - .settings( - name := "zinc", - mimaSettings, - ) lazy val zincTesting = (project in internalPath / "zinc-testing") .settings( - minimalSettings, - noPublish, name := "zinc Testing", - libraryDependencies ++= Seq(scalaCheck, scalatest, junit, sjsonnewScalaJson.value) + libraryDependencies ++= Seq(scalaCheck, scalatest, junit, sjsonnewScalaJson.value), + noPublish, ) .configure(addSbtLmCore, addSbtLmIvy) lazy val zincCompile = (project in file("zinc-compile")) .dependsOn(zincCompileCore, zincCompileCore % "test->test") - .configure(addBaseSettingsAndTestDeps) - .settings( - name := "zinc Compile", - mimaSettings, - ) - .configure(addSbtUtilTracking) + .settings(name := "zinc Compile", mimaSettings) + .configure(addSbtUtilTracking, addTestDependencies) // Persists the incremental data structures using Protobuf lazy val zincPersist = (project in internalPath / "zinc-persist") .dependsOn(zincCore, zincCore % "test->test") - .configure(addBaseSettingsAndTestDeps) .settings( name := "zinc Persist", libraryDependencies += sbinary, @@ -212,6 +69,7 @@ lazy val zincPersist = (project in internalPath / "zinc-persist") PB.targets in Compile := List(scalapb.gen() -> (sourceManaged in Compile).value), mimaSettings, ) + .configure(addTestDependencies) // Implements the core functionality of detecting and propagating changes incrementally. // Defines the data structures for representing file fingerprints and relationships and the overall source analysis @@ -223,7 +81,6 @@ lazy val zincCore = (project in internalPath / "zinc-core") compilerBridge % Test, zincTesting % Test ) - .configure(addBaseSettingsAndTestDeps) .settings( // we need to fork because in unit tests we set usejavacp = true which means // we are expecting all of our dependencies to be on classpath so Scala compiler @@ -236,28 +93,23 @@ lazy val zincCore = (project in internalPath / "zinc-core") compileOrder := sbt.CompileOrder.Mixed, mimaSettings, ) - .configure(addSbtIO, addSbtUtilLogging, addSbtUtilRelation) + .configure(addSbtIO, addSbtUtilLogging, addSbtUtilRelation, addTestDependencies) lazy val zincBenchmarks = (project in internalPath / "zinc-benchmarks") .dependsOn(compilerInterface % "compile->compile;compile->test") .dependsOn(compilerBridge, zincCore, zincTesting % Test) .enablePlugins(JmhPlugin) .settings( - noPublish, name := "Benchmarks of Zinc and the compiler bridge", - libraryDependencies ++= Seq( - "org.eclipse.jgit" % "org.eclipse.jgit" % "4.6.0.201612231935-r", - "net.openhft" % "affinity" % "3.0.6" - ), - scalaVersion := scala212, - crossScalaVersions := Seq(scala211, scala212), + libraryDependencies ++= List(jgit, affinity), javaOptions in Test += "-Xmx600M -Xms600M", + tearDownBenchmarkResources := BuildDefaults.tearDownBenchmarkResources.value, + noPublish, ) lazy val zincIvyIntegration = (project in internalPath / "zinc-ivy-integration") .dependsOn(zincCompileCore, zincTesting % Test) .settings( - baseSettings, name := "zinc Ivy Integration", compileOrder := sbt.CompileOrder.ScalaThenJava, mimaSettings, @@ -274,17 +126,17 @@ lazy val zincCompileCore = (project in internalPath / "zinc-compile-core") zincClassfile, zincTesting % Test ) - .configure(addBaseSettingsAndTestDeps) .settings( name := "zinc Compile Core", libraryDependencies ++= Seq(scalaCompiler.value % Test, launcherInterface, parserCombinator), unmanagedJars in Test := Seq(packageSrc in compilerBridge in Compile value).classpath, managedSourceDirectories in Compile += baseDirectory.value / "src" / "main" / "contraband-java", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-java", + sourceManaged in (Compile, generateContrabands) := + baseDirectory.value / "src" / "main" / "contraband-java", mimaSettings, ) - .configure(addSbtUtilLogging, addSbtIO, addSbtUtilControl) + .configure(addSbtUtilLogging, addSbtIO, addSbtUtilControl, addTestDependencies) // defines Java structures used across Scala versions, such as the API structures and relationships extracted by // the analysis compiler phases and passed back to sbt. The API structures are defined in a simple @@ -292,15 +144,14 @@ lazy val zincCompileCore = (project in internalPath / "zinc-compile-core") lazy val compilerInterface = (project in internalPath / "compiler-interface") .enablePlugins(ContrabandPlugin) .settings( - minimalSettings, // javaOnlySettings, name := "Compiler Interface", - // Use the smallest Scala version in the compilerBridgeScalaVersions + // Use the smallest Scala version in the bridgeScalaVersions // Technically the scalaVersion shouldn't have any effect since scala library is not included, // but given that Scala 2.10 compiler cannot parse Java 8 source, it's probably good to keep this. crossScalaVersions := Seq(scala210), scalaVersion := scala210, - relaxNon212, + adaptOptionsForOldScalaVersions, libraryDependencies ++= Seq(scalaLibrary.value % Test), exportJars := true, resourceGenerators in Compile += Def @@ -315,21 +166,15 @@ lazy val compilerInterface = (project in internalPath / "compiler-interface") .taskValue, managedSourceDirectories in Compile += baseDirectory.value / "src" / "main" / "contraband-java", - sourceManaged in (Compile, generateContrabands) := baseDirectory.value / "src" / "main" / "contraband-java", + sourceManaged in (Compile, generateContrabands) := + baseDirectory.value / "src" / "main" / "contraband-java", crossPaths := false, autoScalaLibrary := false, - altPublishSettings, + zincPublishLocalSettings, mimaSettings, ) .configure(addSbtUtilInterface) -val cleanSbtBridge = taskKey[Unit]("Cleans the sbt bridge.") - -def wrapIn(color: String, content: String): String = { - import sbt.internal.util.ConsoleAppender - if (!ConsoleAppender.formatEnabledInEnv) content - else color + content + scala.Console.RESET -} /** * Compiler-side interface to compiler that is compiled against the compiler being used either in advance or on the fly. @@ -343,58 +188,19 @@ def wrapIn(color: String, content: String): String = { lazy val compilerBridge: Project = (project in internalPath / "compiler-bridge") .dependsOn(compilerInterface) .settings( - baseSettings, - crossScalaVersions := compilerBridgeScalaVersions, - relaxNon212, + crossScalaVersions := bridgeScalaVersions, + adaptOptionsForOldScalaVersions, libraryDependencies += scalaCompiler.value % "provided", autoScalaLibrary := false, // precompiledSettings, name := "Compiler Bridge", - exportJars := true, - inBoth(unmanagedSourceDirectories ++= scalaPartialVersion.value.collect { - case (2, y) if y == 10 => new File(scalaSource.value.getPath + "_2.10") - case (2, y) if y == 11 || y == 12 => new File(scalaSource.value.getPath + "_2.11-12") - case (2, y) if y >= 13 => new File(scalaSource.value.getPath + "_2.13") - }.toList), + inCompileAndTest(unmanagedSourceDirectories ++= BuildDefaults.handleScalaSpecificSources.value), // Use a bootstrap compiler bridge to compile the compiler bridge. - scalaCompilerBridgeSource := { - val old = scalaCompilerBridgeSource.value - scalaVersion.value match { - case x if x startsWith "2.13." => ("org.scala-sbt" % "compiler-bridge_2.13.0-M2" % "1.1.0-M1-bootstrap2" % Compile).sources() - case _ => old - } - }, - cleanSbtBridge := { - val sbtV = sbtVersion.value - val sbtOrg = "org.scala-sbt" - val sbtScalaVersion = "2.10.6" - val bridgeVersion = version.value - val scalaV = scalaVersion.value - - // Assumes that JDK version is the same than the one that publishes the bridge - val classVersion = System.getProperty("java.class.version") - - val home = System.getProperty("user.home") - val org = organization.value - val artifact = moduleName.value - val artifactName = - s"$org-$artifact-$bridgeVersion-bin_${scalaV}__$classVersion" - - val targetsToDelete = List( - // We cannot use the target key, it's not scoped in `ThisBuild` nor `Global`. - (baseDirectory in ThisBuild).value / "target" / "zinc-components", - file(home) / ".ivy2/cache" / sbtOrg / artifactName, - file(home) / ".sbt/boot" / s"scala-$sbtScalaVersion" / sbtOrg / "sbt" / sbtV / artifactName - ) - val logger = streams.value.log - logger.info(wrapIn(scala.Console.BOLD, "Cleaning stale compiler bridges:")) - targetsToDelete.foreach { target => - IO.delete(target) - logger.info(s"${wrapIn(scala.Console.GREEN, " ✓ ")}${target.getAbsolutePath}") - } - }, + scalaCompilerBridgeSource := BuildDefaults.customCompilerBridge.value, + exportJars := true, + cleanSbtBridge := BuildDefaults.cleanSbtBridge.value, publishLocal := publishLocal.dependsOn(cleanSbtBridge).value, - altPublishSettings, + zincPublishLocalSettings, ) /** @@ -406,8 +212,7 @@ lazy val compilerBridgeTest = (project in internalPath / "compiler-bridge-test") .dependsOn(compilerBridge, compilerInterface % "test->test", zincApiInfo % "test->test") .settings( name := "Compiler Bridge Test", - baseSettings, - relaxNon212, + adaptOptionsForOldScalaVersions, // we need to fork because in unit tests we set usejavacp = true which means // we are expecting all of our dependencies to be on classpath so Scala compiler // can use them while constructing its own classpath for compilation @@ -415,190 +220,49 @@ lazy val compilerBridgeTest = (project in internalPath / "compiler-bridge-test") // needed because we fork tests and tests are ran in parallel so we have multiple Scala // compiler instances that are memory hungry javaOptions in Test += "-Xmx1G", - crossScalaVersions := compilerBridgeTestScalaVersions, + crossScalaVersions := bridgeTestScalaVersions, libraryDependencies += scalaCompiler.value, - altPublishSettings, + zincPublishLocalSettings, skip in publish := true, ) -val scalaPartialVersion = Def setting (CrossVersion partialVersion scalaVersion.value) - -def inBoth(ss: Setting[_]*): Seq[Setting[_]] = Seq(Compile, Test) flatMap (inConfig(_)(ss)) - // defines operations on the API of a source, including determining whether it has changed and converting it to a string // and discovery of Projclasses and annotations lazy val zincApiInfo = (project in internalPath / "zinc-apiinfo") .dependsOn(compilerInterface, zincClassfile % "compile;test->test") - .configure(addBaseSettingsAndTestDeps) .settings( name := "zinc ApiInfo", - crossScalaVersions := compilerBridgeTestScalaVersions, - relaxNon212, + crossScalaVersions := bridgeTestScalaVersions, + adaptOptionsForOldScalaVersions, mimaSettings, ) + .configure(addTestDependencies) // Utilities related to reflection, managing Scala versions, and custom class loaders lazy val zincClasspath = (project in internalPath / "zinc-classpath") .dependsOn(compilerInterface) - .configure(addBaseSettingsAndTestDeps) .settings( name := "zinc Classpath", - crossScalaVersions := compilerBridgeTestScalaVersions, - relaxNon212, + crossScalaVersions := bridgeTestScalaVersions, + adaptOptionsForOldScalaVersions, libraryDependencies ++= Seq(scalaCompiler.value, launcherInterface), mimaSettings, ) - .configure(addSbtIO) + .configure(addSbtIO, addTestDependencies) // class file reader and analyzer lazy val zincClassfile = (project in internalPath / "zinc-classfile") .dependsOn(compilerInterface % "compile;test->test") - .configure(addBaseSettingsAndTestDeps) .settings( name := "zinc Classfile", - crossScalaVersions := compilerBridgeTestScalaVersions, - relaxNon212, + crossScalaVersions := bridgeTestScalaVersions, + adaptOptionsForOldScalaVersions, mimaSettings, ) - .configure(addSbtIO, addSbtUtilLogging) + .configure(addSbtIO, addSbtUtilLogging, addTestDependencies) // re-implementation of scripted engine lazy val zincScripted = (project in internalPath / "zinc-scripted") .dependsOn(zinc, zincIvyIntegration % "test->test") - .settings( - minimalSettings, - noPublish, - name := "zinc Scripted", - ) + .settings(name := "zinc Scripted", noPublish) .configure(addSbtUtilScripted) - -lazy val crossTestBridges = { - Command.command("crossTestBridges") { state => - (compilerBridgeTestScalaVersions.flatMap { (bridgeVersion: String) => - // Note the ! here. You need this so compilerInterface gets forced to the scalaVersion - s"++ $bridgeVersion!" :: - s"${compilerBridgeTest.id}/test" :: - Nil - }) ::: - (s"++ $scala212!" :: - state) - } -} - -lazy val publishBridgesAndSet = { - Command.args("publishBridgesAndSet", "") { (state, args) => - require(args.nonEmpty, "Missing Scala version argument.") - val userScalaVersion = args.mkString("") - s"${compilerInterface.id}/publishLocal" :: - compilerBridgeScalaVersions.flatMap { (bridgeVersion: String) => - s"++ $bridgeVersion!" :: - s"${compilerBridge.id}/publishLocal" :: Nil - } ::: - s"++ $userScalaVersion!" :: - state - } -} - -lazy val publishBridgesAndTest = Command.args("publishBridgesAndTest", "") { - (state, args) => - require(args.nonEmpty, - "Missing arguments to publishBridgesAndTest. Maybe quotes are missing around command?") - val version = args mkString "" - s"${compilerInterface.id}/publishLocal" :: - (compilerBridgeScalaVersions.flatMap { (bridgeVersion: String) => - s"++ $bridgeVersion" :: - s"${compilerBridge.id}/publishLocal" :: Nil - }) ::: - s"++ $version" :: - s"zincRoot/scalaVersion" :: - s"zincRoot/test" :: - s"zincRoot/scripted" :: - state -} - -val dir = IO.createTemporaryDirectory -val dirPath = dir.getAbsolutePath -lazy val tearDownBenchmarkResources = taskKey[Unit]("Remove benchmark resources.") -tearDownBenchmarkResources in ThisBuild := { IO.delete(dir) } - -addCommandAlias( - "runBenchmarks", - s""";zincBenchmarks/run $dirPath - |;zincBenchmarks/jmh:run -p _tempDir=$dirPath -prof gc - |;tearDownBenchmarkResources - """.stripMargin -) - -lazy val otherRootSettings = Seq( - Scripted.scriptedBufferLog := true, - Scripted.scriptedPrescripted := { addSbtAlternateResolver _ }, - Scripted.scripted := scriptedTask.evaluated, - Scripted.scriptedUnpublished := scriptedUnpublishedTask.evaluated, - Scripted.scriptedSource := (sourceDirectory in zinc).value / "sbt-test", - publishAll := { - val _ = (publishLocal).all(ScopeFilter(inAnyProject)).value - } -) - -def scriptedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask { - val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed - publishAll.value - // These two projects need to be visible in a repo even if the default - // local repository is hidden, so we publish them to an alternate location and add - // that alternate repo to the running scripted test (in Scripted.scriptedpreScripted). - (altLocalPublish in compilerInterface).value - (altLocalPublish in compilerBridge).value - doScripted( - (fullClasspath in zincScripted in Test).value, - (scalaInstance in zincScripted).value, - scriptedSource.value, - result, - scriptedBufferLog.value, - scriptedPrescripted.value - ) -} - -def addSbtAlternateResolver(scriptedRoot: File) = { - val resolver = scriptedRoot / "project" / "AddResolverPlugin.scala" - if (!resolver.exists) { - IO.write( - resolver, - s"""import sbt._ - |import Keys._ - | - |object AddResolverPlugin extends AutoPlugin { - | override def requires = sbt.plugins.JvmPlugin - | override def trigger = allRequirements - | - | override lazy val projectSettings = Seq(resolvers += alternativeLocalResolver) - | lazy val alternativeLocalResolver = Resolver.file("$altLocalRepoName", file("$altLocalRepoPath"))(Resolver.ivyStylePatterns) - |} - |""".stripMargin - ) - } -} - -def scriptedUnpublishedTask: Def.Initialize[InputTask[Unit]] = Def.inputTask { - val result = scriptedSource(dir => (s: State) => scriptedParser(dir)).parsed - doScripted( - (fullClasspath in zincScripted in Test).value, - (scalaInstance in zincScripted).value, - scriptedSource.value, - result, - scriptedBufferLog.value, - scriptedPrescripted.value - ) -} - -lazy val publishAll = TaskKey[Unit]("publish-all") -lazy val publishLauncher = TaskKey[Unit]("publish-launcher") - -def customCommands: Seq[Setting[_]] = Seq( - commands += Command.command("release") { state => - "clean" :: // This is required since version number is generated in properties file. - "+compile" :: - "+publishSigned" :: - "reload" :: - state - } -) diff --git a/docs/project-structure.png b/docs/project-structure.png new file mode 100644 index 0000000000..ef017fa341 Binary files /dev/null and b/docs/project-structure.png differ diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/ClassNameSpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/ClassNameSpecification.scala index aa4c18a7d8..2dda8dc0f1 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/ClassNameSpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/ClassNameSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import sbt.internal.inc.UnitSpec diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/DependencySpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/DependencySpecification.scala index f529163f8d..70a8e112c1 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/DependencySpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/DependencySpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import xsbti.TestCallback.ExtractedClassDependencies diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractAPISpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractAPISpecification.scala index 697a441458..d786b183d5 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractAPISpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractAPISpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import xsbti.api._ diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesPerformanceSpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesPerformanceSpecification.scala index 1a61fa925f..a1bb27c08e 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesPerformanceSpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesPerformanceSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import java.net.URI diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesSpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesSpecification.scala index e77e301462..e546b1b1e6 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesSpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/ExtractUsedNamesSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import sbt.internal.inc.UnitSpec diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/InteractiveConsoleInterfaceSpecification.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/InteractiveConsoleInterfaceSpecification.scala index 12f82dc223..3419c8ce27 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/InteractiveConsoleInterfaceSpecification.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/InteractiveConsoleInterfaceSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import sbt.internal.inc.UnitSpec diff --git a/internal/compiler-bridge-test/src/test/scala/xsbt/ScalaCompilerForUnitTesting.scala b/internal/compiler-bridge-test/src/test/scala/xsbt/ScalaCompilerForUnitTesting.scala index 423d968c20..c6e11cc8ec 100644 --- a/internal/compiler-bridge-test/src/test/scala/xsbt/ScalaCompilerForUnitTesting.scala +++ b/internal/compiler-bridge-test/src/test/scala/xsbt/ScalaCompilerForUnitTesting.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import xsbti.TestCallback.ExtractedClassDependencies diff --git a/internal/compiler-interface/src/test/scala/xsbti/TestCallback.scala b/internal/compiler-interface/src/test/scala/xsbti/TestCallback.scala index 7f0c6eed3f..e55309348d 100644 --- a/internal/compiler-interface/src/test/scala/xsbti/TestCallback.scala +++ b/internal/compiler-interface/src/test/scala/xsbti/TestCallback.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbti import java.io.File diff --git a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala index ed9fc0af0f..0617bb6096 100644 --- a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala +++ b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassCanonicalNameSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala index 709c61a217..b5d509d1f4 100644 --- a/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/sbt/internal/inc/ClassToAPISpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala index 877b026dee..1d489c2e0b 100644 --- a/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala +++ b/internal/zinc-apiinfo/src/test/scala/xsbt/api/NameHashingSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt.api import xsbti.api._ diff --git a/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmarkSpec.scala b/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmarkSpec.scala index e0ebc143e0..7cb49ca212 100644 --- a/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmarkSpec.scala +++ b/internal/zinc-benchmarks/src/test/scala/xsbt/ZincBenchmarkSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package xsbt import org.scalatest.FunSuite diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/UnitSpec.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/UnitSpec.scala index bf2d70ea51..3e3794f340 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/UnitSpec.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/UnitSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala index 913218d331..0192eeae6f 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/AnalyzeSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala index f9e0ed3602..c7746f57cf 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/JavaCompilerForUnitTesting.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala index 338e853c42..d1ae7e55ec 100644 --- a/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala +++ b/internal/zinc-classfile/src/test/scala/sbt/internal/inc/classfile/ParserSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala index 05c2885a69..00e6e5bc1f 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/TestClassFileManager.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import java.io.File diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala index 807b7678b7..97c0dba4a7 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingLogger.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc.javac import sbt.util.{ Level, Logger } diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala index 416ec2ac41..a7424a8970 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/CollectingReporter.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala index d1e0bae3b7..eb2c160cf4 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavaCompilerSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala index 12ad295bff..85af4f682b 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/JavacProcessLoggerSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/javaErrorParserSpec.scala b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/javaErrorParserSpec.scala index b786c7d193..a6da76095b 100644 --- a/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/javaErrorParserSpec.scala +++ b/internal/zinc-compile-core/src/test/scala/sbt/internal/inc/javac/javaErrorParserSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala b/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala index 8f94fc7510..992ab34e83 100644 --- a/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala +++ b/internal/zinc-core/src/test/scala/sbt/internal/inc/HashSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala index abd2485a4c..9170152265 100644 --- a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala +++ b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/BridgeProviderSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import java.io.File diff --git a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/ZincComponentCompilerSpec.scala b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/ZincComponentCompilerSpec.scala index f3245c1ea4..3530c75898 100644 --- a/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/ZincComponentCompilerSpec.scala +++ b/internal/zinc-ivy-integration/src/test/scala/sbt/internal/inc/ZincComponentCompilerSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import sbt.internal.util.ConsoleLogger diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala index 780bda8abc..5fcbf19a09 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/AnalysisGenerators.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala index e0f4766f27..cbfa70d248 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryAnalysisFormatSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc.binary import java.io.File diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala index ce160dcd0d..f3e27642f8 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/binary/BinaryMappersSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc.binary import java.nio.file.Paths diff --git a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala index de5fe13911..854ecd320c 100644 --- a/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala +++ b/internal/zinc-persist/src/test/scala/sbt/inc/text/TextAnalysisFormatSpecification.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc.text import java.io.{ BufferedReader, File, StringReader, StringWriter } diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/BatchScriptRunner.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/BatchScriptRunner.scala index 5f36d99a67..e1159169af 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/BatchScriptRunner.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/BatchScriptRunner.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import org.scalatest.exceptions.TestFailedException diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala index 8fdf8417ea..53ecd9e51b 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncHandler.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package internal package inc diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncScriptedRunner.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncScriptedRunner.scala index 0f5cca876b..ea88044627 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncScriptedRunner.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/IncScriptedRunner.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import java.io.File diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedHandlers.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedHandlers.scala index dc23dc9cfa..193db7dff9 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedHandlers.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedHandlers.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import java.io.File diff --git a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedTests.scala b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedTests.scala index 1af4282af8..7da51dc401 100644 --- a/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedTests.scala +++ b/internal/zinc-scripted/src/test/scala/sbt/internal/inc/ScriptedTests.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc import java.io.File diff --git a/project/BuildPlugin.scala b/project/BuildPlugin.scala new file mode 100644 index 0000000000..978a59980d --- /dev/null +++ b/project/BuildPlugin.scala @@ -0,0 +1,385 @@ +import sbt._, Keys._ +import com.typesafe.sbt.GitPlugin, GitPlugin.autoImport._ +import bintray.BintrayPlugin, BintrayPlugin.autoImport._ +import com.lucidchart.sbt.scalafmt.ScalafmtCorePlugin, ScalafmtCorePlugin.autoImport._ +import com.lucidchart.sbt.scalafmt.ScalafmtSbtPlugin, ScalafmtSbtPlugin.autoImport._ +import com.typesafe.tools.mima.plugin.MimaPlugin, MimaPlugin.autoImport._ +import de.heikoseeberger.sbtheader.HeaderPlugin, HeaderPlugin.autoImport._ +import Dependencies._ +import Scripted._ + +object BuildPlugin extends AutoPlugin { + override def requires = + sbt.plugins.JvmPlugin && GitPlugin && BintrayPlugin && + ScalafmtCorePlugin && ScalafmtSbtPlugin && MimaPlugin && HeaderPlugin + + override def trigger = allRequirements + + val autoImport = BuildAutoImported + + override def buildSettings: Seq[Setting[_]] = BuildImplementation.buildSettings + override def projectSettings: Seq[Setting[_]] = BuildImplementation.projectSettings +} + +trait BuildKeys { + val tearDownBenchmarkResources: TaskKey[Unit] = taskKey("Remove benchmark resources.") + val scriptedPublishAll: TaskKey[Unit] = taskKey("Publishes all the Zinc artifacts for scripted") + val cleanSbtBridge: TaskKey[Unit] = taskKey("Cleans the sbt bridge") + val zincPublishLocal: TaskKey[Unit] = + taskKey("Publishes Zinc artifacts to an alternative local cache") +} + +object BuildAutoImported extends BuildKeys { + import BuildImplementation.{ BuildDefaults, BuildResolvers } + + val baseVersion = "1.1.0-SNAPSHOT" + val internalPath = file("internal") + val bridgeScalaVersions: List[String] = List(scala212, scala213, scala211, scala210) + // TODO: Add 2.13 (at the time some dependencies are not available for Scala 2.13.0-M2) + val bridgeTestScalaVersions: List[String] = List(scala212, scala211, scala210) + + val ZincGitHomepage: URL = url("https://github.com/sbt/zinc") + + val ScalaCenterMaintainer: Developer = + Developer("jvican", "Jorge Vicente Cantero", "@jvican", url("https://github.com/jvican")) + + // Defines several settings that are exposed to the projects definition in build.sbt + val noPublish: Seq[Setting[_]] = BuildDefaults.noPublishSettings + + // Sets up mima settings for modules that have to be binary compatible with Zinc 1.0.0 + val mimaSettings: Seq[Setting[_]] = + List(mimaPreviousArtifacts := BuildDefaults.zincPreviousArtifacts.value) + + val adaptOptionsForOldScalaVersions: Seq[Setting[_]] = + List(scalacOptions := BuildDefaults.zincScalacOptionsRedefinition.value) + + val zincPublishLocalSettings: Seq[Setting[_]] = List( + resolvers += BuildResolvers.AlternativeLocalResolver, + zincPublishLocal := BuildDefaults.zincPublishLocalImpl.value, + ) + + val benchmarksTestDir: File = IO.createTemporaryDirectory + + def inCompileAndTest(ss: SettingsDefinition*): Seq[Setting[_]] = + Seq(Compile, Test) flatMap (inConfig(_)(Def.settings(ss: _*))) +} + +import BuildPlugin.autoImport._ + +object BuildImplementation { + val buildSettings: Seq[Setting[_]] = List( + git.baseVersion := baseVersion, + git.gitUncommittedChanges := BuildDefaults.gitUncommittedChanges.value, + version := { + val previous = version.value + if (previous.contains("-SNAPSHOT")) git.baseVersion.value else previous + }, + bintrayPackage := "zinc", + // TODO(jvican): Remove `scmInfo` and `homepage` when we have support for sbt-release-early + scmInfo := Some(ScmInfo(ZincGitHomepage, "git@github.com:sbt/zinc.git")), + description := "Incremental compiler of Scala", + homepage := Some(ZincGitHomepage), + // The rest of the zinc developers come from sbt-houserules + developers += ScalaCenterMaintainer, + scalafmtOnCompile := true, + scalafmtVersion := "1.2.0", + scalafmtOnCompile in Sbt := false, + ) + + def projectSettings: Seq[Setting[_]] = Def settings ( + scalaVersion := scala212, + // publishArtifact in packageDoc := false, + resolvers ++= BuildResolvers.all, + resolvers ~= BuildResolvers.removeRepeatedResolvers, + // concurrentRestrictions in Global += Util.testExclusiveRestriction, + testOptions += Tests.Argument(TestFrameworks.ScalaCheck, "-w", "1"), + javacOptions in Compile ++= Seq("-Xlint", "-Xlint:-serial"), + crossScalaVersions := Seq(scala211, scala212), + publishArtifact in Test := false, + scalacOptions += "-YdisableFlatCpCaching", + inCompileAndTest(Seq(headerCreate, headerCheck) flatMap (inTask(_)( + unmanagedResources ~= (_ filterNot { f => + // exclude test resource source files + (f.getName endsWith ".java") || (f.getName endsWith ".scala") + }) + ))), + ) + + // Defines the constants for the alternative publishing + val ZincAlternativeRepoName: String = "alternative-local" + val ZincAlternativeRepoPath: String = sys.props("user.home") + "/.ivy2/zinc-alternative" + val ZincAlternativeRepoDir: File = file(ZincAlternativeRepoPath) + + object BuildResolvers { + val TypesafeReleases: Resolver = Resolver.typesafeIvyRepo("releases") + val SonatypeSnapshots: Resolver = Resolver.sonatypeRepo("snapshots") + val BintrayMavenReleases: Resolver = + MavenRepository("bintray-sbt-maven-releases", "https://dl.bintray.com/sbt/maven-releases/") + val BintraySbtIvySnapshots: Resolver = + Resolver.url("bintray-sbt-ivy-snapshots", + new URL("https://dl.bintray.com/sbt/ivy-snapshots/"))(Resolver.ivyStylePatterns) + val all: List[Resolver] = + List(TypesafeReleases, SonatypeSnapshots, BintrayMavenReleases, BintraySbtIvySnapshots) + + val AlternativeLocalResolver: Resolver = + Resolver.file(ZincAlternativeRepoName, ZincAlternativeRepoDir)(Resolver.ivyStylePatterns) + + // Naive way of implementing a filter to remove repeated resolvers. + def removeRepeatedResolvers(rs: Seq[Resolver]): Seq[Resolver] = rs.distinct + } + + object BuildCommands { + def crossTestBridges(bridgeTest: Project): Command = { + Command.command("crossTestBridges") { (state: State) => + val bridgeCommands = bridgeTestScalaVersions.flatMap { (bridgeVersion: String) => + // Note the ! here. You need this so compilerInterface gets forced to the scalaVersion + s"++ $bridgeVersion!" :: s"${bridgeTest.id}/test" :: Nil + } + bridgeCommands ::: s"++ $scala212!" :: state + } + } + + def publishBridgesAndSet(bridge: Project, interface: Project): Command = { + Command.args("publishBridgesAndSet", "") { (state, args) => + require(args.nonEmpty, "Missing Scala version argument.") + val version = args.mkString("") + val bridgeCommands = bridgeScalaVersions.flatMap { (v: String) => + // Note the ! here - it forces the scalaVersion + s"++ $v!" :: s"${bridge.id}/publishLocal" :: Nil + } + s"${interface.id}/publishLocal" :: bridgeCommands ::: s"++ $version!" :: state + } + } + + def publishBridgesAndTest(bridge: Project, interface: Project): Command = { + Command.args("publishBridgesAndTest", "") { (state, args) => + require(args.nonEmpty, "Missing arguments to publishBridgesAndTest.") + val version = args mkString "" + val bridgeCommands = bridgeScalaVersions.flatMap { (v: String) => + s"++ $v" :: s"${bridge.id}/publishLocal" :: Nil + } + s"${interface.id}/publishLocal" :: + bridgeCommands ::: + s"++ $version" :: + s"zincRoot/scalaVersion" :: + s"zincRoot/test" :: + s"zincRoot/scripted" :: + state + } + } + + val release: Command = + Command.command("release")(st => + "clean" :: // This is required since version number is generated in properties file. + "+compile" :: + "+publishSigned" :: + "reload" :: + st + ) + + def runBenchmarks(benchmarkProject: Project): Command = { + val projectId = benchmarkProject.id + val dirPath = benchmarksTestDir.getAbsolutePath + val runPreSetup = s"$projectId/run $dirPath" + val runBenchmark = s"$projectId/jmh:run -p _tempDir=$dirPath -prof gc" + val tearDownResources = s"$projectId/${tearDownBenchmarkResources.key.label}" + Command.command("runBenchmarks")(st => runPreSetup :: runBenchmark :: tearDownResources :: st) + } + + def all(bridge: Project, bridgeTest: Project, interface: Project, bench: Project): Seq[Command] = { + val crossTest = crossTestBridges(bridgeTest) + val publishBridges = publishBridgesAndSet(bridge, interface) + val publishBridgesTest = publishBridgesAndTest(bridge, interface) + val runBench = runBenchmarks(bench) + List(crossTest, publishBridges, publishBridgesTest, runBench, release) + } + } + + object BuildDefaults { + private[this] val statusCommands = List( + List("diff-index", "--cached", "HEAD"), + List("diff-index", "HEAD"), + List("diff-files"), + List("ls-files", "--exclude-standard", "--others") + ) + + // https://github.com/sbt/sbt-git/issues/109 + // Workaround from https://github.com/sbt/sbt-git/issues/92#issuecomment-161853239 + val gitUncommittedChanges: Def.Initialize[Boolean] = Def.setting { + val dir = baseDirectory.value + // can't use git.runner.value because it's a task + val runner = com.typesafe.sbt.git.ConsoleGitRunner + // sbt/zinc#334 Seemingly "git status" resets some stale metadata. + runner("status")(dir, com.typesafe.sbt.git.NullLogger) + val uncommittedChanges = statusCommands.flatMap { c => + val res = runner(c: _*)(dir, com.typesafe.sbt.git.NullLogger) + if (res.isEmpty) Nil else List(c -> res) + } + val logger = sLog.value + val areUncommitted = uncommittedChanges.nonEmpty + if (areUncommitted) { + uncommittedChanges.foreach { + case (cmd, res) => + logger.debug(s"""Uncommitted changes found via "${cmd.mkString(" ")}":\n$res""") + } + } + areUncommitted + } + + val zincPreviousArtifacts: Def.Initialize[Set[ModuleID]] = Def.setting { + val zincModule = (organization.value % moduleName.value % "1.0.0") + .cross(if (crossPaths.value) CrossVersion.binary else CrossVersion.disabled) + Set(zincModule) + } + + val zincScalacOptionsRedefinition: Def.Initialize[Task[Seq[String]]] = { + val exclude = Set( + "-Xfatal-warnings", + "-deprecation", + "-Ywarn-unused", + "-Ywarn-unused-import", + "-YdisableFlatCpCaching" + ) + Def.task { + val old = scalacOptions.value + scalaBinaryVersion.value match { + case v if v == "2.12" || v == "2.13" => old + case _ => old.filterNot(exclude.contains) + } + } + } + + val zincPublishLocalImpl: Def.Initialize[Task[Unit]] = Def.task { + import sbt.internal.librarymanagement._ + val logger = streams.value.log + val config = (publishLocalConfiguration).value + val ivy = new IvySbt((ivyConfiguration.value)) + val moduleSettings = Keys.moduleSettings.value + val module = new ivy.Module(moduleSettings) + val newConfig = config.withResolverName(ZincAlternativeRepoName).withOverwrite(false) + logger.info(s"Publishing $module to local repo: $ZincAlternativeRepoName") + Set(IvyActions.publish(module, newConfig, logger)) + } + + val noPublishSettings: Seq[Setting[_]] = List( + publish := {}, + publishLocal := {}, + publishArtifact in Compile := false, + publishArtifact in Test := false, + publishArtifact := false, + skip in publish := true, + ) + + private[this] def wrapIn(color: String, content: String): String = { + import sbt.internal.util.ConsoleAppender + if (!ConsoleAppender.formatEnabledInEnv) content + else color + content + scala.Console.RESET + } + + val cleanSbtBridge: Def.Initialize[Task[Unit]] = Def.task { + val sbtV = sbtVersion.value + val sbtOrg = "org.scala-sbt" + val sbtScalaVersion = "2.10.6" + val bridgeVersion = version.value + val scalaV = scalaVersion.value + + // Assumes that JDK version is the same than the one that publishes the bridge + val classVersion = System.getProperty("java.class.version") + + val home = System.getProperty("user.home") + val org = organization.value + val artifact = moduleName.value + val artifactName = s"$org-$artifact-$bridgeVersion-bin_${scalaV}__$classVersion" + + val targetsToDelete = List( + // We cannot use the target key, it's not scoped in `ThisBuild` nor `Global`. + (baseDirectory in ThisBuild).value / "target" / "zinc-components", + file(home) / ".ivy2/cache" / sbtOrg / artifactName, + file(home) / ".ivy2/local" / sbtOrg / artifactName, + file(home) / ".sbt/boot" / s"scala-$sbtScalaVersion" / sbtOrg / "sbt" / sbtV / artifactName + ) + + val logger = streams.value.log + logger.info(wrapIn(scala.Console.BOLD, "Cleaning stale compiler bridges:")) + targetsToDelete.foreach { target => + IO.delete(target) + logger.info(s"${wrapIn(scala.Console.GREEN, " ✓ ")}${target.getAbsolutePath}") + } + } + + private[this] val scalaPartialVersion = + Def.setting(CrossVersion.partialVersion(scalaVersion.value)) + + val handleScalaSpecificSources: Def.Initialize[List[File]] = Def.setting { + val source = scalaSource.value + scalaPartialVersion.value.collect { + case (2, y) if y == 10 => new File(source.getPath + "_2.10") + case (2, y) if y == 11 || y == 12 => new File(source.getPath + "_2.11-12") + case (2, y) if y >= 13 => new File(source.getPath + "_2.13") + }.toList + } + + val customCompilerBridge: Def.Initialize[ModuleID] = Def.setting { + val old = scalaCompilerBridgeSource.value + val bootstrapModule = + "org.scala-sbt" % "compiler-bridge_2.13.0-M2" % "1.1.0-M1-bootstrap2" % Compile sources() + scalaVersion.value match { + case x if x startsWith "2.13." => bootstrapModule + case _ => old + } + } + + def zincScripted( + bridgeRef: Project, + interfaceRef: Project, + scriptedRef: Project, + ): Def.Initialize[InputTask[Unit]] = Def.inputTask { + val result = scriptedSource(dir => (_: State) => scriptedParser(dir)).parsed + scriptedPublishAll.value // We first publish all the zinc modules + + // Publish the interface and the bridge to an alternative location where + // scripted then resolves them from + (zincPublishLocal in interfaceRef).value + (zincPublishLocal in bridgeRef).value + + val scriptedClasspath = (fullClasspath in scriptedRef in Test).value + val instance = (scalaInstance in scriptedRef).value + val source = scriptedSource.value + val logged = scriptedBufferLog.value + val hook = scriptedPrescripted.value + doScripted(scriptedClasspath, instance, source, result, logged, hook) + } + + def zincOnlyScripted(scriptedRef: Project): Def.Initialize[InputTask[Unit]] = Def.inputTask { + val result = scriptedSource(dir => (_: State) => scriptedParser(dir)).parsed + val scriptedClasspath = (fullClasspath in scriptedRef in Test).value + val instance = (scalaInstance in scriptedRef).value + val source = scriptedSource.value + val logged = scriptedBufferLog.value + val hook = scriptedPrescripted.value + doScripted(scriptedClasspath, instance, source, result, logged, hook) + } + + private[this] val ZincAlternativeResolverPlugin = s""" + |import sbt._ + |import Keys._ + | + |object AddResolverPlugin extends AutoPlugin { + | override def requires = sbt.plugins.JvmPlugin + | override def trigger = allRequirements + | + | override lazy val projectSettings = Seq(resolvers += alternativeLocalResolver) + | lazy val alternativeLocalResolver = Resolver.file("$ZincAlternativeRepoName", file("$ZincAlternativeRepoPath"))(Resolver.ivyStylePatterns) + |} + |""".stripMargin + + def addSbtAlternateResolver(scriptedRoot: File): Unit = { + val resolver = scriptedRoot / "project" / "AddResolverPlugin.scala" + if (!resolver.exists) IO.write(resolver, ZincAlternativeResolverPlugin) + else () + } + + val tearDownBenchmarkResources: Def.Initialize[Task[Unit]] = + Def.task(IO.delete(benchmarksTestDir)) + } +} diff --git a/project/Dependencies.scala b/project/Dependencies.scala index 6bca5b05a2..bdde41bd61 100644 --- a/project/Dependencies.scala +++ b/project/Dependencies.scala @@ -80,19 +80,12 @@ object Dependencies { val scalaCheck = "org.scalacheck" %% "scalacheck" % "1.13.4" val scalatest = "org.scalatest" %% "scalatest" % "3.0.1" val junit = "junit" % "junit" % "4.11" - val sjsonnew = Def.setting { - "com.eed3si9n" %% "sjson-new-core" % contrabandSjsonNewVersion.value - } - val sjsonnewScalaJson = Def.setting { - "com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value - } + val sjsonnew = Def.setting("com.eed3si9n" %% "sjson-new-core" % contrabandSjsonNewVersion.value) + val sjsonnewScalaJson = + Def.setting("com.eed3si9n" %% "sjson-new-scalajson" % contrabandSjsonNewVersion.value) + val affinity = "net.openhft" % "affinity" % "3.0.6" + val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % "4.6.0.201612231935-r" def addTestDependencies(p: Project): Project = - p.settings( - libraryDependencies ++= Seq( - scalaCheck % Test, - scalatest % Test, - junit % Test - ) - ) + p.settings(libraryDependencies ++= Seq(scalaCheck % Test, scalatest % Test, junit % Test)) } diff --git a/project/Header.scala b/project/Header.scala index b6daaa577a..0cf167e33b 100644 --- a/project/Header.scala +++ b/project/Header.scala @@ -7,19 +7,15 @@ import de.heikoseeberger.sbtheader.HeaderPlugin.{autoImport => SbtHeaderKeys} object CustomHeaderPlugin extends AutoPlugin { override def requires = plugins.JvmPlugin && HeaderPlugin override def trigger = allRequirements - import SbtHeaderKeys.{HeaderFileType, HeaderCommentStyle, HeaderLicense} + import SbtHeaderKeys.HeaderLicense override def projectSettings = Seq( - SbtHeaderKeys.headerMappings ++= Map( - HeaderFileType.scala -> HeaderCommentStyle.CStyleBlockComment, - HeaderFileType.java -> HeaderCommentStyle.CStyleBlockComment - ), SbtHeaderKeys.headerLicense := Some(HeaderLicense.Custom( """|Zinc - The incremental compiler for Scala. |Copyright 2011 - 2017, Lightbend, Inc. |Copyright 2008 - 2010, Mark Harrah |This software is released under the terms written in LICENSE. |""".stripMargin - )) + )), ) } diff --git a/project/Scripted.scala b/project/Scripted.scala index d018b64b69..07f893cdb7 100644 --- a/project/Scripted.scala +++ b/project/Scripted.scala @@ -82,8 +82,7 @@ object Scripted { val bridgeClass = Class.forName("sbt.internal.inc.IncScriptedRunner", true, loader) val bridge = bridgeClass.newInstance.asInstanceOf[IncScriptedRunner] // val launcherVmOptions = Array("-XX:MaxPermSize=256M") // increased after a failure in scripted source-dependencies/macro - try { - bridge.run(sourcePath, bufferLog, args.toArray) - } catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause } + try bridge.run(sourcePath, bufferLog, args.toArray) + catch { case ite: java.lang.reflect.InvocationTargetException => throw ite.getCause } } } diff --git a/zinc-compile/src/test/scala/inc/DocSpec.scala b/zinc-compile/src/test/scala/inc/DocSpec.scala index 7eafe4aa95..46628a6dc7 100644 --- a/zinc-compile/src/test/scala/inc/DocSpec.scala +++ b/zinc-compile/src/test/scala/inc/DocSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt package inc diff --git a/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala b/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala index ec55b454ab..36de4e8871 100644 --- a/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala +++ b/zinc-compile/src/test/scala/sjsonnew/support/scalajson/unsafe/FixedParser.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sjsonnew package support.scalajson.unsafe diff --git a/zinc/src/main/scala/sbt/internal/inc/caching/ClasspathCache.scala b/zinc/src/main/scala/sbt/internal/inc/caching/ClasspathCache.scala index cda89f31e0..3aab605eef 100644 --- a/zinc/src/main/scala/sbt/internal/inc/caching/ClasspathCache.scala +++ b/zinc/src/main/scala/sbt/internal/inc/caching/ClasspathCache.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.internal.inc.caching import java.io.File diff --git a/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala b/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala index 9d7f543332..5fc8800a8d 100644 --- a/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala +++ b/zinc/src/test/scala/sbt/inc/ClasspathHashingHookSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import java.io.File diff --git a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala index 6f3ff188d0..0e7c55b721 100644 --- a/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/IncrementalCompilerSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import xsbti.compile.AnalysisStore diff --git a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala index 794b67c520..cde07ff489 100644 --- a/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala +++ b/zinc/src/test/scala/sbt/inc/MultiProjectIncrementalSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import java.io.File diff --git a/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala b/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala index 60d486709a..49e1d596e9 100644 --- a/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala +++ b/zinc/src/test/scala/sbt/inc/NameHashingCompilerSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import java.nio.file.Paths diff --git a/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala b/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala index 574d5d54da..aede0b979f 100644 --- a/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala +++ b/zinc/src/test/scala/sbt/inc/NestedJavaClassSpec.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import sbt.internal.inc.Analysis diff --git a/zinc/src/test/scala/sbt/inc/TestResource.scala b/zinc/src/test/scala/sbt/inc/TestResource.scala index 9b2cf643d0..03c64525e6 100644 --- a/zinc/src/test/scala/sbt/inc/TestResource.scala +++ b/zinc/src/test/scala/sbt/inc/TestResource.scala @@ -1,3 +1,10 @@ +/* + * Zinc - The incremental compiler for Scala. + * Copyright 2011 - 2017, Lightbend, Inc. + * Copyright 2008 - 2010, Mark Harrah + * This software is released under the terms written in LICENSE. + */ + package sbt.inc import java.io.File