mirror of
https://github.com/ethauvin/kobalt-doc.git
synced 2025-04-25 03:57:11 -07:00
Merge branch 'master' of github.com:cbeust/kobalt-doc
Conflicts: getting-started/index.html
This commit is contained in:
commit
50fea149f3
5 changed files with 21 additions and 22 deletions
|
@ -68,9 +68,8 @@ The build file is located in <code>kobalt/src/Built.kt</code> and it is a valid
|
|||
|
||||
<pre class="brush:java">
|
||||
import com.beust.kobalt.*
|
||||
import com.beust.kobalt.plugin.kotlin.kotlinProject
|
||||
|
||||
val kobalt = kotlinProject {
|
||||
val kobalt = project {
|
||||
name = "kobalt"
|
||||
group = "com.beust"
|
||||
artifactId = name
|
||||
|
@ -84,7 +83,7 @@ Here are a few noteworthy details about this small build file:
|
|||
<ul>
|
||||
<li>You have now declared a variable called <code>kobalt</code> which you can reuse further in your build file, should you ever need to.
|
||||
<li>You can specify the directory of the project if it's not in the root, which means that one build file can be used to build multiple projects.
|
||||
<li>The functions <code>kotlinProject</code> and <code>homeDir</code> are supplied by Kobalt and are referred to as "directives"
|
||||
<li>The functions <code>project</code> and <code>homeDir</code> are supplied by Kobalt and are referred to as "directives"
|
||||
</ul>
|
||||
|
||||
<p>
|
||||
|
@ -124,7 +123,7 @@ Now that we have declared a project, we can use it to configure additional steps
|
|||
<pre class="brush:java;highlight=5,6,7,8">
|
||||
import com.beust.kobalt.plugin.packaging.assemble
|
||||
|
||||
val kobalt = kotlinProject {
|
||||
val kobalt = project {
|
||||
// ...
|
||||
assemble {
|
||||
jar {
|
||||
|
@ -374,8 +373,8 @@ You can specify more than one project in a build file, simply by declaring them:
|
|||
</p>
|
||||
|
||||
<pre class="brush:java">
|
||||
val p1 = javaProject { ... }
|
||||
val p2 = kotlinProject { ... }
|
||||
val p1 = project { ... }
|
||||
val p2 = project { ... }
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
@ -383,7 +382,7 @@ If some of your projects need to be built in a certain order, you can specify de
|
|||
</p>
|
||||
|
||||
<pre class="brush:java">
|
||||
val p2 = kotlinProject(p1) { ... }
|
||||
val p2 = project(p1) { ... }
|
||||
</pre>
|
||||
|
||||
<p>
|
||||
|
@ -502,7 +501,7 @@ First of all, make sure you specified the group, artifactId and version of your
|
|||
</p>
|
||||
|
||||
<pre class="brush:java">
|
||||
val kobalt = kotlinProject {
|
||||
val kobalt = project {
|
||||
group = "com.beust"
|
||||
artifactId = "kobalt"
|
||||
version = "0.72"
|
||||
|
@ -551,7 +550,7 @@ Now, all you need to do is to upload your package:
|
|||
Then you use this variable wherever you need it in your build file:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
val p = javaProject {
|
||||
val p = project {
|
||||
name = if (experimental) "project-exp" else "project"
|
||||
version = "1.3"
|
||||
</pre>
|
||||
|
|
|
@ -109,7 +109,7 @@ import com.beust.kobalt.plugin.java.*
|
|||
import com.beust.kobalt.plugin.packaging.*
|
||||
import com.beust.kobalt.plugin.publish.*
|
||||
|
||||
val jcommander = javaProject {
|
||||
val jcommander = project {
|
||||
name = "jcommander"
|
||||
group = "com.beust"
|
||||
artifactId = name
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
<p>
|
||||
<ul>
|
||||
<li><a href="#plugin-xml"><b>kobalt-plugin.xml</b></a>. A file that describes all the components (called "plug-in actors") of your plug-in, such as contributors.</li>
|
||||
<li><a href="#directives"><b>Directives</b></a>. Kotlin functions that users of your plug-in can invoke in their build file, such as <code>kotlinProject</code> or <code>dependencies</code>. These functions typically configure some data that your plug-in will later use to perform its functions.</li>
|
||||
<li><a href="#directives"><b>Directives</b></a>. Kotlin functions that users of your plug-in can invoke in their build file, such as <code>project</code> or <code>dependencies</code>. These functions typically configure some data that your plug-in will later use to perform its functions.</li>
|
||||
<li><a href="#tasks"><b>Tasks</b></a>. These tasks are invoked from the command line and ask your plug-ins to perform certain actions.</li>
|
||||
<li><a href="#properties"><b>Properties</b></a>. Plug-ins can export properties and read properties from other plug-ins.</li>
|
||||
</ul>
|
||||
|
|
|
@ -50,10 +50,11 @@
|
|||
<h2 class="section" id="java-kotlin">Java and Kotlin</h2>
|
||||
|
||||
<p>
|
||||
The Java and Kotlin plug-ins are extremely similar, the only difference is that you configure a Java project with the <code>javaProject</code> directive and a Kotlin project with <code>kotlinProject</code>:
|
||||
Java and Kotlin are supported by default by Kobalt. You use the directive <code>project{}</code>
|
||||
to declare a new project and Kobalt will automatically detect how to compile it:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
val p = javaProject(wrapper) {
|
||||
val p = project(wrapper) {
|
||||
name = "kobalt"
|
||||
group = "com.beust"
|
||||
artifactId = name
|
||||
|
@ -61,13 +62,13 @@ val p = javaProject(wrapper) {
|
|||
}</pre>
|
||||
|
||||
<p>
|
||||
Both these directives create an object of type <code><a href="https://github.com/cbeust/kobalt/blob/master/src/main/kotlin/com/beust/kobalt/api/Project.kt">Project</code></a>.
|
||||
The <code>project{}</code> directive creates an object of type <code><a href="https://github.com/cbeust/kobalt/blob/master/src/main/kotlin/com/beust/kobalt/api/Project.kt">Project</code></a>.
|
||||
</p>
|
||||
|
||||
<h3 class="section" id="project" indent="1">Project</h3>
|
||||
|
||||
<p>
|
||||
A <code>Project</code> has two mandatory attributes: <code>name</code> and <code>version</code>. If you are planning to deploy your project to a Maven repository, you also have to specify its <code>group</code> (e.g. <code>com.beust</code>) and <code>artifactId</code> (e.g. <code>kobalt</code>).
|
||||
A <code>Project</code> has two mandatory attributes: <code>name</code> and <code>version</code>. If you are planning to deploy your project to a Maven repository, you also have to specify its <code>group</code> (e.g. <code>"com.beust"</code>) and <code>artifactId</code> (e.g. <code>"kobalt"</code>).
|
||||
</p>
|
||||
|
||||
<p>
|
||||
|
@ -86,20 +87,19 @@ A <code>Project</code> has two mandatory attributes: <code>name</code> and <code
|
|||
|
||||
<h4 class="section" id="mixed-projects" indent="2">Mixed language projects</h4>
|
||||
<p>
|
||||
A Kobalt project can have multiple languages in it (Kotlin and Java): just specify all the source
|
||||
directories you need. For example, for a <code>javaProject</code>, add <code>src/main/kotlin</code> as a
|
||||
source directory:
|
||||
A Kobalt project can mix Kotlin and Java in it, simply specify all the source
|
||||
directories you need:
|
||||
</p>
|
||||
<pre class="brush:java">
|
||||
val p = javaProject(wrapper) {
|
||||
val p = project(wrapper) {
|
||||
name = "kobalt"
|
||||
// ...
|
||||
sourceDirectories {
|
||||
path("src/main/java", "src/main/kotlin")
|
||||
}
|
||||
}</pre>
|
||||
<p>Note that source files must be in their respective directory (<code>.java</code> in
|
||||
<code>src/main/java</code> and <code>.kt</code> in <code>src/main/kotlin</code>).
|
||||
<p>
|
||||
Kotlin and Java files can be in the same directories.
|
||||
</p>
|
||||
|
||||
<h3 class="section" id="tasks" indent="1">Tasks</h3>
|
||||
|
|
|
@ -83,7 +83,7 @@ $ $KOBALT_HOME/kobaltw --init kotlin
|
|||
</p>
|
||||
|
||||
<pre class="brush:java">
|
||||
val project = kotlinProject {
|
||||
val project = project {
|
||||
name = "kobalt-line-count"
|
||||
group = "com.beust.kobalt"
|
||||
artifactId = name
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue