diff --git a/build.gradle.kts b/build.gradle.kts index 2ea6b0fd0aa..23290cdabd2 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -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") diff --git a/buildSrc/src/main/kotlin/dependencies.kt b/buildSrc/src/main/kotlin/dependencies.kt index d5bacfcfa8e..005dbd33cf1 100644 --- a/buildSrc/src/main/kotlin/dependencies.kt +++ b/buildSrc/src/main/kotlin/dependencies.kt @@ -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"]}" diff --git a/dependencies/protobuf/build.gradle.kts b/dependencies/protobuf/build.gradle.kts index 0b171efb1fe..68b68c9aab5 100644 --- a/dependencies/protobuf/build.gradle.kts +++ b/dependencies/protobuf/build.gradle.kts @@ -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().configureEach { + isPreserveFileTimestamps = false + isReproducibleFileOrder = true + } } \ No newline at end of file diff --git a/dependencies/protobuf/protobuf-lite/build.gradle.kts b/dependencies/protobuf/protobuf-lite/build.gradle.kts index 0ef3bfbfad1..3e5f827a6d6 100644 --- a/dependencies/protobuf/protobuf-lite/build.gradle.kts +++ b/dependencies/protobuf/protobuf-lite/build.gradle.kts @@ -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("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) + } } } diff --git a/dependencies/protobuf/protobuf-relocated/build.gradle.kts b/dependencies/protobuf/protobuf-relocated/build.gradle.kts index 11cfe96c540..9576dc7e64a 100644 --- a/dependencies/protobuf/protobuf-relocated/build.gradle.kts +++ b/dependencies/protobuf/protobuf-relocated/build.gradle.kts @@ -8,7 +8,7 @@ plugins { } repositories { - jcenter() + mavenCentral() } val baseProtobuf by configurations.creating @@ -26,9 +26,9 @@ dependencies { } val prepare = tasks.register("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("relocateSources") { } val prepareSources = task("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) + } } } diff --git a/gradle/verification-metadata.xml b/gradle/verification-metadata.xml index 62237f3711f..2e021aa2d8e 100644 --- a/gradle/verification-metadata.xml +++ b/gradle/verification-metadata.xml @@ -8211,22 +8211,22 @@ - - - - + + + + - + - - - - + + + + - + @@ -8769,6 +8769,7 @@ + @@ -8820,6 +8821,7 @@ + @@ -8889,6 +8891,7 @@ + @@ -8926,6 +8929,7 @@ + diff --git a/gradle/versions.properties b/gradle/versions.properties index b8d0189609b..f610207180f 100644 --- a/gradle/versions.properties +++ b/gradle/versions.properties @@ -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