Skip to content

Commit

Permalink
Merge branch 'JetBrains:master' into settings-property-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximPestryakov authored Dec 15, 2024
2 parents 700dec8 + 93b2f1d commit eb0197f
Show file tree
Hide file tree
Showing 66 changed files with 739 additions and 665 deletions.
8 changes: 5 additions & 3 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,18 @@ This should be tested by QA

## Release Notes
<!--
Optional, if omitted - won't be included in the changelog
If we definitely shouldn't add Release Notes, add only N/A.
Sections:
Or enumerate sections, subsections and all changes.
Possible sections:
- Highlights
- Known Issues
- Breaking Changes
- Features
- Fixes
Subsections:
Possible subsections:
- Multiple Platforms
- iOS
- Desktop
Expand Down
7 changes: 3 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
[![official project](http://jb.gg/badges/official.svg)](https://confluence.jetbrains.com/display/ALL/JetBrains+on+GitHub)
[![Latest release](https://img.shields.io/github/v/release/JetBrains/compose-multiplatform?color=brightgreen&label=latest%20release)](https://github.com/JetBrains/compose-multiplatform/releases/latest)
[![Latest build](https://img.shields.io/github/v/release/JetBrains/compose-multiplatform?color=orange&include_prereleases&label=latest%20build)](https://github.com/JetBrains/compose-multiplatform/releases)


[![stable](https://img.shields.io/github/v/release/JetBrains/compose-multiplatform?sort=semver&display_name=release&label=stable&color=brightgreen)](https://github.com/JetBrains/compose-multiplatform/releases/latest)
[![prerelease](https://img.shields.io/github/v/release/JetBrains/compose-multiplatform?include_prereleases&filter=*-*&display_name=release&label=prerelease&color=blue)](https://github.com/JetBrains/compose-multiplatform/releases)
[![dev](https://img.shields.io/github/v/tag/JetBrains/compose-multiplatform?include_prereleases&sort=semver&filter=v*%2Bdev*&label=dev&color=orange)](https://github.com/JetBrains/compose-multiplatform/tags)

# Compose Multiplatform

Expand Down
78 changes: 0 additions & 78 deletions build-helpers/build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion build-helpers/gradle.properties

This file was deleted.

51 changes: 0 additions & 51 deletions build-helpers/publishing/build.gradle.kts

This file was deleted.

1 change: 0 additions & 1 deletion build-helpers/settings.gradle.kts

This file was deleted.

74 changes: 74 additions & 0 deletions ci/build-helpers/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
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)
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)
}

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")
)
}
26 changes: 26 additions & 0 deletions ci/build-helpers/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import org.gradle.kotlin.dsl.gradleKotlinDsl

plugins {
`java`
`java-gradle-plugin`
kotlin("jvm") version "1.9.24"
}

repositories {
mavenCentral()
maven("https://maven.pkg.jetbrains.space/public/p/space/maven")
}

dependencies {
compileOnly(gradleApi())
compileOnly(gradleKotlinDsl())

val jacksonVersion = "2.12.5"
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion")
implementation("com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion")
implementation("io.ktor:ktor-client-okhttp:1.6.4")
implementation("org.apache.tika:tika-parsers:1.24.1")
implementation("org.jsoup:jsoup:1.14.3")
implementation("org.jetbrains:space-sdk-jvm:83821-beta")
implementation("de.undercouch:gradle-download-task:4.1.2")
}
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,14 @@ import org.gradle.api.tasks.Internal
import org.gradle.api.tasks.OutputFile
import org.gradle.api.tasks.TaskAction
import org.jetbrains.compose.internal.publishing.utils.SpaceApiClient
import org.jetbrains.compose.internal.publishing.utils.SpaceApiClient.PackageInfo
import space.jetbrains.api.runtime.types.PackageRepositoryIdentifier
import space.jetbrains.api.runtime.types.ProjectIdentifier
import java.util.regex.Pattern

abstract class FindModulesInSpaceTask : DefaultTask() {
@get:Input
abstract val requestedGroupId: Property<String>

@get:Input
abstract val requestedVersion: Property<String>
abstract val requestedCoordinates: Property<String>

@get:Input
abstract val spaceInstanceUrl: Property<String>
Expand Down Expand Up @@ -52,11 +51,14 @@ abstract class FindModulesInSpaceTask : DefaultTask() {
val projectId = ProjectIdentifier.Id(spaceProjectId.get())
val repoId = PackageRepositoryIdentifier.Id(spaceRepoId.get())
val modules = ArrayList<String>()
val requestedGroupId = requestedGroupId.get()
val requestedVersion = requestedVersion.get()
space.forEachPackageWithVersion(projectId, repoId, requestedVersion) { pkg ->
if (pkg.groupId.startsWith(requestedGroupId)) {
modules.add("${pkg.groupId}:${pkg.artifactId}:${pkg.version}")
val requestedCoordinates = requestedCoordinates.get().split(",")
requestedCoordinates.forEach { req ->
val version = req.substringAfterLast(":") // suppose we don't support wildcards in version
space.forEachPackageWithVersion(projectId, repoId, version) { pkg ->
val pkgStr = pkg.toString()
if (pkgStr.matchesWildcard(req)) {
modules.add(pkgStr)
}
}
}

Expand All @@ -65,4 +67,9 @@ abstract class FindModulesInSpaceTask : DefaultTask() {
writeText(modules.joinToString("\n"))
}
}
}
}

private fun String.matchesWildcard(pattern: String): Boolean = "\\Q$pattern\\E"
.replace("*", "\\E.*\\Q")
.toRegex()
.matches(this)
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,14 @@ import org.gradle.api.provider.Provider

@Suppress("unused") // public api
class MavenCentralProperties(private val myProject: Project) {
val version: Provider<String> =
propertyProvider("maven.central.version")
val coordinates: Provider<String> =
propertyProvider("maven.central.coordinates")

val stage: Provider<String> =
propertyProvider("maven.central.stage")

val description: Provider<String> =
propertyProvider("maven.central.description")

val user: Provider<String> =
propertyProvider("maven.central.user", envVar = "MAVEN_CENTRAL_USER")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ abstract class UploadToSonatypeTask : DefaultTask() {
abstract val stagingProfileName: Property<String>

@get:Internal
abstract val autoCommitOnSuccess: Property<Boolean>
abstract val stagingDescription: Property<String>

@get:Internal
abstract val version: Property<String>
abstract val autoCommitOnSuccess: Property<Boolean>

@get:Internal
abstract val modulesToUpload: ListProperty<ModuleToUpload>
Expand Down Expand Up @@ -59,7 +59,7 @@ abstract class UploadToSonatypeTask : DefaultTask() {
validate(stagingProfile, modules)

val stagingRepo = sonatype.createStagingRepo(
stagingProfile, "Staging repo for '${stagingProfile.name}' release '${version.get()}'"
stagingProfile, stagingDescription.get()
)
try {
for (module in modules) {
Expand All @@ -76,7 +76,7 @@ abstract class UploadToSonatypeTask : DefaultTask() {
private fun validate(stagingProfile: StagingProfile, modules: List<ModuleToUpload>) {
val validationIssues = arrayListOf<Pair<ModuleToUpload, ModuleValidator.Status.Error>>()
for (module in modules) {
val status = ModuleValidator(stagingProfile, module, version.get()).validate()
val status = ModuleValidator(stagingProfile, module).validate()
if (status is ModuleValidator.Status.Error) {
validationIssues.add(module to status)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import java.io.File
internal class ModuleValidator(
private val stagingProfile: StagingProfile,
private val module: ModuleToUpload,
private val version: String
) {
private val errors = arrayListOf<String>()
private var status: Status? = null
Expand All @@ -37,10 +36,6 @@ internal class ModuleValidator(
errors.add("Module's group id '${module.groupId}' does not match staging repo '${stagingProfile.name}'")
}

if (module.version != version) {
errors.add("Unexpected version '${module.version}' (expected: '$version')")
}

val pomFile = artifactFile(extension = "pom")
val pom = when {
pomFile.exists() ->
Expand Down
Loading

0 comments on commit eb0197f

Please sign in to comment.