Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
49 commits
Select commit Hold shift + click to select a range
dbc4c90
Improve doc wording
alexander-yevsyukov Apr 21, 2024
92d94b8
Add draft `PipelineSetup`
alexander-yevsyukov Apr 22, 2024
bf720d6
Bump version -> `0.21.6`
alexander-yevsyukov Apr 22, 2024
c503b4a
Rename `SettingsDirectory.directory` to `path`
alexander-yevsyukov Apr 22, 2024
59c4abb
Update dependency reports
alexander-yevsyukov Apr 22, 2024
e00300a
Add vanilla Protobuf test fixtures
alexander-yevsyukov Apr 22, 2024
1239c8e
Add popular format extensions
alexander-yevsyukov Apr 25, 2024
3847d20
Store codegen request into a file
alexander-yevsyukov Apr 25, 2024
ebefc75
Fix the path to stored request
alexander-yevsyukov Apr 25, 2024
7ff8a46
Fix the path to stored request
alexander-yevsyukov Apr 25, 2024
72c0ca8
Update docs and extensions for the `Format` enum
alexander-yevsyukov Apr 25, 2024
6bf752a
Generate descriptor set file
alexander-yevsyukov May 1, 2024
6488255
Test `binpb` as the primary format extension
alexander-yevsyukov May 1, 2024
c23cbdf
Temporarily disable test
alexander-yevsyukov May 1, 2024
6d4fa68
Improve docs of `protoc` plugin
alexander-yevsyukov May 2, 2024
c44482a
Bump `checkout` and `setup-java` -> `v4`
alexander-yevsyukov May 2, 2024
99ecccb
Add `prototap` build extension
alexander-yevsyukov May 2, 2024
d059e59
Consolidate `protoc` plugin code
alexander-yevsyukov May 2, 2024
06a4805
Avoid unnecessary dependencies
alexander-yevsyukov May 2, 2024
7ff9968
Specify artifact for `protoc`
alexander-yevsyukov May 2, 2024
2f0fe20
Bump ProtoTap -> `0.8.3`
alexander-yevsyukov May 2, 2024
82cbe8f
Expose `Protobuf.javaLib` artifact
alexander-yevsyukov May 2, 2024
5c92254
Remove unnecessary file
alexander-yevsyukov May 2, 2024
83952fd
Get generated source code from ProtoTap
alexander-yevsyukov May 2, 2024
b4d5e9e
Remove extra empty line
alexander-yevsyukov May 3, 2024
e60c551
Update `config`
alexander-yevsyukov May 8, 2024
6343330
Update `config`
alexander-yevsyukov May 8, 2024
ac951c9
Obtain class loader from a calling class
alexander-yevsyukov May 8, 2024
3b9fbf3
Expose obtaining the calling class
alexander-yevsyukov May 8, 2024
b03588d
Remove redundant build config
alexander-yevsyukov May 8, 2024
af7cf87
Improve tests of `PipelineSetup`
alexander-yevsyukov May 8, 2024
87b5682
Extract common code as `fun`
alexander-yevsyukov May 8, 2024
aa33a66
Add test for `protocOutputDir` ext. `fun`
alexander-yevsyukov May 8, 2024
e65914d
Document `PipelineSetup` factory methods
alexander-yevsyukov May 8, 2024
f562db3
Document the constructor
alexander-yevsyukov May 8, 2024
7ed4a2d
Update build time
alexander-yevsyukov May 8, 2024
ee8716b
Update `config`
alexander-yevsyukov May 8, 2024
aaf7539
Document `-Xexpect-actual-classes` Kotlin compiler arg.
alexander-yevsyukov May 9, 2024
0d8051d
Restore the comment on archive classifier
alexander-yevsyukov May 9, 2024
5fa074a
Fix the level of nested headers
alexander-yevsyukov May 9, 2024
be79255
Document directory name conventions
alexander-yevsyukov May 9, 2024
6d9e4be
Update build time
alexander-yevsyukov May 9, 2024
0f16652
Fix grammar in docs
alexander-yevsyukov May 9, 2024
e75c694
Update build time
alexander-yevsyukov May 9, 2024
1a7a1a3
Fix the level of the header
alexander-yevsyukov May 9, 2024
307573e
Bump Dokka -> `1.9.20`
alexander-yevsyukov May 9, 2024
7bd1074
Fix doc heading levels
alexander-yevsyukov May 9, 2024
f3393f4
Use link to the method
alexander-yevsyukov May 9, 2024
dc95cde
Update build time
alexander-yevsyukov May 9, 2024
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 @@ -37,17 +37,22 @@ import kotlin.io.path.listDirectoryEntries
* A directory containing settings files.
*
* Only the files with the [recognized extensions][Format] are considered settings files.
* Only the files directly in the directory are considered, no subdirectories are traversed.
*
* Only the files belonging to the directory directly are considered,
* no subdirectories are traversed.
*
* @param path
* the existing path to the settings directory.
*/
public class SettingsDirectory(
private val directory: Path
public val path: Path
) {
init {
require(directory.toFile().isDirectory) {
"The path `$directory` is not a directory."
require(path.toFile().isDirectory) {
"The path `$path` is not a directory."
}
require(directory.exists()) {
"The directory `$directory` does not exist."
require(path.exists()) {
"The directory `$path` does not exist."
}
}

Expand Down Expand Up @@ -111,7 +116,7 @@ public class SettingsDirectory(

private fun file(consumerId: String, format: Format): Path {
val fileName = "${consumerId}.${format.extensions.first()}"
return directory.resolve(fileName)
return path.resolve(fileName)
}

/**
Expand All @@ -126,6 +131,6 @@ public class SettingsDirectory(
}

private fun files() =
directory.listDirectoryEntries()
path.listDirectoryEntries()
.filter { it.isSettings() }
}
16 changes: 13 additions & 3 deletions api/src/main/proto/spine/protodata/settings.proto
Original file line number Diff line number Diff line change
Expand Up @@ -70,21 +70,31 @@ extend google.protobuf.EnumValueOptions {

// Possible file extensions associated with a file format.
//
// Only applicable to the `ConfigurationFormat` enum.
// Only applicable to the `Format` enum.
//
repeated string extension = 73980 [(internal) = true];
}

// The format of a custom configuration for ProtoData.
// The format of a protobuf message stored in a file.
//
// Configuration files for ProtoData and its plugins could be stored in one of these formats.
//
enum Format {

RCF_UNKNOWN = 0;

// A Protobuf message encoded in binary.
PROTO_BINARY = 1 [(extension) = "pb", (extension) = "bin"];
//
// See: https://protobuf.dev/programming-guides/techniques/#suffixes
// See: https://buf.build/docs/reference/inputs#binpb
//
PROTO_BINARY = 1 [(extension) = "binpb", (extension) = "pb", (extension) = "bin"];

// A Protobuf message encoded in Protobuf JSON.
//
// Use this item instead of [JSON] for Protobuf messages stored in
// JSON format so that the correct parser is selected for the file.
//
PROTO_JSON = 2 [(extension) = "pb.json"];

// A plain JSON value.
Expand Down
31 changes: 18 additions & 13 deletions api/src/test/kotlin/io/spine/protodata/settings/FormatSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,8 @@

package io.spine.protodata.settings

import com.google.common.truth.Truth.assertThat
import io.kotest.matchers.collections.shouldContainInOrder
import io.kotest.matchers.shouldBe
import io.spine.protodata.settings.Format.JSON
import io.spine.protodata.settings.Format.PLAIN
import io.spine.protodata.settings.Format.PROTO_BINARY
Expand All @@ -41,18 +42,22 @@ class FormatSpec {

@Test
fun `provide allowed extensions`() {
assertThat(RCF_UNKNOWN.extensions)
.isEmpty()
RCF_UNKNOWN.extensions shouldBe emptyList()

assertThat(JSON.extensions)
.containsExactly("json")
assertThat(PROTO_JSON.extensions)
.containsExactly("pb.json")
assertThat(PROTO_BINARY.extensions)
.containsExactly("pb", "bin")
assertThat(YAML.extensions)
.containsExactly("yml", "yaml")
assertThat(PLAIN.extensions)
.containsExactly("txt")
PROTO_BINARY.extensions.shouldContainInOrder(
"binpb", "pb", "bin"
)
PROTO_JSON.extensions.shouldContainInOrder(
"pb.json"
)
JSON.extensions.shouldContainInOrder(
"json"
)
YAML.extensions.shouldContainInOrder(
"yml", "yaml"
)
PLAIN.extensions.shouldContainInOrder(
"txt"
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class Pipeline(
private val request: CodeGeneratorRequest,

/**
* The directory where setting files for this pipeline are stored.
* The directory to which setting files for the [plugins] should be stored.
*/
private val settings: SettingsDirectory
) {
Expand Down
19 changes: 12 additions & 7 deletions buildSrc/src/main/kotlin/BuildExtensions.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, TeamDev. All rights reserved.
* Copyright 2024, 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 @@ -31,6 +31,7 @@ import io.spine.internal.dependency.GradleDoctor
import io.spine.internal.dependency.Kotest
import io.spine.internal.dependency.Kover
import io.spine.internal.dependency.ProtoData
import io.spine.internal.dependency.ProtoTap
import io.spine.internal.dependency.Protobuf
import io.spine.internal.dependency.Spine
import io.spine.internal.gradle.standardToSpineSdk
Expand Down Expand Up @@ -81,8 +82,9 @@ val PluginDependenciesSpec.mcJava: Spine.McJava
/**
* Shortcut to [ProtoData] dependency object.
*
* This plugin is in Gradle Portal. But when used in pair with [mcJava], it cannot be applied
* directly to a project. It is so, because [mcJava] uses [protoData] as its dependency.
* This plugin is published at Gradle Portal. But when used in a pair with [mcJava],
* it cannot be applied directly to a project.
* It is so, because [mcJava] uses [protoData] as its dependency.
* And buildscript's classpath ends up with both of them.
*/
val PluginDependenciesSpec.protoData: ProtoData
Expand All @@ -95,8 +97,8 @@ val PluginDependenciesSpec.protoData: ProtoData
* declared in auto-generated `org.gradle.kotlin.dsl.PluginAccessors.kt` file.
* It conflicts with our own declarations.
*
* Declaring of top-level shortcuts eliminates need in applying plugins
* using fully-qualified name of dependency objects.
* Declaring of top-level shortcuts eliminates the need in applying plugins
* using fully qualified name of dependency objects.
*
* It is still possible to apply a plugin with a custom version, if needed.
* Just declare a version again on the returned [PluginDependencySpec].
Expand All @@ -117,6 +119,9 @@ val PluginDependenciesSpec.errorprone: PluginDependencySpec
val PluginDependenciesSpec.protobuf: PluginDependencySpec
get() = id(Protobuf.GradlePlugin.id)

val PluginDependenciesSpec.prototap: PluginDependencySpec
get() = id(ProtoTap.gradlePluginId).version(ProtoTap.version)

val PluginDependenciesSpec.`gradle-doctor`: PluginDependencySpec
get() = id(GradleDoctor.pluginId).version(GradleDoctor.version)

Expand All @@ -132,9 +137,9 @@ val PluginDependenciesSpec.kover: PluginDependencySpec
* Configures the dependencies between third-party Gradle tasks
* and those defined via ProtoData and Spine Model Compiler.
*
* It is required in order to avoid warnings in build logs, detecting the undeclared
* It is required to avoid warnings in build logs, detecting the undeclared
* usage of Spine-specific task output by other tasks,
* e.g. the output of `launchProtoData` is used by `compileKotlin`.
* e.g., the output of `launchProtoData` is used by `compileKotlin`.
*/
@Suppress("unused")
fun Project.configureTaskDependencies() {
Expand Down
8 changes: 6 additions & 2 deletions buildSrc/src/main/kotlin/DependencyResolution.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2023, TeamDev. All rights reserved.
* Copyright 2024, 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 @@ -57,7 +57,7 @@ import org.gradle.api.artifacts.ConfigurationContainer
import org.gradle.api.artifacts.ResolutionStrategy

/**
* The function to be used in `buildscript` when a fully-qualified call must be made.
* The function to be used in `buildscript` when a fully qualified call must be made.
*/
@Suppress("unused")
fun doForceVersions(configurations: ConfigurationContainer) {
Expand Down Expand Up @@ -122,6 +122,10 @@ private fun ResolutionStrategy.forceTestDependencies() {
private fun ResolutionStrategy.forceTransitiveDependencies() {
force(
Asm.lib,
Asm.tree,
Asm.analysis,
Asm.util,
Asm.commons,
AutoValue.annotations,
CommonsCli.lib,
CommonsCodec.lib,
Expand Down
10 changes: 9 additions & 1 deletion buildSrc/src/main/kotlin/io/spine/internal/dependency/Asm.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ package io.spine.internal.dependency
// https://asm.ow2.io/
@Suppress("unused", "ConstPropertyName")
object Asm {
private const val version = "9.2"
private const val version = "9.6"
const val lib = "org.ow2.asm:asm:$version"

// We use the following artifacts only to force the versions
// of the dependencies which are transitive for us.
//
const val tree = "org.ow2.asm:asm-tree:$version"
const val analysis = "org.ow2.asm:asm-analysis:$version"
const val util = "org.ow2.asm:asm-util:$version"
const val commons = "org.ow2.asm:asm-commons:$version"
}
41 changes: 41 additions & 0 deletions buildSrc/src/main/kotlin/io/spine/internal/dependency/Caffeine.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2024, 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.spine.internal.dependency

/**
* A [high performance](https://github.com/ben-manes/caffeine/wiki/Benchmarks),
* [near optimal](https://github.com/ben-manes/caffeine/wiki/Efficiency) caching library.
*
* This library is a transitive dependency for us via ErrorProne.
*
* @see <a href="https://github.com/ben-manes/caffeine">Caffeine at GitHub</a>
*/
@Suppress("unused")
object Caffeine {
private const val version = "3.0.5"
const val lib = "com.github.ben-manes.caffeine:caffeine:$version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ object Dokka {
* When changing the version, also change the version used in the
* `buildSrc/build.gradle.kts`.
*/
const val version = "1.9.10"
const val version = "1.9.20"

object GradlePlugin {
const val id = "org.jetbrains.dokka"
Expand Down
37 changes: 37 additions & 0 deletions buildSrc/src/main/kotlin/io/spine/internal/dependency/Jacoco.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* Copyright 2023, 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.spine.internal.dependency

/**
* Code coverage library for Java.
*
* @see <a href="https://www.eclemma.org/jacoco/">Releases</a>
*/
@Suppress("ConstPropertyName")
object Jacoco {
const val version = "0.8.12"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ package io.spine.internal.dependency
// https://github.com/Kotlin/kotlinx-kover
@Suppress("unused", "ConstPropertyName")
object Kover {
const val version = "0.7.4"
const val version = "0.7.6"
const val id = "org.jetbrains.kotlinx.kover"
const val classpath = "org.jetbrains.kotlinx:kover-gradle-plugin:$version"
}
42 changes: 42 additions & 0 deletions buildSrc/src/main/kotlin/io/spine/internal/dependency/Log4j2.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
/*
* Copyright 2024, 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Redistribution and use in source and/or binary forms, with or without
* modification, must retain the above copyright notice and the following
* disclaimer.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package io.spine.internal.dependency

/**
* An open-source logging framework.
*
* Spine uses its own [logging library][Spine.Logging], but also
* provides a backend implementation for [Log4j2]. This is why
* this dependency is needed.
*
* @see <a href="https://github.com/apache/logging-log4j2">Log4j2 releases at GitHub</a>
*/
@Suppress("unused", "ConstPropertyName")
object Log4j2 {
private const val version = "2.20.0"
const val core = "org.apache.logging.log4j:log4j-core:$version"
}
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ object ProtoData {
* The version of ProtoData dependencies.
*/
val version: String
private const val fallbackVersion = "0.20.7"
private const val fallbackVersion = "0.21.5"

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

/**
* The artifact for the ProtoData Gradle plugin.
Expand Down
Loading