-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
82 lines (71 loc) · 1.93 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
buildscript {
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-compiler:$kotlinVersion"
}
}
plugins {
id 'org.jetbrains.kotlin.multiplatform' version "$kotlinVersion"
id 'maven-publish'
}
group 'ru.spbstu'
version "$kotlinVersion"
repositories {
mavenCentral()
}
task gen() {
outputs.dir('src/commonMain/kotlin/kotlinx')
doLast {
def warnings =
Class.forName("org.jetbrains.kotlin.diagnostics.Errors")
.declaredFields
.collect { [it.name, it.get(null)] }
.findAll { it[1] in Class.forName("org.jetbrains.kotlin.diagnostics.DiagnosticFactory") }
.findAll { it[1]?.severity?.toString() == 'WARNING' }
.collect { it[0] }
.collect { """const val $it = "$it" """ }
.join('\n')
mkdir 'src/commonMain/kotlin/kotlinx'
new File("src/commonMain/kotlin/kotlinx/Warnings.kt").withPrintWriter {
it.println("package kotlinx.warnings")
it.println()
it.println("object Warnings { ")
it.println(' ' + warnings.replace('\n', '\n '))
it.println("}")
}
}
}
kotlin {
jvm()
js(BOTH) {
nodejs()
browser()
}
linuxX64()
targets.all {
compilations.all {
compileKotlinTask.dependsOn(gen)
}
}
sourceSets {
commonMain {}
}
}
clean {
afterEvaluate {
delete 'src/commonMain/kotlin/kotlinx'
}
}
publishing {
repositories {
maven {
url = "https://maven.pkg.github.com/vorpal-research/kotlin-maven"
credentials {
username (project.findProperty('deployUsername') ?: System.getenv('DEPLOY_USERNAME'))
password (project.findProperty('deployPassword') ?: System.getenv('DEPLOY_PASSWORD'))
}
}
}
}