This commit is contained in:
Alexander Nozik 2022-04-13 16:47:00 +03:00
parent 6e9ef8326b
commit 368ed94c52
No known key found for this signature in database
GPG Key ID: F7FCF2DD25C71357
6 changed files with 44 additions and 90 deletions

View File

@ -19,8 +19,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Deprecated
### Removed
- Ktor specific artifacts from version catalog
### Fixed
- Moved signing out of sonatype block
### Security

View File

@ -1,5 +1,5 @@
[versions]
tools = "0.11.3-kotlin-1.6.20"
tools = "0.11.4-kotlin-1.6.20"
kotlin = "1.6.20"
atomicfu = "0.17.1"
binary-compatibility-validator = "0.8.0"
@ -73,60 +73,6 @@ kotlinx-serialization-protobuf = { module = "org.jetbrains.kotlinx:kotlinx-seria
kotlinx-serialization-properties = { module = "org.jetbrains.kotlinx:kotlinx-serialization-properties", version.ref = "kotlinx-serialization" }
ktor-bom = { module = "io.ktor:ktor-bom", version.ref = "ktor" }
ktor-client-android = { module = "io.ktor:ktor-client-android", version.ref = "ktor" }
ktor-client-apache = { module = "io.ktor:ktor-client-apache", version.ref = "ktor" }
ktor-client-cio = { module = "io.ktor:ktor-client-cio", version.ref = "ktor" }
ktor-client-core = { module = "io.ktor:ktor-client-core", version.ref = "ktor" }
ktor-client-curl = { module = "io.ktor:ktor-client-curl", version.ref = "ktor" }
ktor-client-auth-basic = { module = "io.ktor:ktor-client-auth-basic", version.ref = "ktor" }
ktor-client-auth = { module = "io.ktor:ktor-client-auth", version.ref = "ktor" }
ktor-client-encoding = { module = "io.ktor:ktor-client-encoding", version.ref = "ktor" }
ktor-client-json = { module = "io.ktor:ktor-client-json", version.ref = "ktor" }
ktor-client-gson = { module = "io.ktor:ktor-client-gson", version.ref = "ktor" }
ktor-client-jackson = { module = "io.ktor:ktor-client-jackson", version.ref = "ktor" }
ktor-client-serialization = { module = "io.ktor:ktor-client-serialization", version.ref = "ktor" }
ktor-client-logging = { module = "io.ktor:ktor-client-loggin", version.ref = "ktor" }
ktor-client-tracing = { module = "io.ktor:ktor-client-tracing", version.ref = "ktor" }
ktor-client-websockets = { module = "io.ktor:ktor-client-websockets", version.ref = "ktor" }
ktor-client-java = { module = "io.ktor:ktor-client-java", version.ref = "ktor" }
ktor-client-jetty = { module = "io.ktor:ktor-client-jetty", version.ref = "ktor" }
ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-mock = { module = "io.ktor:ktor-client-mock", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-auth-jwt = { module = "io.ktor:ktor-auth-jwt", version.ref = "ktor" }
ktor-auth-ldap = { module = "io.ktor:ktor-auth-ldap", version.ref = "ktor" }
ktor-auth = { module = "io.ktor:ktor-auth", version.ref = "ktor" }
ktor-freemaker = { module = "io.ktor:ktor-freemaker", version.ref = "ktor" }
ktor-gson = { module = "io.ktor:ktor-gson", version.ref = "ktor" }
ktor-html-builder = { module = "io.ktor:ktor-html-builder", version.ref = "ktor" }
ktor-jackson = { module = "io.ktor:ktor-jackson", version.ref = "ktor" }
ktor-locations = { module = "io.ktor:ktor-locations", version.ref = "ktor" }
ktor-metrics-micrometer = { module = "io.ktor:ktor-metrics-micrometer", version.ref = "ktor" }
ktor-metrics = { module = "io.ktor:ktor-metrics", version.ref = "ktor" }
ktor-mustache = { module = "io.ktor:ktor-mustache", version.ref = "ktor" }
ktor-pebble = { module = "io.ktor:ktor-pebble", version.ref = "ktor" }
ktor-serialization = { module = "io.ktor:ktor-serialization", version.ref = "ktor" }
ktor-server-sessions = { module = "io.ktor:ktor-server-sessions", version.ref = "ktor" }
ktor-thymeleaf = { module = "io.ktor:ktor-thymeleaf", version.ref = "ktor" }
ktor-velocity = { module = "io.ktor:ktor-velocity", version.ref = "ktor" }
ktor-webjars = { module = "io.ktor:ktor-webjars", version.ref = "ktor" }
ktor-websockets = { module = "io.ktor:ktor-websockets", version.ref = "ktor" }
ktor-http = { module = "io.ktor:ktor-http", version.ref = "ktor" }
ktor-http-cio = { module = "io.ktor:ktor-http-cio", version.ref = "ktor" }
ktor-io = { module = "io.ktor:ktor-io", version.ref = "ktor" }
ktor-network = { module = "io.ktor:ktor-network", version.ref = "ktor" }
ktor-network-tls = { module = "io.ktor:ktor-network-tls", version.ref = "ktor" }
ktor-network-tls-certificates = { module = "io.ktor:ktor-network-tls-certificates", version.ref = "ktor" }
ktor-server-cio = { module = "io.ktor:ktor-server-cio", version.ref = "ktor" }
ktor-server-core = { module = "io.ktor:ktor-server-core", version.ref = "ktor" }
ktor-server-host-common = { module = "io.ktor:ktor-server-host-common", version.ref = "ktor" }
ktor-server-jetty = { module = "io.ktor:ktor-server-jetty", version.ref = "ktor" }
ktor-server-netty = { module = "io.ktor:ktor-server-netty", version.ref = "ktor" }
ktor-server-servlet = { module = "io.ktor:ktor-server-servlet", version.ref = "ktor" }
ktor-server-test-host = { module = "io.ktor:ktor-server-test-host", version.ref = "ktor" }
ktor-server-tomcat = { module = "io.ktor:ktor-server-tomcat", version.ref = "ktor" }
ktor-test-dispatcher = { module = "io.ktor:ktor-test-dispatcher", version.ref = "ktor" }
ktor-utils = { module = "io.ktor:ktor-utils", version.ref = "ktor" }
xmlutil-core = { module = "io.github.pdvrieze.xmlutil:core", version.ref = "xmlutil" }
xmlutil-ktor = { module = "io.github.pdvrieze.xmlutil:ktor", version.ref = "xmlutil" }

View File

@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists

View File

@ -3,9 +3,8 @@ package ru.mipt.npm.gradle
import org.gradle.api.Plugin
import org.gradle.api.Project
@Suppress("UNUSED_VARIABLE")
public open class KScienceCommonPlugin : Plugin<Project> {
override fun apply(project: Project): Unit = project.configureKScience(
KotlinVersion(1, 6, 10)
KotlinVersion(1, 6, 20)
)
}

View File

@ -28,8 +28,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.jvm") {
//logger.info("Applying KScience configuration for JVM project")
configure<KotlinJvmProjectExtension> {
explicitApiWarning()
sourceSets.all {
languageSettings.applySettings(kotlinVersion)
}
@ -41,6 +39,8 @@ public fun Project.configureKScience(
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}")
}
}
explicitApiWarning()
}
tasks.withType<KotlinJvmCompile> {
kotlinOptions {
@ -61,8 +61,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.js") {
//logger.info("Applying KScience configuration for JS project")
configure<KotlinJsProjectExtension> {
explicitApiWarning()
js(IR) {
browser {
commonWebpackConfig {
@ -87,6 +85,8 @@ public fun Project.configureKScience(
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:${KScienceVersions.coroutinesVersion}")
}
}
explicitApiWarning()
}
(tasks.findByName("processResources") as? Copy)?.apply {
@ -97,8 +97,6 @@ public fun Project.configureKScience(
pluginManager.withPlugin("org.jetbrains.kotlin.multiplatform") {
configure<KotlinMultiplatformExtension> {
explicitApiWarning()
jvm {
compilations.all {
kotlinOptions {
@ -159,6 +157,8 @@ public fun Project.configureKScience(
tasks.withType<Test> {
useJUnitPlatform()
}
explicitApiWarning()
}
}

View File

@ -10,6 +10,7 @@ import org.gradle.plugins.signing.SigningExtension
import org.gradle.plugins.signing.SigningPlugin
import org.jetbrains.kotlin.gradle.dsl.KotlinJsProjectExtension
import org.jetbrains.kotlin.gradle.dsl.KotlinJvmProjectExtension
import org.jetbrains.kotlin.gradle.plugin.mpp.pm20.targets
internal fun Project.requestPropertyOrNull(propertyName: String): String? = findProperty(propertyName) as? String
?: System.getenv(propertyName)
@ -31,12 +32,15 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
from(it.kotlin)
}
}
publications.create<MavenPublication>("js") {
kotlin.js().components.forEach {
from(it)
}
artifact(sourcesJar)
afterEvaluate {
publications.create<MavenPublication>("js") {
kotlin.targets.flatMap { it.components }.forEach {
from(it)
}
artifact(sourcesJar)
}
}
}
@ -51,12 +55,14 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
}
}
publications.create<MavenPublication>("jvm") {
kotlin.target.components.forEach {
from(it)
}
afterEvaluate {
publications.create<MavenPublication>("jvm") {
kotlin.target.components.forEach {
from(it)
}
artifact(sourcesJar)
artifact(sourcesJar)
}
}
}
@ -98,6 +104,23 @@ internal fun Project.setupPublication(mavenPomConfiguration: MavenPom.() -> Unit
mavenPomConfiguration()
}
}
if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>()
}
extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use file signing
sign(publications)
}
}
}
}
@ -194,22 +217,6 @@ internal fun Project.addSonatypePublishing() {
allprojects {
plugins.withId("maven-publish") {
configure<PublishingExtension> {
if (!plugins.hasPlugin("signing")) {
apply<SigningPlugin>()
}
extensions.configure<SigningExtension>("signing") {
val signingId: String? = requestPropertyOrNull("publishing.signing.id")
if (!signingId.isNullOrBlank()) {
val signingKey: String = requestProperty("publishing.signing.key")
val signingPassphrase: String = requestProperty("publishing.signing.passPhrase")
// if key is provided, use it
useInMemoryPgpKeys(signingId, signingKey, signingPassphrase)
} // else use file signing
sign(publications)
}
repositories.maven {
val sonatypeRepo = "https://oss.sonatype.org/service/local/staging/deploy/maven2"
name = "sonatype"