Skip to content

Commit 7c5f391

Browse files
Merge pull request #197 from SpineEventEngine/newer-protodata-etc
Newer ProtoData and other dependencies
2 parents 8314a80 + 6574cae commit 7c5f391

16 files changed

Lines changed: 514 additions & 423 deletions

File tree

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,4 +117,4 @@ pubspec.lock
117117
# Ignore the `tmp` directory used for building dependant repositories.
118118
/tmp
119119

120-
old-dot-gradle-test-kit/
120+
.gradle-test-kit/

build.gradle.kts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@ buildscript {
7474
dependencies {
7575
classpath(mcJava.pluginLib)
7676
classpath(enforcedPlatform(io.spine.dependency.kotlinx.Coroutines.bom))
77+
classpath(enforcedPlatform(io.spine.dependency.lib.Grpc.bom))
7778
}
7879
}
7980

buildSrc/src/main/kotlin/io/spine/dependency/Dependency.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -114,5 +114,3 @@ private fun ResolutionStrategy.forceWithLogging(
114114
force(artifact)
115115
project.log { "Forced the version of `$artifact` in " + configuration.diagSuffix(project) }
116116
}
117-
118-

buildSrc/src/main/kotlin/io/spine/dependency/local/Base.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ package io.spine.dependency.local
3333
*/
3434
@Suppress("ConstPropertyName")
3535
object Base {
36-
const val version = "2.0.0-SNAPSHOT.316"
37-
const val versionForBuildScript = "2.0.0-SNAPSHOT.316"
36+
const val version = "2.0.0-SNAPSHOT.317"
37+
const val versionForBuildScript = "2.0.0-SNAPSHOT.317"
3838
const val group = Spine.group
3939
const val artifact = "spine-base"
4040
const val lib = "$group:$artifact:$version"

buildSrc/src/main/kotlin/io/spine/dependency/local/CoreJava.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ package io.spine.dependency.local
3434
@Suppress("ConstPropertyName", "unused")
3535
object CoreJava {
3636
const val group = Spine.group
37-
const val version = "2.0.0-SNAPSHOT.301"
37+
const val version = "2.0.0-SNAPSHOT.313"
3838

3939
const val coreArtifact = "spine-core"
4040
const val clientArtifact = "spine-client"

buildSrc/src/main/kotlin/io/spine/dependency/local/McJava.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,12 +42,12 @@ object McJava {
4242
/**
4343
* The version used to in the build classpath.
4444
*/
45-
const val dogfoodingVersion = "2.0.0-SNAPSHOT.307"
45+
const val dogfoodingVersion = "2.0.0-SNAPSHOT.310"
4646

4747
/**
4848
* The version to be used for integration tests.
4949
*/
50-
const val version = "2.0.0-SNAPSHOT.307"
50+
const val version = "2.0.0-SNAPSHOT.310"
5151

5252
/**
5353
* The ID of the Gradle plugin.

buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoData.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ object ProtoData {
7272
* The version of ProtoData dependencies.
7373
*/
7474
val version: String
75-
private const val fallbackVersion = "0.94.0"
75+
private const val fallbackVersion = "0.95.0"
7676

7777
/**
7878
* The distinct version of ProtoData used by other build tools.
@@ -81,7 +81,7 @@ object ProtoData {
8181
* transitional dependencies, this is the version used to build the project itself.
8282
*/
8383
val dogfoodingVersion: String
84-
private const val fallbackDfVersion = "0.94.0"
84+
private const val fallbackDfVersion = "0.95.0"
8585

8686
/**
8787
* The artifact for the ProtoData Gradle plugin.

buildSrc/src/main/kotlin/io/spine/dependency/local/ProtoTap.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ package io.spine.dependency.local
3838
)
3939
object ProtoTap {
4040
const val group = "io.spine.tools"
41-
const val version = "0.9.1"
41+
const val version = "0.10.0"
4242
const val gradlePluginId = "io.spine.prototap"
4343
const val api = "$group:prototap-api:$version"
4444
const val gradlePlugin = "$group:prototap-gradle-plugin:$version"

buildSrc/src/main/kotlin/io/spine/dependency/local/Validation.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ object Validation {
3636
/**
3737
* The version of the Validation library artifacts.
3838
*/
39-
const val version = "2.0.0-SNAPSHOT.316"
39+
const val version = "2.0.0-SNAPSHOT.332"
4040

4141
const val group = "io.spine.validation"
4242
private const val prefix = "spine-validation"

buildSrc/src/main/kotlin/io/spine/gradle/protobuf/ProtoTaskExtensions.kt

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,14 @@
3030
package io.spine.gradle.protobuf
3131

3232
import com.google.protobuf.gradle.GenerateProtoTask
33+
import com.google.protobuf.gradle.ProtobufExtension
3334
import io.spine.gradle.sourceSets
3435
import java.io.File
3536
import java.nio.file.Files
3637
import java.nio.file.Path
3738
import java.nio.file.Paths
3839
import java.nio.file.StandardOpenOption.TRUNCATE_EXISTING
40+
import kotlin.io.path.Path
3941
import org.gradle.api.Project
4042
import org.gradle.api.file.SourceDirectorySet
4143
import org.gradle.api.tasks.SourceSet
@@ -329,18 +331,42 @@ fun IdeaModule.printSourceDirectories() {
329331
excludeDirs.forEach { println(it) }
330332
}
331333

334+
/**
335+
* Obtains the extension of Protobuf Gradle Plugin in the given project.
336+
*/
337+
val Project.protobufExtension: ProtobufExtension?
338+
get() = extensions.findByType(ProtobufExtension::class.java)
339+
332340
/**
333341
* Obtains the directory where the Protobuf Gradle Plugin should place the generated code.
334342
*
335-
* The directory is fixed to be `$buildDir/generated/source/proto` and cannot be
336-
* changed by the settings of the plugin. Even though [ProtobufExtension] has a property
343+
* The directory is fixed to be `$buildDir/generated/source/proto` in versions pre v0.9.5
344+
* and cannot be changed by the settings of the plugin.
345+
* In the v0.9.5 the path was changed to
346+
* [`$buildDir/generated/sources/proto`](https://github.com/google/protobuf-gradle-plugin/releases/tag/v0.9.5).
347+
*
348+
* Even though [ProtobufExtension] has a property
337349
* [generatedFilesBaseDir][ProtobufExtension.getGeneratedFilesBaseDir], which is supposed
338-
* to be used for this purpose, it is declared with `@PackageScope` and thus cannot be
339-
* accessed from outside the plugin. The Protobuf Gradle Plugin (at v0.9.2) does not
340-
* modify the value of the property either.
350+
* to be used for this purpose, it is declared with `@PackageScope` (again in earlier versions)
351+
* and thus cannot be accessed from outside the plugin.
352+
* The Protobuf Gradle Plugin (at v0.9.2) does not modify the value of the property either.
353+
* Therefore, we try getting the path using the newer version API and resort to the "legacy"
354+
* convention if the call fails.
341355
*/
342356
val Project.generatedSourceProtoDir: Path
343-
get() = layout.buildDirectory.dir("generated/source/proto").get().asFile.toPath()
357+
get() {
358+
val legacyPath = layout.buildDirectory.dir("generated/source/proto").get().asFile.toPath()
359+
protobufExtension?.let {
360+
return try {
361+
it.generatedFilesBaseDir.let { Path(it) }
362+
} catch (_: Throwable) {
363+
// Probably we're running on an older version of the Protobuf Gradle Plugin
364+
// which has `package-access` for the `getGeneratedFilesDir()` method.
365+
legacyPath
366+
}
367+
}
368+
return legacyPath
369+
}
344370

345371
/**
346372
* Ensures that the sources generated by Protobuf Gradle Plugin

0 commit comments

Comments
 (0)