aboutsummaryrefslogtreecommitdiff
path: root/kvision-modules/kvision-testutils/build.gradle
blob: 1bf2dcf0328c293fcf5c8e3adbd542d3df804bcd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
apply plugin: 'kotlin-platform-js'

task cleanLibs(type: Delete) {
    delete 'build/js', 'build/libs'
}

if (project.gradle.startParameter.taskNames.contains("jar")) {
    compileKotlin2Js.dependsOn 'cleanLibs'
}

jar {
    duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}

task testJar(type: Jar, dependsOn: testClasses) {
    baseName = "${project.archivesBaseName}-test"
    from sourceSets.test.output
}

configurations {
    tests
}

artifacts {
    tests testJar
}

publishing {
    publications {
        mavenProject(MavenPublication) {
            artifact testJar {
                classifier 'tests'
            }
        }
    }
}

compileKotlin2Js {
    kotlinOptions.metaInfo = true
    kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
    kotlinOptions.sourceMap = !production
    kotlinOptions.moduleKind = 'umd'
}

compileTestKotlin2Js {
    kotlinOptions.metaInfo = true
    kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
    kotlinOptions.sourceMap = !production
    kotlinOptions.moduleKind = 'umd'
}

dependencies {
    compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlinVersion"
    compile "org.jetbrains.kotlin:kotlin-test-js:$kotlinVersion"
    if (!project.gradle.startParameter.taskNames.contains("generatePomFileForMavenProjectPublication")) {
        compile project(":kvision-modules:kvision-base")
    } else {
        compile rootProject
    }
}