Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
17 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,3 +92,22 @@ jobs:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: true
verbose: true

# The Codecov CLI ships a set of "file fixes" with every upload. For
# `.kt` files — never `.java` — they mark each line holding nothing
# but a brace or a parenthesis as non-code. JaCoCo, however, does
# measure one such line: it attributes a Kotlin lambda body's
# instructions to the body's closing `}`, through the synthetic
# `$lambda$N` that an `invokedynamic` lambda compiles to. The fixes
# thus discard roughly a tenth of the measured lines, which would be
# harmless if every ingestion applied them. Not every one does: when
# Codecov re-processes a stored upload, the second pass leaves them
# unapplied, so one and the same report can be ingested on either
# line basis. That switch moves the `src/main/**` project status by
# about 0.7 percentage points, fourteen times the threshold in
# `.codecov.yml`, and it has been seen on `master`, whose commits
# are the `target: auto` baselines — so it can shift a pull
# request's delta either way. Sending no fixes makes both ingestion
# paths agree, at the price of counting a lambda-closing brace as a
# coverable line.
disable_file_fixes: true
2 changes: 1 addition & 1 deletion .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ on:
jobs:
publish:
name: Publish to Maven repositories
uses: SpineEventEngine/config/.github/workflows/publishing.yml@3516efc5dee84e88bc541944ff743f435eec6a1d
uses: SpineEventEngine/config/.github/workflows/publishing.yml@ad3dff0890c7716cbba3fe2ce17bf4fe5905a318
permissions:
contents: read
packages: write
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ val grGitVersion = "5.3.3"
* This version may change from the [version of Kotlin][io.spine.dependency.lib.Kotlin.version]
* used by the project.
*/
val kotlinEmbeddedVersion = "2.4.21"
val kotlinEmbeddedVersion = "2.4.10"

/**
* The version of Guava used in `buildSrc`.
Expand Down
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/io/spine/dependency/lib/Kotlin.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object Kotlin : DependencyWithBom() {
* This is the version of Kotlin we use for writing code that does not depend on Gradle.
*/
@Suppress("MemberVisibilityCanBePrivate") // used directly from the outside.
const val runtimeVersion = "2.4.21"
const val runtimeVersion = "2.4.10"

