forked from JetBrains/lets-plot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbuild.gradle
274 lines (242 loc) · 8.68 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
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
buildscript {
dependencies {
classpath "org.yaml:snakeyaml:1.25"
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.30.0"
}
}
plugins {
id "org.jetbrains.kotlin.multiplatform" apply false
id "org.jetbrains.kotlin.js" apply false
id "org.jetbrains.gradle.plugin.idea-ext" apply false
id "com.github.johnrengelman.shadow" apply false
id "io.codearte.nexus-staging"
}
project.ext.letsPlotTaskGroup = 'lets-plot'
def include_sources_letsPlotJvmCommon = [
'base-portable',
'base',
'mapper-core',
'vis-canvas',
'vis-svg-mapper',
'vis-svg-portable',
'plot-base-portable',
'plot-common-portable',
'plot-builder-portable',
'plot-builder',
'plot-config-portable',
'plot-config',
]
def include_sources_letsPlotJvmJfx = [
'vis-svg-mapper-jfx',
'vis-swing-common',
'vis-swing-jfx',
'vis-demo-common',
'vis-demo-common-jfx',
]
def include_sources_letsPlotJvmBatik = [
'vis-svg-mapper-batik',
'vis-swing-common',
'vis-swing-batik',
'vis-demo-common',
'vis-demo-common-batik',
]
def include_sources_letsPlotGIS = [
'vis-canvas',
'gis',
'livemap',
':plot-livemap',
]
configurations {
letsPlotJvmCommonSources
letsPlotJvmJfxSources
letsPlotJvmBatikSources
letsPlotGISSources
}
allprojects {
group = 'org.jetbrains.lets-plot'
version = "2.3.1-alpha1"
project.ext.js_artifact_version = "2.3.1.dev1"
// see also: python-package/lets_plot/_version.py
// Generate JVM 1.8 bytecode
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
kotlinOptions.jvmTarget = "1.8"
}
tasks.withType(JavaCompile).configureEach {
sourceCompatibility = "1.8"
targetCompatibility = "1.8"
}
project.ext.jfx_platform = { -> //getJfxPlatform()
OperatingSystem os = org.gradle.nativeplatform.platform.internal.DefaultNativePlatform.currentOperatingSystem
if ( os.isWindows() ) {
return "win"
} else if ( os.isLinux() ) {
return "linux"
} else if ( os.isMacOsX() ) {
return "mac"
} else {
return "unknown"
}
}
repositories {
mavenCentral()
}
// jar jvm sources of this project
if (name in include_sources_letsPlotJvmCommon ||
name in include_sources_letsPlotJvmJfx ||
name in include_sources_letsPlotJvmBatik ||
name in include_sources_letsPlotGIS) {
apply plugin: "org.jetbrains.kotlin.multiplatform"
kotlin.jvm {} // for `jvmSourcesJar` task
build.dependsOn += jvmSourcesJar
}
// make build configuration depend on sources jars
def sources_jar_path = "${buildDir}/libs/${name}-jvm-${version}-sources.jar"
if (name in include_sources_letsPlotJvmCommon) {
rootProject.dependencies {
letsPlotJvmCommonSources files(sources_jar_path)
}
}
if (name in include_sources_letsPlotJvmJfx) {
rootProject.dependencies {
letsPlotJvmJfxSources files(sources_jar_path)
}
}
if (name in include_sources_letsPlotJvmBatik) {
rootProject.dependencies {
letsPlotJvmBatikSources files(sources_jar_path)
}
}
if (name in include_sources_letsPlotGIS) {
rootProject.dependencies {
letsPlotGISSources files(sources_jar_path)
}
}
}
import org.yaml.snakeyaml.Yaml
def build_settings_file = new File(rootDir, "build_settings.yml")
if (!build_settings_file.canRead()) {
throw new GradleException("Couldn't read build_settings.yml")
}
def settings = new Yaml().load(build_settings_file.newInputStream())
if (settings.build_python_extension) {
assert settings.python.include_path != null
}
if (settings.enable_python_package) {
assert settings.build_python_extension
assert settings.python.bin_path != null
}
project.ext.buildSettings = settings
// Maven publication settings
// define local Maven Repository path:
project.ext.localMavenRepository = "$rootDir/.maven-publish-dev-repo"
// define Sonatype nexus repository manager settings:
def sonatypeSnapshotUrl = "https://oss.sonatype.org/content/repositories/snapshots/"
def sonatypeReleaseUrl = "https://oss.sonatype.org/service/local/staging/deploy/maven2/"
project.ext.sonatypeUrl = version.contains('SNAPSHOT') ? sonatypeSnapshotUrl : sonatypeReleaseUrl
// nexus-staging plugin settings:
nexusStaging {
packageGroup = 'org.jetbrains'
username = project.buildSettings?.sonatype?.username
password = project.buildSettings?.sonatype?.password
}
// "JavaDoc" artifact for all publications.
task jarJavaDocs(type: Jar) {
group project.letsPlotTaskGroup
classifier 'javadoc'
from("$rootDir/README.md")
}
// Publish some sub-projects as Kotlin Multiproject libraries.
task publishKotlinApiDependenciesToMavenLocalRepository {
group project.letsPlotTaskGroup
}
task publishKotlinApiDependenciesToMavenRepository {
group project.letsPlotTaskGroup
}
subprojects {
// Configure publishing for projects which "Lets-Plot Kotlin API" depends on.
if (name in [
'plot-base-portable',
'base-portable',
'vis-svg-portable',
'plot-common-portable',
'plot-config-portable',
'plot-builder-portable',
]) {
apply plugin: "maven-publish"
apply plugin: "signing"
// Do not publish 'native' targets.
def publications_to_publish = ["jvm", "js", "kotlinMultiplatform", "metadata"]
publishing {
publications {
withType(MavenPublication) {
if (name in publications_to_publish) {
// Configure this publication.
artifact rootProject.jarJavaDocs
pom {
name = "Lets-Plot (Kotlin) internal dependency artifact"
description = "The Let-Plot Kotlin API depends on this artifact."
url = "https://github.com/JetBrains/lets-plot"
licenses {
license {
name = "MIT"
url = "https://raw.githubusercontent.com/JetBrains/lets-plot/master/LICENSE"
}
}
developers {
developer {
id = "jetbrains"
name = "JetBrains"
email = "[email protected]"
}
}
scm {
url = "https://github.com/JetBrains/lets-plot"
}
}
}
}
}
repositories {
maven {
url = project.sonatypeUrl
credentials {
username = project.buildSettings?.sonatype?.username
password = project.buildSettings?.sonatype?.password
}
}
mavenLocal {
url = uri(project.localMavenRepository)
}
}
}
afterEvaluate {
// Add LICENSE file to the META-INF folder inside published JAR files
jvmJar {
metaInf {
from("$rootDir"){
include "LICENSE"
}
}
}
// Configure artifacts signing process.
def publications_to_sign = []
for (task in it.tasks.withType(PublishToMavenRepository)) {
if (task.getPublication().name in publications_to_publish) {
def repoName = task.repository.name
if (repoName == "MavenLocal") {
publishKotlinApiDependenciesToMavenLocalRepository.dependsOn += task
} else if (repoName == "maven") {
publishKotlinApiDependenciesToMavenRepository.dependsOn += task
publications_to_sign += task.getPublication()
} else {
throw new IllegalStateException("Repository expected: 'MavenLocal' or 'maven' but was: '$repoName'.")
}
}
}
// Sign artifacts.
publications_to_sign.each {
signing.sign(it)
}
}
}
}