From 7ad0fa6db1e54d6bdd8de07f6cebe60fedd77595 Mon Sep 17 00:00:00 2001 From: Cedric Beust Date: Thu, 8 Oct 2015 07:03:41 -0700 Subject: [PATCH] Plug-ins doc. --- js/kobalt.js | 4 + plug-in/index.html | 2 +- plugins/index.html | 212 +++++++++++++++++++++++++++++++++++++++++++++ template | 75 ++++++---------- 4 files changed, 242 insertions(+), 51 deletions(-) create mode 100644 plugins/index.html diff --git a/js/kobalt.js b/js/kobalt.js index 39faa8a..e70a3cc 100644 --- a/js/kobalt.js +++ b/js/kobalt.js @@ -11,6 +11,10 @@ var content = [ url: "../documentation/index.html", title: "Documentation" }, + { + url: "../plugins/index.html", + title: "Plug-ins" + }, { url: "../plug-in/index.html", title: "A plug-in in 10mn" diff --git a/plug-in/index.html b/plug-in/index.html index d278c3d..dbef3a7 100644 --- a/plug-in/index.html +++ b/plug-in/index.html @@ -240,7 +240,7 @@ And that's it! You can now iterate on your plug-in and upload it with additional - + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + + + +
+

Plug-ins

+

Kobalt ships with a number of plug-ins that are available to use right away.

+ +
+ + +
+ +

Java and Kotlin

+ +

+The Java and Kotlin plug-ins are extremely similar, the only difference is that you configure a Java project with the javaProject directive and a Kotlin project with kotlinProject: +

+ +
+val p = javaProject(wrapper) {
+  name = "kobalt"
+  group = "com.beust"
+  artifactId = name
+  version = "0.1"
+}
+
+ +

+Both these directives allow you to consider an object of type Project. +

+ +

Project

+ +

+A Project has two mandatory attributes: name and version. If you are planning to deploy your project to a Maven repository, you also have to specify its group (e.g. com.beust) and artifactId (e.g. kobalt). +

+ +

+ Additionally, a Project lets you specify the following parameters: + +

+
sourceDirectories
+
The location of your source files
+
sourceDirectoriesTest
+
The location of your test source files
+
dependencies
+
The dependencies for your project
+
dependenciesTest
+
The dependencies for your tests
+
+ +

Tasks

+

+Once you have at least one project configured, the plug-in lets you invoke the following tasks: +

+
compile
+
Compile the project
+
compileTest
+
Compile the tests
+
test
+
Run the tests
+
clean
+
Clean the project
+
+ +

Packaging

+ +

+The Packaging plug-in lets you generate various archives for your project: jar, war and zip files, each of them defining a directive by the same name inside the assemble directive: +

+ +
+val packaging = assemble(kobalt) {
+  jar {}
+}
+
+ +

+ If you don't specify a name for your archive, a default one will be used that contains your project name, version and the corresponding suffix, e.g. kobalt-1.1.jar or sec-0.2.war. +

+ +

zip

+ +

+All these archives are zip files, so the zip archive is at the top of the hierarchy and jar and war inherit all its attributes, which include name, include and exclude. +

+ +

include and exclude

+ +

+All archives let you include and exclude files. +

+ +

+ include has two different forms: +

+ +
+val a = assemble(kobalt) {
+  zip {
+      include("kobaltw", "README")
+      include(from("doc/"),
+              to("html/"),
+              glob("**html"))
+  }
+}
+
+ +

+ The first form, with just one parameter, simply copies the file from your directory into the archive, preserving its path. The second form has three parameters which allow you to move the file to a different path into your archive. Note the use of the from, to and glob directives, which are necessary to disambiguate the call. +

+ +

jar

+ +

+ A jar is like a zip with two additional available parameters: +

+ +
+
fatJar
+
If true, all the dependencies and their dependencies will be included in the jar file
+
manifest
+
Specify attributes to add to the manifest
+
+ +

+ Here is how you generate an executable jar file: +

+ +
+val a = assemble(kobalt) {
+  jar {
+      fatJar = true
+      manifest {
+          attributes("Main-Class", "com.beust.kobalt.KobaltPackage")
+      }
+  }
+}
+
+ + +

Publishing

+ +

+

+ +
+ + +
+
+ + + + + + + + + + + + + diff --git a/template b/template index fb2fab5..86cb94e 100644 --- a/template +++ b/template @@ -2,22 +2,24 @@ - Kobalt + Kobalt, by Cedric Beust - + - + - + -