Skip to content

Fork in test to work around classpath issues #6

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

Merged
merged 1 commit into from
Mar 10, 2014
Merged
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
22 changes: 22 additions & 0 deletions src/main/scala/ScalaModulePlugin.scala
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ object ScalaModulePlugin extends Plugin {
// to allow compiling against snapshot versions of Scala
resolvers += Resolver.sonatypeRepo("snapshots"),

// resolvers += "scala-release-temp" at "http://private-repo.typesafe.com/typesafe/scala-release-temp/"

// don't use for doc scope, scaladoc warnings are not to be reckoned with
// TODO: turn on for nightlies, but don't enable for PR validation... "-Xfatal-warnings"
scalacOptions in compile ++= Seq("-optimize", "-feature", "-deprecation", "-unchecked", "-Xlint"),
Expand All @@ -44,6 +46,13 @@ object ScalaModulePlugin extends Plugin {
(baseDirectory.value / s"${name.value}.properties") -> s"${name.value}.properties"
},

// needed to fix classloader issues (see scala/scala-xml#20)
// essentially, the problem is that the run-time bootclasspath leaks into the compilation classpath,
// so that scalac see classes used to run it, as classes used to compile against...
// forking uses a minimal classpath, so this craziness is avoided
// alternatively, manage the scala instance as shown at the end of this file (commented)
fork in Test := true,

publishArtifact in Test := false,

// maven publishing
Expand Down Expand Up @@ -103,3 +112,16 @@ object ScalaModulePlugin extends Plugin {
// import com.typesafe.tools.mima.plugin.MimaKeys.previousArtifact
// previousArtifact := Some(organization.value %% name.value % binaryReferenceVersion.value)
}


// ALTERNATIVE to fork in test for fixing classpath issues noted above:
// manage the Scala instance ourselves to exclude the published scala-xml (scala-compiler depends on it)
// since this dependency hides the classes we're testing
// managedScalaInstance := false
//
// ivyConfigurations += Configurations.ScalaTool
//
// libraryDependencies ++= Seq(
// "org.scala-lang" % "scala-library" % scalaVersion.value,
// ("org.scala-lang" % "scala-compiler" % scalaVersion.value % "scala-tool").exclude("org.scala-lang.modules", s"scala-xml_${scalaBinaryVersion.value}")
// )