Plugin ids update.

This commit is contained in:
Alexander Nozik 2020-09-05 14:17:04 +03:00
parent 4dbc21e5c0
commit 65ab0e75d3
6 changed files with 120 additions and 72 deletions

View File

@ -1,14 +1,14 @@
import java.util.* import java.util.*
plugins { plugins {
`java-gradle-plugin`
`kotlin-dsl` `kotlin-dsl`
`maven-publish` `maven-publish`
id("com.jfrog.bintray") version "1.8.5"
id("org.jetbrains.changelog") version "0.4.0" id("org.jetbrains.changelog") version "0.4.0"
} }
group = "ru.mipt.npm" group = "ru.mipt.npm"
version = "0.6.0-dev-1" version = "0.6.0-dev-3"
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
@ -28,44 +28,44 @@ dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion") implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.4") implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.4")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.0-rc") implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.0")
implementation("org.jetbrains.dokka:dokka-core:1.4.0-rc") implementation("org.jetbrains.dokka:dokka-core:1.4.0")
} }
gradlePlugin { gradlePlugin {
plugins { plugins {
create("kscience-publish") { create("kscience.publish") {
id = "kscience.publish" id = "ru.mipt.npm.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.KSciencePublishPlugin"
} }
create("kscience.mpp") { create("kscience.mpp") {
id = "kscience.mpp" id = "ru.mipt.npm.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("kscience.jvm") {
id = "kscience.jvm" id = "ru.mipt.npm.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("kscience.js") {
id = "kscience.js" id = "ru.mipt.npm.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("kscience.native") {
id = "kscience.native" id = "ru.mipt.npm.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("kscience.node") {
id = "kscience.node" id = "ru.mipt.npm.node"
description = "NodeJS target for kotlin-mpp and kotlin-js" description = "NodeJS target for kotlin-mpp and kotlin-js"
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin" implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin"
} }
@ -74,7 +74,7 @@ gradlePlugin {
publishing { publishing {
repositories { repositories {
maven("https://bintray.com/mipt-npm/scientifik") maven("https://bintray.com/mipt-npm/kscience")
} }
val vcs = "https://github.com/mipt-npm/scientifik-gradle-tools" val vcs = "https://github.com/mipt-npm/scientifik-gradle-tools"
@ -105,38 +105,67 @@ publishing {
} }
scm { scm {
url.set(vcs) url.set(vcs)
tag.set(project.version.toString())
} }
} }
} }
bintray { val bintrayUser: String? by project
user = project.findProperty("bintrayUser") as? String ?: System.getenv("BINTRAY_USER") val bintrayApiKey: String? by project
key = project.findProperty("bintrayApiKey") as? String? ?: System.getenv("BINTRAY_API_KEY")
publish = true
override = true // for multi-platform Kotlin/Native publishing
// We have to use delegateClosureOf because bintray supports only dynamic groovy syntax val bintrayRepo = if (project.version.toString().contains("dev")) {
// this is a problem of this plugin "dev"
pkg.apply { } else {
userOrg = "mipt-npm" findProperty("bintrayRepo") as? String
repo = if (project.version.toString().contains("dev")) "dev" else "kscience" }
name = project.name
issueTrackerUrl = "$vcs/issues" val projectName = project.name
setLicenses("Apache-2.0")
vcsUrl = vcs if (bintrayRepo != null && bintrayUser != null && bintrayApiKey != null) {
version.apply { repositories {
name = project.version.toString() maven {
vcsTag = project.version.toString() name = "bintray"
released = Date().toString() url = uri(
"https://api.bintray.com/maven/mipt-npm/$bintrayRepo/$projectName/;publish=1;override=1"
)
credentials {
username = bintrayUser
password = bintrayApiKey
}
} }
} }
//workaround bintray bug
project.afterEvaluate {
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
}
} }
} }
// bintray {
// user = project.findProperty("bintrayUser") as? String ?: System.getenv("BINTRAY_USER")
// key = project.findProperty("bintrayApiKey") as? String? ?: System.getenv("BINTRAY_API_KEY")
// publish = true
// override = true // for multi-platform Kotlin/Native publishing
//
// // We have to use delegateClosureOf because bintray supports only dynamic groovy syntax
// // this is a problem of this plugin
// pkg.apply {
// userOrg = "mipt-npm"
// repo = if (project.version.toString().contains("dev")) "dev" else "kscience"
// name = project.name
// issueTrackerUrl = "$vcs/issues"
// setLicenses("Apache-2.0")
// vcsUrl = vcs
// version.apply {
// name = project.version.toString()
// vcsTag = project.version.toString()
// released = Date().toString()
// }
// }
//
// //workaround bintray bug
// project.afterEvaluate {
// setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
// }
//
// }
//}

View File

