You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

74 lines
2.7 KiB

Don't publish `build-helpers`, use it directly Fixes https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage We need some changes in it: https://youtrack.jetbrains.com/issue/CMP-7198/Maven-Central-publication-publishes-old-artifacts-for-Core-Bundle https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage and the current workflow is complicated: - make changes - publish this as a library in the dev repo - add this as a dependency in some Gradle project (Example https://github.com/JetBrains/compose-multiplatform-core/blob/2d8c5f479f590305b9fedc744e00fdc9c276bbb9/mpp/build.gradle.kts#L286) - Run the gradle task on CI from compose-multiplatform-core project ``` clone compose-multiplatform-core ./gradlew reuploadArtifactsToMavenCentral --info --stacktrace -Pmaven.central.sign=true -Pmaven.central.group=$group -Pmaven.central.stage=$stage -Pmaven.central.version=$version -Pmaven.central.staging.close.after.upload=true ``` This task also doesn't use any of `compose-multiplatform-core` info, so it is overhead to store it as part of this project. Now we just change some code, and it is already can be run by CI. Related change on CI: https://jetbrains.team/p/ui/repositories/compose-teamcity-config/revision/14790a506883923b25ef9ef4d05802f6210362f3 Related change in core: TODO ## Testing 1. Run https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_UploadToMavenCentralManually on branch igor.demin/upload-to-maven-central-without-library with: 2. See:
2 weeks ago
import org.jetbrains.compose.internal.publishing.*
plugins {
signing
}
val mavenCentral = MavenCentralProperties(project)
if (mavenCentral.signArtifacts) {
signing.useInMemoryPgpKeys(
mavenCentral.signArtifactsKey.get(),
mavenCentral.signArtifactsPassword.get()
)
}
val publishingDir = project.layout.buildDirectory.dir("publishing")
val originalArtifactsRoot = publishingDir.map { it.dir("original") }
val preparedArtifactsRoot = publishingDir.map { it.dir("prepared") }
val modulesFile = publishingDir.map { it.file("modules.txt") }
val findComposeModules by tasks.registering(FindModulesInSpaceTask::class) {
requestedCoordinates.set(mavenCentral.coordinates)
Don't publish `build-helpers`, use it directly Fixes https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage We need some changes in it: https://youtrack.jetbrains.com/issue/CMP-7198/Maven-Central-publication-publishes-old-artifacts-for-Core-Bundle https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage and the current workflow is complicated: - make changes - publish this as a library in the dev repo - add this as a dependency in some Gradle project (Example https://github.com/JetBrains/compose-multiplatform-core/blob/2d8c5f479f590305b9fedc744e00fdc9c276bbb9/mpp/build.gradle.kts#L286) - Run the gradle task on CI from compose-multiplatform-core project ``` clone compose-multiplatform-core ./gradlew reuploadArtifactsToMavenCentral --info --stacktrace -Pmaven.central.sign=true -Pmaven.central.group=$group -Pmaven.central.stage=$stage -Pmaven.central.version=$version -Pmaven.central.staging.close.after.upload=true ``` This task also doesn't use any of `compose-multiplatform-core` info, so it is overhead to store it as part of this project. Now we just change some code, and it is already can be run by CI. Related change on CI: https://jetbrains.team/p/ui/repositories/compose-teamcity-config/revision/14790a506883923b25ef9ef4d05802f6210362f3 Related change in core: TODO ## Testing 1. Run https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_UploadToMavenCentralManually on branch igor.demin/upload-to-maven-central-without-library with: 2. See:
2 weeks ago
spaceInstanceUrl.set("https://public.jetbrains.space")
spaceClientId.set(System.getenv("COMPOSE_REPO_USERNAME") ?: "")
spaceClientSecret.set(System.getenv("COMPOSE_REPO_KEY") ?: "")
spaceProjectId.set(System.getenv("COMPOSE_DEV_REPO_PROJECT_ID") ?: "")
spaceRepoId.set(System.getenv("COMPOSE_DEV_REPO_REPO_ID") ?: "")
modulesTxtFile.set(modulesFile)
}
val downloadArtifactsFromComposeDev by tasks.registering(DownloadFromSpaceMavenRepoTask::class) {
dependsOn(findComposeModules)
modulesToDownload.set(project.provider {
readComposeModules(
modulesFile,
originalArtifactsRoot
)
})
spaceRepoUrl.set("https://maven.pkg.jetbrains.space/public/p/compose/dev")
}
val fixModulesBeforePublishing by tasks.registering(FixModulesBeforePublishingTask::class) {
dependsOn(downloadArtifactsFromComposeDev)
inputRepoDir.set(originalArtifactsRoot)
outputRepoDir.set(preparedArtifactsRoot)
}
val reuploadArtifactsToMavenCentral by tasks.registering(UploadToSonatypeTask::class) {
dependsOn(fixModulesBeforePublishing)
modulesToUpload.set(project.provider { readComposeModules(modulesFile, preparedArtifactsRoot) })
sonatypeServer.set("https://oss.sonatype.org")
user.set(mavenCentral.user)
password.set(mavenCentral.password)
autoCommitOnSuccess.set(mavenCentral.autoCommitOnSuccess)
stagingProfileName.set(mavenCentral.stage)
stagingDescription.set(mavenCentral.description)
Don't publish `build-helpers`, use it directly Fixes https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage We need some changes in it: https://youtrack.jetbrains.com/issue/CMP-7198/Maven-Central-publication-publishes-old-artifacts-for-Core-Bundle https://youtrack.jetbrains.com/issue/CMP-1339/Change-description-of-androidx-artifacts-in-Maven-Central-stage and the current workflow is complicated: - make changes - publish this as a library in the dev repo - add this as a dependency in some Gradle project (Example https://github.com/JetBrains/compose-multiplatform-core/blob/2d8c5f479f590305b9fedc744e00fdc9c276bbb9/mpp/build.gradle.kts#L286) - Run the gradle task on CI from compose-multiplatform-core project ``` clone compose-multiplatform-core ./gradlew reuploadArtifactsToMavenCentral --info --stacktrace -Pmaven.central.sign=true -Pmaven.central.group=$group -Pmaven.central.stage=$stage -Pmaven.central.version=$version -Pmaven.central.staging.close.after.upload=true ``` This task also doesn't use any of `compose-multiplatform-core` info, so it is overhead to store it as part of this project. Now we just change some code, and it is already can be run by CI. Related change on CI: https://jetbrains.team/p/ui/repositories/compose-teamcity-config/revision/14790a506883923b25ef9ef4d05802f6210362f3 Related change in core: TODO ## Testing 1. Run https://teamcity.jetbrains.com/buildConfiguration/JetBrainsPublicProjects_Compose_UploadToMavenCentralManually on branch igor.demin/upload-to-maven-central-without-library with: 2. See:
2 weeks ago
}
fun readComposeModules(
modulesFile: Provider<out FileSystemLocation>,
repoRoot: Provider<out FileSystemLocation>
): List<ModuleToUpload> =
modulesFile.get().asFile.readLines()
.filter { it.isNotBlank() }
.map { line ->
val (group, artifact, version) = line.split(":")
ModuleToUpload(
groupId = group,
artifactId = artifact,
version = version,
localDir = repoRoot.get().asFile.resolve("$group/$artifact/$version")
)
}