Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update sbt and coursier #1090

Merged
merged 3 commits into from
Apr 14, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ inThisBuild(
onLoadMessage := s"Welcome to scalafix ${version.value}",
scalaVersion := scala212,
crossScalaVersions := List(scala212, scala211),
fork.in(Test, test) := true
fork := true
)
)

Expand Down Expand Up @@ -169,7 +169,8 @@ lazy val unit = project
.in(file("scalafix-tests/unit"))
.settings(
noPublish,
fork := false,
// Change working directory to match when `fork := false`.
baseDirectory.in(Test) := baseDirectory.in(ThisBuild).value,
javaOptions := Nil,
buildInfoPackage := "scalafix.tests",
buildInfoObject := "BuildInfo",
Expand Down Expand Up @@ -251,6 +252,7 @@ lazy val docs = project
.in(file("scalafix-docs"))
.settings(
noMima,
baseDirectory.in(run) := baseDirectory.in(ThisBuild).value,
skip in publish := true,
moduleName := "scalafix-docs",
scalaVersion := scala212,
Expand Down
7 changes: 4 additions & 3 deletions project/Dependencies.scala
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ object Dependencies {
def scala211 = "2.11.12"
def scala212 = "2.12.11"
def scala213 = "2.13.1"
def coursierV = "2.0.0-RC5-6"
val currentScalaVersion = scala212

val jgit = "org.eclipse.jgit" % "org.eclipse.jgit" % "5.6.0.201912101111-r"
Expand All @@ -25,7 +26,7 @@ object Dependencies {

def testsDeps = List(
// integration property tests
"io.get-coursier" %% "coursier" % "2.0.0-RC5-6",
"io.get-coursier" %% "coursier" % coursierV,
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
"org.typelevel" %% "cats-core" % "2.0.0",
"com.typesafe.slick" %% "slick" % "3.3.2",
Expand All @@ -34,7 +35,7 @@ object Dependencies {
)

def coursierDeps = Seq(
"io.get-coursier" %% "coursier" % coursier.util.Properties.version,
"io.get-coursier" %% "coursier-cache" % coursier.util.Properties.version
"io.get-coursier" %% "coursier" % coursierV,
"io.get-coursier" %% "coursier-cache" % coursierV
)
}
8 changes: 3 additions & 5 deletions project/ScalafixBuild.scala
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
lazy val isFullCrossVersion = Seq(
crossVersion := CrossVersion.full
)
lazy val isScala213 = Def.setting {
scalaVersion.value.startsWith("2.13")
}
lazy val isScala213 = Def.setting { scalaVersion.value.startsWith("2.13") }
lazy val warnUnusedImports = Def.setting {
if (isScala213.value) "-Ywarn-unused:imports"
else "-Ywarn-unused-import"
Expand All @@ -59,7 +57,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
name,
version,
stableVersion,
"coursier" -> coursier.util.Properties.version,
"coursier" -> coursierV,
"nightly" -> version.value,
"scalameta" -> scalametaV,
scalaVersion,
Expand Down Expand Up @@ -155,7 +153,7 @@ object ScalafixBuild extends AutoPlugin with GhpagesKeys {
"stableVersion" -> stableVersion.value,
"scalametaVersion" -> scalametaV,
"supportedScalaVersions" -> supportedScalaVersions,
"coursierVersion" -> coursier.util.Properties.version
"coursierVersion" -> coursierV
)
),
fork in tut := true
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=1.2.8
sbt.version=1.3.9
3 changes: 0 additions & 3 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
addSbtPlugin("com.geirsson" % "sbt-ci-release" % "1.5.2")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.9.0")
addSbtPlugin(
"io.get-coursier" % "sbt-coursier" % coursier.util.Properties.version
)
addSbtPlugin("com.typesafe.sbt" % "sbt-ghpages" % "0.6.3")
addSbtPlugin("com.typesafe.sbt" % "sbt-site" % "1.4.0")
// exclude is a workaround for https://github.com/sbt/sbt-assembly/issues/236#issuecomment-294452474
Expand Down
1 change: 0 additions & 1 deletion project/project/plugins.sbt
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
addSbtPlugin("org.scala-js" % "sbt-scalajs" % "0.6.23")
addSbtPlugin("io.get-coursier" % "sbt-coursier" % "2.0.0-RC3-3")
unmanagedSources.in(Compile) += baseDirectory.value / ".." / "Dependencies.scala"
Binary file modified sbt
Binary file not shown.
9 changes: 8 additions & 1 deletion scalafix-docs/src/main/scala/scalafix/docs/PatchDocs.scala
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
package scalafix.docs

import java.nio.file.Paths
import java.io.File
import org.typelevel.paiges.Doc
import scala.meta.inputs.Input
import scala.meta.interactive.InteractiveSemanticdb
Expand Down Expand Up @@ -101,7 +103,12 @@ object PatchDocs {
"-Ywarn-unused",
"-P:semanticdb:synthetics:on"
)
lazy val compiler = InteractiveSemanticdb.newCompiler(scalacOptions)
lazy val classpath = ClasspathOps
.getURLs(this.getClass().getClassLoader())
.map(p => Paths.get(p.toURI()))
.mkString(File.pathSeparator)
lazy val compiler =
InteractiveSemanticdb.newCompiler(classpath, scalacOptions)
lazy val symtab =
GlobalSymbolTable(ClasspathOps.thisClasspath, includeJdk = true)
lazy val scalafixSymtab = new Symtab { self =>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ class ScalafixImplSuite extends FunSuite with DiffAssertions {
}

test("error") {
val cl = new URLClassLoader(Array())
val cl = new URLClassLoader(Array(), null)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahhh, I tried the fork := true up above like you did, but didn't catch this one down here.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It was also necessary to update baseDirectory.in(Test) := baseDirectory.in(ThisBuild).value. That should honestly be the default behavior in sbt, but changing the default would break a lot of builds

val ex = intercept[ScalafixException] {
i.Scalafix.classloadInstance(cl)
}
Expand Down