Skip to content

Commit 59e14e7

Browse files
committed
minor fixups to macro annotation testing
fix it to work on Windows (scala/scala-dev#505) or at least give better diagnostics if it doesn't also supply a missing .gitignore entry
1 parent a52482c commit 59e14e7

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -49,5 +49,6 @@
4949
/project/target/
5050
/project/project/target/
5151
/project/project/project/target/
52+
/test/macro-annot/target/
5253
/build-sbt/
5354
local.sbt

build.sbt

+9-3
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ lazy val instanceSettings = Seq[Setting[_]](
117117
Quiet.silenceScalaBinaryVersionWarning
118118
)
119119

120-
// be careful with using this instance, as it may cause performance problems (e.g., MetaSpace exhaustion)r
120+
// be careful with using this instance, as it may cause performance problems (e.g., MetaSpace exhaustion)
121121
lazy val quickInstanceSettings = Seq[Setting[_]](
122122
organization := "org.scala-lang",
123123
// we don't cross build Scala itself
@@ -129,8 +129,14 @@ lazy val quickInstanceSettings = Seq[Setting[_]](
129129
scalaInstance := {
130130
// TODO: express in terms of distDependencies?
131131
val cpElems: Seq[java.io.File] = (fullClasspath in Compile in replFrontend).value.map(_.data) ++ (fullClasspath in Compile in scaladoc).value.map(_.data)
132-
val libraryJar = cpElems.find(_.getPath.endsWith("classes/library")).get
133-
val compilerJar = cpElems.find(_.getPath.endsWith("classes/compiler")).get
132+
def findJar(name: String): java.io.File = {
133+
import java.io.File.separatorChar
134+
val target = s"classes$separatorChar$name"
135+
cpElems.find(_.getPath.endsWith(target))
136+
.getOrElse(throw new RuntimeException(
137+
s"""$target not found in:\n${cpElems.mkString("\n")}"""))
138+
}
139+
val (libraryJar, compilerJar) = (findJar("library"), findJar("compiler"))
134140
val extraJars = cpElems.filter(f => (f ne libraryJar) && (f ne compilerJar))
135141
val v = (version in Global).value
136142
new ScalaInstance(v, new URLClassLoader(cpElems.map(_.toURI.toURL).toArray[URL], null), libraryJar, compilerJar, extraJars, Some(v))

0 commit comments

Comments
 (0)