Skip to content

Commit

Permalink
Merge pull request scala#8660 from retronym/backport/sbt-bump
Browse files Browse the repository at this point in the history
[backport] Upgrade 2.12.x build to SBT 1.3.7 [ci: last-only]
  • Loading branch information
retronym authored Feb 3, 2020
2 parents 31d4d2f + 5b1bf53 commit b8c33ad
Show file tree
Hide file tree
Showing 29 changed files with 386 additions and 343 deletions.
2 changes: 0 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,6 @@ Note that sbt's incremental compilation is often too coarse for the Scala compil
codebase and re-compiles too many files, resulting in long build times (check
[sbt#1104](https://github.com/sbt/sbt/issues/1104) for progress on that front). In the
meantime you can:
- Enable "Ant mode" in which sbt only re-compiles source files that were modified.
Create a file `local.sbt` containing the line `antStyle := true`.
- Use IntelliJ IDEA for incremental compiles (see [IDE Setup](#ide-setup) below) - its
incremental compiler is a bit less conservative, but usually correct.

Expand Down
389 changes: 291 additions & 98 deletions build.sbt

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion project/BuildSettings.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import sbt._
/** This object defines keys that should be visible with an unqualified name in all .sbt files and the command line */
object BuildSettings extends AutoPlugin {
object autoImport {
lazy val antStyle = settingKey[Boolean]("Use ant-style incremental builds instead of name-hashing")
lazy val baseVersion = settingKey[String]("The base version number from which all others are derived")
lazy val baseVersionSuffix = settingKey[String]("Identifies the kind of version to build")
lazy val mimaReferenceVersion = settingKey[Option[String]]("Scala version number to run MiMa against")
Expand Down
1 change: 0 additions & 1 deletion project/Osgi.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package scala.build

import aQute.bnd.osgi.Builder
import aQute.bnd.osgi.Constants._
import java.util.Properties
import java.util.jar.Attributes
import sbt._
import sbt.Keys._
Expand Down
11 changes: 6 additions & 5 deletions project/PartestTestListener.scala
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import java.util.concurrent.TimeUnit

import sbt.testing.{SuiteSelector, TestSelector}
import sbt.{JUnitXmlTestsListener, TestEvent, TestResult, TestsListener, _}
import sbt.internal.util.EscHelpers.removeEscapeSequences

// The default JUnitXMLListener doesn't play well with partest: we end up clobbering the one-and-only partest.xml
// file on group of tests run by `testAll`, and the test names in the XML file don't seem to show the path to the
Expand All @@ -21,9 +22,9 @@ class PartestTestListener(target: File) extends TestsListener {
val skipStatus = EnumSet.of(TStatus.Skipped, TStatus.Ignored)

override def doInit(): Unit = ()
override def doComplete(finalResult: TestResult.Value): Unit = ()
override def doComplete(finalResult: TestResult): Unit = ()
override def endGroup(name: String, t: Throwable): Unit = ()
override def endGroup(name: String, result: TestResult.Value): Unit = ()
override def endGroup(name: String, result: TestResult): Unit = ()
override def testEvent(event: TestEvent): Unit = {
// E.g "test.files.pos" or "test.scaladoc.run"
def groupOf(e: sbt.testing.Event) = {
Expand Down Expand Up @@ -62,21 +63,21 @@ class PartestTestListener(target: File) extends TestsListener {
val writer = new PrintWriter(stringWriter)
e.throwable.get.printStackTrace(writer)
writer.flush()
ConsoleLogger.removeEscapeSequences(stringWriter.toString)
removeEscapeSequences(stringWriter.toString)
} else {
""
}

<testcase classname={group} name={testOf(e)} time={(1.0 * e.duration() / 1000).toString}>
{e.status match {
case TStatus.Error if e.throwable.isDefined =>
<error message={ConsoleLogger.removeEscapeSequences(e.throwable.get.getMessage)} type={e.throwable.get.getClass.getName}>
<error message={removeEscapeSequences(e.throwable.get.getMessage)} type={e.throwable.get.getClass.getName}>
{trace}
</error>
case TStatus.Error =>
<error message={"No Exception or message provided"}/>
case TStatus.Failure if e.throwable.isDefined =>
<failure message={ConsoleLogger.removeEscapeSequences(e.throwable.get.getMessage)} type={e.throwable.get.getClass.getName}>
<failure message={removeEscapeSequences(e.throwable.get.getMessage)} type={e.throwable.get.getClass.getName}>
{trace}
</failure>
case TStatus.Failure =>
Expand Down
2 changes: 1 addition & 1 deletion project/PartestUtil.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ object PartestUtil {
private def testCaseFinder = (testBase / srcPath).*(AllPassFilter).*(testCaseFilter)
private val basePaths = allTestCases.map(_._2.split('/').take(3).mkString("/") + "/").distinct

def allTestCases = testCaseFinder.pair(relativeTo(globalBase))
def allTestCases = testCaseFinder.pair(io.Path.relativeTo(globalBase))
def basePathExamples = new FixedSetExamples(basePaths)
private def equiv(f1: File, f2: File) = f1.getCanonicalFile == f2.getCanonicalFile
def parentChain(f: File): Iterator[File] =
Expand Down
25 changes: 2 additions & 23 deletions project/Quiet.scala
Original file line number Diff line number Diff line change
Expand Up @@ -2,32 +2,11 @@ package scala.build

import sbt._
import Keys._
import java.util.function.Supplier

object Quiet {
// Workaround sbt issue described:
//
// https://github.com/scala/scala-dev/issues/100
def silenceScalaBinaryVersionWarning = ivyConfiguration := {
ivyConfiguration.value match {
case c: InlineIvyConfiguration =>
val delegate = c.log
val logger = new Logger {
override def trace(t: => Throwable): Unit = delegate.trace(t)
override def log(level: sbt.Level.Value, message: => String): Unit = {
level match {
case sbt.Level.Warn =>
val message0 = message
val newLevel = if (message.contains("differs from Scala binary version in project"))
delegate.log(sbt.Level.Debug, message)
else
delegate.log(level, message)
case _ => delegate.log(level, message)
}
}
override def success(message: => String): Unit = delegate.success(message)
}
new InlineIvyConfiguration(c.paths, c.resolvers, c.otherResolvers, c.moduleConfigurations, c.localOnly, c.lock, c.checksums, c.resolutionCacheDir, c.updateOptions, logger)
case x => x
}
}
def silenceScalaBinaryVersionWarning = scalaModuleInfo ~= (x => x.map(_.withCheckExplicit(false)))
}
9 changes: 1 addition & 8 deletions project/ScriptCommands.scala
Original file line number Diff line number Diff line change
Expand Up @@ -111,14 +111,7 @@ object ScriptCommands {
def enableOptimizerCommand = setup("enableOptimizer")(_ => enableOptimizer)

private[this] def setup(name: String)(f: Seq[String] => Seq[Setting[_]]) = Command.args(name, name) { case (state, seq) =>
// `Project.extract(state).append(f(seq), state)` would be simpler, but it
// takes the project's initial state and discards all changes that were made in the sbt console.
val session = Project.session(state)
val extracted = Project.extract(state)
val settings = f(seq)
val appendSettings = Load.transformSettings(Load.projectScope(extracted.currentRef), extracted.currentRef.build, extracted.rootProject, settings)
val newStructure = Load.reapply(session.mergeSettings ++ appendSettings, extracted.structure)(extracted.showKey)
Project.setProject(session, newStructure, state)
Project.extract(state).appendWithSession(f(seq), state)
}

val enableOptimizer = Seq(
Expand Down
23 changes: 19 additions & 4 deletions project/VersionUtil.scala
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
package scala.build

import sbt.{stringToProcess => _, _}
import sbt._
import Keys._
import java.util.{Date, Locale, Properties, TimeZone}
import java.io.{File, FileInputStream}
import java.text.SimpleDateFormat
import java.time.Instant
import java.time.format.DateTimeFormatter
import java.time.temporal.{TemporalAccessor, TemporalQueries, TemporalQuery}

import scala.collection.JavaConverters._
import BuildSettings.autoImport._
Expand Down Expand Up @@ -71,8 +74,21 @@ object VersionUtil {
val db = new FileRepositoryBuilder().findGitDir.build
val head = db.resolve("HEAD")
if (head eq null) {
log.info("No git HEAD commit found -- Using current date and 'unknown' SHA")
(new Date, "unknown")
import scala.sys.process._
try {
// Workaround lack of git worktree support in JGit https://bugs.eclipse.org/bugs/show_bug.cgi?id=477475
val sha = List("git", "rev-parse", "HEAD").!!.trim
val commitDateIso = List("git", "log", "-1", "--format=%cI", "HEAD").!!.trim
val date = java.util.Date.from(DateTimeFormatter.ISO_DATE_TIME.parse(commitDateIso, new TemporalQuery[Instant] {
override def queryFrom(temporal: TemporalAccessor): Instant = Instant.from(temporal)
}))
(date, sha.substring(0, 7))
} catch {
case ex: Exception =>
ex.printStackTrace()
log.info("No git HEAD commit found -- Using current date and 'unknown' SHA")
(new Date, "unknown")
}
} else {
val commit = new RevWalk(db).parseCommit(head)
(new Date(commit.getCommitTime.toLong * 1000L), commit.getName.substring(0, 7))
Expand Down Expand Up @@ -109,7 +125,6 @@ object VersionUtil {
* suffix is used for releases. All other suffix values are treated as RC / milestone builds. The special suffix
* value "SPLIT" is used to split the real suffix off from `baseVersion` instead and then apply the usual logic. */
private lazy val versionPropertiesImpl: Def.Initialize[Versions] = Def.setting {
val log = sLog.value
val (date, sha) = (gitProperties.value.date, gitProperties.value.sha)

val (base, suffix) = {
Expand Down
2 changes: 1 addition & 1 deletion project/build.properties
Original file line number Diff line number Diff line change
@@ -1 +1 @@
sbt.version=0.13.18
sbt.version=1.3.7
4 changes: 2 additions & 2 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
scalacOptions ++= Seq("-unchecked", "-feature"/*, "-deprecation"*/, "-Xlint" /*, "-Xfatal-warnings"*/)
scalacOptions ++= Seq("-unchecked", "-feature"/*, "-deprecation", "-Xlint" , "-Xfatal-warnings"*/)

libraryDependencies += "org.apache.commons" % "commons-lang3" % "3.3.2"

Expand All @@ -18,7 +18,7 @@ buildInfoKeys := Seq[BuildInfoKey](buildClasspath)

buildInfoPackage := "scalabuild"

addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.1.18")
addSbtPlugin("com.typesafe" % "sbt-mima-plugin" % "0.6.1")

libraryDependencies ++= Seq(
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.6.0.201612231935-r",
Expand Down
2 changes: 1 addition & 1 deletion project/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.6.1")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
2 changes: 1 addition & 1 deletion scripts/common
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ rm -rf "$WORKSPACE/resolutionScratch_"
mkdir -p "$WORKSPACE/resolutionScratch_"

SBT_CMD=${SBT_CMD-sbt}
SBT_CMD="$SBT_CMD -sbt-version 0.13.18"
SBT_CMD="$SBT_CMD -sbt-version 1.3.7"

# repo to publish builds
integrationRepoUrl=${integrationRepoUrl-"https://scala-ci.typesafe.com/artifactory/scala-integration/"}
Expand Down
4 changes: 2 additions & 2 deletions scripts/jobs/integrate/windows
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ generateRepositoriesConfig
SBT="java $JAVA_OPTS -Dsbt.ivy.home=$WORKSPACE/.ivy2 -jar $sbtLauncher -Dsbt.override.build.repos=true -Dsbt.repository.config=$sbtRepositoryConfig"

# Build locker with STARR
$SBT --warn "setupPublishCore" generateBuildCharacterPropertiesFile publishLocal
$SBT -warn "setupPublishCore" generateBuildCharacterPropertiesFile publishLocal

# Build quick and run the tests
parseScalaProperties buildcharacter.properties
$SBT -Dstarr.version=$maven_version_number --warn "setupValidateTest" testAll
$SBT -Dstarr.version=$maven_version_number -warn "setupValidateTest" testAll
4 changes: 2 additions & 2 deletions scripts/jobs/validate/publish-core
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ case $prDryRun in
;;
*)
echo ">>> Getting Scala version number."
$SBT --warn "setupPublishCore $prRepoUrl" generateBuildCharacterPropertiesFile
$SBT -warn "setupPublishCore $prRepoUrl" generateBuildCharacterPropertiesFile
parseScalaProperties buildcharacter.properties # produce maven_version_number

echo ">>> Checking availability of Scala ${maven_version_number} in $prRepoUrl."
Expand All @@ -28,7 +28,7 @@ case $prDryRun in
if $libraryAvailable && $reflectAvailable && $compilerAvailable; then
echo "Scala core already built!"
else
$SBT --warn "setupPublishCore $prRepoUrl" publish
$SBT -warn "setupPublishCore $prRepoUrl" publish
fi

mv buildcharacter.properties jenkins.properties # parsed by the jenkins job
Expand Down
2 changes: 1 addition & 1 deletion scripts/jobs/validate/test
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ case $prDryRun in
# and run JUnit tests, ScalaCheck tests, partest, OSGi tests, MiMa and scaladoc
$SBT \
-Dstarr.version=$scalaVersion \
--warn \
-warn \
"setupValidateTest $prRepoUrl" \
$testExtraArgs \
testAll
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ final class JrtClassPath(fs: java.nio.file.FileSystem) extends ClassPath with No
final class CtSymClassPath(ctSym: java.nio.file.Path, release: Int) extends ClassPath with NoSourcePaths with Closeable {
import java.nio.file.Path, java.nio.file._

private val fileSystem: FileSystem = FileSystems.newFileSystem(ctSym, null)
private val fileSystem: FileSystem = FileSystems.newFileSystem(ctSym, null: ClassLoader)
private val root: Path = fileSystem.getRootDirectories.iterator().next
private val roots = Files.newDirectoryStream(root).iterator().asScala.toList

Expand Down
2 changes: 1 addition & 1 deletion src/intellij/junit.iml.SAMPLE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../../build/quick/classes/junit" />
<output-test url="file://$MODULE_DIR$/../../target/junit/test-classes" />
<exclude-output />
Expand Down
2 changes: 1 addition & 1 deletion src/intellij/repl.iml.SAMPLE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<module type="JAVA_MODULE" version="4">
<component name="NewModuleRootManager" inherit-compiler-output="false">
<component name="NewModuleRootManager">
<output url="file://$MODULE_DIR$/../../build/quick/classes/repl" />
<output-test url="file://$MODULE_DIR$/../../out/test/repl" />
<exclude-output />
Expand Down
57 changes: 38 additions & 19 deletions src/intellij/scala.ipr.SAMPLE
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
</component>
<component name="InspectionProjectProfileManager">
<profile version="1.0">
<option value="Project Default" name="myName"/>
<inspection_tool enabled_by_default="false" level="WARNING" enabled="false" class="EmptyCheck"/>
<option value="Project Default" name="myName" />
<inspection_tool enabled_by_default="false" level="WARNING" enabled="false" class="EmptyCheck" />
</profile>
<version value="1.0" />
</component>
Expand Down Expand Up @@ -154,6 +154,27 @@
</item>
</group>
</component>
<component name="ProjectCodeStyleConfiguration">
<option name="USE_PER_PROJECT_SETTINGS" value="true" />
<code_scheme name="Project" version="173">
<XML>
<option name="XML_LEGACY_SETTINGS_IMPORTED" value="true" />
</XML>
<codeStyleSettings language="JAVA">
<indentOptions>
<option name="INDENT_SIZE" value="2" />
<option name="CONTINUATION_INDENT_SIZE" value="4" />
<option name="TAB_SIZE" value="2" />
</indentOptions>
</codeStyleSettings>
<codeStyleSettings language="Scala">
<option name="BLANK_LINES_BEFORE_IMPORTS" value="0" />
<option name="BLANK_LINES_AFTER_IMPORTS" value="0" />
<option name="BLANK_LINES_AROUND_METHOD" value="0" />
<option name="BLANK_LINES_AROUND_METHOD_IN_INTERFACE" value="0" />
</codeStyleSettings>
</code_scheme>
</component>
<component name="ProjectLevelVcsManager" settingsEditedManually="false">
<OptionsSetting value="true" id="Add" />
<OptionsSetting value="true" id="Remove" />
Expand Down Expand Up @@ -208,7 +229,6 @@
<JAVADOC />
<SOURCES />
</library>

<library name="compiler-deps">
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
Expand All @@ -222,21 +242,21 @@
</library>
<library name="compilerOptionsExporter-deps">
<CLASSES>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-6.0.0-scala-1.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/bundles/jackson-dataformat-yaml-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.18.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.module/jackson-module-scala_2.12/bundles/jackson-module-scala_2.12-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.module/jackson-module-paranamer/bundles/jackson-module-paranamer-2.9.5.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/com.thoughtworks.paranamer/paranamer/bundles/paranamer-2.8.jar!/"/>
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant/jars/ant-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.apache.ant/ant-launcher/jars/ant-launcher-1.9.4.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-asm/bundles/scala-asm-6.0.0-scala-1.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.scala-lang.modules/scala-xml_2.12/bundles/scala-xml_2.12-1.0.6.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-core/bundles/jackson-core-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-annotations/bundles/jackson-annotations-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.core/jackson-databind/bundles/jackson-databind-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.dataformat/jackson-dataformat-yaml/bundles/jackson-dataformat-yaml-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/org.yaml/snakeyaml/bundles/snakeyaml-1.18.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.module/jackson-module-scala_2.12/bundles/jackson-module-scala_2.12-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.fasterxml.jackson.module/jackson-module-paranamer/bundles/jackson-module-paranamer-2.9.5.jar!/" />
<root url="jar://$USER_HOME$/.ivy2/cache/com.thoughtworks.paranamer/paranamer/bundles/paranamer-2.8.jar!/" />
</CLASSES>
<JAVADOC/>
<SOURCES/>
<JAVADOC />
<SOURCES />
</library>
<library name="interactive-deps">
<CLASSES>
Expand Down Expand Up @@ -447,7 +467,6 @@
</library>
<library name="starr" type="Scala">
<properties>
<option name="languageLevel" value="Scala_2_12" />
<compiler-classpath>
<root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.12.1.jar" />
<root url="file://$USER_HOME$/.ivy2/cache/org.scala-lang/scala-compiler/jars/scala-compiler-2.12.1.jar" />
Expand Down Expand Up @@ -482,4 +501,4 @@
<SOURCES />
</library>
</component>
</project>
</project>
11 changes: 0 additions & 11 deletions src/library/mima-filters/2.12.0.backwards.excludes

This file was deleted.

Loading

0 comments on commit b8c33ad

Please sign in to comment.