Skip to content

Move scalafix build to the main build #69

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

Closed
wants to merge 1 commit into from
Closed
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: 3 additions & 3 deletions admin/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,14 @@ set -e
RELEASE_COMBO=true

if [[ "$TEST_SCALAFIX" == "true" ]]; then
Copy link
Contributor Author

Choose a reason for hiding this comment

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

RELEASE_COMBO does not seem to be used.

cd scalafix && sbt input/compile output/compile tests/test
sbt tests/test
exit 0
fi

if [ "$SCALAJS_VERSION" = "" ]; then
projectPrefix="scala-collection-compat"
projectPrefix="compat"
else
projectPrefix="scala-collection-compatJS"
projectPrefix="compatJS"
fi

verPat="[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z0-9-]+)?"
Expand Down
78 changes: 68 additions & 10 deletions build.sbt
Original file line number Diff line number Diff line change
@@ -1,28 +1,36 @@
import sbtcrossproject.{crossProject, CrossType}
import ScalaModulePlugin._
import sbtcrossproject.{crossProject, CrossType}
import _root_.scalafix.Versions.{version => scalafixVersion, scala212 => scalafixScala212}

lazy val scala212 = "2.12.6"
lazy val scala213 = "2.13.0-M4"

inThisBuild(Seq(
crossScalaVersions := Seq("2.12.6", "2.13.0-M4", "2.11.12")
crossScalaVersions := Seq(scala212, scala213, "2.11.12")
))

disablePlugins(JvmPlugin)
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this prevents sbt from giving command history / autocompletion.

Copy link
Contributor

Choose a reason for hiding this comment

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

For reference, this was added in #41

lazy val root = project
.in(file("."))
.aggregate(rules, input, output, tests, compatJVM, compatJS)
.disablePlugins(ScalafixPlugin)

lazy val `scala-collection-compat` = crossProject(JSPlatform, JVMPlatform)
lazy val compat = crossProject(JSPlatform, JVMPlatform)
.withoutSuffixFor(JVMPlatform)
.crossType(CrossType.Pure)
.in(file("."))
.settings(scalaModuleSettings)
.jvmSettings(scalaModuleSettingsJVM)
.settings(
name := "scala-collection-compat",
moduleName := "scala-collection-compat",
version := "0.1-SNAPSHOT",
scalacOptions ++= Seq("-feature", "-language:higherKinds", "-language:implicitConversions"),
unmanagedSourceDirectories in Compile += {
val sharedSourceDir = baseDirectory.value.getParentFile / "src/main"
if (scalaVersion.value.startsWith("2.13.")) sharedSourceDir / "scala-2.13"
else sharedSourceDir / "scala-2.11_2.12"
}
},
scalaVersion := scala212
)
.settings(scalaModuleSettings)
.jvmSettings(scalaModuleSettingsJVM)
.jvmSettings(
OsgiKeys.exportPackage := Seq(s"scala.collection.compat.*;version=${version.value}"),
libraryDependencies += "com.novocode" % "junit-interface" % "0.11" % "test"
Expand All @@ -36,6 +44,56 @@ lazy val `scala-collection-compat` = crossProject(JSPlatform, JVMPlatform)
fork in Test := false // Scala.js cannot run forked tests
)
.jsConfigure(_.enablePlugins(ScalaJSJUnitPlugin))
.disablePlugins(ScalafixPlugin)

lazy val compatJVM = compat.jvm
lazy val compatJS = compat.js

lazy val rules = project
.in(file("scalafix/rules"))
.settings(
scalaVersion := scalafixScala212,
libraryDependencies += "ch.epfl.scala" %% "scalafix-core" % scalafixVersion
)

lazy val input = project
.in(file("scalafix/input"))
.settings(
scalaVersion := scalafixScala212,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

semanticdb plugin required by scalafix is not available for 2.12.6

scalafixSourceroot := sourceDirectory.in(Compile).value
)

lazy val output = project
.in(file("scalafix/output"))
.settings(
resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/",
scalaVersion := scala213
)

lazy val outputFailure = project
.in(file("scalafix/output-failure"))
.settings(
resolvers += "scala-pr" at "https://scala-ci.typesafe.com/artifactory/scala-integration/",
scalaVersion := scala213
)

lazy val `scala-collection-compatJVM` = `scala-collection-compat`.jvm
lazy val `scala-collection-compatJS` = `scala-collection-compat`.js
lazy val tests = project
.in(file("scalafix/tests"))
.settings(
scalaVersion := scalafixScala212,
libraryDependencies += "ch.epfl.scala" % "scalafix-testkit" % scalafixVersion % Test cross CrossVersion.full,
buildInfoPackage := "fix",
buildInfoKeys := Seq[BuildInfoKey](
"inputSourceroot" ->
sourceDirectory.in(input, Compile).value,
"outputSourceroot" ->
sourceDirectory.in(output, Compile).value,
"outputFailureSourceroot" ->
sourceDirectory.in(outputFailure, Compile).value,
"inputClassdirectory" ->
classDirectory.in(input, Compile).value
),
test in Test := (test in Test).dependsOn(compile in (output, Compile)).value
)
.dependsOn(input, rules)
.enablePlugins(BuildInfoPlugin)
3 changes: 3 additions & 0 deletions project/plugins.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,6 @@ val scalaJSVersion =
addSbtPlugin("org.scala-js" % "sbt-scalajs" % scalaJSVersion)
addSbtPlugin("org.portable-scala" % "sbt-scalajs-crossproject" % "0.4.0")
addSbtPlugin("org.scala-lang.modules" % "sbt-scala-module" % "1.0.14")

addSbtPlugin("ch.epfl.scala" % "sbt-scalafix" % "0.5.10")
addSbtPlugin("com.eed3si9n" % "sbt-buildinfo" % "0.7.0")
52 changes: 0 additions & 52 deletions scalafix/build.sbt

This file was deleted.

1 change: 0 additions & 1 deletion scalafix/project/build.properties

This file was deleted.

3 changes: 0 additions & 3 deletions scalafix/project/plugins.sbt

This file was deleted.