Build: Use protobuf from kotlin-dependencies repo

#KTI-892
This commit is contained in:
Vyacheslav Gerasimov
2022-08-31 20:13:15 +02:00
parent 46bc1d5b09
commit 15d797b5b5
7 changed files with 68 additions and 43 deletions
-7
View File
@@ -475,13 +475,6 @@ allprojects {
}
}
maven(protobufRepo) {
content {
includeModule("org.jetbrains.kotlin", "protobuf-lite")
includeModule("org.jetbrains.kotlin", "protobuf-relocated")
}
}
maven(intellijRepo)
maven("https://packages.jetbrains.team/maven/p/ij/intellij-dependencies")
+3 -8
View File
@@ -248,14 +248,9 @@ private fun DependencyHandler.testApi(dependencyNotation: Any) {
add("testApi", dependencyNotation)
}
val Project.protobufVersion: String get() = findProperty("versions.protobuf") as String
val Project.protobufRepo: String
get() =
"https://teamcity.jetbrains.com/guestAuth/app/rest/builds/buildType:(id:Kotlin_Protobuf),status:SUCCESS,pinned:true,tag:$protobufVersion/artifacts/content/internal/repo/"
fun Project.protobufLite(): String = "org.jetbrains.kotlin:protobuf-lite:$protobufVersion"
fun Project.protobufFull(): String = "org.jetbrains.kotlin:protobuf-relocated:$protobufVersion"
val Project.protobufRelocatedVersion: String get() = findProperty("versions.protobuf-relocated") as String
fun Project.protobufLite(): String = "org.jetbrains.kotlin:protobuf-lite:$protobufRelocatedVersion"
fun Project.protobufFull(): String = "org.jetbrains.kotlin:protobuf-relocated:$protobufRelocatedVersion"
fun Project.kotlinxCollectionsImmutable() =
"org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:${rootProject.extra["versions.kotlinx-collections-immutable"]}"
+14 -1
View File
@@ -1,7 +1,20 @@
/*
How to Publish
1. Bump version parameter
2. Prepare publication credentials for https://kotlin.jetbrains.space/p/kotlin/packages/maven/kotlin-dependencies
3. Execute `./gradlew -p dependencies/protobuf publish -PkotlinSpaceUsername=usr -PkotlinSpacePassword=token`
*/
val protobufVersion by extra("2.6.1")
val publishedVersion by extra("2.6.1-1")
allprojects {
group = "org.jetbrains.kotlin"
version = protobufVersion
version = publishedVersion
tasks.withType<AbstractArchiveTask>().configureEach {
isPreserveFileTimestamps = false
isReproducibleFileOrder = true
}
}
+24 -9
View File
@@ -15,8 +15,8 @@ val relocatedProtobuf by configurations.creating
val relocatedProtobufSources by configurations.creating
val protobufVersion: String by rootProject.extra
val protobufJarPrefix = "protobuf-$protobufVersion"
val outputJarPath = "$buildDir/libs/$protobufJarPrefix-lite.jar"
val outputJarPath = "$buildDir/libs/protobuf-lite-$protobufVersion.jar"
val sourcesJarName = "protobuf-lite-$protobufVersion-sources.jar"
dependencies {
relocatedProtobuf(project(":protobuf-relocated"))
@@ -88,22 +88,31 @@ val prepare by tasks.registering {
}
}
val prepareSources = tasks.register<Copy>("prepareSources") {
dependsOn(":protobuf-relocated:prepareSources")
from(provider {
relocatedProtobuf
.resolvedConfiguration
.resolvedArtifacts
.single { it.name == "protobuf-relocated" && it.classifier == "sources" }.file
})
into("$buildDir/libs/")
rename { sourcesJarName }
}
val mainArtifact = artifacts.add(
"default",
provider {
prepare.outputs.files.singleFile
prepare.get().outputs.files.singleFile
}
) {
builtBy(prepare)
classifier = ""
}
val sourcesArtifact = artifacts.add(
"default",
provider {
relocatedProtobuf.resolvedConfiguration.resolvedArtifacts.single { it.name == "protobuf-relocated" && it.classifier == "sources" }.file
}
) {
val sourcesArtifact = artifacts.add("default", File("$buildDir/libs/$sourcesJarName")) {
builtBy(prepareSources)
classifier = "sources"
}
@@ -119,5 +128,11 @@ publishing {
maven {
url = uri("${rootProject.buildDir}/internal/repo")
}
maven {
name = "kotlinSpace"
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
credentials(org.gradle.api.artifacts.repositories.PasswordCredentials::class)
}
}
}
+12 -7
View File
@@ -8,7 +8,7 @@ plugins {
}
repositories {
jcenter()
mavenCentral()
}
val baseProtobuf by configurations.creating
@@ -26,9 +26,9 @@ dependencies {
}
val prepare = tasks.register<ShadowJar>("prepare") {
destinationDir = File(outputJarsPath)
version = protobufVersion
classifier = ""
destinationDirectory.set(File(outputJarsPath))
archiveVersion.set(protobufVersion)
archiveClassifier.set("")
from(
provider {
baseProtobuf.files.find { it.name.startsWith("protobuf-java") }?.canonicalPath
@@ -56,9 +56,9 @@ val relocateSources = task<Copy>("relocateSources") {
}
val prepareSources = task<Jar>("prepareSources") {
destinationDir = File(outputJarsPath)
version = protobufVersion
classifier = "sources"
destinationDirectory.set(File(outputJarsPath))
archiveVersion.set(protobufVersion)
archiveClassifier.set("sources")
from(relocateSources)
}
@@ -76,5 +76,10 @@ publishing {
maven {
url = uri("${rootProject.buildDir}/internal/repo")
}
maven {
name = "kotlinSpace"
url = uri("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/kotlin-dependencies")
credentials(org.gradle.api.artifacts.repositories.PasswordCredentials::class)
}
}
}
+14 -10
View File
@@ -8211,22 +8211,22 @@
<sha256 value="42f0619d2f1bc9920959cbf05d53d950e456d5de1cab1b0dc8ca10503b2c34ce" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="protobuf-lite" version="2.6.1">
<artifact name="protobuf-lite-2.6.1.jar">
<md5 value="4694af8297b31dfdf6b0e8ae741b78a9" origin="Generated by Gradle"/>
<sha256 value="0c958c19f823b093d0edecfaa4248c9d8dfaa649a4577e517f94acdd6dd25291" origin="Generated by Gradle"/>
<component group="org.jetbrains.kotlin" name="protobuf-lite" version="2.6.1-1">
<artifact name="protobuf-lite-2.6.1-1.jar">
<md5 value="5485b73a64b689f391ac38ba6d3f9073" origin="Generated by Gradle"/>
<sha256 value="e3bd7bc7b4f3460a6efd303c29920ba6e90ba3656d7d897f1b952a4e52c00f4a" origin="Generated by Gradle"/>
</artifact>
<artifact name="protobuf-lite-2.6.1.pom">
<artifact name="protobuf-lite-2.6.1-1.pom">
<md5 value="f9f7056d5b15cfe9e850f79d649eebab" origin="Generated by Gradle"/>
<sha256 value="8e9b3e56b5e45ba4e21483e7654f4161b8b0bf211022aed6e7692a7b0a1d3c24" origin="Generated by Gradle"/>
</artifact>
</component>
<component group="org.jetbrains.kotlin" name="protobuf-relocated" version="2.6.1">
<artifact name="protobuf-relocated-2.6.1.jar">
<md5 value="5211d57349a37abfc9eb7be6ed521d91" origin="Generated by Gradle"/>
<sha256 value="5bba5a5d593d294afb611cb72ba849bfe30c0e1dda2a33c621b17b608ac8b277" origin="Generated by Gradle"/>
<component group="org.jetbrains.kotlin" name="protobuf-relocated" version="2.6.1-1">
<artifact name="protobuf-relocated-2.6.1-1.jar">
<md5 value="456d0ca41c83ce71b745fd3c46db4570" origin="Generated by Gradle"/>
<sha256 value="c91bed049ce22b5fc556d1c5df8c630367348f0461f30e0fe46ea094ccffcba4" origin="Generated by Gradle"/>
</artifact>
<artifact name="protobuf-relocated-2.6.1.pom">
<artifact name="protobuf-relocated-2.6.1-1.pom">
<md5 value="68d1e7281523fe2a8e82656c10ab60f1" origin="Generated by Gradle"/>
<sha256 value="2d38e5dbd46253e23b6678b138f41d32098f8ed773dd8c6211105509cf9529d4" origin="Generated by Gradle"/>
</artifact>
@@ -8769,6 +8769,7 @@
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-core" version="1.4.0-RC">
<artifact name="kotlinx-serialization-core-metadata-1.4.0-RC-all.jar">
<md5 value="e593fca534711d7896ea6ef3a3c84bfc" origin="Generated by Gradle"/>
<sha256 value="87ee01517d3418721737b8f02021e917e49b7065d87b8458907bebfac1fc347c" origin="Generated by Gradle"/>
</artifact>
</component>
@@ -8820,6 +8821,7 @@
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-core-jvm" version="1.4.0-RC">
<artifact name="kotlinx-serialization-core-jvm-1.4.0-RC.jar">
<md5 value="6f151fd23347be84bce070eb2f15b47d" origin="Generated by Gradle"/>
<sha256 value="d6651a429223c906aa51faec629c42d59266666d690d67b6bc8c447ec4ea79bb" origin="Generated by Gradle"/>
</artifact>
</component>
@@ -8889,6 +8891,7 @@
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-json" version="1.4.0-RC">
<artifact name="kotlinx-serialization-json-metadata-1.4.0-RC-all.jar">
<md5 value="a60e806a0c3a861cad6522de1a502df7" origin="Generated by Gradle"/>
<sha256 value="f9f6f8a472e98252e679d999e44f07d83d02128ea1b2ca762cbb8d28776f64af" origin="Generated by Gradle"/>
</artifact>
</component>
@@ -8926,6 +8929,7 @@
</component>
<component group="org.jetbrains.kotlinx" name="kotlinx-serialization-json-jvm" version="1.4.0-RC">
<artifact name="kotlinx-serialization-json-jvm-1.4.0-RC.jar">
<md5 value="df9049885997956336f00a2b409ec1c4" origin="Generated by Gradle"/>
<sha256 value="0d302c3de73ef8db548a5537a522a35eb599ed02a29b579092362bab9c34e1fc" origin="Generated by Gradle"/>
</artifact>
</component>
+1 -1
View File
@@ -56,7 +56,7 @@ versions.ktor-client-core=2.0.2
versions.ktor-client-cio=2.0.2
versions.ktor-client-websockets=2.0.2
versions.native-platform=0.14
versions.protobuf=2.6.1
versions.protobuf-relocated=2.6.1-1
versions.r8=2.2.64
versions.robolectric=4.0
versions.nodejs=16.14.2