Skip to content

sureshg/kotlin-starter

Repository files navigation

Kotlin Kotlin Starter

version changelog build api-doc gitter license kotlin

A starter template for my kotlin projects using Gradle Kotlin DSL!

Download

  • Binary

    Download

    After download, make sure to set the execute permission (chmod +x kotlin-starter).

    Windows users can run the executable jar - Download.

Build

  • Source

     $ git clone https://github.com/sureshg/kotlin-starter
     $ cd kotlin-starter
     $ ./gradlew makeExecutable -q

    The binary would be located at build/libs/kotlin-starter

    Inorder to build a new version, change appVersion in the gradle.properties or pass it to ./gradlew -q -PappVersion=2.0.0

  • API Doc

    The API docs would be generated under the docs, which can be published as GitHub Pages

     $ cd kotlin-starter
     $ ./gradlew dokka
  • Github Release

    In order to publish the kotlin-starter binary to Github, generate Github Access token

     $ export GITHUB_TOKEN=<token>
     $ cd kotlin-starter
     $ ./gradlew prepareRelease
     $ ./gradlew githubRelease -q

    The latest release is version

Usage

  • Help

    $ kotlin-starter --help

Examples

  • Generating AOT type-safe accessors in kotlin,

    $ ./gradlew kotlinDslAccessorsSnapshot
  • Other Tasks

    # Run the main class.
    $ ./gradlew clean :run
    
    # Display project dependency
    $ ./gradlew dependencyInsight --dependency kotlin-stdlib  --configuration compile
    $ ./gradlew dependencies
    
    # See task tree for build task
    $ ./gradlew :build :taskTree

Kotlin Build Script Compilation

Script compilation happens in 4 steps:

  • Extract buildscript block, compile it against parent project classpath (up to buildSrc), evaluate it against current project.
  • Extract plugins block, compile it against the same classpath as the previous step, evaluate it against current project.
  • MAGIC (generate Kotlin code based on information contributed by previous steps).
  • Compile whole script against classpath contributed by previous steps.

**Require Java 8 or later