-
Notifications
You must be signed in to change notification settings - Fork 53
/
Copy pathbuild.gradle.kts
175 lines (152 loc) · 5.92 KB
/
build.gradle.kts
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
/*
* Copyright (c) 2024. JetBrains s.r.o.
* Use of this source code is governed by the MIT license that can be found in the LICENSE file.
*/
import org.gradle.jvm.tasks.Jar
plugins {
kotlin("multiplatform")
`maven-publish`
signing
}
val artifactBaseName = "lets-plot-image-export"
val artifactGroupId = project.group as String
val artifactVersion = project.version as String
val assertjVersion = project.extra["assertj_version"]
val batikGroupId = "org.apache.xmlgraphics"
val batikArtifacts = listOf("batik-transcoder", "batik-codec")
val batikVersion = project.extra["batik_version"]
val hamcrestVersion = project.extra["hamcrest_version"]
val kotlinLoggingVersion = project.extra["kotlinLogging_version"]
val mavenLocalPath = rootProject.project.extra["localMavenRepository"]
val mockitoVersion = project.extra["mockito_version"]
val tiffioGroupId = "com.twelvemonkeys.imageio"
val tiffioArtifact = "imageio-tiff"
val tiffioVersion = project.extra["twelvemonkeys_imageio_version"]
kotlin {
jvm()
sourceSets {
commonMain {
dependencies {
implementation( kotlin("stdlib-common"))
implementation(project(":commons"))
implementation(project(":datamodel"))
implementation(project(":plot-stem"))
}
}
commonTest {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
jvmMain {
dependencies {
implementation("io.github.microutils:kotlin-logging-jvm:$kotlinLoggingVersion")
implementation(kotlin("stdlib-jdk8"))
implementation(project(":platf-awt"))
batikArtifacts.forEach {
api("$batikGroupId:$it:$batikVersion")
}
// TIFF support
implementation("$tiffioGroupId:$tiffioArtifact:$tiffioVersion")
}
}
jvmTest {
dependencies {
implementation("org.assertj:assertj-core:$assertjVersion")
implementation("org.hamcrest:hamcrest-core:$hamcrestVersion")
implementation("org.hamcrest:hamcrest-library:$hamcrestVersion")
implementation("org.mockito:mockito-core:$mockitoVersion")
implementation(kotlin("test"))
implementation(kotlin("test-junit"))
implementation(project(":demo-and-test-shared"))
}
}
}
}
val jvmJarPlotImageExport by tasks.named<Jar>("jvmJar") {
archiveFileName.set("$artifactBaseName-${artifactVersion}.jar")
// Add LICENSE file to the META-INF folder inside published JAR files.
metaInf {
from("$rootDir") {
include("LICENSE")
}
}
}
val jvmPlotImageExportSourcesJar by tasks.named<Jar>("jvmSourcesJar") {
archiveFileName.set("$artifactBaseName-$artifactVersion-sources.jar")
archiveClassifier.set("sources")
}
// Generating JavaDoc task for each publication task.
// Fixes "Task ':plot-image-export:publishJsPublicationToMavenRepository' uses this output of task
// ':plot-image-export:signJvmPublication' without declaring an explicit or implicit dependency" error.
// Issues:
// - https://github.com/gradle-nexus/publish-plugin/issues/208
// - https://github.com/gradle/gradle/issues/26091
//
val jvmPlotImageExportJarJavaDoc by tasks.registering (Jar::class) {
archiveBaseName.set("$artifactBaseName-$artifactVersion-javadoc.jar")
archiveClassifier.set("javadoc")
from("$rootDir/README.md")
}
publishing {
publications {
register("letsPlotImageExport", MavenPublication::class) {
groupId = artifactGroupId
artifactId = artifactBaseName
version = artifactVersion
artifact(jvmJarPlotImageExport)
artifact(jvmPlotImageExportSourcesJar)
artifact(jvmPlotImageExportJarJavaDoc.get())
pom {
name = "Lets-Plot raster image export"
description = "Exporting a plot to a raster image (PNG,JPG or TIFF)."
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"
}
// Dependencies
withXml {
val deps = asNode().appendNode("dependencies")
batikArtifacts.forEach {
val dep = deps.appendNode("dependency")
dep.appendNode("groupId", batikGroupId)
dep.appendNode("artifactId", it)
dep.appendNode("version", batikVersion)
}
var dep = deps.appendNode("dependency")
dep.appendNode("groupId", tiffioGroupId)
dep.appendNode("artifactId", tiffioArtifact)
dep.appendNode("version", tiffioVersion)
dep = deps.appendNode("dependency")
dep.appendNode("groupId", project.group)
dep.appendNode("artifactId", "platf-awt")
dep.appendNode("version", project.version)
}
}
}
}
repositories {
mavenLocal {
url = uri("$mavenLocalPath")
}
}
}
signing {
if (!project.version.toString().contains("SNAPSHOT")) {
sign(publishing.publications["letsPlotImageExport"])
}
}