Commit a9c683b3 authored by Nikolay Igotti's avatar Nikolay Igotti

Revert "Make publications comply with Maven Central requirements (#267)"

This reverts commit 71e2477d.
parent 839ae5e2
...@@ -2,12 +2,10 @@ import de.undercouch.gradle.tasks.download.Download ...@@ -2,12 +2,10 @@ import de.undercouch.gradle.tasks.download.Download
import org.gradle.crypto.checksum.Checksum import org.gradle.crypto.checksum.Checksum
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile import org.jetbrains.kotlin.gradle.tasks.KotlinNativeCompile
import java.util.Locale
plugins { plugins {
kotlin("multiplatform") version "1.5.31" // "1.6.0-M1" kotlin("multiplatform") version "1.5.31" // "1.6.0-M1"
`maven-publish` `maven-publish`
signing
id("org.gradle.crypto.checksum") version "1.1.0" id("org.gradle.crypto.checksum") version "1.1.0"
id("de.undercouch.download") version "4.1.1" id("de.undercouch.download") version "4.1.1"
} }
...@@ -952,14 +950,6 @@ afterEvaluate { ...@@ -952,14 +950,6 @@ afterEvaluate {
} }
} }
val emptySourcesJar by tasks.registering(Jar::class) {
archiveClassifier.set("sources")
}
val emptyJavadocJar by tasks.registering(Jar::class) {
archiveClassifier.set("javadoc")
}
publishing { publishing {
repositories { repositories {
configureEach { configureEach {
...@@ -983,81 +973,34 @@ publishing { ...@@ -983,81 +973,34 @@ publishing {
} }
} }
publications { publications {
val pomNameForPublication = HashMap<String, String>()
pomNameForPublication["kotlinMultiplatform"] = "Skiko MPP"
kotlin.targets.forEach {
pomNameForPublication[it.name] = "Skiko ${toTitleCase(it.name)}"
}
configureEach { configureEach {
this as MavenPublication this as MavenPublication
groupId = "org.jetbrains.skiko" groupId = "org.jetbrains.skiko"
if (skiko.signArtifacts) {
signing.sign(this)
}
// Necessary for publishing to Maven Central
artifact(emptyJavadocJar)
pom { pom {
name.set("Skiko")
description.set("Kotlin Skia bindings") description.set("Kotlin Skia bindings")
packaging = "jar" url.set("http://www.github.com/JetBrains/skiko")
licenses { licenses {
license { license {
name.set("The Apache License, Version 2.0") name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
} }
} }
val repoUrl = "https://www.github.com/JetBrains/skiko"
url.set(repoUrl)
scm {
url.set(repoUrl)
val repoConnection = "scm:git:$repoUrl.git"
connection.set(repoConnection)
developerConnection.set(repoConnection)
}
developers {
developer {
name.set("Compose Multiplatform Team")
organization.set("JetBrains")
organizationUrl.set("https://www.jetbrains.com")
}
}
} }
} }
create<MavenPublication>("skikoJvmRuntime") { create<MavenPublication>("skikoJvmRuntime") {
pomNameForPublication[name] = "Skiko JVM Runtime for ${targetOs.name} ${targetArch.name}"
artifactId = SkikoArtifacts.runtimeArtifactIdFor(targetOs, targetArch) artifactId = SkikoArtifacts.runtimeArtifactIdFor(targetOs, targetArch)
afterEvaluate { afterEvaluate {
artifact(skikoJvmRuntimeJar.map { it.archiveFile.get() }) artifact(skikoJvmRuntimeJar.map { it.archiveFile.get() })
var jvmSourcesArtifact: Any? = null
kotlin.jvm().mavenPublication {
jvmSourcesArtifact = artifacts.find { it.classifier == "sources" }
}
if (jvmSourcesArtifact == null) {
error("Could not find sources jar artifact for JVM target")
} else {
artifact(jvmSourcesArtifact)
}
} }
} }
if (supportWasm) { if (supportWasm) {
create<MavenPublication>("skikoWasmRuntime") { create<MavenPublication>("skikoWasmRuntime") {
pomNameForPublication[name] = "Skiko WASM Runtime"
artifactId = SkikoArtifacts.jsWasmArtifactId artifactId = SkikoArtifacts.jsWasmArtifactId
artifact(skikoWasmJar.get()) artifact(skikoWasmJar.get())
artifact(emptySourcesJar)
}
} }
val publicationsWithoutPomNames = publications.filter { it.name !in pomNameForPublication }
if (publicationsWithoutPomNames.isNotEmpty()) {
error("Publications with unknown POM names: ${publicationsWithoutPomNames.joinToString { "'$it'" }}")
}
configureEach {
this as MavenPublication
pom.name.set(pomNameForPublication[name]!!)
} }
} }
} }
......
...@@ -127,9 +127,6 @@ class SkikoProperties(private val myProject: Project) { ...@@ -127,9 +127,6 @@ class SkikoProperties(private val myProject: Project) {
val isRelease: Boolean val isRelease: Boolean
get() = myProject.findProperty("deploy.release") == "true" get() = myProject.findProperty("deploy.release") == "true"
val signArtifacts: Boolean
get() = myProject.findProperty("deploy.sign") == "true"
val buildType: SkiaBuildType val buildType: SkiaBuildType
get() = if (myProject.findProperty("skiko.debug") == "true") SkiaBuildType.DEBUG else SkiaBuildType.RELEASE get() = if (myProject.findProperty("skiko.debug") == "true") SkiaBuildType.DEBUG else SkiaBuildType.RELEASE
......
...@@ -2,7 +2,6 @@ import org.gradle.api.Task ...@@ -2,7 +2,6 @@ import org.gradle.api.Task
import org.gradle.api.provider.Provider import org.gradle.api.provider.Provider
import org.gradle.api.tasks.TaskContainer import org.gradle.api.tasks.TaskContainer
import org.gradle.kotlin.dsl.register import org.gradle.kotlin.dsl.register
import java.util.*
// Utils, that are not needed in scripts can be placed to internal/utils // Utils, that are not needed in scripts can be placed to internal/utils
...@@ -16,7 +15,10 @@ inline fun <reified T : Task> TaskContainer.registerOrGetTask( ...@@ -16,7 +15,10 @@ inline fun <reified T : Task> TaskContainer.registerOrGetTask(
} }
fun joinToTitleCamelCase(vararg parts: String): String = fun joinToTitleCamelCase(vararg parts: String): String =
parts.joinToString(separator = "") { toTitleCase(it) } parts.joinToString(separator = "") { part ->
if (part.isEmpty()) part
fun toTitleCase(s: String): String = else buildString {
s.capitalize(Locale.ROOT) append(part.first().toTitleCase())
\ No newline at end of file append(part.substring(1))
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment