Skip to content

Commit

Permalink
closes #76: Add setting to skip individual projects
Browse files Browse the repository at this point in the history
  • Loading branch information
Heiko Seeberger committed Apr 16, 2012
1 parent 38ce631 commit 1421025
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 1 deletion.
Expand Up @@ -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) |@|
Expand Down Expand Up @@ -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]] =
Expand Down Expand Up @@ -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] =
Expand Down
Expand Up @@ -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
}

Expand Down
Expand Up @@ -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
)
)
}
8 changes: 8 additions & 0 deletions sbteclipse-plugin/src/sbt-test/sbteclipse/01-structure/test
Expand Up @@ -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
Expand All @@ -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.