Change package name and fix javadoc and sources publishing
This commit is contained in:
parent
c37ff35b4c
commit
5d20e54ea4
@ -11,8 +11,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Add sonatype publishing
|
- Add sonatype publishing
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
- Kotlin to 1.4.30 stable
|
- Kotlin to 1.4.30 stable.
|
||||||
- Added intermediate jsCommon main/test sourcesSet for node plugin
|
- Added intermediate jsCommon main/test sourcesSet for node plugin.
|
||||||
|
- Plugin names changed to `ru.mipt.npm` package.
|
||||||
|
- Common plugin id changed to `common`
|
||||||
|
- Plugins group changed to `ru.mipt.npm` with `gradle prefix
|
||||||
|
|
||||||
### Deprecated
|
### Deprecated
|
||||||
|
|
||||||
|
26
README.md
26
README.md
@ -2,28 +2,28 @@
|
|||||||
|
|
||||||
A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects.
|
A collection of gradle plugins for building and publish in *kscience* and *dataforge* projects.
|
||||||
|
|
||||||
## ru.mipt.npm.kscience
|
## ru.mipt.npm.gradle.common
|
||||||
A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target.
|
A primary plugin. When used with kotlin-jvm, kotlin-js or kotlin-mulitplatform configures the project for appropriate target.
|
||||||
|
|
||||||
## ru.mipt.npm.project
|
## ru.mipt.npm.gradle.project
|
||||||
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
|
Root project tool including JetBrains changelog plugin an kotlin binary compatibility validator tool.
|
||||||
|
|
||||||
## ru.mipt.npm.publish
|
## ru.mipt.npm.gradle.publish
|
||||||
Enables publishing to maven-central, bintray, Space and github.
|
Enables publishing to maven-central, bintray, Space and github.
|
||||||
|
|
||||||
## ru.mipt.npm.mpp
|
## ru.mipt.npm.gradle.mpp
|
||||||
`= kotlin("multiplatform") + ru.mipt.npm.kscience`
|
`= kotlin("multiplatform") + ru.mipt.npm.gradle.common`
|
||||||
|
|
||||||
Includes JVM-IR and JS-IR-Browser targets.
|
Includes JVM-IR and JS-IR-Browser targets.
|
||||||
|
|
||||||
## ru.mipt.npm.jvm
|
## ru.mipt.npm.gradle.jvm
|
||||||
`= kotlin("jvm") + ru.mipt.npm.kscience`
|
`= kotlin("jvm") + ru.mipt.npm.gradle.common`
|
||||||
|
|
||||||
## ru.mipt.npm.js
|
## ru.mipt.npm.gradle.js
|
||||||
`= kotlin("js + ru.mipt.npm.kscience`
|
`= kotlin("js + ru.mipt.npm.gradle.common`
|
||||||
|
|
||||||
## ru.mipt.npm.native
|
## ru.mipt.npm.gradle.native
|
||||||
add default native targets to `ru.mipt.npm.mpp`
|
add default native targets to `ru.mipt.npm.gradle.mpp`
|
||||||
|
|
||||||
## ru.mipt.npm.node
|
## ru.mipt.npm.gradle.node
|
||||||
add node target to `ru.mipt.npm.mpp`
|
add node target to `ru.mipt.npm.gradle.mpp`
|
@ -8,7 +8,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "ru.mipt.npm"
|
group = "ru.mipt.npm"
|
||||||
version = "0.7.8"
|
version = "0.8.0"
|
||||||
|
|
||||||
description = "Build tools for DataForge and kscience projects"
|
description = "Build tools for DataForge and kscience projects"
|
||||||
|
|
||||||
@ -38,58 +38,59 @@ dependencies {
|
|||||||
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0")
|
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.4.0")
|
||||||
}
|
}
|
||||||
|
|
||||||
gradlePlugin {
|
project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply{
|
||||||
plugins {
|
plugins {
|
||||||
create("kscience.common") {
|
create("common") {
|
||||||
id = "ru.mipt.npm.kscience"
|
id = "ru.mipt.npm.gradle.common"
|
||||||
description = "The generalized kscience plugin that works in conjunction with any kotlin plugin"
|
description = "The generalized kscience plugin that works in conjunction with any kotlin plugin"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.project") {
|
create("project") {
|
||||||
id = "ru.mipt.npm.project"
|
id = "ru.mipt.npm.gradle.project"
|
||||||
description = "The root plugin for multimodule project infrastructure"
|
description = "The root plugin for multimodule project infrastructure"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.publish") {
|
create("publishing") {
|
||||||
id = "ru.mipt.npm.publish"
|
id = "ru.mipt.npm.gradle.publish"
|
||||||
description = "The publication plugin for bintray and github"
|
description = "The publication plugin for bintray and github"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KSciencePublishPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KSciencePublishingPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.mpp") {
|
create("mpp") {
|
||||||
id = "ru.mipt.npm.mpp"
|
id = "ru.mipt.npm.gradle.mpp"
|
||||||
description = "Pre-configured multiplatform project"
|
description = "Pre-configured multiplatform project"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.jvm") {
|
create("jvm") {
|
||||||
id = "ru.mipt.npm.jvm"
|
id = "ru.mipt.npm.gradle.jvm"
|
||||||
description = "Pre-configured JVM project"
|
description = "Pre-configured JVM project"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.js") {
|
create("js") {
|
||||||
id = "ru.mipt.npm.js"
|
id = "ru.mipt.npm.gradle.js"
|
||||||
description = "Pre-configured JS project"
|
description = "Pre-configured JS project"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.native") {
|
create("native") {
|
||||||
id = "ru.mipt.npm.native"
|
id = "ru.mipt.npm.gradle.native"
|
||||||
description = "Additional native targets to be use alongside mpp"
|
description = "Additional native targets to be use alongside mpp"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin"
|
||||||
}
|
}
|
||||||
|
|
||||||
create("kscience.node") {
|
create("node") {
|
||||||
id = "ru.mipt.npm.node"
|
id = "ru.mipt.npm.gradle.node"
|
||||||
description = "Additional nodejs target to be use alongside mpp"
|
description = "Additional nodejs target to be use alongside mpp"
|
||||||
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin"
|
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
afterEvaluate {
|
||||||
publishing {
|
publishing {
|
||||||
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
||||||
|
|
||||||
@ -106,7 +107,6 @@ publishing {
|
|||||||
|
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
||||||
|
|
||||||
publication.apply {
|
publication.apply {
|
||||||
artifact(sourcesJar)
|
artifact(sourcesJar)
|
||||||
artifact(javadocsJar)
|
artifact(javadocsJar)
|
||||||
@ -190,4 +190,5 @@ publishing {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
@ -128,7 +128,7 @@ class KScienceExtension(val project: Project) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
fun publish() {
|
fun publish() {
|
||||||
project.plugins.apply(KSciencePublishPlugin::class)
|
project.plugins.apply(KSciencePublishingPlugin::class)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,6 +1,5 @@
|
|||||||
package ru.mipt.npm.gradle
|
package ru.mipt.npm.gradle
|
||||||
|
|
||||||
import org.gradle.api.GradleException
|
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.*
|
||||||
@ -19,19 +18,6 @@ class KScienceNativePlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
configure<KotlinMultiplatformExtension> {
|
configure<KotlinMultiplatformExtension> {
|
||||||
val ideaActive = System.getProperty("idea.active") == "true"
|
|
||||||
|
|
||||||
if (ideaActive) {
|
|
||||||
//development mode
|
|
||||||
val hostOs = System.getProperty("os.name")
|
|
||||||
|
|
||||||
when {
|
|
||||||
hostOs == "Mac OS X" -> macosX64("native")
|
|
||||||
hostOs == "Linux" -> linuxX64("native")
|
|
||||||
hostOs.startsWith("Windows") -> mingwX64("native")
|
|
||||||
else -> throw GradleException("Host OS is not supported in Kotlin/Native.")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
//deploy mode
|
//deploy mode
|
||||||
linuxX64()
|
linuxX64()
|
||||||
mingwX64()
|
mingwX64()
|
||||||
@ -76,4 +62,3 @@ class KScienceNativePlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
@ -11,16 +11,9 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
|
|||||||
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
|
||||||
|
|
||||||
|
|
||||||
/**
|
open class KSciencePublishingPlugin : Plugin<Project> {
|
||||||
* From https://github.com/Kotlin/kotlinx.serialization/blob/master/buildSrc/src/main/kotlin/Publishing.kt
|
|
||||||
*/
|
|
||||||
private fun Project.getSensitiveProperty(name: String): String? {
|
|
||||||
return project.findProperty(name) as? String ?: System.getenv(name)
|
|
||||||
}
|
|
||||||
|
|
||||||
open class KSciencePublishPlugin : Plugin<Project> {
|
override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.common") {
|
||||||
|
|
||||||
override fun apply(project: Project): Unit = project.plugins.withId("ru.mipt.npm.kscience") {
|
|
||||||
project.afterEvaluate {
|
project.afterEvaluate {
|
||||||
if (plugins.findPlugin("maven-publish") == null) {
|
if (plugins.findPlugin("maven-publish") == null) {
|
||||||
plugins.apply("maven-publish")
|
plugins.apply("maven-publish")
|
||||||
@ -31,12 +24,6 @@ open class KSciencePublishPlugin : Plugin<Project> {
|
|||||||
val vcs = findProperty("vcs") as? String
|
val vcs = findProperty("vcs") as? String
|
||||||
?: githubProject?.let { "https://github.com/$githubOrg/$it" }
|
?: githubProject?.let { "https://github.com/$githubOrg/$it" }
|
||||||
|
|
||||||
// if (vcs == null) {
|
|
||||||
// project.logger.warn("[${project.name}] Missing deployment configuration. Skipping publish.")
|
|
||||||
// return
|
|
||||||
// }
|
|
||||||
|
|
||||||
|
|
||||||
project.configure<PublishingExtension> {
|
project.configure<PublishingExtension> {
|
||||||
plugins.withId("org.jetbrains.kotlin.js") {
|
plugins.withId("org.jetbrains.kotlin.js") {
|
||||||
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
|
val kotlin = extensions.findByType<KotlinJsProjectExtension>()!!
|
||||||
@ -149,7 +136,7 @@ open class KSciencePublishPlugin : Plugin<Project> {
|
|||||||
val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm"
|
val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm"
|
||||||
val bintrayUser: String? by project
|
val bintrayUser: String? by project
|
||||||
val bintrayApiKey: String? by project
|
val bintrayApiKey: String? by project
|
||||||
|
val bintrayPublish: Boolean? by project
|
||||||
|
|
||||||
val bintrayRepo = if (project.version.toString().contains("dev")) {
|
val bintrayRepo = if (project.version.toString().contains("dev")) {
|
||||||
"dev"
|
"dev"
|
||||||
@ -159,7 +146,7 @@ open class KSciencePublishPlugin : Plugin<Project> {
|
|||||||
|
|
||||||
val projectName = project.name
|
val projectName = project.name
|
||||||
|
|
||||||
if (bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) {
|
if (bintrayPublish == true && bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) {
|
||||||
project.logger.info("Adding bintray publishing to project [$projectName]")
|
project.logger.info("Adding bintray publishing to project [$projectName]")
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
@ -181,7 +168,7 @@ open class KSciencePublishPlugin : Plugin<Project> {
|
|||||||
val sonatypePassword: String? by project
|
val sonatypePassword: String? by project
|
||||||
|
|
||||||
val keyId: String? by project
|
val keyId: String? by project
|
||||||
val signingKey: String? = getSensitiveProperty("signingKey")
|
val signingKey: String? = project.findProperty("signingKey") as? String ?: System.getenv("signingKey")
|
||||||
val signingKeyPassphrase: String? by project
|
val signingKeyPassphrase: String? by project
|
||||||
|
|
||||||
if (sonatypePublish == true && sonatypeUser != null && sonatypePassword != null) {
|
if (sonatypePublish == true && sonatypeUser != null && sonatypePassword != null) {
|
Loading…
Reference in New Issue
Block a user