-
Notifications
You must be signed in to change notification settings - Fork 72
Expand file tree
/
Copy pathbuild.gradle.kts
More file actions
78 lines (67 loc) · 2.41 KB
/
Copy pathbuild.gradle.kts
File metadata and controls
78 lines (67 loc) · 2.41 KB
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
import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinJvmCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask
buildscript {
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${rootProject.properties["kotlin_version"]}")
}
}
plugins {
id("kotlinx.team.infra") version "0.4.0-dev-91"
}
infra {
publishing {
include(":kotlinx-collections-immutable")
libraryRepoUrl = "https://github.com/Kotlin/kotlinx.collections.immutable"
}
}
allprojects {
repositories {
mavenCentral()
val kotlinRepoUrl = providers.gradleProperty("kotlin_repo_url").orNull
if (kotlinRepoUrl != null) {
maven(kotlinRepoUrl)
}
}
val setAllWarningsAsError = providers.gradleProperty("kotlin_Werror_override").map {
when (it) {
"enable" -> true
"disable" -> false
else -> error("Unexpected value for 'kotlin_Werror_override' property: $it")
}
}
tasks.withType(KotlinCompilationTask::class).configureEach {
compilerOptions {
if (setAllWarningsAsError.orNull != false) {
allWarningsAsErrors = true
}
freeCompilerArgs.addAll(
"-Xexpect-actual-classes",
"-Xreport-all-warnings",
"-Xrender-internal-diagnostic-names"
)
}
if (this is KotlinJsCompile) {
compilerOptions {
freeCompilerArgs.add("-Xwasm-enable-array-range-checks")
}
} else if (this is KotlinJvmCompile) {
compilerOptions {
freeCompilerArgs.add("-jvm-default=disable")
}
}
val extraOpts = providers.gradleProperty("kotlin_additional_cli_options").orNull
extraOpts?.split(' ')?.map(String::trim)?.filter(String::isNotBlank)?.let { opts ->
if (opts.isNotEmpty()) {
compilerOptions.freeCompilerArgs.addAll(opts)
}
}
doFirst {
logger.info("Added Kotlin compiler flags: ${compilerOptions.freeCompilerArgs.get().joinToString(", ")}")
logger.info("allWarningsAsErrors=${compilerOptions.allWarningsAsErrors.get()}")
}
}
}
tasks.withType<org.jetbrains.kotlin.gradle.targets.js.npm.tasks.KotlinNpmInstallTask>().configureEach {
args.add("--ignore-engines")
}