override val version = runtimeVersion
override val group = "org.jetbrains.kotlin"
Expand All @@ -43,7 +43,7 @@ object Kotlin : DependencyWithBom() {
* [embedded into Gradle](https://docs.gradle.org/current/userguide/compatibility.html#kotlin),
* which the Gradle version determines on its own.
*/
const val embeddedVersion = "2.4.21"
const val embeddedVersion = "2.4.10"

/**
* The version of the JetBrains annotations library, which is a transitive
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ package io.spine.dependency.lib
// https://github.com/square/kotlinpoet
@Suppress("unused", "ConstPropertyName")
object KotlinPoet {
private const val version = "2.4.0"
private const val version = "2.3.0"
const val lib = "com.squareup:kotlinpoet:$version"
const val ksp = "com.squareup:kotlinpoet-ksp:$version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,31 @@ object OpenTelemetryKotlin : Dependency() {
*/
val compat = "$group:compat:$version"

/**
* The export machinery of the Kotlin SDK, including the `batchLogRecordProcessor`
* builder.
*
* Use it together with [implementation] and an exporter artifact, such as
* [exportersOtlp]. Like [core] and [implementation], it is for applications
* and tests.
*/
val exportersCore = "$group:exporters-core:$version"

/**
* The OTLP exporters of the Kotlin SDK, such as `otlpHttpLogRecordExporter`,
* which send data over HTTP using Ktor.
*
* Use it together with [exportersCore].
*/
val exportersOtlp = "$group:exporters-otlp:$version"

override val modules: List<String> = listOf(
"$group:api",
"$group:noop",
"$group:core",
"$group:implementation",
"$group:compat",
"$group:exporters-core",
"$group:exporters-otlp",
)
}
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package io.spine.dependency.local
"unused" /* Some subprojects do not use all Base artifacts. */,
)
object Base {
const val version = "2.0.0-SNAPSHOT.461"
const val version = "2.0.0-SNAPSHOT.462"
const val versionForBuildScript = "2.0.0-SNAPSHOT.461"
const val group = Spine.group
private const val prefix = "spine"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ object Compiler : Dependency() {
* The version of the Compiler dependencies.
*/
override val version: String
private const val fallbackVersion = "2.0.0-SNAPSHOT.079"
private const val fallbackVersion = "2.0.0-SNAPSHOT.081"

/**
* The distinct version of the Compiler used by other build tools.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ package io.spine.dependency.local
"unused" /* Some subprojects do not use all Logging artifacts. */,
)
object Logging {
const val version = "2.0.0-SNAPSHOT.426"
const val version = "2.0.0-SNAPSHOT.428"
const val group = Spine.group

const val loggingArtifact = "spine-logging"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ package io.spine.dependency.local
)
object ProtoTap {
const val group = Spine.toolsGroup
const val version = "0.17.3"
const val version = "0.17.4"
const val gradlePluginId = "io.spine.prototap"
const val api = "$group:prototap-api:$version"
const val gradlePlugin = "$group:prototap-gradle-plugin:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package io.spine.dependency.local
"ConstPropertyName" /* We use a custom convention for artifact properties. */,
)
object Reflect {
const val version = "2.0.0-SNAPSHOT.202"
const val version = "2.0.0-SNAPSHOT.203"
const val group = Spine.group
const val artifact = "spine-reflect"
const val lib = "$group:$artifact:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ package io.spine.dependency.local
"ConstPropertyName" /* We use a custom convention for artifact properties. */,
)
object TestLib {
const val version = "2.0.0-SNAPSHOT.215"
const val version = "2.0.0-SNAPSHOT.216"
const val group = Spine.toolsGroup
const val artifact = "base-testlib"
const val lib = "$group:$artifact:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package io.spine.dependency.local
)
object ToolBase {
const val group = Spine.toolsGroup
const val version = "2.0.0-SNAPSHOT.426"
const val version = "2.0.0-SNAPSHOT.428"
const val dogfoodingVersion = "2.0.0-SNAPSHOT.426"

const val archive = "$group:archive:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ package io.spine.dependency.test
*/
@Suppress("unused", "ConstPropertyName")
object KotlinCompileTesting {
private const val version = "0.14.0"
private const val version = "0.13.0"
private const val group = "dev.zacsweers.kctfork"
const val libCore = "$group:core:$version"
const val libKsp = "$group:ksp:$version"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ abstract class CheckVersionIncrement : DefaultTask() {
*/
private fun checkArtifactNotPublished(path: String) {
val artifact = "$path/${MavenMetadata.FILE_NAME}"
val repositories = targetRepositories()
val repositories = repository.targets()
var found = false
for (repoUrl in repositories) {
val metadata = fetch(repoUrl, artifact) ?: continue
Expand All @@ -252,18 +252,6 @@ abstract class CheckVersionIncrement : DefaultTask() {
}
}

/**
* Returns the URLs of the target repositories: the `snapshots` one, and
* the `releases` one unless it is the same destination.
*/
private fun targetRepositories(): List<String> {
val snapshots = repository.target(snapshots = true)
if (repository.hasOneTarget()) {
return listOf(snapshots)
}
return listOf(snapshots, repository.target(snapshots = false))
}

/**
* Throws if the [metadata] of the artifact at the given [path], fetched from [repoUrl],
* lists the current [version].
Expand Down
37 changes: 32 additions & 5 deletions buildSrc/src/main/kotlin/io/spine/gradle/publish/GitHubPackages.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,26 +19,53 @@ import io.spine.gradle.repo.Repository
import io.spine.gradle.buildDirectory
import net.lingala.zip4j.ZipFile
import org.gradle.api.Project
import org.gradle.api.artifacts.repositories.MavenArtifactRepository

/**
* Maven repositories of Spine Event Engine projects hosted at GitHub Packages.
*/
internal object GitHubPackages {

/**
* Obtains an instance of the GitHub Packages repository with the given name.
* The name of the GitHub Packages repository.
*
* The Maven repository that a project publishes to is named after it:
* `GitHub-Packages` for releases, and `GitHub-Packages-snapshots` for snapshots
* (see `Repository.name(snapshots)`).
*/
fun repository(repoName: String): Repository {
const val repositoryName = "GitHub-Packages"

/**
* Obtains an instance of the GitHub Packages repository of the given GitHub repository.
*
* @param slug The name of the GitHub repository of Spine Event Engine, without
* the organization, such as `core-jvm`.
*/
fun repository(slug: String): Repository {
val githubActor: String = actor()
val url = "https://maven.pkg.github.com/SpineEventEngine/$repoName"
val url = "https://maven.pkg.github.com/SpineEventEngine/$slug"
return Repository(
name = "GitHub-Packages",
name = repositoryName,
releases = url,
snapshots = url
) { project -> project.credentialsWithToken(githubActor) }
}

private fun actor(): String {
/**
* Tells whether the given Maven repository is a GitHub Packages one, as registered
* for publishing by [repository].
*
* The name tells it, whichever repository at GitHub Packages the [candidate] is.
*/
fun isRepository(candidate: MavenArtifactRepository): Boolean =
candidate.name in listOf(false, true).map { snapshots ->
Repository.publishingName(name = repositoryName, snapshots = snapshots)
}

/**
* Obtains the user to authenticate with at GitHub Packages, along with a token.
*/
fun actor(): String {
var githubActor: String? = System.getenv("GITHUB_ACTOR")
githubActor = if (githubActor.isNullOrEmpty()) {
"developers@spine.io"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ import io.spine.gradle.SpineTaskGroup
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.publish.maven.tasks.PublishToMavenLocal

/**
Expand Down Expand Up @@ -219,10 +218,3 @@ private fun Project.publishedArtifactPaths(): Set<String> =
mavenPublications()
.map { it.repositoryPath }
.toSet()

/**
* The path to the artifact of this publication in a Maven repository,
* such as `io/spine/spine-base`.
*/
private val MavenPublication.repositoryPath: String
get() = "${groupId.replace('.', '/')}/$artifactId"
19 changes: 9 additions & 10 deletions buildSrc/src/main/kotlin/io/spine/gradle/publish/MavenMetadata.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ package io.spine.gradle.publish

import com.fasterxml.jackson.databind.DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES
import com.fasterxml.jackson.dataformat.xml.XmlMapper
import java.io.FileNotFoundException
import java.net.URL

/**
Expand Down Expand Up @@ -50,16 +49,16 @@ internal data class MavenMetadata(var versioning: Versioning = Versioning()) {
*
* If the document could not be found, assumes that the module was never
* released and thus has no metadata.
*
* The document is read by [RemoteFile], which bounds the read with timeouts
* and retries it after a transient failure.
*
* @param url The URL of the document.
* @param authorization The value of the `Authorization` header to send, if any.
*/
fun fetchAndParse(url: URL): MavenMetadata? {
return try {
url.openStream().use { stream ->
mapper.readValue(stream, MavenMetadata::class.java)
}
} catch (_: FileNotFoundException) {
null
}
}
fun fetchAndParse(url: URL, authorization: String? = null): MavenMetadata? =
RemoteFile.readText(url, authorization)
?.let { mapper.readValue(it, MavenMetadata::class.java) }
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -322,14 +322,19 @@ private fun Project.publishedArtifacts(): Map<String, String> {

mavenPublications().forEach { publication ->
publication.rejectMavenSnapshot()
val base = "${publication.artifactId}-${publication.version}"
publication.artifacts.forEach { artifact ->
val classifier = artifact.classifier?.takeIf { it.isNotEmpty() }
val suffix = classifier?.let { "-$it" } ?: ""
record("$base$suffix.${artifact.extension}", artifact.file)
val name = publication.publishedName(
classifier = artifact.classifier,
extension = artifact.extension
)
record(name, artifact.file)
}
pomFileOf(publication)?.let {
record(publication.publishedName(classifier = null, extension = "pom"), it)
}
moduleFileOf(publication)?.let {
record(publication.publishedName(classifier = null, extension = "module"), it)
}
pomFileOf(publication)?.let { record("$base.pom", it) }
moduleFileOf(publication)?.let { record("$base.module", it) }
}
return result
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ internal object PublicationSbom {
/**
* The extension of a published SBOM, as in `<artifactId>-<version>.spdx.json`.
*/
private const val sbomExtension = "spdx.json"
const val sbomExtension = "spdx.json"

/**
* The [platform][KotlinTarget.platform] under which a JVM module looks up the modules
Expand Down
Loading
Loading