Newer
Older
komp-todo / build.gradle
rnentjes on 1 Apr 2017 1 KB Initial commit
group 'nl.astraeus'
version '0.0.1-SNAPSHOT'

buildscript {
    ext.kotlin_version = '1.1.1'

    repositories {
        maven {
            url "http://nexus.astraeus.nl/nexus/content/groups/public"
        }
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

apply plugin: 'kotlin2js'

repositories {
    maven {
        url "http://nexus.astraeus.nl/nexus/content/groups/public"
    }
    mavenCentral()
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
    compile "nl.astraeus:komp:0.0.1-SNAPSHOT"
}

compileKotlin2Js {
    kotlinOptions.metaInfo = true

    compileKotlin2Js.kotlinOptions.sourceMap = true
    compileKotlin2Js.kotlinOptions.outputFile = "${projectDir}/web/js/kotlin/komp-todo.js"
    compileKotlin2Js.kotlinOptions.suppressWarnings = true
    compileKotlin2Js.kotlinOptions.verbose = true
}

compileKotlin2Js.doLast {
    configurations.compile.each { File file ->
        copy {
            includeEmptyDirs = false

            from zipTree(file.absolutePath)
            into "${projectDir}/web/js/kotlin"
            include { fileTreeElement ->
                def path = fileTreeElement.path
                path.endsWith(".js") && (path.startsWith("META-INF/resources/") || !path.startsWith("META-INF/"))
            }
        }
    }
}