1+ import jetbrains.sign.GpgSignSignatoryProvider
12import org.gradle.jvm.tasks.Jar
23import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
34import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
45
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+
535plugins {
636 kotlin(" multiplatform" ) version " 1.9.22"
37+ id(" io.github.gradle-nexus.publish-plugin" ) version " 1.1.0"
38+ `maven- publish`
39+ signing
740}
841
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+
954kotlin {
1055 androidNativeArm32()
1156 androidNativeArm64()
@@ -62,12 +107,14 @@ kotlin {
62107 }
63108 }
64109
65- val nonJvmMain by creating {}
110+ val nonJvmMain by creating {
111+ dependsOn(commonMain)
112+ }
66113 }
67114
68115 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" ))
71118 }
72119 }
73120
@@ -133,4 +180,51 @@ tasks {
133180 into(" META-INF/versions/9/" )
134181 }
135182 }
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