@@ -2,21 +2,24 @@ plugins {
22 `java- gradle- plugin`
33 `kotlin- dsl`
44 `maven- publish`
5- id( " de.marcphilipp.nexus-publish " ) version " 0.4.0 "
5+ signing
66 id(" org.jetbrains.changelog" ) version " 1.0.0"
7+ id(" org.jetbrains.dokka" ) version " 1.4.20"
78}
89
910group = " ru.mipt.npm"
10- version = " 0.7.7 "
11+ version = " 0.8.0 "
1112
1213description = " Build tools for DataForge and kscience projects"
1314
1415repositories {
1516 gradlePluginPortal()
1617 jcenter()
18+ maven(" https://repo.kotlin.link" )
1719 maven(" https://kotlin.bintray.com/kotlinx" )
1820 maven(" https://dl.bintray.com/kotlin/kotlin-eap" )
1921 maven(" https://dl.bintray.com/kotlin/kotlin-dev" )
22+
2023}
2124
2225val kotlinVersion = " 1.4.30"
@@ -31,111 +34,161 @@ dependencies {
3134 implementation(" org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion " )
3235 implementation(" org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.15.1" )
3336 implementation(" org.jetbrains.dokka:dokka-gradle-plugin:1.4.20" )
34- implementation(" org.jetbrains.dokka:dokka-base:1.4.20" )
3537 implementation(" org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.0.0" )
3638 implementation(" org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0" )
3739}
3840
39- gradlePlugin {
41+ project.extensions.findByType< GradlePluginDevelopmentExtension >()?. apply {
4042 plugins {
41- create(" kscience. common" ){
42- id = " ru.mipt.npm.kscience "
43+ create(" common" ) {
44+ id = " ru.mipt.npm.gradle.common "
4345 description = " The generalized kscience plugin that works in conjunction with any kotlin plugin"
4446 implementationClass = " ru.mipt.npm.gradle.KScienceCommonPlugin"
4547 }
4648
47- create(" kscience. project" ){
48- id = " ru.mipt.npm.project"
49+ create(" project" ) {
50+ id = " ru.mipt.npm.gradle. project"
4951 description = " The root plugin for multimodule project infrastructure"
5052 implementationClass = " ru.mipt.npm.gradle.KScienceProjectPlugin"
5153 }
5254
53- create(" kscience.publish " ) {
54- id = " ru.mipt.npm.publish"
55+ create(" publishing " ) {
56+ id = " ru.mipt.npm.gradle. publish"
5557 description = " The publication plugin for bintray and github"
56- implementationClass = " ru.mipt.npm.gradle.KSciencePublishPlugin "
58+ implementationClass = " ru.mipt.npm.gradle.KSciencePublishingPlugin "
5759 }
5860
59- create(" kscience. mpp" ) {
60- id = " ru.mipt.npm.mpp"
61+ create(" mpp" ) {
62+ id = " ru.mipt.npm.gradle. mpp"
6163 description = " Pre-configured multiplatform project"
6264 implementationClass = " ru.mipt.npm.gradle.KScienceMPPlugin"
6365 }
6466
65- create(" kscience. jvm" ) {
66- id = " ru.mipt.npm.jvm"
67+ create(" jvm" ) {
68+ id = " ru.mipt.npm.gradle. jvm"
6769 description = " Pre-configured JVM project"
6870 implementationClass = " ru.mipt.npm.gradle.KScienceJVMPlugin"
6971 }
7072
71- create(" kscience. js" ) {
72- id = " ru.mipt.npm.js"
73+ create(" js" ) {
74+ id = " ru.mipt.npm.gradle. js"
7375 description = " Pre-configured JS project"
7476 implementationClass = " ru.mipt.npm.gradle.KScienceJSPlugin"
7577 }
7678
77- create(" kscience. native" ) {
78- id = " ru.mipt.npm.native"
79+ create(" native" ) {
80+ id = " ru.mipt.npm.gradle. native"
7981 description = " Additional native targets to be use alongside mpp"
8082 implementationClass = " ru.mipt.npm.gradle.KScienceNativePlugin"
8183 }
8284
83- create(" kscience. node" ) {
84- id = " ru.mipt.npm.node"
85+ create(" node" ) {
86+ id = " ru.mipt.npm.gradle. node"
8587 description = " Additional nodejs target to be use alongside mpp"
8688 implementationClass = " ru.mipt.npm.gradle.KScienceNodePlugin"
8789 }
8890 }
8991}
9092
91- publishing {
92- val vcs = " https://github.com/mipt-npm/scientifik-gradle-tools"
93+ afterEvaluate {
94+ publishing {
95+ val vcs = " https://github.com/mipt-npm/gradle-tools"
9396
94- // Process each publication we have in this project
95- publications.filterIsInstance<MavenPublication >().forEach { publication ->
97+ val sourcesJar: Jar by tasks.creating(Jar ::class ) {
98+ archiveClassifier.set(" sources" )
99+ from(sourceSets.named(" main" ).get().allSource)
100+ }
96101
97- publication.pom {
98- name.set(project.name)
99- description.set(project.description)
100- url.set(vcs)
102+ val javadocsJar: Jar by tasks.creating(Jar ::class ) {
103+ group = " documentation"
104+ archiveClassifier.set(" javadoc" )
105+ from(tasks.dokkaHtml)
106+ }
101107
102- licenses {
103- license {
104- name.set(" The Apache Software License, Version 2.0" )
105- url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
106- distribution.set(" repo" )
108+ // Process each publication we have in this project
109+ publications.filterIsInstance<MavenPublication >().forEach { publication ->
110+ publication.apply {
111+ artifact(sourcesJar)
112+ artifact(javadocsJar)
113+
114+ pom {
115+ name.set(project.name)
116+ description.set(project.description)
117+ url.set(vcs)
118+
119+ licenses {
120+ license {
121+ name.set(" The Apache Software License, Version 2.0" )
122+ url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
123+ distribution.set(" repo" )
124+ }
125+ }
126+ developers {
127+ developer {
128+ id.set(" MIPT-NPM" )
129+ name.set(" MIPT nuclear physics methods laboratory" )
130+ organization.set(" MIPT" )
131+ organizationUrl.set(" http://npm.mipt.ru" )
132+ }
133+
134+ }
135+ scm {
136+ url.set(vcs)
137+ tag.set(project.version.toString())
138+ }
107139 }
108140 }
109- developers {
110- developer {
111- id.set(" MIPT-NPM" )
112- name.set(" MIPT nuclear physics methods laboratory" )
113- organization.set(" MIPT" )
114- organizationUrl.set(" http://npm.mipt.ru" )
115- }
141+ }
116142
117- }
118- scm {
119- url.set(vcs)
120- tag.set(project.version.toString())
143+ val spaceRepo: String = " https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven"
144+ val spaceUser: String? by project
145+ val spaceToken: String? by project
146+
147+ if (spaceUser != null && spaceToken != null ) {
148+ project.logger.info(" Adding mipt-npm Space publishing to project [${project.name} ]" )
149+ repositories {
150+ maven {
151+ name = " space"
152+ url = uri(spaceRepo)
153+ credentials {
154+ username = spaceUser
155+ password = spaceToken
156+ }
157+
158+ }
121159 }
122160 }
123- }
124161
125- val sonatypeUser: String? by project
126- val sonatypePassword: String? by project
162+ val sonatypeUser: String? by project
163+ val sonatypePassword: String? by project
164+
165+ if (sonatypeUser != null && sonatypePassword != null ) {
166+ val sonatypeRepo: String = if (project.version.toString().contains(" dev" )) {
167+ " https://oss.sonatype.org/content/repositories/snapshots"
168+ } else {
169+ " https://oss.sonatype.org/service/local/staging/deploy/maven2"
170+ }
171+
172+ if (plugins.findPlugin(" signing" ) == null ) {
173+ plugins.apply (" signing" )
174+ }
127175
128- if (sonatypeUser != null && sonatypePassword != null ) {
129- nexusPublishing {
130176 repositories {
131- sonatype{
132- username.set(sonatypeUser)
133- password.set(sonatypePassword)
177+ maven {
178+ name = " sonatype"
179+ url = uri(sonatypeRepo)
180+ credentials {
181+ username = sonatypeUser
182+ password = sonatypePassword
183+ }
134184 }
135185 }
186+ signing {
187+ // useGpgCmd()
188+ sign(publications)
189+ }
136190 }
137191 }
138192
139193}
140194
141-
0 commit comments