Skip to content

Commit

Permalink
Always generate classpath entries that are required for the Eclipse p…
Browse files Browse the repository at this point in the history
…roject to function properly. This is the beginning of changing the way in which we specify the classpath entries to generate so that we can add either managed sources or managed classes to the classpath as desired by the user
  • Loading branch information
Ben McCann committed Mar 31, 2015
1 parent 96293cc commit fdb6985
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 12 deletions.
Expand Up @@ -60,7 +60,6 @@ import scala.xml.transform.{ RewriteRule, RuleTransformer }
import scalaz.{ Failure, NonEmptyList, Success }
import scalaz.Scalaz._
import scalaz.effect._
import scalaz.std.tuple._

private object Eclipse extends EclipseSDTConfig {
val SettingFormat = """-([^:]*):?(.*)""".r
Expand Down Expand Up @@ -436,10 +435,10 @@ private object Eclipse extends EclipseSDTConfig {
else
scalaz.Validation.success(Nil)
List(
dirs(ValueSet(Unmanaged, Source), Keys.unmanagedSourceDirectories),
dirs(ValueSet(Unmanaged, Resource), Keys.unmanagedResourceDirectories),
dirs(ValueSet(Managed, Source), Keys.managedSourceDirectories),
dirs(ValueSet(Managed, Resource), Keys.managedResourceDirectories)
dirs(ValueSet(), Keys.unmanagedSourceDirectories),
dirs(ValueSet(), Keys.unmanagedResourceDirectories),
dirs(ValueSet(ManagedSrc), Keys.managedSourceDirectories),
dirs(ValueSet(ManagedResources), Keys.managedResourceDirectories)
) reduceLeft (_ +++ _)
}

Expand Down
Expand Up @@ -210,17 +210,26 @@ trait EclipsePlugin {

object EclipseCreateSrc extends Enumeration {

@deprecated("Always enabled", "3.1.0")
val Unmanaged = Value

@deprecated("Use ManagedSrc and ManagedResources", "3.1.0")
val Managed = Value

@deprecated("Always enabled", "3.1.0")
val Source = Value

@deprecated("Always enabled", "3.1.0")
val Resource = Value

val Default = ValueSet(Unmanaged, Source, Resource)
val ManagedSrc = Value

val All = ValueSet(Unmanaged, Managed, Source, Resource)
val ManagedResources = Value

val Default = ValueSet(ManagedSrc, ManagedResources)

@deprecated("Does nothing. Uses default values", "3.1.0")
val All = Default
}

object EclipseProjectFlavor extends Enumeration {
Expand Down
Expand Up @@ -135,8 +135,8 @@ TaskKey[Unit]("verify-classpath-xml-suba") <<= baseDirectory map { dir =>
error("""Not expected .classpath of suba project to contain <classpathentry kind="..." path="...src_managed/main" output="..." />: %s """ format classpath)
if ((classpath \ "classpathentry" \\ "@path") map (_.text) contains "target/scala-2.10/src_managed/test")
error("""Not expected .classpath of suba project to contain <classpathentry kind="..." path="...src_managed/test" output="..." />: %s """ format classpath)
if ((classpath \ "classpathentry" \\ "@path") map (_.text) contains "src/main/scala")
error("""Not expected .classpath of suba project to contain <classpathentry kind="..." path="src/main/scala" output="..." />: %s """ format classpath)
if (!(classpath.child contains <classpathentry kind="src" path="src/main/scala" />))
error("""Expected .classpath of suba project to contain <classpathentry kind="..." path="src/main/scala" />: %s """ format classpath)
if ((classpath \ "classpathentry" \\ "@path") map (_.text) contains "src/main/java")
error("""Not expected .classpath of suba project to contain <classpathentry kind="..." path="src/main/java" output="..." />: %s """ format classpath)
if ((classpath \ "classpathentry" \\ "@path") map (_.text) contains "src/main/resources")
Expand Down
Expand Up @@ -44,7 +44,6 @@ object Build extends Build {
"biz.aQute" % "bndlib" % "1.50.0",
"org.specs2" %% "specs2" % "2.1.1" % "test"
),
EclipseKeys.createSrc := EclipseCreateSrc.ValueSet(EclipseCreateSrc.Managed, EclipseCreateSrc.Resource),
EclipseKeys.createSrc in Test := EclipseCreateSrc.ValueSet.empty,
EclipseKeys.withSource := true
)
Expand Down
Expand Up @@ -13,8 +13,6 @@ seq(ProtobufPlugin.protobufSettings: _*)

seq(Twirl.settings: _*)

EclipseKeys.createSrc := EclipseCreateSrc.All

TaskKey[Unit]("verify-valid") <<= baseDirectory map { dir =>
val classpath = XML.loadFile(dir / ".classpath")
val srcManaged = """^target/scala-([0-9.]+)/src_managed/main$""".r
Expand Down

0 comments on commit fdb6985

Please sign in to comment.