forked from Kotlin/kotlinx.serialization
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
166 lines (142 loc) · 6.43 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
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
/*
* Copyright 2017-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
buildscript {
if (project.hasProperty("bootstrap")) {
ext.kotlin_version = property('kotlin.version.snapshot')
ext["kotlin.native.home"] = System.getenv("KONAN_LOCAL_DIST")
} else {
ext.kotlin_version = property('kotlin.version')
}
if (project.hasProperty("library.version")) {
ext.overriden_version = property('library.version')
}
ext.experimentalsEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlinx.serialization.InternalSerializationApi"
]
ext.experimentalsInTestEnabled = ["-progressive", "-Xuse-experimental=kotlin.Experimental",
"-Xuse-experimental=kotlin.ExperimentalMultiplatform",
"-Xuse-experimental=kotlinx.serialization.ExperimentalSerializationApi",
"-Xuse-experimental=kotlinx.serialization.InternalSerializationApi",
"-Xuse-experimental=kotlin.ExperimentalUnsignedTypes"
]
/*
* This property group is used to build kotlinx.serialization against Kotlin compiler snapshot.
* When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version.
* DO NOT change the name of these properties without adapting kotlinx.train build chain.
*/
def prop = rootProject.properties['build_snapshot_train']
ext.build_snapshot_train = prop != null && prop != ""
if (build_snapshot_train) {
ext.kotlin_version = rootProject.properties['kotlin_snapshot_version']
if (kotlin_version == null) {
throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler")
}
repositories {
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
maven { url "https://bintray.com/jetbrains/kotlin-native-dependencies" }
}
}
repositories {
mavenLocal()
maven {
url "https://kotlin.bintray.com/kotlin-dev"
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://kotlin.bintray.com/kotlin-eap' }
maven { url 'https://kotlin.bintray.com/kotlinx' }
maven { url "https://dl.bintray.com/jetbrains/kotlin-native-dependencies" }
jcenter()
gradlePluginPortal()
}
configurations.classpath {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion kotlin_version
}
}
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version"
classpath "org.jetbrains.kotlinx:binary-compatibility-validator:$validator_version"
classpath "org.jetbrains.kotlinx:kotlinx-knit:$knit_version"
classpath 'com.google.protobuf:protobuf-gradle-plugin:0.8.8'
// Various benchmarking stuff
classpath "com.github.jengelman.gradle.plugins:shadow:4.0.2"
classpath "me.champeau.gradle:jmh-gradle-plugin:0.4.8"
classpath "net.ltgt.gradle:gradle-apt-plugin:0.21"
}
}
// To make it visible for compilerVersion.gradle
ext.compilerVersion = org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION
apply plugin: 'binary-compatibility-validator'
apiValidation {
ignoredProjects += ["benchmark", "guide", "kotlinx-serialization"]
}
apply plugin: 'base'
apply plugin: 'kotlinx-knit'
knit {
siteRoot = "https://kotlin.github.io/kotlinx.serialization"
}
// Build API docs for all modules with dokka before running Knit
knitPrepare.dependsOn "dokka"
allprojects {
group 'org.jetbrains.kotlinx'
def deployVersion = properties['DeployVersion']
if (deployVersion != null) version = deployVersion
if (project.hasProperty("bootstrap")) {
version = version + '-SNAPSHOT'
}
// the only place where HostManager could be instantiated
project.ext.hostManager = new org.jetbrains.kotlin.konan.target.HostManager()
if (build_snapshot_train) {
// Snapshot-specific
repositories {
mavenLocal()
maven { url "https://oss.sonatype.org/content/repositories/snapshots" }
}
}
configurations.all {
resolutionStrategy.eachDependency { DependencyResolveDetails details ->
if (details.requested.group == 'org.jetbrains.kotlin') {
details.useVersion kotlin_version
}
}
}
repositories {
mavenLocal()
jcenter()
maven { url "https://dl.bintray.com/kotlin/kotlinx" }
maven {
url "https://kotlin.bintray.com/kotlin-dev"
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" }
}
}
subprojects {
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile).all { task ->
if (task.name.contains("Test") || task.name.contains("Jmh")) {
task.kotlinOptions.freeCompilerArgs += experimentalsInTestEnabled
} else {
task.kotlinOptions.freeCompilerArgs += experimentalsEnabled
}
}
apply from: rootProject.file('gradle/teamcity.gradle')
// Configure publishing for some artifacts
if (project.name != "benchmark" && project.name != "guide") {
apply from: rootProject.file('gradle/publishing.gradle')
}
}
apply from: rootProject.file('gradle/compilerVersion.gradle')
apply from: rootProject.file("gradle/dokka.gradle")