Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,6 @@
package io.spine.dependency.local

import io.spine.dependency.Dependency
import io.spine.dependency.local.Compiler.DF_VERSION_ENV
import io.spine.dependency.local.Compiler.VERSION_ENV
import io.spine.dependency.local.Compiler.dogfoodingVersion
import io.spine.dependency.local.Compiler.pluginLib
import io.spine.dependency.local.Compiler.version

/**
* Dependencies on the Spine Compiler modules.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -61,33 +61,20 @@ object CoreJvmCompiler {
/**
* The library with the [dogfoodingVersion].
*/
val pluginLib = pluginLibNew(dogfoodingVersion)
val pluginLib = pluginLib(dogfoodingVersion)

/**
* The library with the given [version].
*
* This is the notation before the version `2.0.0-SNAPSHOT.013`
* The name of the published fat JAR artifact.
*/
@Deprecated("Use `pluginLibNew()` instead.")
fun pluginLib(version: String): String = "$group:core-jvm-plugins:$version:all"
const val fatJarArtifact = "core-jvm-plugins"

/**
* The library with the given [version].
*
* @since 2.0.0-SNAPSHOT.013
*/
fun pluginLibNew(version: String): String = "$group:core-jvm-plugins:$version"

/** The artifact reference for forcing in configurations. */
const val pluginsArtifact: String = "$group:core-jvm-plugins:$version"

/**
* The `core-jvm-base` artifact with the [version].
*/
val base = base(version)
fun pluginLib(version: String): String = "$group:core-jvm-plugins:$version"

/**
* The `core-jvm-base` artifact with the given [version].
* The artifact reference for forcing in configurations.
*/
fun base(version: String): String = "$group:core-jvm-base:$version"
val pluginsArtifact: String = pluginLib(version)
}
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ package io.spine.dependency.local
*/
@Suppress("ConstPropertyName")
object TestLib {
const val version = "2.0.0-SNAPSHOT.212"
const val version = "2.0.0-SNAPSHOT.213"
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 @@ -149,10 +149,8 @@ import org.gradle.kotlin.dsl.findByType
*/
fun Project.spinePublishing(block: SpinePublishing.() -> Unit): SpinePublishing {
apply<MavenPublishPlugin>()
val name = SpinePublishing::class.java.simpleName
.replaceFirstChar { it.lowercase(Locale.getDefault()) }
val extension = with(extensions) {
findByType<SpinePublishing>() ?: create(name, project)
findByType<SpinePublishing>() ?: create(SpinePublishing.extensionName, project)
}
extension.run {
block()
Expand Down Expand Up @@ -192,6 +190,12 @@ open class SpinePublishing(private val project: Project) {
* to a tool module's artifact ID.
*/
const val NONE_PREFIX = "NONE"

/**
* The name of the extension registered in a Gradle project.
*/
public val extensionName: String = SpinePublishing::class.java.simpleName
.replaceFirstChar { it.lowercase(Locale.ROOT) }
}

private val testJar = TestJar()
Expand Down Expand Up @@ -346,13 +350,14 @@ open class SpinePublishing(private val project: Project) {
*
* @see modules
*/
private fun projectsToPublish(): Collection<Project> {
fun projectsToPublish(): Set<Project> {
if (project.subprojects.isEmpty()) {
return setOf(project)
}
return modules.union(modulesWithCustomPublishing)
.map { name -> project.project(name) }
.ifEmpty { setOf(project) }
.toSet()
}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,9 @@ class SpinePublishingTest {
// Let's use it instead of creating a second one with a different name.
extension.modules = setOf("sub")

// Subproject's extension must be named 'SpinePublishing'
// to be found by SpinePublishing::class.java.simpleName
val extensionName = SpinePublishing::class.java.simpleName
val subExtension = subproject.extensions.create<SpinePublishing>(extensionName, subproject)
val extensionName = SpinePublishing.extensionName
val subExtension =
subproject.extensions.create<SpinePublishing>(extensionName, subproject)

val exception = shouldThrow<IllegalStateException> {
subExtension.configured()
Expand Down
Loading