diff --git a/documentation/index.html b/documentation/index.html index 552da89..27d1ff4 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -105,7 +105,7 @@ As of this writing, Kobalt supports Java and Kotlin projects.

General concepts

-The build file is typically called Built.kt and it is a valid Kotlin file. Typically, it contains imports, the declaration of one or more projects and the declaration of additional configurations (e.g. packaging, publishing, etc...). Since it's a Kotlin file, it can also contain any class or function you need: +The build file is typically called Built.kt and it is a valid Kotlin file. It contains imports, the declaration of one or more projects and the declaration of additional configurations (e.g. packaging, publishing, etc...). Since it's a Kotlin file, it can also contain any class or function you need:

@@ -124,48 +124,52 @@ val kobalt = kotlinProject {
 Here are a few noteworthy details about this small build file:
 
 
 
 

Directives

-Now that we have declared a project, we can use it to configure additional steps of our build, such as the assembling it (creating jar and other files: +Now that we have declared a project, we can use it to configure additional steps of our build, such as how to assemble it (creating jar and other files):

 import com.beust.kobalt.plugin.packaging.assemble
 
-// ...
-
-val packKobalt = assemble(kobalt) {
-    jar {
+val kobalt = kotlinProject {
+    // ...
+
+    assemble {
+        jar {
     }
+
 }
 

-This is the simplest jar declaration you can have. You can trigger the creation of this jar file by invoking the task "assemble". Note that we passed the kobalt variable to the assemble function, so we make it clear which project we are currently configuring for packaging. The jar directive accepts various settings, so let's be a bit more specific. And let's add a zip file too: +This is the simplest jar declaration you can have. You can trigger the creation of this jar file by invoking the task "assemble" from the command line. Note the presence of the corresponding import: without it, your build file will not compile. Another interesting details is that the assemble function we just imported is an extension function on the Project class, which is how the import makes it legal to call assemble in the middle of our project. If you remove the import, that line will no longer compile. +

+

+ The jar directive accepts various settings, so let's be a bit more specific. And let's add a zip file too:

-val assembleKobalt = assemble(kobalt) {
-    jar {
-        fatJar = true
-        manifest {
-            attributes("Main-Class", "com.beust.kobalt.KobaltPackage")
+    assemble {
+        jar {
+            fatJar = true
+            manifest {
+                attributes("Main-Class", "com.beust.kobalt.KobaltPackage")
+            }
+        }
+        zip {
+            include("kobaltw")
+            include(from("$buildDirectory/libs"), to("kobalt/wrapper"),
+                    "$projectName-$version.jar")
+            include(from("modules/wrapper/$buildDirectory/libs"), to("kobalt/wrapper"),
+                    "$projectName-wrapper.jar")
         }
-    }
-    zip {
-        include("kobaltw")
-        include(from("${kobalt.buildDirectory}/libs"),
-                to("kobalt/wrapper"),
-                "${kobalt.name}-${kobalt.version}.jar",
-                "${kobalt.name}-wrapper.jar")
-    }
-}
 

@@ -437,13 +441,12 @@ dependencies {

2. Declare the main class of your plug-in in the Jar file's manifest:

-val p = packaging(examplePlugin) {
-    jar {
-        manifest {
-            attributes("Kobalt-Plugin-Class", "com.beust.kobalt.example.ExamplePlugin")
+    packaging {
+        jar {
+            manifest {
+                attributes("Kobalt-Plugin-Class", "com.beust.kobalt.example.ExamplePlugin")
+            }
         }
-    }
-}
 

Implementing

@@ -479,10 +482,9 @@ Next, you can declare tasks with the @Task annotation:

-@Task(name = "coverage", description = "Run coverage",
-    runAfter = arrayOf("compile"))
+@Task(name = "coverage", description = "Run coverage", runAfter = arrayOf("compile"))
 public fun coverage(project: Project): TaskResult {
-    println("Running the coverage on project ${project}")
+    println("Running the coverage on project $project")
     return TaskResult()
 }
 
diff --git a/home/index.html b/home/index.html index 92f3d6c..fd5e73d 100644 --- a/home/index.html +++ b/home/index.html @@ -74,16 +74,16 @@ val jcommander = javaProject { dependenciesTest { compile("org.testng:testng:6.9.5") } -} -val a = assemble(jcommander) { - mavenJars { + assemble { + mavenJars { + } + + jcenter { + publish = false } } -val j = jcenter(jcommander) { - publish = false -}

Design goals

diff --git a/plug-in-development/index.html b/plug-in-development/index.html index 2aee0e7..02a67c5 100644 --- a/plug-in-development/index.html +++ b/plug-in-development/index.html @@ -101,7 +101,7 @@ Next, we want the manifest of our jar file to point to our main Kobalt plug-in c

-val packProject = packaging(project) {
+packaging {
     jar {
         manifest {
             attributes("Kobalt-Plugin-Class", "com.beust.kobalt.plugin.linecount.Main")
@@ -150,7 +150,7 @@ If you go to the maven section of your bintray account, you will now see that th
 

-val jc = jcenter(project) {
+jcenter {
     publish = true
 }
 
diff --git a/plug-ins/index.html b/plug-ins/index.html index a2e3f1e..5c0c1ee 100644 --- a/plug-ins/index.html +++ b/plug-ins/index.html @@ -113,8 +113,9 @@ The Packaging plug-in lets you generate various archives for your project: jar,

-val packaging = assemble(kobalt) {
-  jar {}
+assemble {
+    jar {
+    }
 }
 
@@ -139,13 +140,13 @@ All archives let you include and exclude files.

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

-val a = assemble(kobalt) {
+assemble {
   jar {
       fatJar = true
       manifest {
@@ -224,7 +225,7 @@ you are ready to do your first upload.
 

-val jc = jcenter(kobalt) {
+jcenter {
   publish = true
   file("${kobalt.buildDirectory}/libs/${kobalt.name}-${kobalt.version}.zip",
        "${kobalt.name}/${kobalt.version}/${kobalt.name}-${kobalt.version}.zip")