Permalink
Browse files

closes #76: Add setting to skip individual projects

  • Loading branch information...
1 parent 38ce631 commit 1421025d451e5fbbab0297cdcd713c61dbf84a82 Heiko Seeberger committed Apr 16, 2012
@@ -104,7 +104,7 @@ private object Eclipse {
state: State): Validation[IO[Seq[String]]] = {
val effects = for {
ref <- structure(state).allProjectRefs
- project <- Project.getProject(ref, structure(state)) if project.aggregate.isEmpty || !skipParents
+ project <- Project.getProject(ref, structure(state)) if !skip(ref, project, skipParents, state)
} yield {
val configs = configurations(ref, state)
val applic = classpathEntryTransformerFactory(ref, state).createTransformer(ref, state) |@|
@@ -150,6 +150,9 @@ private object Eclipse {
state
}
+ def skip(ref: ProjectRef, project: ResolvedProject, skipParents: Boolean, state: State): Boolean =
+ skip(ref, state) || (skipParents && !project.aggregate.isEmpty)
+
def mapConfigurations[A](
configurations: Seq[Configuration],
f: Configuration => Validation[Seq[A]]): Validation[Seq[A]] =
@@ -446,6 +449,9 @@ private object Eclipse {
def relativizeLibs(ref: ProjectRef, state: State): Boolean =
setting(EclipseKeys.relativizeLibs in ref, state).fold(_ => true, id)
+ def skip(ref: ProjectRef, state: State): Boolean =
+ setting(EclipseKeys.skipProject in ref, state).fold(_ => false, id)
+
// IO
def saveXml(file: File, xml: Node): IO[Unit] =
@@ -111,6 +111,11 @@ trait EclipsePlugin {
"Relativize the paths to the libraries?"
)
+ val skipProject: SettingKey[Boolean] = SettingKey(
+ prefix("skipProject"),
+ "Skip creating Eclipse files for a given project?"
+ )
+
private def prefix(key: String) = "eclipse-" + key
}
@@ -40,4 +40,12 @@ object Build extends Build {
),
dependencies = Seq(suba, suba % "test->test")
)
+
+ lazy val subc = Project(
+ "subc",
+ new File("sub/subc"),
+ settings = Project.defaultSettings ++ Seq(
+ EclipseKeys.skipProject := true
+ )
+ )
}
@@ -19,6 +19,10 @@ $ exists sub/subb/.classpath
$ exists sub/subb/.project
$ exists sub/subb/.settings/org.scala-ide.sdt.core.prefs
$ exists sub/subb/touch-pre-task
+$ absent sub/subc/.classpath
+$ absent sub/subc/.project
+$ absent sub/subc/.settings
+$ absent sub/subc/touch-pre-task
# skip-parents=false
$ exec find . -path "*.classpath*" -delete
@@ -40,3 +44,7 @@ $ exists sub/subb/.classpath
$ exists sub/subb/.project
$ exists sub/subb/.settings/org.scala-ide.sdt.core.prefs
$ exists sub/subb/touch-pre-task
+$ absent sub/subc/.classpath
+$ absent sub/subc/.project
+$ absent sub/subc/.settings
+$ absent sub/subc/touch-pre-task

0 comments on commit 1421025

Please sign in to comment.