1
0
Fork 0
mirror of https://github.com/ethauvin/kobalt-doc.git synced 2025-04-25 12:07:10 -07:00
kobalt-doc/idea-plug-in/index.html
2015-10-21 20:23:10 -07:00

147 lines
5 KiB
HTML

<html>
<head>
<title>
Kobalt, by Cedric Beust
</title>
<!-- Bootstrap core CSS -->
<link href="../bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
<!-- Optional Bootstrap Theme -->
<link href="data:text/css;charset=utf-8," data-href="../bootstrap/dist/css/bootstrap-theme.min.css" rel="stylesheet" id="bs-theme-stylesheet">
<!--[if lt IE 9]><script src="../assets/js/ie8-responsive-file-warning.js"></script><![endif]-->
<!--
<script src="../bootstrap/assets/js/ie-emulation-modes-warning.js"></script>
-->
<!-- HTML5 shim and Respond.js for IE8 support of HTML5 elements and media queries -->
<!--[if lt IE 9]>
<script src="https://oss.maxcdn.com/html5shiv/3.7.2/html5shiv.min.js"></script>
<script src="https://oss.maxcdn.com/respond/1.4.2/respond.min.js"></script>
<![endif]-->
<!-- Favicons -->
<!--
<link rel="icon" href="/favicon.ico">
-->
</head>
<body>
<div class="container">
<!-- Static navbar -->
<nav id="kobalt-navbar" class="navbar navbar-default">
</nav>
<!-- Main component for a primary marketing message or call to action -->
<div class="jumbotron">
<h1>IDEA plug-in</h1>
<p>How to install and use the Kobalt IDEA plug-in.</p>
</div>
<!-- Main content -->
<div class="col-md-9">
<h2 class="section" id="installation">Installation</h2>
<p>
Open the "Plugins" section of the IDEA preferences and find the "Kobalt" plug-in. Install it and restart IDEA. If the plug-in was correctly installed, you should see a new menu called "Kobalt" juste before the "Help" menu:
</p>
<p align="center">
<img src="../pics/kobalt-menu.png" class="img-rounded"/>
</p>
<h2 class="section" id="features">Features</h2>
<p>
The Kobalt IDEA plug-in offers the following features:
<ul>
<li>Smarter auto completion.</li>
<li>Synchronization of build files.</li>
</ul>
</p>
<h3 class="section" indent="1" id="auto-completion">Auto completion</h3>
<p>
Since Kobalt's build files are valid Kotlin files, you can leverage IDEA's auto complete feature to assist you in writing build files. There are two steps to take to enable this support:
</p>
<ul>
<li>Add the root of your project as a source directory, so that IDEA will recognize and compile your <code>Build.kt</code> file.</li>
<li>Add the latest kobalt.jar file as a dependency of your project.</li>
</ul>
<p>
Now that your <code>Build.kt</code> file is recognized by IDEA, you can use Ctrl-space to trigger auto completion whenever you need help figuring out what functions you can invoke. However, by default, IDEA will display all the Kotlin functions available within a given scope. While all these functions are valid and will produce a valid Kotlin file, you are probably going to prever Kobalt directives over regular Kotlin functions, so the Kobalt IDEA plug-in will re-order the suggestions so that Kobalt's directives appear first. Compare the next two screen shots:
</p>
<h3 class="section" indent="1" id="synchronization">Synchronization of build files</h3>
<p>
When you select the "Synchronize build file" menu item from the <code>Kobalt</code> main menu, the Kobalt IDEA plug-in will locate your <code>Build.kt</code> file and parse it. Then it will update your modules' library and dependency information to reflect all the dependencies declared in your build file.
</p>
<p>
For example, the following list of dependencies:
</p>
<pre>
dependencies {
compile("org.apache.ant:ant:1.7.0",
"junit:junit:4.10",
"org.beanshell:bsh:2.0b4",
"com.google.inject:guice:4.0:no_aop",
"com.beust:jcommander:1.48",
"org.yaml:snakeyaml:1.15")
}
</pre>
<p>
will update your project structure as follows:
</p>
<p>
The plug-in will honor other types of dependencies, such as <code>provided</code> or <code>test</code>. For example:
</p>
<pre>
dependencies {
compile("org.apache.ant:ant:1.7.0")
test("org.testng:testng:6.9.8")
provided("com.beust:jcommander:1.48")
}
</pre>
<p>
will produce the following libraries and dependencies:
</p>
<h2 class="section" id="source-code">Source code</h2>
<p>
The source code for the Kobalt IDEA plug-in <a href="http://github.com/cbeust/kobalt-idea-plugin">can be found on github</a>. The license is Apache 2.0.
</p>
</div>
<!-- Table of contents -->
<div class="col-md-3" id="table-of-contents">
</div>
<!-- Bootstrap core JavaScript
================================================== -->
<!-- Placed at the end of the document so the pages load faster -->
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="../bootstrap/dist/js/bootstrap.min.js"></script>
<script src="../js/kobalt.js"></script>
<script>generateKobalt(4);</script>
<!--
<script src="../../assets/js/docs.min.js"></script>
-->
<!-- IE10 viewport hack for Surface/desktop Windows 8 bug -->
<!--
<script src="../../assets/js/ie10-viewport-bug-workaround.js"></script>
-->
</body>