Skip to content

Commit

Permalink
Add support for ideOutputDirectory setting
Browse files Browse the repository at this point in the history
Also bump version to 4.3.1
  • Loading branch information
Nikolay Obedin committed Oct 23, 2015
1 parent 767b490 commit 334329a
Show file tree
Hide file tree
Showing 7 changed files with 323 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def newProject(projectName: String): Project =
.settings(
name := "sbt-structure-" + projectName,
organization := "org.jetbrains",
version := "4.3.0",
version := "4.3.1",
licenses += ("Apache-2.0", url("http://www.apache.org/licenses/LICENSE-2.0.html")),
unmanagedSourceDirectories in Compile += baseDirectory.value.getParentFile / "shared" / "src" / "main" / "scala",
publishMavenStyle := false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ProjectExtractor(implicit projectRef: ProjectRef) extends Extractor with C
}

private def extractConfiguration(configuration: sbt.Configuration)(implicit state: State): Option[ConfigurationData] =
projectSetting(Keys.classDirectory.in(configuration)).map { output =>
projectSetting(Keys.classDirectory.in(configuration)).map { sbtOutput =>
val sources = {
val managed = projectSetting(Keys.managedSourceDirectories.in(configuration)).getOrElse(Seq.empty)
val unmanaged = projectSetting(Keys.unmanagedSourceDirectories.in(configuration)).getOrElse(Seq.empty)
Expand All @@ -55,6 +55,9 @@ class ProjectExtractor(implicit projectRef: ProjectRef) extends Extractor with C
projectSetting(SettingKeys.ideExcludedDirectories.in(configuration)).getOrElse(Seq.empty) ++
projectSetting(SettingKeys.sbtIdeaExcludeFolders.in(configuration)).map(_.map(file)).getOrElse(Seq.empty)

val output =
projectSetting(SettingKeys.ideOutputDirectory.in(configuration)).flatten.getOrElse(sbtOutput)

ConfigurationData(mapConfiguration(configuration).name, sources, resources, excludes, output)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ object SettingKeys {
val ideBasePackages = SettingKey[Seq[String]]("ide-base-packages")
val ideExcludedDirectories = SettingKey[Seq[File]]("ide-excluded-directories")
val ideSkipProject = SettingKey[Boolean]("ide-skip-project")
val ideOutputDirectory = SettingKey[Option[File]]("ide-output-directory")

val sbtIdeaBasePackage = SettingKey[Option[String]]("idea-base-package")
val sbtIdeaExcludeFolders = SettingKey[Seq[String]]("idea-exclude-folders")
Expand Down
5 changes: 5 additions & 0 deletions extractor/src/test/data/0.13/ide-settings/project/Build.scala
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,9 @@ object MyBuild extends Build {
)

lazy val projectToSkip = project.in(file("skip")).settings(ideSkipProject := true)

lazy val projectToRedirectOutput = project.in(file("redirectOutput")).settings(
ideOutputDirectory := Some(target.value / "idea-classes"),
ideOutputDirectory in Test := Some(target.value / "idea-test-classes")
)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
resolvers += Resolver.url("jetbrains-bintray",
url("http://dl.bintray.com/jetbrains/sbt-plugins/"))(Resolver.ivyStylePatterns)

addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "0.1.1")
addSbtPlugin("org.jetbrains" % "sbt-ide-settings" % "0.1.2")
155 changes: 153 additions & 2 deletions extractor/src/test/data/0.13/ide-settings/structure-0.13.7.xml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
<import>
import _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin, _root_.sbtide.ConfigPlugin
</import>
<classes>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/jars/sbt-ide-settings-0.1.1.jar</classes>
<classes>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/jars/sbt-ide-settings-0.1.2.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/jansi.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/jline.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/scala-compiler.jar</classes>
Expand Down Expand Up @@ -119,7 +119,7 @@
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_8_2/srcs/precompiled-2_8_2-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_9_2/srcs/precompiled-2_9_2-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_9_3/srcs/precompiled-2_9_3-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/srcs/sbt-ide-settings-0.1.1-sources.jar</sources>
<sources>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/srcs/sbt-ide-settings-0.1.2-sources.jar</sources>
</build>
<java>
<home>$BASE/some/home</home>
Expand Down Expand Up @@ -157,11 +157,162 @@
</dependencies>
<resolver name="public" root="https://repo1.maven.org/maven2/"/>
</project>
<project>
<id>projectToRedirectOutput</id>
<name>projectToRedirectOutput</name>
<organization>projecttoredirectoutput</organization>
<version>0.1-SNAPSHOT</version>
<base>$BASE/redirectOutput</base>
<target>$BASE/redirectOutput/target</target>
<build>
<import>import sbt._, Keys._, dsl._</import>
<import>import MyBuild._</import>
<import>import _root_.sbtide.ConfigPlugin.autoImport._</import>
<import>
import _root_.sbt.plugins.IvyPlugin, _root_.sbt.plugins.JvmPlugin, _root_.sbt.plugins.CorePlugin, _root_.sbt.plugins.JUnitXmlReportPlugin, _root_.sbtide.ConfigPlugin
</import>
<classes>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/jars/sbt-ide-settings-0.1.2.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/jansi.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/jline.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/scala-compiler.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/scala-library.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/lib/scala-reflect.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/actions-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/api-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/apply-macro-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/cache-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/classfile-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/classpath-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/collections-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/command-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/compile-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/compiler-integration-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/compiler-ivy-integration-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/completion-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/control-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/cross-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/incremental-compiler-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/io-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/ivy-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/ivy-2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/jawn-parser_2.10-0.6.0.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/jline-2.11.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/jsch-0.1.46.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/json4s-ast_2.10-3.2.10.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/json4s-core_2.10-3.2.10.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/json4s-native_2.10-3.2.10.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/json4s-support_2.10-0.6.0.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/launcher-interface-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/logging-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/logic-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/main-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/main-settings-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/paranamer-2.6.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/persist-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/process-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/relation-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/run-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/sbinary_2.10-0.4.2.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/sbt-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/scala-reflect-2.10.4.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/scalap-2.10.0.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/task-system-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/tasks-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/test-agent-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/test-interface-1.0.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/testing-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/tracking-0.13.7.jar</classes>
<classes>~/.sbt/boot/scala-2.10.4/org.scala-sbt/sbt/0.13.7/xsbti/interface-0.13.7.jar</classes>
<sources>~/.ivy2/cache/org.scala-sbt/sbt/srcs/sbt-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-lang/scala-library/srcs/scala-library-2.10.4-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/main/srcs/main-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/actions/srcs/actions-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/classpath/srcs/classpath-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-lang/scala-compiler/srcs/scala-compiler-2.10.4-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-lang/scala-reflect/srcs/scala-reflect-2.10.4-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/launcher-interface/srcs/launcher-interface-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/interface/srcs/interface-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/io/srcs/io-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/control/srcs/control-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/completion/srcs/completion-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/collections/srcs/collections-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/jline/jline/srcs/jline-2.11-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/api/srcs/api-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/compiler-integration/srcs/compiler-integration-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/incremental-compiler/srcs/incremental-compiler-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/logging/srcs/logging-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/process/srcs/process-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/relation/srcs/relation-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/compile/srcs/compile-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/persist/srcs/persist-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-tools.sbinary/sbinary_2.10/srcs/sbinary_2.10-0.4.2-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/classfile/srcs/classfile-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/compiler-ivy-integration/srcs/compiler-ivy-integration-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/ivy/srcs/ivy-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/cross/srcs/cross-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt.ivy/ivy/srcs/ivy-2.3.0-sbt-fccfbd44c9f64523b61398a0155784dcbaeae28f-sources.jar</sources>
<sources>~/.ivy2/cache/com.jcraft/jsch/srcs/jsch-0.1.46-sources.jar</sources>
<sources>~/.ivy2/cache/org.json4s/json4s-native_2.10/srcs/json4s-native_2.10-3.2.10-sources.jar</sources>
<sources>~/.ivy2/cache/org.json4s/json4s-core_2.10/srcs/json4s-core_2.10-3.2.10-sources.jar</sources>
<sources>~/.ivy2/cache/org.json4s/json4s-ast_2.10/srcs/json4s-ast_2.10-3.2.10-sources.jar</sources>
<sources>~/.ivy2/cache/com.thoughtworks.paranamer/paranamer/srcs/paranamer-2.6-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-lang/scalap/srcs/scalap-2.10.0-sources.jar</sources>
<sources>~/.ivy2/cache/org.spire-math/jawn-parser_2.10/srcs/jawn-parser_2.10-0.6.0-sources.jar</sources>
<sources>~/.ivy2/cache/org.spire-math/json4s-support_2.10/srcs/json4s-support_2.10-0.6.0-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/run/srcs/run-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/task-system/srcs/task-system-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/tasks/srcs/tasks-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/tracking/srcs/tracking-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/cache/srcs/cache-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/testing/srcs/testing-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/test-agent/srcs/test-agent-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/test-interface/srcs/test-interface-1.0-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/main-settings/srcs/main-settings-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/apply-macro/srcs/apply-macro-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/command/srcs/command-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/logic/srcs/logic-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_8_2/srcs/precompiled-2_8_2-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_9_2/srcs/precompiled-2_9_2-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/org.scala-sbt/precompiled-2_9_3/srcs/precompiled-2_9_3-0.13.7-sources.jar</sources>
<sources>~/.ivy2/cache/scala_2.10/sbt_0.13/org.jetbrains/sbt-ide-settings/srcs/sbt-ide-settings-0.1.2-sources.jar</sources>
</build>
<scala>
<version>2.10.4</version>
<library>~/.sbt/boot/scala-2.10.4/lib/scala-library.jar</library>
<compiler>~/.sbt/boot/scala-2.10.4/lib/scala-compiler.jar</compiler>
<extra>~/.sbt/boot/scala-2.10.4/lib/scala-reflect.jar</extra>
</scala>
<configuration id="compile">
<sources>$BASE/redirectOutput/src/main/java</sources>
<sources>$BASE/redirectOutput/src/main/scala</sources>
<sources managed="true">$BASE/redirectOutput/target/scala-2.10/src_managed/main</sources>
<resources>$BASE/redirectOutput/src/main/resources</resources>
<resources managed="true">$BASE/redirectOutput/target/scala-2.10/resource_managed/main</resources>
<classes>$BASE/redirectOutput/target/idea-classes</classes>
</configuration>
<configuration id="test">
<sources>$BASE/redirectOutput/src/test/java</sources>
<sources>$BASE/redirectOutput/src/test/scala</sources>
<sources managed="true">$BASE/redirectOutput/target/scala-2.10/src_managed/test</sources>
<resources>$BASE/redirectOutput/src/test/resources</resources>
<resources managed="true">$BASE/redirectOutput/target/scala-2.10/resource_managed/test</resources>
<classes>$BASE/redirectOutput/target/idea-test-classes</classes>
</configuration>
<dependencies>
<module configurations="compile" organization="org.scala-lang" name="scala-library" revision="2.10.4" artifactType="jar" classifier=""/>
</dependencies>
<resolver name="public" root="https://repo1.maven.org/maven2/"/>
</project>
<repository>
<module organization="org.scala-lang" name="scala-library" revision="2.10.1" artifactType="jar" classifier="">
<jar>~/.ivy2/cache/org.scala-lang/scala-library/jars/scala-library-2.10.1.jar</jar>
<doc>~/.ivy2/cache/org.scala-lang/scala-library/docs/scala-library-2.10.1-javadoc.jar</doc>
<src>~/.ivy2/cache/org.scala-lang/scala-library/srcs/scala-library-2.10.1-sources.jar</src>
</module>
<module organization="org.scala-lang" name="scala-library" revision="2.10.4" artifactType="jar" classifier="">
<jar>~/.sbt/boot/scala-2.10.4/lib/scala-library.jar</jar>
<doc>~/.ivy2/cache/org.scala-lang/scala-library/docs/scala-library-2.10.4-javadoc.jar</doc>
<src>~/.ivy2/cache/org.scala-lang/scala-library/srcs/scala-library-2.10.4-sources.jar</src>
</module>
</repository>
</structure>
Loading

0 comments on commit 334329a

Please sign in to comment.