aboutsummaryrefslogtreecommitdiff
path: root/stage2
diff options
context:
space:
mode:
authorJan Christopher Vogt <oss.nsp@cvogt.org>2017-04-06 10:56:42 -0400
committerGitHub <noreply@github.com>2017-04-06 10:56:42 -0400
commit16ac805f1a3669b3bcca160e523e3d8cf4c7cc2b (patch)
tree686727fc21107b7ea66f1f7efa883e32994dfbb1 /stage2
parent2f6aaac52ac0b6afabf83ed8bd75cf5ea72ee78f (diff)
parent34f3d10608d6f11deb90979066d69d31b7a8fe4f (diff)
downloadcbt-16ac805f1a3669b3bcca160e523e3d8cf4c7cc2b.tar.gz
cbt-16ac805f1a3669b3bcca160e523e3d8cf4c7cc2b.tar.bz2
cbt-16ac805f1a3669b3bcca160e523e3d8cf4c7cc2b.zip
Merge pull request #416 from cvogt/idea-plugin
Add IntelliJ IDEA project generator plugin
Diffstat (limited to 'stage2')
-rw-r--r--stage2/plugins/IntelliJ.scala70
1 files changed, 70 insertions, 0 deletions
diff --git a/stage2/plugins/IntelliJ.scala b/stage2/plugins/IntelliJ.scala
new file mode 100644
index 0000000..c41ea51
--- /dev/null
+++ b/stage2/plugins/IntelliJ.scala
@@ -0,0 +1,70 @@
+package cbt
+
+import java.io.{ File, FileWriter }
+
+trait IntelliJ extends BaseBuild {
+ private // this plugin is not functional right now, needs fixing
+ def intellij = {
+ lib.writeIfChanged(
+ projectDirectory / name ++ ".iml",
+ IntelliJ.iml(
+ scalaVersion,
+ transitiveDependencies
+ )
+ )
+ }
+}
+
+// TODO:
+// - projects, their builds, their build builds, etc should be represented individually
+// ideally with cbt's main sources being editable, but not the sources of other cbt versions
+object IntelliJ {
+ def iml(
+ scalaVersion: String,
+ transitiveDependencies: Seq[Dependency]
+ ): String = {
+ """<?xml version="1.0" encoding="UTF-8"?>""" ++ "\n" ++
+// format: OFF
+<module type="JAVA_MODULE" version="4">
+ <component name="NewModuleRootManager" inherit-compiler-output="true">
+ <exclude-output/>
+ <content url="file://$MODULE_DIR$/../cbt/compatibility">
+ <sourceFolder url="file://$MODULE_DIR$/../cbt/compatibility" isTestSource="false"/>
+ <excludeFolder url="file://$MODULE_DIR$/../cbt/compatibility/target/scala-2.11"/>
+ </content>
+ <content url="file://$MODULE_DIR$/../cbt/nailgun_launcher">
+ <sourceFolder url="file://$MODULE_DIR$/../cbt/nailgun_launcher" isTestSource="false"/>
+ <excludeFolder url="file://$MODULE_DIR$/../cbt/nailgun_launcher/target"/>
+ </content>
+ <content url="file://$MODULE_DIR$/../cbt/stage1">
+ <sourceFolder url="file://$MODULE_DIR$/../cbt/stage1" isTestSource="false"/>
+ <excludeFolder url="file://$MODULE_DIR$/../cbt/stage1/target/scala-2.11"/>
+ </content>
+ <content url="file://$MODULE_DIR$/../cbt/stage2">
+ <sourceFolder url="file://$MODULE_DIR$/../cbt/stage2" isTestSource="false"/>
+ <excludeFolder url="file://$MODULE_DIR$/../cbt/stage2/target/scala-2.11"/>
+ </content>
+ <content url="file://$MODULE_DIR$">
+ <sourceFolder url="file://$MODULE_DIR$/src/main/scala/main" isTestSource="false"/>
+ <sourceFolder url="file://$MODULE_DIR$/src/test/scala" isTestSource="false"/>
+ </content>
+ <orderEntry type="inheritedJdk"/>
+ <orderEntry type="sourceFolder" forTests="false"/>
+ <orderEntry type="library" name="scala-sdk-{scalaVersion}" level="application"/>
+ {
+ transitiveDependencies.flatMap( _.exportedClasspath.files ).map( _.string ).map { cp =>
+ <orderEntry type="module-library">
+ <library>
+ <CLASSES>
+ <root url={ if ( cp.endsWith( ".jar" ) ) s"jar://$cp!/" else s"file://$cp/" }/>
+ </CLASSES>
+ <JAVADOC/>
+ <SOURCES/>
+ </library>
+ </orderEntry>
+ }
+ }
+ </component>
+</module>.buildString( stripComments = false ) // format: ON
+ }
+}