Skip to content

Commit af86dad

Browse files
author
James Santucci
committed
wip
1 parent 2db957b commit af86dad

File tree

5 files changed

+30
-31
lines changed

5 files changed

+30
-31
lines changed

build.sbt

Lines changed: 17 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,12 @@ addCommandAlias(
1212
addCommandAlias("ci-docs", ";github; mdoc; headerCreateAll")
1313
addCommandAlias("ci-publish", ";github; ci-release")
1414

15+
def scalaVersionSuffix(scalaVersion: String) = CrossVersion.partialVersion(scalaVersion) match {
16+
case Some((2, 12)) => "2.12"
17+
case Some((2, 13)) => "2.13"
18+
case s => throw new Exception("$s")
19+
}
20+
1521
lazy val V = new {
1622
val cats: String = "2.7.0"
1723
val collectioncompat: String = "2.6.0"
@@ -32,13 +38,13 @@ lazy val definitions = (project in file("definitions"))
3238
.settings(
3339
crossScalaVersions := Seq(V.scala212, V.scala),
3440
libraryDependencies ++= Seq(
35-
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
3641
"org.typelevel" %% "cats-core" % V.cats,
3742
"org.scalacheck" %% "scalacheck" % V.scalacheck,
3843
"com.github.alexarchambault" %% "scalacheck-shapeless_1.15" % V.scalacheckShapeless,
39-
"org.scalatest" %% "scalatest-core" % V.scalatest exclude ("org.scala-lang.modules", "scala-xml_2.12") exclude ("org.scala-lang.modules", "scala-xml_2.13"),
40-
"org.scalatest" %% "scalatest" % V.scalatest exclude ("org.scala-lang.modules", "scala-xml_2.12") exclude ("org.scala-lang.modules", "scala-xml_2.13")
41-
)
44+
"org.scalatest" %% "scalatest-core" % V.scalatest,
45+
"org.scalatest" %% "scalatest" % V.scalatest
46+
),
47+
dependencyOverrides += "org.scala-lang.modules" %% "scala-xml" % "2.0.1"
4248
)
4349

4450
lazy val compiler = (project in file("compiler"))
@@ -48,19 +54,19 @@ lazy val compiler = (project in file("compiler"))
4854
crossScalaVersions := Seq(V.scala212, V.scala),
4955
scalacOptions -= "-Xfatal-warnings",
5056
libraryDependencies ++= Seq(
51-
"org.scala-lang.modules" %% "scala-xml" % "1.2.0",
5257
"org.scala-exercises" %% "runtime" % V.runtime exclude ("org.scala-lang.modules", "scala-collection-compat"),
53-
"org.scala-lang" % "scala-compiler" % scalaVersion.value exclude ("org.scala-lang.modules", "scala-xml"),
58+
"org.scala-lang" % "scala-compiler" % scalaVersion.value,
5459
"org.scala-lang.modules" %% "scala-collection-compat" % V.collectioncompat,
5560
"org.typelevel" %% "cats-core" % V.cats % Compile,
5661
"org.http4s" %% "http4s-blaze-client" % V.http4s,
5762
"org.http4s" %% "http4s-circe" % V.http4s,
5863
"com.47deg" %% "github4s" % V.github4s,
59-
"org.scalariform" %% "scalariform" % V.scalariform exclude ("org.scala-lang.modules", "scala-xml"),
60-
"org.typelevel" %% "cats-laws" % V.cats % Test,
61-
"org.scalatest" %% "scalatest-core" % V.scalatest % Test exclude ("org.scala-lang.modules", "scala-xml_2.12"),
62-
"org.scalatest" %% "scalatest" % V.scalatest % Test exclude ("org.scala-lang.modules", "scala-xml_2.12")
63-
)
64+
"org.scalariform" %% "scalariform" % V.scalariform,
65+
"org.typelevel" %% "cats-laws" % V.cats % Test,
66+
"org.scalatest" %% "scalatest-core" % V.scalatest % Test,
67+
"org.scalatest" %% "scalatest" % V.scalatest % Test
68+
),
69+
dependencyOverrides += "org.scala-lang.modules" %% "scala-xml" % "2.0.1"
6470
)
6571
.dependsOn(definitions)
6672

project/build.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
sbt.version=1.6.1
1+
sbt.version=1.3.3

