-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
82 lines (72 loc) · 1.93 KB
/
build.gradle.kts
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
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnPlugin
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
plugins {
kotlin("js") version "1.7.10"
}
group = "dev.datlag.kromex"
version = "0.1.0"
allprojects {
repositories {
google()
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
}
repositories {
google()
mavenLocal()
mavenCentral()
gradlePluginPortal()
}
dependencies {
implementation(kotlin("stdlib-js"))
runtimeOnly(npm("webextension-polyfill", "0.9.0"))
implementation(devNpm("webpack-bundle-analyzer", "4.5.0"))
compileOnly(project(":background"))
compileOnly(project(":content"))
compileOnly(project(":popup"))
}
kotlin {
js(LEGACY) {
browser {
commonWebpackConfig {
cssSupport.enabled = true
}
}
}
}
rootProject.plugins.withType<YarnPlugin> {
rootProject.the<YarnRootExtension>().download = true
}
tasks {
val extensionFolder = "build/extension"
val copyBundleFile = register<Copy>("copyBundleFile") {
from("build/distributions") {
include("*.js")
}
into(extensionFolder)
}
val copyResources = register<Copy>("copyResources") {
val resourceFolder = "src/main/resources"
from(
"$resourceFolder/manifest.json",
"$resourceFolder/icons",
"$resourceFolder/html",
"$resourceFolder/css"
)
into(extensionFolder)
}
val copyPolyfill = register<Copy>("copyPolyfill") {
from("build/js/node_modules/webextension-polyfill/dist") {
include("browser-polyfill.min.js")
include("browser-polyfill.min.js.map")
}
into(extensionFolder)
}
val extension = register<Zip>("extension") {
dependsOn(copyResources, copyPolyfill, copyBundleFile)
from(extensionFolder)
into("build")
}
}