aboutsummaryrefslogtreecommitdiff
path: root/build.gradle
blob: 462af51bff65809b57721ccb30c873dcec44766b (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
plugins {
  id 'kotlin2js' version '1.3.21'
}

group 'io.jamesbarnett'
version '1.0-SNAPSHOT'

repositories {
  mavenCentral()
  maven { url 'https://jitpack.io' }
}

dependencies {
  compile "org.jetbrains.kotlin:kotlin-stdlib-js"
  compile "com.github.markaren:three.kt:v0.88-ALPHA-7"
  testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}

task assembleWeb(type: Sync) {
  configurations.compile.each { File file ->
    from(zipTree(file.absolutePath), {
      includeEmptyDirs = false
      include { fileTreeElement ->
        def path = fileTreeElement.path
        path.endsWith(".js") && (path.startsWith("META-INF/resources/") ||
          !path.startsWith("META-INF/"))
      }
    })
  }

  from compileKotlin2Js.destinationDir
  into "${projectDir}/web/kotlin"

  dependsOn classes
}
assemble.dependsOn assembleWeb

task copyWebResources(type: Sync) {
  from "${projectDir}/src/main/resources"
  into "${projectDir}/web"
}

assembleWeb.dependsOn copyWebResources

clean.doFirst() {
  delete("${projectDir}/web")
}