Skip to content

Instantly share code, notes, and snippets.

@hmhmsh
Last active November 24, 2016 12:48
Show Gist options
  • Select an option

  • Save hmhmsh/2c3e598951b25157a3bf5f08054907af to your computer and use it in GitHub Desktop.

Select an option

Save hmhmsh/2c3e598951b25157a3bf5f08054907af to your computer and use it in GitHub Desktop.

Revisions

  1. @hasess hasess revised this gist Nov 24, 2016. 1 changed file with 6 additions and 0 deletions.
    6 changes: 6 additions & 0 deletions hellogradle.kt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,6 @@
    //
    fun hello(): String = "HELLO"

    fun main(args: Array<String>) {
    println(hello())
    }
  2. @hasess hasess created this gist Nov 24, 2016.
    5 changes: 5 additions & 0 deletions Kotlin-gradle.sublime-build
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,5 @@
    {
    "file_regex": "^(...*?):([0-9]*):?([0-9]*)",
    "selector": ["source.kt"],
    "shell_cmd": "gradle -Pmain=\"${file_name}\""
    }
    32 changes: 32 additions & 0 deletions build.gradle
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,32 @@
    buildscript {
    ext.kotlin_version = '1.0.5'
    repositories {
    mavenCentral()
    }
    dependencies {
    classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
    }

    apply plugin: 'kotlin'
    apply plugin: 'application'

    repositories {
    mavenCentral()
    }

    dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    }

    sourceSets {
    main.java.srcDirs += './'
    }

    defaultTasks 'run'

    run {
    if (project.hasProperty('main')) {
    main(project.main.replace(".kt", "Kt").capitalize())
    }
    }