Build: Use protobuf from kotlin-dependencies repo
#KTI-892
This commit is contained in:
+14
-1
@@ -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
@@ -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
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user