Skip to content

Commit 3bae601

Browse files
authored
Merge pull request #8 from mipt-npm/dev
0.8.0
2 parents cf1f5bf + e54da4c commit 3bae601

File tree

9 files changed

+402
-328
lines changed

9 files changed

+402
-328
lines changed

CHANGELOG.md

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,28 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
77

88
## [Unreleased]
99
### Added
10+
11+
### Changed
12+
13+
### Deprecated
14+
15+
### Removed
16+
17+
### Fixed
18+
19+
### Security
20+
## [0.8.0]
21+
### Added
1022
- Ktor version to versions
1123
- Add sonatype publishing
24+
- Per-platform release publishing
1225

1326
### Changed
14-
- Kotlin to 1.4.30 stable
15-
- Added intermediate jsCommon main/test sourcesSet for node plugin
27+
- Kotlin to 1.4.30 stable.
28+
- Added intermediate jsCommon main/test sourcesSet for node plugin.
29+
- Plugin names changed to `ru.mipt.npm` package.
30+
- Common plugin id changed to `common`
31+
- Plugins group changed to `ru.mipt.npm` with `gradle` prefix
1632

1733
### Deprecated
1834

README.md

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,29 @@
11
# KScience build tools
22

3-
A collection of gradle plugins for building and publishin *kscience* and *dataforge* projects.
3+
A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects.
44

5-
## ru.mipt.npm.kscience
5+
## ru.mipt.npm.gradle.common
66
A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target.
77

8-
## ru.mipt.npm.project
8+
## ru.mipt.npm.gradle.project
99
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
1010

11-
## ru.mipt.npm.publish
11+
## ru.mipt.npm.gradle.publish
1212
Enables publishing to maven-central, bintray, Space and github.
1313

14-
## ru.mipt.npm.mpp
15-
`= kotlin("multiplatform") + ru.mipt.npm.kscience`
14+
## ru.mipt.npm.gradle.mpp
15+
`= kotlin("multiplatform") + ru.mipt.npm.gradle.common`
1616

1717
Includes JVM-IR and JS-IR-Browser targets.
1818

19-
## ru.mipt.npm.jvm
20-
`= kotlin("jvm") + ru.mipt.npm.kscience`
19+
## ru.mipt.npm.gradle.jvm
20+
`= kotlin("jvm") + ru.mipt.npm.gradle.common`
2121

22-
## ru.mipt.npm.js
23-
`= kotlin("js + ru.mipt.npm.kscience`
22+
## ru.mipt.npm.gradle.js
23+
`= kotlin("js") + ru.mipt.npm.gradle.common`
2424

25-
## ru.mipt.npm.native
26-
add default native targets to `ru.mipt.npm.mpp`
25+
## ru.mipt.npm.gradle.native
26+
add default native targets to `ru.mipt.npm.gradle.mpp`
2727

28-
## ru.mipt.npm.node
29-
add node target to `ru.mipt.npm.mpp`
28+
## ru.mipt.npm.gradle.node
29+
add node target to `ru.mipt.npm.gradle.mpp`

build.gradle.kts

Lines changed: 107 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -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

910
group = "ru.mipt.npm"
10-
version = "0.7.7"
11+
version = "0.8.0"
1112

1213
description = "Build tools for DataForge and kscience projects"
1314

1415
repositories {
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

2225
val 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-

src/main/kotlin/ru/mipt/npm/gradle/KScienceExtension.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ class KScienceExtension(val project: Project) {
128128
}
129129

130130
fun publish() {
131-
project.plugins.apply(KSciencePublishPlugin::class)
131+
project.plugins.apply(KSciencePublishingPlugin::class)
132132
}
133133
}
134134

0 commit comments

Comments
 (0)