@ -45,6 +45,23 @@ class KScienceExtension(val project: Project) {
SerializationTargets(sourceSet, configuration).apply(block) SerializationTargets(sourceSet, configuration).apply(block)
} }
fun useAtomic(
version: String = KScienceVersions.atomicVersion,
sourceSet: DependencySourceSet = DependencySourceSet.MAIN,
configuration: DependencyConfiguration = DependencyConfiguration.IMPLEMENTATION
): Unit = project.run {
plugins.apply("kotlinx-atomicfu")
useCommonDependency(
"org.jetbrains.kotlinx:atomicfu-common:$version",
dependencySourceSet = sourceSet,
dependencyConfiguration = configuration
)
}
fun useDokka(): Unit = project.run {
plugins.apply("org.jetbrains.dokka")
}
/** /**
* Mark this module as an application module. JVM application should be enabled separately * Mark this module as an application module. JVM application should be enabled separately
*/ */
@ -52,13 +69,16 @@ class KScienceExtension(val project: Project) {
project.extensions.findByType<KotlinProjectExtension>()?.apply { project.extensions.findByType<KotlinProjectExtension>()?.apply {
explicitApi = null explicitApi = null
} }
project.pluginManager.withPlugin("org.jetbrains.kotlin.jvm"){
project.plugins.apply("org.gradle.application")
}
project.extensions.findByType<KotlinJsProjectExtension>()?.apply { project.extensions.findByType<KotlinJsProjectExtension>()?.apply {
js { js {
binaries.executable() binaries.executable()
} }
} }
project.extensions.findByType<KotlinMultiplatformExtension>()?.apply { project.extensions.findByType<KotlinMultiplatformExtension>()?.apply {
js{ js {
binaries.executable() binaries.executable()
} }
} }
@ -67,7 +87,7 @@ class KScienceExtension(val project: Project) {
/** /**
* Activate publishing and configure it * Activate publishing and configure it
*/ */
fun publishing(block: Publishing.() -> Unit) = Publishing().apply(block) fun publish(block: Publishing.() -> Unit = {}) = Publishing().apply(block)
inner class Publishing { inner class Publishing {
init { init {

View File

@ -61,17 +61,17 @@ open class KScienceJVMPlugin : Plugin<Project> {
} }
} }
pluginManager.withPlugin("org.jetbrains.dokka") { // pluginManager.withPlugin("org.jetbrains.dokka") {
logger.info("Adding dokka functionality to project ${project.name}") // logger.info("Adding dokka functionality to project ${project.name}")
val dokkaHtml by tasks.getting(DokkaTask::class){ // val dokkaHtml by tasks.getting(DokkaTask::class){
dokkaSourceSets { // dokkaSourceSets {
configureEach { // configureEach {
jdkVersion = 11 // jdkVersion.set(11)
} // }
} // }
} // }
} // }
} }
} }

View File

@ -70,29 +70,29 @@ open class KScienceMPPlugin : Plugin<Project> {
} }
} }
pluginManager.withPlugin("org.jetbrains.dokka") { // pluginManager.withPlugin("org.jetbrains.dokka") {
logger.info("Adding dokka functionality to project ${this@run.name}") // logger.info("Adding dokka functionality to project ${this@run.name}")
//
val dokkaHtml by tasks.getting(DokkaTask::class) { // val dokkaHtml by tasks.getting(DokkaTask::class) {
dokkaSourceSets { // dokkaSourceSets {
register("commonMain") { // register("commonMain") {
displayName = "common" // displayName = "common"
platform = "common" // platform = "common"
} // }
register("jvmMain") { // register("jvmMain") {
displayName = "jvm" // displayName = "jvm"
platform = "jvm" // platform = "jvm"
} // }
register("jsMain") { // register("jsMain") {
displayName = "js" // displayName = "js"
platform = "js" // platform = "js"
} // }
configureEach { // configureEach {
jdkVersion = 11 // jdkVersion = 11
} // }
} // }
} // }
} // }
tasks.apply { tasks.apply {
withType<Test>() { withType<Test>() {

View File

@ -13,7 +13,7 @@ object KScienceVersions {
val JVM_TARGET = JavaVersion.VERSION_11 val JVM_TARGET = JavaVersion.VERSION_11
object Serialization{ object Serialization{
const val xmlVersion = "0.20.0.10"//to be fixed const val xmlVersion = "0.80.0-RC"//to be fixed
const val yamlVersion = "0.16.1" const val yamlVersion = "0.16.1"
const val bsonVersion = "0.2.1" const val bsonVersion = "0.2.1"
} }

View File

@ -25,7 +25,6 @@ internal fun RepositoryHandler.applyRepos(): Unit {
maven("https://dl.bintray.com/kotlin/kotlin-eap") maven("https://dl.bintray.com/kotlin/kotlin-eap")
maven("https://kotlin.bintray.com/kotlinx") maven("https://kotlin.bintray.com/kotlinx")
maven("https://kotlin.bintray.com/kotlin-js-wrappers/") maven("https://kotlin.bintray.com/kotlin-js-wrappers/")
maven("https://dl.bintray.com/mipt-npm/scientifik")
maven("https://dl.bintray.com/mipt-npm/kscience") maven("https://dl.bintray.com/mipt-npm/kscience")
maven("https://dl.bintray.com/mipt-npm/dev") maven("https://dl.bintray.com/mipt-npm/dev")
maven("https://dl.bintray.com/mipt-npm/dataforge") maven("https://dl.bintray.com/mipt-npm/dataforge")