forked from ktorio/ktor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
131 lines (104 loc) · 4.52 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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
import org.jetbrains.kotlin.konan.target.HostManager
buildscript {
repositories {
mavenLocal()
jcenter()
maven { url "https://plugins.gradle.org/m2/" }
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-allopen:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlinx:atomicfu-gradle-plugin:$atomic_fu_version"
classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "me.champeau.gradle:jmh-gradle-plugin:$jmh_plugin_version"
}
}
ext.configuredVersion = project.hasProperty("releaseVersion") ? project.releaseVersion : project.version
ext.globalM2 = "$buildDir/m2"
ext.publishLocal = project.hasProperty("publishLocal")
apply from: "gradle/experimental.gradle"
apply from: 'gradle/verifier.gradle'
/**
* `darwin` is subset of `posix`.
* Don't create `posix` and `darwin` sourceSets in single project.
*/
def platforms = ["common", "jvm", "js", "posix", "darwin"]
rootProject.ext.skipPublish = ["binary-compatibility-validator", "ktor-server-benchmarks"]
def projectNeedsPlatform(project, platform) {
if (rootProject.ext.skipPublish.contains(project.name)) return platform == "jvm"
def files = project.projectDir.listFiles()
def hasPosix = files.any { it.name == "posix" }
def hasDarwin = files.any { it.name == "darwin" }
if (hasPosix && hasDarwin) return false
if (hasPosix && platform == "darwin") return false
if (hasDarwin && platform == "posix") return false
if (!hasPosix && !hasDarwin && platform == "darwin") return false
return files.any { it.name == "common" || it.name == platform }
}
allprojects {
group = "io.ktor"
version = configuredVersion
project.ext.hostManager = new HostManager()
repositories {
mavenLocal()
maven {
url "https://dl.bintray.com/kotlin/kotlinx/"
credentials {
username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: ""
password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: ""
}
}
maven { url "https://dl.bintray.com/kotlin/kotlin-eap" }
maven { url "https://dl.bintray.com/kotlin/kotlin-dev" }
jcenter()
}
apply plugin: "kotlin-multiplatform"
platforms.each { platform ->
if (projectNeedsPlatform(project, platform)) {
configure([it]) {
apply from: rootProject.file("gradle/utility.gradle")
apply from: rootProject.file("gradle/${platform}.gradle")
}
}
}
apply from: rootProject.file('gradle/dokka.gradle')
if (!rootProject.ext.skipPublish.contains(project.name)) {
apply from: rootProject.file('gradle/publish.gradle')
}
configurations { testOutput }
kotlin {
configure(sourceSets) {
def srcDir = name.endsWith("Main") ? "src" : "test"
def resourcesPrefix = name.endsWith("Test") ? "test-" : ""
def platform = name[0..-5]
kotlin.srcDirs = ["$platform/$srcDir"]
resources.srcDirs = ["$platform/${resourcesPrefix}resources"]
if (rootProject.ext.skipPublish.contains(project.name)) return
languageSettings {
progressiveMode = true
experimentalAnnotations.each { useExperimentalAnnotation(it) }
if (project.path.startsWith(":ktor-server:ktor-server") && project.name != "ktor-server-core") {
useExperimentalAnnotation("io.ktor.server.engine.EngineAPI")
}
}
}
}
}
afterEvaluate {
def allCompileKotlinTasks = subprojects.collect {
it.hasProperty("compileKotlinJvm") ? [it.compileKotlinJvm] : []
}.flatten()
configure(allCompileKotlinTasks) {
kotlinOptions.freeCompilerArgs += ["-XXLanguage:+InlineClasses"]
}
task dokkaWebsite(type: dokka.getClass()) {
outputFormat = 'kotlin-website'
outputDirectory = "${rootProject.projectDir}/apidoc"
kotlinTasks { allCompileKotlinTasks }
reportUndocumented = false
}
}