2019-06-28 16:22:11 +03:00
|
|
|
plugins {
|
2020-09-05 14:17:04 +03:00
|
|
|
`java-gradle-plugin`
|
2019-06-28 16:22:11 +03:00
|
|
|
`kotlin-dsl`
|
|
|
|
`maven-publish`
|
2021-02-16 22:58:16 +03:00
|
|
|
signing
|
2021-03-08 22:00:06 +03:00
|
|
|
id("org.jetbrains.changelog") version "1.1.2"
|
2021-04-26 19:17:11 +03:00
|
|
|
id("org.jetbrains.dokka") version "1.4.32"
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
|
|
|
|
2020-08-20 10:02:28 +03:00
|
|
|
group = "ru.mipt.npm"
|
2021-05-08 13:57:46 +03:00
|
|
|
version = "0.9.6"
|
2021-02-16 18:19:22 +03:00
|
|
|
|
|
|
|
description = "Build tools for DataForge and kscience projects"
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2021-04-26 19:17:11 +03:00
|
|
|
changelog{
|
|
|
|
version = project.version.toString()
|
|
|
|
}
|
|
|
|
|
2019-06-28 16:22:11 +03:00
|
|
|
repositories {
|
2021-04-14 18:18:53 +03:00
|
|
|
mavenCentral()
|
2019-06-28 16:22:11 +03:00
|
|
|
gradlePluginPortal()
|
2021-02-19 21:25:05 +03:00
|
|
|
maven("https://repo.kotlin.link")
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
|
|
|
|
2021-04-26 19:17:11 +03:00
|
|
|
val kotlinVersion = "1.5.0"
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2019-11-20 10:41:37 +03:00
|
|
|
java {
|
2019-11-20 12:25:02 +03:00
|
|
|
targetCompatibility = JavaVersion.VERSION_1_8
|
2019-11-20 10:41:37 +03:00
|
|
|
}
|
|
|
|
|
2019-06-28 16:22:11 +03:00
|
|
|
// Add plugins used in buildSrc as dependencies, also we should specify version only here
|
|
|
|
dependencies {
|
|
|
|
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
2019-07-20 20:39:26 +03:00
|
|
|
implementation("org.jetbrains.kotlin:kotlin-serialization:$kotlinVersion")
|
2021-04-26 19:17:11 +03:00
|
|
|
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.16.1")
|
|
|
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:1.4.32")
|
2021-03-08 22:00:06 +03:00
|
|
|
implementation("org.jetbrains.intellij.plugins:gradle-changelog-plugin:1.1.2")
|
2021-03-22 22:46:59 +03:00
|
|
|
implementation("org.jetbrains.kotlinx:binary-compatibility-validator:0.5.0")
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
|
|
|
|
2021-03-07 09:22:48 +03:00
|
|
|
project.extensions.findByType<GradlePluginDevelopmentExtension>()?.apply {
|
2019-06-28 16:22:11 +03:00
|
|
|
plugins {
|
2021-02-21 12:11:54 +03:00
|
|
|
create("common") {
|
|
|
|
id = "ru.mipt.npm.gradle.common"
|
2020-11-25 12:16:09 +03:00
|
|
|
description = "The generalized kscience plugin that works in conjunction with any kotlin plugin"
|
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceCommonPlugin"
|
|
|
|
}
|
2020-11-27 15:10:15 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("project") {
|
|
|
|
id = "ru.mipt.npm.gradle.project"
|
2020-09-22 16:21:09 +03:00
|
|
|
description = "The root plugin for multimodule project infrastructure"
|
2020-09-25 09:55:01 +03:00
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceProjectPlugin"
|
2020-09-10 11:38:57 +03:00
|
|
|
}
|
2020-11-27 15:10:15 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("mpp") {
|
|
|
|
id = "ru.mipt.npm.gradle.mpp"
|
2019-06-28 16:22:11 +03:00
|
|
|
description = "Pre-configured multiplatform project"
|
2020-08-20 10:02:28 +03:00
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceMPPlugin"
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
2019-07-21 17:40:08 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("jvm") {
|
|
|
|
id = "ru.mipt.npm.gradle.jvm"
|
2019-07-21 17:40:08 +03:00
|
|
|
description = "Pre-configured JVM project"
|
2020-08-20 10:02:28 +03:00
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceJVMPlugin"
|
2019-07-21 17:40:08 +03:00
|
|
|
}
|
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("js") {
|
|
|
|
id = "ru.mipt.npm.gradle.js"
|
2019-07-21 17:40:08 +03:00
|
|
|
description = "Pre-configured JS project"
|
2020-08-20 10:02:28 +03:00
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceJSPlugin"
|
|
|
|
}
|
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("native") {
|
|
|
|
id = "ru.mipt.npm.gradle.native"
|
2020-08-20 10:02:28 +03:00
|
|
|
description = "Additional native targets to be use alongside mpp"
|
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceNativePlugin"
|
|
|
|
}
|
2020-09-30 20:43:02 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
create("node") {
|
|
|
|
id = "ru.mipt.npm.gradle.node"
|
2020-09-30 20:43:02 +03:00
|
|
|
description = "Additional nodejs target to be use alongside mpp"
|
|
|
|
implementationClass = "ru.mipt.npm.gradle.KScienceNodePlugin"
|
|
|
|
}
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
afterEvaluate {
|
|
|
|
publishing {
|
|
|
|
val vcs = "https://github.com/mipt-npm/gradle-tools"
|
2021-02-16 22:58:16 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
val sourcesJar: Jar by tasks.creating(Jar::class) {
|
|
|
|
archiveClassifier.set("sources")
|
|
|
|
from(sourceSets.named("main").get().allSource)
|
|
|
|
}
|
2021-02-16 22:58:16 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
val javadocsJar: Jar by tasks.creating(Jar::class) {
|
|
|
|
group = "documentation"
|
|
|
|
archiveClassifier.set("javadoc")
|
|
|
|
from(tasks.dokkaHtml)
|
|
|
|
}
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
// Process each publication we have in this project
|
|
|
|
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
|
|
|
publication.apply {
|
|
|
|
artifact(sourcesJar)
|
|
|
|
artifact(javadocsJar)
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
pom {
|
|
|
|
name.set(project.name)
|
|
|
|
description.set(project.description)
|
|
|
|
url.set(vcs)
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
licenses {
|
|
|
|
license {
|
|
|
|
name.set("The Apache Software License, Version 2.0")
|
|
|
|
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
|
|
|
|
distribution.set("repo")
|
|
|
|
}
|
|
|
|
}
|
|
|
|
developers {
|
|
|
|
developer {
|
|
|
|
id.set("MIPT-NPM")
|
|
|
|
name.set("MIPT nuclear physics methods laboratory")
|
|
|
|
organization.set("MIPT")
|
|
|
|
organizationUrl.set("http://npm.mipt.ru")
|
|
|
|
}
|
2021-02-16 22:58:16 +03:00
|
|
|
|
|
|
|
}
|
2021-02-21 12:11:54 +03:00
|
|
|
scm {
|
|
|
|
url.set(vcs)
|
|
|
|
tag.set(project.version.toString())
|
2021-02-16 22:58:16 +03:00
|
|
|
}
|
|
|
|
}
|
2019-06-28 16:22:11 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
val spaceRepo: String = "https://maven.pkg.jetbrains.space/mipt-npm/p/mipt-npm/maven"
|
2021-03-07 09:22:48 +03:00
|
|
|
val spaceUser: String? = project.findProperty("publishing.space.user") as? String
|
|
|
|
val spaceToken: String? = project.findProperty("publishing.space.token") as? String
|
2021-02-21 12:11:54 +03:00
|
|
|
|
|
|
|
if (spaceUser != null && spaceToken != null) {
|
|
|
|
project.logger.info("Adding mipt-npm Space publishing to project [${project.name}]")
|
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = "space"
|
|
|
|
url = uri(spaceRepo)
|
|
|
|
credentials {
|
|
|
|
username = spaceUser
|
|
|
|
password = spaceToken
|
|
|
|
}
|
2021-02-17 10:14:16 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
}
|
2021-02-17 10:14:16 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-03-07 09:22:48 +03:00
|
|
|
val sonatypeUser: String? = project.findProperty("publishing.sonatype.user") as? String
|
|
|
|
val sonatypePassword: String? = project.findProperty("publishing.sonatype.password") as? String
|
2021-02-16 18:19:22 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
if (sonatypeUser != null && sonatypePassword != null) {
|
|
|
|
val sonatypeRepo: String = if (project.version.toString().contains("dev")) {
|
|
|
|
"https://oss.sonatype.org/content/repositories/snapshots"
|
|
|
|
} else {
|
|
|
|
"https://oss.sonatype.org/service/local/staging/deploy/maven2"
|
|
|
|
}
|
2021-02-17 10:14:16 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
if (plugins.findPlugin("signing") == null) {
|
|
|
|
plugins.apply("signing")
|
|
|
|
}
|
2021-02-17 10:14:16 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
repositories {
|
|
|
|
maven {
|
|
|
|
name = "sonatype"
|
|
|
|
url = uri(sonatypeRepo)
|
|
|
|
credentials {
|
|
|
|
username = sonatypeUser
|
|
|
|
password = sonatypePassword
|
|
|
|
}
|
2020-09-05 14:17:04 +03:00
|
|
|
}
|
|
|
|
}
|
2021-02-21 12:11:54 +03:00
|
|
|
signing {
|
|
|
|
//useGpgCmd()
|
|
|
|
sign(publications)
|
|
|
|
}
|
2021-02-17 10:14:16 +03:00
|
|
|
}
|
2021-02-16 22:58:16 +03:00
|
|
|
}
|
2019-06-28 16:22:11 +03:00
|
|
|
|
2021-02-21 12:11:54 +03:00
|
|
|
}
|
2019-06-28 16:22:11 +03:00
|
|
|
|