1
+ import jetbrains.sign.GpgSignSignatoryProvider
1
2
import org.gradle.jvm.tasks.Jar
2
3
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
3
4
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
4
5
6
+ /*
7
+ * Copyright 2000-2021 JetBrains s.r.o.
8
+ *
9
+ * Licensed under the Apache License, Version 2.0 (the "License");
10
+ * you may not use this file except in compliance with the License.
11
+ * You may obtain a copy of the License at
12
+ *
13
+ * https://www.apache.org/licenses/LICENSE-2.0
14
+ *
15
+ * Unless required by applicable law or agreed to in writing, software
16
+ * distributed under the License is distributed on an "AS IS" BASIS,
17
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18
+ * See the License for the specific language governing permissions and
19
+ * limitations under the License.
20
+ */
21
+
22
+ buildscript {
23
+ repositories {
24
+ maven { url = uri(" https://packages.jetbrains.team/maven/p/jcs/maven" ) }
25
+ }
26
+ dependencies {
27
+ classpath(" com.jetbrains:jet-sign:38" )
28
+ }
29
+ }
30
+
31
+ repositories {
32
+ mavenCentral()
33
+ }
34
+
5
35
plugins {
6
36
kotlin(" multiplatform" ) version " 1.9.22"
37
+ id(" io.github.gradle-nexus.publish-plugin" ) version " 1.1.0"
38
+ `maven- publish`
39
+ signing
7
40
}
8
41
42
+ var projectVersion = project.findProperty(" projectVersion" ) as String
43
+ val publishingUser: String? = System .getenv(" PUBLISHING_USER" )
44
+ val publishingPassword: String? = System .getenv(" PUBLISHING_PASSWORD" )
45
+ if (publishingPassword == null ) {
46
+ projectVersion + = " -SNAPSHOT"
47
+ }
48
+ println (" ##teamcity[setParameter name='java.annotations.version' value='$projectVersion ']" )
49
+
50
+ // https://github.com/gradle/gradle/issues/847
51
+ group = " org.jetbrains.proto"
52
+ version = projectVersion
53
+
9
54
kotlin {
10
55
androidNativeArm32()
11
56
androidNativeArm64()
@@ -62,12 +107,14 @@ kotlin {
62
107
}
63
108
}
64
109
65
- val nonJvmMain by creating {}
110
+ val nonJvmMain by creating {
111
+ dependsOn(commonMain)
112
+ }
66
113
}
67
114
68
115
targets.onEach {
69
- if (it.platformType != KotlinPlatformType .jvm) {
70
- it.compilations.getByName(" main" ).source (sourceSets.getByName(" nonJvmMain" ))
116
+ if (it.platformType != KotlinPlatformType .jvm && it.platformType != KotlinPlatformType .common ) {
117
+ it.compilations.getByName(" main" ).defaultSourceSet.dependsOn (sourceSets.getByName(" nonJvmMain" ))
71
118
}
72
119
}
73
120
@@ -133,4 +180,51 @@ tasks {
133
180
into(" META-INF/versions/9/" )
134
181
}
135
182
}
136
- }
183
+ }
184
+
185
+ nexusPublishing {
186
+ repositories {
187
+ sonatype {
188
+ username.set(publishingUser)
189
+ password.set(publishingPassword)
190
+ }
191
+ }
192
+ }
193
+
194
+ publishing {
195
+ publications.withType(MavenPublication ::class ) {
196
+ group = " org.jetbrains"
197
+ version = rootProject.version as String
198
+
199
+ pom {
200
+ name.set(" JetBrains Java Annotations" )
201
+ description.set(" A set of annotations used for code inspection support and code documentation." )
202
+ url.set(" https://github.com/JetBrains/java-annotations" )
203
+ scm {
204
+ url.set(" https://github.com/JetBrains/java-annotations" )
205
+ connection.set(" scm:git:git://github.com/JetBrains/java-annotations.git" )
206
+ developerConnection.set(" scm:git:ssh://github.com:JetBrains/java-annotations.git" )
207
+ }
208
+ licenses {
209
+ license {
210
+ name.set(" The Apache Software License, Version 2.0" )
211
+ url.set(" https://www.apache.org/licenses/LICENSE-2.0.txt" )
212
+ distribution.set(" repo" )
213
+ }
214
+ }
215
+ developers {
216
+ developer {
217
+ id.set(" JetBrains" )
218
+ name.set(" JetBrains Team" )
219
+ organization.set(" JetBrains" )
220
+ organizationUrl.set(" https://www.jetbrains.com" )
221
+ }
222
+ }
223
+ }
224
+ }
225
+ }
226
+
227
+ signing {
228
+ sign(publishing.publications)
229
+ signatories = GpgSignSignatoryProvider ()
230
+ }
0 commit comments