Skip to content
Browse files

Allow user-specified XML to be inserted into facet listing

  • Loading branch information...
1 parent 3900b0f commit b65bf986d4ecfc4e8b5b2ca7a13234f2fb87052b @mdekstrand mdekstrand committed with Apr 30, 2012
View
1 src/main/scala/org/sbtidea/IdeaModuleDescriptor.scala
@@ -41,6 +41,7 @@ class IdeaModuleDescriptor(val imlDir: File, projectRoot: File, val project: Sub
</configuration>
</facet>
{ if (project.webAppPath.isDefined && userEnv.webFacet == true) webFacet() else scala.xml.Null }
+ { project.extraFacets }
</component>
<component name="NewModuleRootManager" inherit-compiler-output={env.projectOutputPath.isDefined.toString}>
{
View
5 src/main/scala/org/sbtidea/IdeaProjectDomain.scala
@@ -1,6 +1,8 @@
package org.sbtidea
import java.io.File
+import xml.NodeSeq
+
// cheating for now
import sbt.ScalaInstance
@@ -28,7 +30,8 @@ case class Directories(sources: Seq[File], resources: Seq[File], outDir: File) {
case class SubProjectInfo(baseDir: File, name: String, dependencyProjects: List[String], classpathDeps: Seq[(File, Seq[File])], compileDirs: Directories,
testDirs: Directories, libraries: Seq[IdeaModuleLibRef], scalaInstance: ScalaInstance,
- ideaGroup: Option[String], webAppPath: Option[File], basePackage: Option[String])
+ ideaGroup: Option[String], webAppPath: Option[File], basePackage: Option[String],
+ extraFacets: NodeSeq)
case class IdeaProjectInfo(baseDir: File, name: String, childProjects: List[SubProjectInfo], ideaLibs: List[IdeaLibrary])
View
8 src/main/scala/org/sbtidea/SbtIdeaPlugin.scala
@@ -9,6 +9,7 @@ import java.io.File
import collection.Seq
import SbtIdeaModuleMapping._
import java.lang.IllegalArgumentException
+import xml.NodeSeq
object SbtIdeaPlugin extends Plugin {
val ideaProjectName = SettingKey[String]("idea-project-name")
@@ -17,13 +18,15 @@ object SbtIdeaPlugin extends Plugin {
val ideaBasePackage = SettingKey[Option[String]]("idea-base-package", "The base package configured in the Scala Facet, used by IDEA to generated nested package clauses. For example, com.acme.wibble")
val ideaSourcesClassifiers = SettingKey[Seq[String]]("idea-sources-classifiers")
val ideaJavadocsClassifiers = SettingKey[Seq[String]]("idea-javadocs-classifiers")
+ val ideaExtraFacets = SettingKey[NodeSeq]("idea-extra-facets")
override lazy val settings = Seq(
Keys.commands += ideaCommand,
ideaProjectName := "IdeaProject",
ideaBasePackage := None,
ideaSourcesClassifiers := Seq("sources"),
- ideaJavadocsClassifiers := Seq("javadoc")
+ ideaJavadocsClassifiers := Seq("javadoc"),
+ ideaExtraFacets := NodeSeq.Empty
)
private val NoClassifiers = "no-classifiers"
@@ -215,11 +218,12 @@ object SbtIdeaPlugin extends Plugin {
}
)
val basePackage = setting(ideaBasePackage, "missing IDEA base package")
+ val extraFacets = settingWithDefault(ideaExtraFacets, NodeSeq.Empty)
val classpathDeps = project.dependencies.map { dep =>
(setting(Keys.classDirectory in Compile, "Missing class directory", dep.project), setting(Keys.sourceDirectories in Compile, "Missing source directory", dep.project))
}
SubProjectInfo(baseDirectory, projectName, project.uses.map(_.project).toList, classpathDeps, compileDirectories,
- testDirectories, librariesExtractor.allLibraries, scalaInstance, ideaGroup, None, basePackage)
+ testDirectories, librariesExtractor.allLibraries, scalaInstance, ideaGroup, None, basePackage, extraFacets)
}
}

0 comments on commit b65bf98

Please sign in to comment.
Something went wrong with that request. Please try again.