This is daab extension for Kotlin. With this plugin you can write daab application with Kotlin.
Add following snippet to your build file(build.gradle
).
buildscript { repositories { mavenCentral() } dependencies { classpath 'com.lisb.daab:daab-kt:0.1.6' } }
To customize this plugin, edit these items.
Property | Value | Default | Nullable |
---|---|---|---|
|
Path to |
|
No |
|
Package of the application. The value should be a valid package name. |
|
No |
|
The application directory relative to the project. |
|
No |
|
The object name to be exported in kotlin file. |
|
No |
A project should have the normal gradle/maven kotlin project structure.
project-root ├── build.gradle └── src └── main └── kotlin └── com └── example
Given a configuration in build.gradle
file…
daab { daabAppDir = 'my-app' mainPackage = 'com.example' appName = 'myApplication' }
If you give a value to mainPackage
, then the main object to be exported should be written under
the package, because Kotlin2Js compiler cannot detect that it is the main object.
The appName
will be used as a file name Kotlin compiler will create, and will be loaded
as a package object by a js file which gradle daab plugin will generate. So note that
the main package object should be named as the same name as the appName
value.
Given tha main kotlin script is written like an example below, app.js
(daab plugin’s generated script)
will load a main entry point myApplication
with the same name. If you give appName
with another,
a daab application won’t run.
package com.example // will run val myApplication: (Robot) -> Unit = { robot -> robot.hear(RegExp("PING", "i")) { res -> res.send("pong") } } // won't run val application: (Robot) -> Unit = { robot -> roobot.head(RegExp("FOO", "i")) { println(it.message.text) } }
Create install-local.gradle
file at the root directory of this project
to install jar files into local maven directory.
apply plugin: 'maven'
To create install-local.gradle
file, use generateInstallLocalGradle
task at the project root directory.
$ ./gradlew generateInstallLocalGradle