diff --git a/documentation/index.html b/documentation/index.html index 197b8b2..3230de6 100644 --- a/documentation/index.html +++ b/documentation/index.html @@ -133,7 +133,7 @@ val kobalt = project {
-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.
+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 detail 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:
@@ -167,7 +167,35 @@ Our jar file is now declared to be a "fat jar" (which means it will include all
The zip directive follows a similar structure, although here we are specifying which file we want to include. For more details on the packaging
plug-in, please see its documentation.
buildScript
directive
+ buildScript
is a special directive that lets you control how the rest of the build file
+ will be compiled, such as defining which plug-ins and which repos to use:
+
+val bs = buildScript { + repos("bintray.com/kotlin/kotlin-eap-1.1") + plugins("com.beust.kobalt:kobalt-line-count:0.18", "com.example:kobalt-optimize:0.3") +}+
The following directives are available inside buildScript:
+ As always, you can use your IDE's auto-completion to find out which directives are available inside buildScript:
+
+
+
Since Build.kt
is a valid Kotlin file, you can write arbitrary Kotlin code in it,
including defining tasks. If you ever need to perform an operation that is not supported by an
@@ -200,9 +228,10 @@ fun taskCreateVersion(project: Project) : TaskResult {
// Build.kt -val bfc = buildFileClasspath("org.testng:testng:6.9.11") -val t = org.testng.TestNG() // now legal -+val bs = buildScript { + buildFileClasspath("org.testng:testng:6.9.11") +} +val t = org.testng.TestNG() // now legal
-Kobalt already knows the location of the most popular Maven repos (Maven Central, JCenter, JBoss) but you can add repos with the repos()
directive:
+Kobalt already knows the location of the most popular Maven repos (Maven Central, JCenter, JBoss) but you can add repos with the repos()
directive
+ inside buildScript{}
:
-val repos = repos("https://dl.bintray.com/cbeust/maven/")+val bs = buildScript { + repos("https://dl.bintray.com/cbeust/maven/") +}
By default, this directive takes URL's as strings, but you can also use local
files with the file
directive:
-val repos = repos(file("/some/local/directory"))+ repos(file("/some/local/directory"))
The homeDir()
directive can also come in handy when you want
to specify a directory starting at your home directory:
-val repos = repos(file(homeDir("some/directory/in/your/home")))+ repos(file(homeDir("some/directory/in/your/home")))
@@ -492,7 +524,7 @@ BUILD SUCCESSFUL (0 seconds)
// Build.kt -val r = repos(localMaven())+ repos(localMaven())
@@ -520,12 +552,14 @@ $ ./kobaltw --tasks
-Let's modify our build to include a plug-in. We do this by adding a call to the plugins
directive on top of the build file:
+Let's modify our build to include a plug-in. We do this by adding a call to the buildScript
directive on top of the build file:
-val repos = repos("https://dl.bintray.com/cbeust/maven/") -val p = plugins("com.beust:kobalt-example-plugin:0.42") +val bs = buildScript { + repos("https://dl.bintray.com/cbeust/maven/") + plugins("com.beust:kobalt-example-plugin:0.42") +}
diff --git a/idea-plug-in/index.html b/idea-plug-in/index.html index 7f93119..35af6cf 100644 --- a/idea-plug-in/index.html +++ b/idea-plug-in/index.html @@ -166,7 +166,9 @@ dependencies {
-val plugins = plugins("com.beust.kobalt:kobalt-line-count:0.17")+val bs = buildScript { + plugins("com.beust.kobalt:kobalt-line-count:0.17") +}
-val repos = repos("https://dl.bintray.com/cbeust/maven/") -val plugins = plugins("com.beust:kobalt-line-count:0.2") +val bs = buildScript { + repos("https://dl.bintray.com/cbeust/maven/") + plugins("com.beust:kobalt-line-count:0.2") +}
@@ -290,10 +292,10 @@ public class Main : BasePlugin() {
-val p = plugins( - file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.2.jar")) -) -+val bs = buildScript { + plugins( + file(homeDir("kotlin/kobalt-line-count/kobaltBuild/libs/kobalt-line-count-0.2.jar"))) +}
You can now set a breakpoint in your plug-in and launch the configuration you created above.