project/plugins.sbt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,3 +8,6 @@ addSbtPlugin("com.alejandrohdezma" % "sbt-github-header" % "0.11.2"
88
addSbtPlugin("com.alejandrohdezma" % "sbt-github-mdoc" % "0.11.2")
99
addSbtPlugin("com.alejandrohdezma" % "sbt-remove-test-from-pom" % "0.1.0")
1010
addSbtPlugin("io.github.davidgregory084" % "sbt-tpolecat" % "0.1.20")
11+
addSbtPlugin("ch.epfl.scala" % "sbt-missinglink" % "0.3.3")
12+
13+
libraryDependencies += "com.spotify" % "missinglink-core" % "0.2.5"

sbt-exercise/src/main/scala/org/scalaexercises/exercises/sbtexercise/ExerciseCompilerPlugin.scala

Lines changed: 7 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,14 @@ import java.io.PrintStream
2626
import sbt.{`package` => _, _}
2727
import sbt.Keys._
2828
import xsbt.api.Discovery
29-
import java.nio.file.Paths
3029
import cats.{`package` => _}
3130
import cats.data.Ior
3231
import cats.implicits._
3332
import sbt.internal.inc.Analysis
34-
import sbt.internal.inc.classpath.ClasspathUtil
33+
import sbt.internal.inc.classpath.ClasspathUtilities
3534
import sbtbuildinfo.BuildInfoPlugin
3635
import sbtbuildinfo.BuildInfoPlugin.autoImport._
3736
import xsbti.compile.CompileAnalysis
38-
import _root_.java.nio.file.Paths
3937

4038
/** The exercise compiler SBT auto plugin */
4139
object ExerciseCompilerPlugin extends AutoPlugin {
@@ -167,12 +165,12 @@ object ExerciseCompilerPlugin extends AutoPlugin {
167165

168166
val libraryClasspath = Attributed.data((Compile / fullClasspath).value)
169167
val classpath = (Meta.compilerClasspath ++ libraryClasspath).distinct
170-
val loader = ClasspathUtil.toLoader(
171-
classpath.map(file => Paths.get(file.getAbsolutePath())),
168+
val loader = ClasspathUtilities.toLoader(
169+
classpath,
172170
null,
173-
ClasspathUtil.createClasspathResources(
174-
appPaths = Meta.compilerClasspath.map(file => Paths.get(file.getAbsolutePath())),
175-
bootPaths = scalaInstance.value.allJars.map(file => Paths.get(file.getAbsolutePath()))
171+
ClasspathUtilities.createClasspathResources(
172+
appPaths = Meta.compilerClasspath,
173+
bootPaths = scalaInstance.value.allJars
176174
)
177175
)
178176

@@ -212,15 +210,7 @@ object ExerciseCompilerPlugin extends AutoPlugin {
212210
.flatMap(analysisIn match {
213211
case analysis: Analysis => analysis.relations.definesClass
214212
})
215-
.map { file =>
216-
(
217-
file.name(),
218-
IO.read(
219-
new File(
220-
(baseDir.getParentFile() +: file.names().tail).mkString("/")
221-
)
222-
)
223-
)
213+
.map { file => (file.getPath, IO.read(file))
224214
}
225215

226216
captureStdStreams(

sbt-exercise/src/sbt-test/sbt-exercise/basic/build.sbt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ lazy val content = (project in file("content"))
1111
Resolver.defaultLocal
1212
),
1313
libraryDependencies ++= Seq(
14-
"org.scala-exercises" %% "runtime" % "0.6.0",
14+
"org.scala-exercises" %% "runtime" % "0.7.0",
1515
"org.scala-exercises" %% "exercise-compiler" % pluginVersion changing (),
1616
"org.scala-exercises" %% "definitions" % pluginVersion changing ()
1717
)
@@ -26,7 +26,7 @@ lazy val contentInPackages = (project in file("contentinpackages"))
2626
Resolver.defaultLocal
2727
),
2828
libraryDependencies ++= Seq(
29-
"org.scala-exercises" %% "runtime" % "0.6.0",
29+
"org.scala-exercises" %% "runtime" % "0.7.0",
3030
"org.scala-exercises" %% "exercise-compiler" % pluginVersion changing (),
3131
"org.scala-exercises" %% "definitions" % pluginVersion changing ()
3232
)

0 commit comments

Comments
 (0)