Skip to content

Commit

Permalink
Merge pull request #534 from SpineEventEngine/latest-small-updates
Browse files Browse the repository at this point in the history
Take custom artifact prefix when checking for version increment
  • Loading branch information
alexander-yevsyukov authored Jan 4, 2025
2 parents f9951f9 + 42814c3 commit 4385bf4
Show file tree
Hide file tree
Showing 6 changed files with 44 additions and 27 deletions.
14 changes: 3 additions & 11 deletions .idea/inspectionProfiles/Project_Default.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -42,12 +42,12 @@ object McJava {
/**
* The version used to in the build classpath.
*/
const val dogfoodingVersion = "2.0.0-SNAPSHOT.259"
const val dogfoodingVersion = "2.0.0-SNAPSHOT.262"

/**
* The version to be used for integration tests.
*/
const val version = "2.0.0-SNAPSHOT.259"
const val version = "2.0.0-SNAPSHOT.262"

/**
* The ID of the Gradle plugin.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -73,7 +73,7 @@ object ProtoData {
* The version of ProtoData dependencies.
*/
val version: String
private const val fallbackVersion = "0.80.1"
private const val fallbackVersion = "0.90.1"

/**
* The distinct version of ProtoData used by other build tools.
Expand All @@ -82,7 +82,7 @@ object ProtoData {
* transitional dependencies, this is the version used to build the project itself.
*/
val dogfoodingVersion: String
private const val fallbackDfVersion = "0.80.1"
private const val fallbackDfVersion = "0.90.1"

/**
* The artifact for the ProtoData Gradle plugin.
Expand All @@ -106,6 +106,9 @@ object ProtoData {
val backend
get() = "$group:protodata-backend:$version"

val params
get() = "$group:protodata-params:$version"

val protocPlugin
get() = "$group:protodata-protoc:$version"

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -36,7 +36,7 @@ object Validation {
/**
* The version of the Validation library artifacts.
*/
const val version = "2.0.0-SNAPSHOT.178"
const val version = "2.0.0-SNAPSHOT.183"

const val group = "io.spine.validation"
private const val prefix = "spine-validation"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -70,8 +70,9 @@ open class CheckVersionIncrement : DefaultTask() {
val versions = metadata?.versioning?.versions
val versionExists = versions?.contains(version) ?: false
if (versionExists) {
throw GradleException("""
Version `$version` is already published to maven repository `$repoUrl`.
throw GradleException(
"""
The version `$version` is already published to the Maven repository `$repoUrl`.
Try incrementing the library version.
All available versions are: ${versions?.joinToString(separator = ", ")}.
Expand All @@ -88,13 +89,28 @@ open class CheckVersionIncrement : DefaultTask() {

private fun Project.artifactPath(): String {
val group = this.group as String
val name = "spine-${this.name}"
val name = "${artifactPrefix()}${this.name}"

val pathElements = ArrayList(group.split('.'))
pathElements.add(name)
val path = pathElements.joinToString(separator = "/")
return path
}

/**
* Returns the artifact prefix used for the publishing of this project.
*
* All current Spine modules should be using `SpinePublishing`.
* Therefore, the corresponding extension should be present in the root project.
* However, just in case, we define the "standard" prefix here as well.
*
* This value MUST be the same as defined by the defaults in `SpinePublishing`.
*/
private fun Project.artifactPrefix(): String {
val ext = rootProject.extensions.findByType(SpinePublishing::class.java)
val result = ext?.artifactPrefix ?: SpinePublishing.DEFAULT_PREFIX
return result
}
}

private data class MavenMetadata(var versioning: Versioning = Versioning()) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2024, TeamDev. All rights reserved.
* Copyright 2025, TeamDev. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -137,6 +137,14 @@ fun Project.spinePublishing(block: SpinePublishing.() -> Unit) {
*/
open class SpinePublishing(private val project: Project) {

companion object {

/**
* The default prefix added before a module name when publishing artifacts.
*/
const val DEFAULT_PREFIX = "spine-"
}

private val protoJar = ProtoJar()
private val testJar = TestJar()
private val dokkaJar = DokkaJar()
Expand Down Expand Up @@ -197,10 +205,8 @@ open class SpinePublishing(private val project: Project) {

/**
* A prefix to be added before the name of each artifact.
*
* The default value is "spine-".
*/
var artifactPrefix: String = "spine-"
var artifactPrefix: String = DEFAULT_PREFIX

/**
* Allows disabling publishing of [protoJar] artifact, containing all Proto sources
Expand Down

0 comments on commit 4385bf4

Please sign in to comment.