diff options
author | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:10:58 +0100 |
---|---|---|
committer | Robert Jaros <rjaros@finn.pl> | 2018-01-31 00:10:58 +0100 |
commit | facf7991ed52cb21852dd6175a3817e94598c2dc (patch) | |
tree | aa4364769bbe0c3d637af8061761ef32c2234c37 /examples/todomvc/build.gradle | |
parent | a3514f0ea18313d37b9701e055f97f7ad81f76c4 (diff) | |
download | kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.tar.gz kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.tar.bz2 kvision-facf7991ed52cb21852dd6175a3817e94598c2dc.zip |
TodoMVC example
Diffstat (limited to 'examples/todomvc/build.gradle')
-rw-r--r-- | examples/todomvc/build.gradle | 94 |
1 files changed, 94 insertions, 0 deletions
diff --git a/examples/todomvc/build.gradle b/examples/todomvc/build.gradle new file mode 100644 index 00000000..3087c146 --- /dev/null +++ b/examples/todomvc/build.gradle @@ -0,0 +1,94 @@ +buildscript { + ext.kotlin_version = '1.2.21' + ext.production = (findProperty('prod') ?: 'false') == 'true' + ext.npmdeps = new URL("file:///home/rjaros/git/kvision/npm.dependencies").getText() + + repositories { + jcenter() + maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' } + maven { url "https://plugins.gradle.org/m2/" } + } + + dependencies { + classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" + classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.26" + classpath "gradle.plugin.io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.0.0.RC6-2" + } +} + +apply plugin: 'kotlin2js' +apply plugin: 'org.jetbrains.kotlin.frontend' +apply plugin: "io.gitlab.arturbosch.detekt" + +repositories { + jcenter() + maven { url = 'https://dl.bintray.com/gbaldeck/kotlin' } + maven { url = 'https://dl.bintray.com/rjaros/kotlin' } + maven { + url "file:///home/rjaros/kotlin/mvn/" + } +} + +dependencies { + compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version" + compile "org.jetbrains.kotlin:kotlin-test-js:$kotlin_version" // for now only compile configuration is supported + compile "pl.treksoft:kvision:0.0.1" +} + +kotlinFrontend { + npm { + npmdeps.eachLine { line -> + def (name, version) = line.tokenize(" ") + dependency(name, version) + } + dependency("todomvc-app-css", "^2.0.0") + dependency("todomvc-common", "^1.0.0") + devDependency("karma") + } + + webpackBundle { + bundleName = "main" + contentPath = file('src/main/web') + } + + define "PRODUCTION", production + +} + +detekt { + version = "1.0.0.RC6-2" + profile("main") { + input = "$projectDir/src/main/kotlin" + config = "$projectDir/detekt.yml" + filters = ".*test.*,.*/resources/.*,.*/tmp/.*" + } +} + +compileKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'commonjs' +} + +compileTestKotlin2Js { + kotlinOptions.metaInfo = true + kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js" + kotlinOptions.sourceMap = !production + kotlinOptions.moduleKind = 'commonjs' +} + +task copyResources(type: Copy) { + from "src/main/resources" + into file(buildDir.path + "/js") +} + +task copyResourcesForTests(type: Copy) { + from "src/main/resources" + into file(buildDir.path + "/js-tests/") +} + +afterEvaluate { + tasks.getByName("webpack-bundle") { dependsOn(copyResources) } + tasks.getByName("webpack-run") { dependsOn(copyResources, copyResourcesForTests) } +} |