New deploy model
This commit is contained in:
parent
e00642bb34
commit
50020082a8
@ -7,7 +7,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "scientifik"
|
group = "scientifik"
|
||||||
version = "0.3.2"
|
version = "0.4.0"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
gradlePluginPortal()
|
gradlePluginPortal()
|
||||||
@ -16,7 +16,7 @@ repositories {
|
|||||||
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
||||||
}
|
}
|
||||||
|
|
||||||
val kotlinVersion = "1.3.61"
|
val kotlinVersion = "1.3.70"
|
||||||
|
|
||||||
java {
|
java {
|
||||||
targetCompatibility = JavaVersion.VERSION_1_8
|
targetCompatibility = JavaVersion.VERSION_1_8
|
||||||
@ -26,11 +26,8 @@ java {
|
|||||||
dependencies {
|
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:kotlinx-metadata-jvm:0.1.0")
|
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.2")
|
||||||
implementation("org.jetbrains.kotlinx:atomicfu-gradle-plugin:0.14.1")
|
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.1")
|
||||||
implementation("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
|
||||||
implementation("org.jetbrains.dokka:dokka-gradle-plugin:0.10.0")
|
|
||||||
implementation("org.jfrog.buildinfo:build-info-extractor-gradle:4.10.0")
|
|
||||||
}
|
}
|
||||||
|
|
||||||
gradlePlugin {
|
gradlePlugin {
|
||||||
|
@ -2,9 +2,7 @@
|
|||||||
* Build constants
|
* Build constants
|
||||||
*/
|
*/
|
||||||
object Scientifik {
|
object Scientifik {
|
||||||
const val ioVersion = "0.1.15"
|
const val coroutinesVersion = "1.3.4"
|
||||||
const val coroutinesVersion = "1.3.3"
|
const val serializationVersion = "0.20.0"
|
||||||
const val atomicfuVersion = "0.14.1"
|
|
||||||
const val serializationVersion = "0.14.0"
|
|
||||||
const val JVM_VERSION = "11"
|
const val JVM_VERSION = "11"
|
||||||
}
|
}
|
||||||
|
@ -1,14 +1,14 @@
|
|||||||
package scientifik
|
package scientifik
|
||||||
|
|
||||||
import com.jfrog.bintray.gradle.BintrayExtension
|
|
||||||
import com.jfrog.bintray.gradle.tasks.BintrayUploadTask
|
|
||||||
import org.gradle.api.Plugin
|
import org.gradle.api.Plugin
|
||||||
import org.gradle.api.Project
|
import org.gradle.api.Project
|
||||||
import org.gradle.api.publish.PublishingExtension
|
import org.gradle.api.publish.PublishingExtension
|
||||||
import org.gradle.api.publish.maven.MavenPublication
|
import org.gradle.api.publish.maven.MavenPublication
|
||||||
import org.gradle.api.publish.maven.internal.artifact.FileBasedMavenArtifact
|
|
||||||
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
import org.gradle.api.publish.maven.tasks.PublishToMavenRepository
|
||||||
import org.gradle.kotlin.dsl.*
|
import org.gradle.kotlin.dsl.configure
|
||||||
|
import org.gradle.kotlin.dsl.provideDelegate
|
||||||
|
import org.gradle.kotlin.dsl.register
|
||||||
|
import org.gradle.kotlin.dsl.withType
|
||||||
|
|
||||||
|
|
||||||
open class ScientifikPublishPlugin : Plugin<Project> {
|
open class ScientifikPublishPlugin : Plugin<Project> {
|
||||||
@ -18,12 +18,6 @@ open class ScientifikPublishPlugin : Plugin<Project> {
|
|||||||
project.plugins.apply("maven-publish")
|
project.plugins.apply("maven-publish")
|
||||||
|
|
||||||
project.run {
|
project.run {
|
||||||
val bintrayRepo = if (project.version.toString().contains("dev")) {
|
|
||||||
"dev"
|
|
||||||
} else {
|
|
||||||
findProperty("bintrayRepo") as? String
|
|
||||||
}
|
|
||||||
|
|
||||||
val githubProject = findProperty("githubProject") as? String
|
val githubProject = findProperty("githubProject") as? String
|
||||||
val vcs = findProperty("vcs") as? String
|
val vcs = findProperty("vcs") as? String
|
||||||
?: githubProject?.let { "https://github.com/mipt-npm/$it" }
|
?: githubProject?.let { "https://github.com/mipt-npm/$it" }
|
||||||
@ -33,11 +27,9 @@ open class ScientifikPublishPlugin : Plugin<Project> {
|
|||||||
return@apply
|
return@apply
|
||||||
}
|
}
|
||||||
|
|
||||||
project.plugins.apply("com.jfrog.bintray")
|
|
||||||
|
|
||||||
project.configure<PublishingExtension> {
|
project.configure<PublishingExtension> {
|
||||||
// Process each publication we have in this project
|
// Process each publication we have in this project
|
||||||
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
publications.withType<MavenPublication>().forEach { publication ->
|
||||||
|
|
||||||
@Suppress("UnstableApiUsage")
|
@Suppress("UnstableApiUsage")
|
||||||
publication.pom {
|
publication.pom {
|
||||||
@ -71,8 +63,9 @@ open class ScientifikPublishPlugin : Plugin<Project> {
|
|||||||
val githubToken: String? by project
|
val githubToken: String? by project
|
||||||
|
|
||||||
if (githubProject != null && githubUser != null && githubToken != null) {
|
if (githubProject != null && githubUser != null && githubToken != null) {
|
||||||
|
project.logger.info("Adding github publishing to project [${project.name}]")
|
||||||
repositories {
|
repositories {
|
||||||
val repository = maven {
|
val githubMavenRepository = maven {
|
||||||
name = "github"
|
name = "github"
|
||||||
url = uri("https://maven.pkg.github.com/mipt-npm/$githubProject/")
|
url = uri("https://maven.pkg.github.com/mipt-npm/$githubProject/")
|
||||||
credentials {
|
credentials {
|
||||||
@ -86,7 +79,7 @@ open class ScientifikPublishPlugin : Plugin<Project> {
|
|||||||
tasks.register<PublishToMavenRepository>("publish${publication.name.capitalize()}ToGithub") {
|
tasks.register<PublishToMavenRepository>("publish${publication.name.capitalize()}ToGithub") {
|
||||||
group = "publishing"
|
group = "publishing"
|
||||||
this.publication = publication
|
this.publication = publication
|
||||||
this.repository = repository
|
this.repository = githubMavenRepository
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -98,60 +91,42 @@ open class ScientifikPublishPlugin : Plugin<Project> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform"){
|
|
||||||
tasks.filterIsInstance<BintrayUploadTask>().forEach {
|
|
||||||
it.doFirst {
|
|
||||||
publications.filterIsInstance<MavenPublication>()
|
|
||||||
.forEach { publication ->
|
|
||||||
val moduleFile =
|
|
||||||
buildDir.resolve("publications/${publication.name}/module.json")
|
|
||||||
if (moduleFile.exists()) {
|
|
||||||
publication.artifact(object : FileBasedMavenArtifact(moduleFile) {
|
|
||||||
override fun getDefaultExtension() = "module"
|
|
||||||
})
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
val bintrayRepo = if (project.version.toString().contains("dev")) {
|
||||||
|
"dev"
|
||||||
if (bintrayRepo == null) {
|
|
||||||
project.logger.warn("[${project.name}] Bintray repository not defined")
|
|
||||||
} else {
|
} else {
|
||||||
|
findProperty("bintrayRepo") as? String
|
||||||
|
}
|
||||||
|
|
||||||
|
val bintrayOrg = project.findProperty("bintrayOrg") as? String ?: "mipt-npm"
|
||||||
|
val bintrayUser = project.findProperty("bintrayUser") as? String
|
||||||
|
val bintrayKey = project.findProperty("bintrayApiKey") as? String
|
||||||
|
|
||||||
|
if (bintrayRepo != null && bintrayUser != null && bintrayKey != null) {
|
||||||
project.logger.info("Adding bintray publishing to project [${project.name}]")
|
project.logger.info("Adding bintray publishing to project [${project.name}]")
|
||||||
project.configure<PublishingExtension> {
|
|
||||||
repositories {
|
repositories {
|
||||||
maven("https://bintray.com/mipt-npm/$bintrayRepo")
|
val bintrayMavenRepository = maven {
|
||||||
|
name = "bintray"
|
||||||
|
uri("https://api.bintray.com/maven/$bintrayOrg/$bintrayRepo/${project.name}/;publish=0;override=1")
|
||||||
|
credentials {
|
||||||
|
this.username = bintrayUser
|
||||||
|
this.password = bintrayKey
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
project.configure<BintrayExtension> {
|
val bintrayPublishTasks = publications.withType<MavenPublication>().map { publication ->
|
||||||
user = project.findProperty("bintrayUser") as? String?
|
tasks.register<PublishToMavenRepository>("publish${publication.name.capitalize()}ToBintray") {
|
||||||
key = project.findProperty("bintrayApiKey") as? String?
|
group = "publishing"
|
||||||
publish = true
|
this.publication = publication
|
||||||
override = true
|
this.repository = bintrayMavenRepository
|
||||||
|
|
||||||
// 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 = bintrayRepo
|
|
||||||
name = project.name
|
|
||||||
issueTrackerUrl = "$vcs/issues"
|
|
||||||
setLicenses("Apache-2.0")
|
|
||||||
vcsUrl = vcs
|
|
||||||
version.apply {
|
|
||||||
this.name = project.version.toString()
|
|
||||||
this.vcsTag = project.version.toString()
|
|
||||||
this.released = java.util.Date().toString()
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//workaround bintray bug
|
tasks.register<PublishToMavenRepository>("publishToBintray") {
|
||||||
afterEvaluate {
|
group = "publishing"
|
||||||
setPublications(*project.extensions.findByType<PublishingExtension>()!!.publications.names.toTypedArray())
|
dependsOn(bintrayPublishTasks)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user