@@ -4,17 +4,7 @@ import sbt.ScriptedPlugin._
44import Dependencies ._
55organization in ThisBuild := " ch.epfl.scala"
66
7- lazy val crossVersions = Seq (
8- " 2.11.8" ,
9- " 2.12.1"
10- )
11-
12- lazy val buildSettings = Seq (
13- )
14-
15- lazy val jvmOptions = Seq (
16- " -Xss4m"
17- )
7+ lazy val crossVersions = Seq (scala211, scala212)
188
199lazy val compilerOptions = Seq (
2010 " -deprecation" ,
@@ -43,13 +33,13 @@ commands += Command.command("release") { s =>
4333
4434commands += Command .command(" ci-fast" ) { s =>
4535 " clean" ::
46- " testQuick" ::
36+ s " plz $ciScalaVersion testQuick" ::
4737 s
4838}
4939
5040commands += Command .command(" ci-slow" ) { s =>
5141 " very publishLocal" ::
52- " wow 2.11.8 scalafix-tests/test" ::
42+ s " wow ${ciScalaVersion.get} scalafix-tests/test " ::
5343 " very scalafix-sbt/scripted" ::
5444 s
5545}
@@ -97,6 +87,8 @@ lazy val buildInfoSettings: Seq[Def.Setting[_]] = Seq(
9787 " stableVersion" -> " 0.3.1" ,
9888 " scalameta" -> scalametaV,
9989 scalaVersion,
90+ " scala211" -> scala211,
91+ " scala212" -> scala212,
10092 sbtVersion
10193 ),
10294 buildInfoPackage := " scalafix" ,
@@ -112,40 +104,22 @@ lazy val allSettings = List(
112104 libraryDependencies += scalatest % Test ,
113105 testOptions in Test += Tests .Argument (" -oD" ),
114106 assemblyJarName in assembly := " scalafix.jar" ,
115- scalaVersion := sys.env. getOrElse(" SCALA_VERSION " , " 2.11.8 " ),
107+ scalaVersion := ciScalaVersion. getOrElse(scala211 ),
116108 crossScalaVersions := crossVersions,
117109 updateOptions := updateOptions.value.withCachedResolution(true )
118110) ++ publishSettings
119111
120- lazy val `scalafix-root` = project
121- .in(file(" ." ))
122- .settings(
123- moduleName := " scalafix" ,
124- allSettings,
125- noPublish,
126- gitPushTag := {
127- val tag = s " v ${version.value}"
128- assert(! tag.endsWith(" SNAPSHOT" ))
129- import sys .process ._
130- Seq (" git" , " tag" , " -a" , tag, " -m" , tag).!!
131- Seq (" git" , " push" , " --tags" ).!!
132- },
133- initialCommands in console :=
134- """
135- |import scala.meta._
136- |import scalafix._
137- """ .stripMargin
138- )
139- .aggregate(
140- `scalafix-nsc`,
141- `scalafix-tests`,
142- `scalafix-testutils`,
143- core,
144- cli,
145- readme,
146- `scalafix-sbt`
147- )
148- .dependsOn(core)
112+ allSettings
113+
114+ noPublish
115+
116+ gitPushTag := {
117+ val tag = s " v ${version.value}"
118+ assert(! tag.endsWith(" SNAPSHOT" ))
119+ import sys .process ._
120+ Seq (" git" , " tag" , " -a" , tag, " -m" , tag).!!
121+ Seq (" git" , " push" , " --tags" ).!!
122+ }
149123
150124// settings to projects using @metaconfig.ConfigReader annotation.
151125lazy val metaconfigSettings : Seq [Def .Setting [_]] = Seq (
@@ -161,14 +135,15 @@ lazy val core = project
161135 allSettings,
162136 buildInfoSettings,
163137 metaconfigSettings,
138+ isFullCrossVersion,
164139 moduleName := " scalafix-core" ,
165140 dependencyOverrides += scalameta,
166141 libraryDependencies ++= Seq (
167142 " com.typesafe" % " config" % " 1.3.1" ,
168143 " com.lihaoyi" %% " sourcecode" % " 0.1.3" ,
169144 metaconfig,
170145 scalameta,
171- scalahost(scalaVersion.value) ,
146+ scalahost,
172147 " org.scala-lang" % " scala-reflect" % scalaVersion.value
173148 )
174149 )
@@ -178,9 +153,10 @@ lazy val core = project
178153lazy val `scalafix-nsc` = project
179154 .settings(
180155 allSettings,
156+ isFullCrossVersion,
181157 libraryDependencies ++= Seq (
182158 " org.scala-lang" % " scala-compiler" % scalaVersion.value,
183- scalahostNsc(scalaVersion.value) ,
159+ scalahostNsc,
184160 ammonite % Test ,
185161 // integration property tests
186162 " org.typelevel" %% " catalysts-platform" % " 0.0.5" % Test ,
@@ -228,28 +204,28 @@ lazy val `scalafix-nsc` = project
228204lazy val cli = project
229205 .settings(
230206 allSettings,
231- packSettings,
232- libraryDependencies ++= Seq (
233- // NB: The Mirror has an undeclared dependency on the scalahost-nsc package.
234- scalahostNsc(scalaVersion.value)
235- ),
207+ isFullCrossVersion,
236208 moduleName := " scalafix-cli" ,
237- packJvmOpts := Map (
238- " scalafix " -> jvmOptions ,
239- " scalafix_ng_server " -> jvmOptions
240- ) ,
209+ fork.in( Test , test) := true ,
210+ baseDirectory.in(test) := file( " . " ) ,
211+ javaOptions.in(test) +=
212+ s " -Dscalafix.scalahost.pluginpath= ${scalahostNscPluginPath.value} " ,
241213 mainClass in assembly := Some (" scalafix.cli.Cli" ),
242- packMain := Map (
243- " scalafix" -> " scalafix.cli.Cli" ,
244- " scalafix_ng_server" -> " com.martiansoftware.nailgun.NGServer"
245- ),
246214 libraryDependencies ++= Seq (
247215 " com.github.scopt" %% " scopt" % " 3.5.0" ,
248216 " com.github.alexarchambault" %% " case-app" % " 1.1.3" ,
249217 " com.martiansoftware" % " nailgun-server" % " 0.9.1"
250218 )
251219 )
252220 .dependsOn(core, `scalafix-testutils` % Test )
221+ lazy val fatcli = project
222+ .settings(
223+ allSettings,
224+ isFullCrossVersion,
225+ moduleName := " scalafix-fatcli" ,
226+ libraryDependencies += scalahostNsc
227+ )
228+ .dependsOn(cli)
253229
254230lazy val publishedArtifacts = Seq (
255231 publishLocal in `scalafix-nsc`,
@@ -264,8 +240,20 @@ lazy val `scalafix-sbt` = project
264240 sbtPlugin := true ,
265241 // Doesn't work because we need to publish 2.11 and 2.12.
266242// scripted := scripted.dependsOn(publishedArtifacts: _*).evaluated,
267- scalaVersion := " 2.10.6" ,
268- crossScalaVersions := Seq (" 2.10.6" ),
243+ testQuick := {
244+ RunSbtCommand (
245+ s " ; very publishLocal " +
246+ " ; very scalafix-sbt/scripted sbt-scalafix/config"
247+ )(state.value)
248+ },
249+ test := {
250+ RunSbtCommand (
251+ " ; very publishLocal " +
252+ " ; very scalafix-sbt/scripted"
253+ )(state.value)
254+ },
255+ scalaVersion := scala210,
256+ crossScalaVersions := Seq (scala210),
269257 moduleName := " sbt-scalafix" ,
270258 scriptedLaunchOpts ++= Seq (
271259 " -Dplugin.version=" + version.value,
@@ -290,7 +278,7 @@ lazy val `scalafix-tests` = project
290278 .settings(
291279 allSettings,
292280 noPublish,
293- testQuick := {},
281+ testQuick := {}, // these tests are slow.
294282 parallelExecution in Test := true ,
295283 libraryDependencies ++= Seq (
296284 ammonite
@@ -344,3 +332,33 @@ def exposePaths(projectName: String,
344332 }
345333 )
346334}
335+
336+ lazy val isFullCrossVersion = Seq (
337+ crossVersion := CrossVersion .full
338+ )
339+
340+ lazy val scalahostNscPluginPath = Def .task {
341+ val files = update
342+ .in(dummyScalahostProject)
343+ .value
344+ .allFiles
345+ val path = files.find { file =>
346+ val path = file.getAbsolutePath
347+ path.endsWith(s " scalahost-nsc_ ${scalaVersion.value}.jar " )
348+ }.get
349+ path.getAbsolutePath
350+ }
351+
352+ // sbt makes it hard to do simple stuff like get the jar of a dependency.
353+ lazy val dummyScalahostProject = project
354+ .in(file(" target/dummy" ))
355+ .settings(
356+ allSettings,
357+ description := " Just a project that has scalahost-nsc on the classpath." ,
358+ libraryDependencies += scalahostNsc
359+ )
360+
361+ lazy val ciScalaVersion = sys.env.get(" CI_SCALA_VERSION" )
362+ lazy val scala210 = " 2.10.6"
363+ lazy val scala211 = " 2.11.8"
364+ lazy val scala212 = " 2.12.1"
0 commit comments