diff options
author | Christopher Vogt <oss.nsp@cvogt.org> | 2017-04-06 01:24:27 +0000 |
---|---|---|
committer | Christopher Vogt <oss.nsp@cvogt.org> | 2017-04-06 01:24:27 +0000 |
commit | 34f3d10608d6f11deb90979066d69d31b7a8fe4f (patch) | |
tree | 087596ae13c334b22e713a8b2d0788f2543680f6 /stage2/plugins/IntelliJ.scala | |
parent | 9bfe739adc62ba073342f78a64e24c18e12d4792 (diff) | |
download | cbt-34f3d10608d6f11deb90979066d69d31b7a8fe4f.tar.gz cbt-34f3d10608d6f11deb90979066d69d31b7a8fe4f.tar.bz2 cbt-34f3d10608d6f11deb90979066d69d31b7a8fe4f.zip |
change IntelliJ plugin draft to follow now recommend plugin style
Diffstat (limited to 'stage2/plugins/IntelliJ.scala')
-rw-r--r-- | stage2/plugins/IntelliJ.scala | 70 |
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 + } +} |