-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
102 lines (89 loc) · 2.82 KB
/
build.gradle
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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
buildscript {
repositories {
jcenter()
maven { url = 'https://dl.bintray.com/kotlin/kotlin-eap' }
maven { url = 'https://kotlin.bintray.com/kotlinx' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlinVersion}"
classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:${frontendPluginVersion}"
}
}
apply plugin: 'kotlin2js'
apply plugin: 'kotlin-platform-js'
apply plugin: 'org.jetbrains.kotlin.frontend'
apply plugin: 'maven-publish'
group 'com.fortytwoapps'
version '1.5.1'
publishing {
publications {
maven(MavenPublication) {
from components.java
pom.withXml {
asNode().dependencies.'*'.findAll() {
it.scope.text() == 'runtime' && project.configurations.compile.allDependencies.find { dep ->
dep.name == it.artifactId.text()
}
}.each() {
it.scope*.value = 'compile'
}
}
}
}
}
model {
tasks.generatePomFileForMavenPublication {
destination = file("$buildDir/libs/tfkt-1.5.1.pom")
}
}
repositories {
mavenCentral()
maven { url = "https://dl.bintray.com/kotlin/kotlin-eap" }
maven { url = "https://kotlin.bintray.com/kotlinx" }
}
dependencies {
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:1.3.3"
implementation "org.jetbrains.kotlin:kotlin-stdlib-js"
testImplementation "org.jetbrains.kotlin:kotlin-test-js"
}
kotlinFrontend {
npm {
dependency("@tensorflow/tfjs", "1.5.1")
dependency("gym-js", "0.2.0")
devDependency("karma", "3.1.4")
devDependency("karma-chrome-launcher", "2.2.0")
}
webpackBundle {
bundleName = "main"
contentPath = file('src/main/web')
mode = "development"
}
karma {
plugins = ["karma-chrome-launcher"]
browsers = ["ChromeHeadless"]
}
}
compileKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$project.buildDir.path/js/${project.name}.js"
kotlinOptions.moduleKind = 'umd'
}
compileTestKotlin2Js {
kotlinOptions.metaInfo = true
kotlinOptions.outputFile = "$project.buildDir.path/js-tests/${project.name}-tests.js"
kotlinOptions.moduleKind = 'umd'
}
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) }
tasks.getByName("test") { dependsOn(copyResources, copyResourcesForTests) }
tasks.getByName("karma-start") { dependsOn(copyResources, copyResourcesForTests) }
}