-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathbuild.gradle
92 lines (76 loc) · 1.79 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
buildscript {
ext {
kotlin_version = '1.2.10'
kotlin_frontend_version = '0.0.26'
kotlinx_coroutines_version = '0.21'
}
repositories {
jcenter()
maven { url 'https://dl.bintray.com/kotlin/kotlin-eap' }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-frontend-plugin:$kotlin_frontend_version"
}
}
apply plugin: 'kotlin2js'
apply plugin: 'org.jetbrains.kotlin.frontend'
repositories {
jcenter()
}
dependencies {
compile "org.jetbrains.kotlin:kotlin-stdlib-js:$kotlin_version"
compile "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlinx_coroutines_version"
}
kotlin {
experimental {
coroutines 'enable'
}
}
compileKotlin2Js {
kotlinOptions {
moduleKind = 'commonjs'
sourceMap = true
}
}
kotlinFrontend {
npm {
dependency 'webextension-polyfill'
}
webpackBundle {
bundleName = 'popup'
contentPath = file('src/main/web')
}
}
task wrapper(type: Wrapper) {
gradleVersion = '4.4'
}
task copyWeb(type: Copy) {
from 'src/main/web'
into 'build/extension'
}
task copyBrowserPolyfill(type: Copy) {
dependsOn 'bundle'
from ('build/node_modules/webextension-polyfill/dist') {
include 'browser-polyfill.min.js'
}
into 'build/extension'
}
task copyBundle(type: Copy) {
dependsOn 'bundle'
from ('build/bundle') {
rename '(.*)\\.bundle.js', '$1.js'
}
into 'build/extension'
}
task prepareExtension {
dependsOn copyWeb, copyBundle, copyBrowserPolyfill
}
task zipExtension(type: Zip) {
dependsOn prepareExtension
from 'build/extension'
}
task extension {
dependsOn zipExtension
}
assemble.dependsOn extension