Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

NoReaction instead of Nothing #1554

Merged
merged 22 commits into from
Oct 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 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
7 changes: 4 additions & 3 deletions .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand All @@ -31,7 +31,8 @@ jobs:
require_tests: true # will fail workflow if test reports not found

- name: Upload code coverage report
uses: codecov/codecov-action@v3
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false
verbose: true
5 changes: 3 additions & 2 deletions .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,16 @@ jobs:
runs-on: windows-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
cache: gradle

# See: https://github.com/al-cheb/configure-pagefile-action
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.3
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/ensure-reports-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
# Configure the checkout of all branches, so that it is possible to run the comparison.
fetch-depth: 0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/gradle-wrapper-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout latest code
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Validate Gradle Wrapper
uses: gradle/wrapper-validation-action@v1
4 changes: 2 additions & 2 deletions .github/workflows/increment-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ jobs:
publish:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
submodules: 'true'

- uses: actions/setup-java@v3
- uses: actions/setup-java@v4
with:
java-version: 11
distribution: zulu
Expand Down
2 changes: 1 addition & 1 deletion .idea/copyright/TeamDev_Open_Source.xml

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

8 changes: 2 additions & 6 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -65,22 +65,21 @@ buildscript {
val spine = io.spine.internal.dependency.Spine
@Suppress("DEPRECATION") // To force `Kotlin.stdLibJdk7`.
force(
io.spine.internal.dependency.Grpc.api,
io.spine.internal.dependency.Kotlin.stdLibJdk7,
spine.base,
spine.toolBase,
spine.server,
spine.reflect,
io.spine.internal.dependency.Spine.Logging.lib,
io.spine.internal.dependency.Spine.Logging.middleware,
io.spine.internal.dependency.Spine.Logging.floggerApi,
io.spine.internal.dependency.Validation.runtime,
)
}
}
}

dependencies {
classpath(io.spine.internal.dependency.Spine.McJava.pluginLib)
classpath(mcJava.pluginLib)
}
}

Expand Down Expand Up @@ -111,7 +110,6 @@ spinePublishing {

destinations = with(PublishingRepos) {
setOf(
cloudRepo,
gitHub("core-java"),
cloudArtifactRegistry
)
Expand Down Expand Up @@ -349,8 +347,6 @@ fun Subproject.forceConfigurations() {
Validation.runtime,
Spine.time,
Spine.Logging.lib,
Spine.Logging.middleware,
Spine.Logging.floggerApi,
Spine.baseTypes,
Spine.change,
Spine.reflect,
Expand Down
12 changes: 6 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
* 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
* https://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
Expand Down Expand Up @@ -36,7 +36,7 @@ plugins {
`kotlin-dsl`

// https://github.com/jk1/Gradle-License-Report/releases
id("com.github.jk1.dependency-license-report").version("2.1")
id("com.github.jk1.dependency-license-report").version("2.7")

// https://github.com/johnrengelman/shadow/releases
id("com.github.johnrengelman.shadow").version("7.1.2")
Expand All @@ -51,8 +51,8 @@ repositories {
/**
* The version of Jackson used by `buildSrc`.
*
* Please keep this value in sync. with `io.spine.internal.dependency.Jackson.version`.
* It's not a requirement, but would be good in terms of consistency.
* Please keep this value in sync with [io.spine.internal.dependency.Jackson.version].
* It is not a requirement but would be good in terms of consistency.
*/
val jacksonVersion = "2.15.3"

Expand All @@ -66,7 +66,7 @@ val jacksonVersion = "2.15.3"
*/
val googleAuthToolVersion = "2.1.5"

val licenseReportVersion = "2.1"
val licenseReportVersion = "2.7"

val grGitVersion = "4.1.1"

Expand Down Expand Up @@ -114,7 +114,7 @@ val protobufPluginVersion = "0.9.4"
* @see <a href="https://github.com/Kotlin/dokka/releases">
* Dokka Releases</a>
*/
val dokkaVersion = "1.9.10"
val dokkaVersion = "1.9.20"

/**
* The version of Detekt Gradle Plugin.
Expand Down
113 changes: 91 additions & 22 deletions buildSrc/src/main/kotlin/BuildExtensions.kt
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
/*
* 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.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* https://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
Expand All @@ -30,23 +30,19 @@ import io.spine.internal.dependency.ErrorProne
import io.spine.internal.dependency.GradleDoctor
import io.spine.internal.dependency.Kotest
import io.spine.internal.dependency.Kover
import io.spine.internal.dependency.Ksp
import io.spine.internal.dependency.McJava
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
import org.gradle.api.Project
import org.gradle.api.Task
import org.gradle.api.tasks.JavaExec
import org.gradle.kotlin.dsl.ScriptHandlerScope
import org.gradle.plugin.use.PluginDependenciesSpec
import org.gradle.plugin.use.PluginDependencySpec

/**
* Applies [standard][standardToSpineSdk] repositories to this `buildscript`.
*/
fun ScriptHandlerScope.standardSpineSdkRepositories() {
repositories.standardToSpineSdk()
}

/**
* Provides shortcuts to reference our dependency objects.
*
Expand All @@ -61,28 +57,48 @@ fun ScriptHandlerScope.standardSpineSdkRepositories() {
* get() = id(GradleDoctor.pluginId).version(GradleDoctor.version)
* ```
*
* But for some plugins, it's impossible to apply them directly to a project.
* But for some plugins, it is impossible to apply them directly to a project.
* For example, when a plugin is not published to Gradle Portal, it can only be
* applied with buildscript's classpath. Thus, it's needed to leave some freedom
* applied with the buildscript's classpath. Thus, it is necessary to leave some freedom
* upon how to apply them. In such cases, just a shortcut to a dependency object
* can be declared, without applying of the plugin in-place.
* can be declared without applying the plugin in-place.
*/
private const val ABOUT_DEPENDENCY_EXTENSIONS = ""

/**
* Shortcut to [Spine.McJava] dependency object.
* Applies [standard][standardToSpineSdk] repositories to this `buildscript`.
*/
fun ScriptHandlerScope.standardSpineSdkRepositories() {
repositories.standardToSpineSdk()
}

/**
* Shortcut to [McJava] dependency object for using under `buildScript`.
*/
val ScriptHandlerScope.mcJava: McJava
get() = McJava

/**
* Shortcut to [McJava] dependency object.
*
* This plugin is not published to Gradle Portal and cannot be applied directly to a project.
* Firstly, it should be put to buildscript's classpath and then applied by ID only.
*/
val PluginDependenciesSpec.mcJava: Spine.McJava
get() = Spine.McJava
val PluginDependenciesSpec.mcJava: McJava
get() = McJava

/**
* Shortcut to [ProtoData] dependency object for using under `buildscript`.
*/
val ScriptHandlerScope.protoData: ProtoData
get() = ProtoData

/**
* 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 Plugin 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 +111,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 +133,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 @@ -128,13 +147,16 @@ val PluginDependenciesSpec.kotest: PluginDependencySpec
val PluginDependenciesSpec.kover: PluginDependencySpec
get() = id(Kover.id).version(Kover.version)

val PluginDependenciesSpec.ksp: PluginDependencySpec
get() = id(Ksp.id).version(Ksp.version)

/**
* 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 Expand Up @@ -176,3 +198,50 @@ fun Project.configureTaskDependencies() {
"publishPluginJar".dependOn(createVersionFile)
}
}

/**
* Obtains all modules names of which do not have `"-tests"` as the suffix.
*
* By convention, such modules are for integration tests and should be treated differently.
*/
val Project.productionModules: Iterable<Project>
get() = rootProject.subprojects.filter { !it.name.contains("-tests") }


/**
* Sets the remote debug option for this task.
*
* The port number is [5566][BuildSettings.REMOTE_DEBUG_PORT].
*
* @param enabled If `true` the task will be suspended.
*/
fun Task.remoteDebug(enabled: Boolean = true) { this as JavaExec
debugOptions {
this@debugOptions.enabled.set(enabled)
port.set(BuildSettings.REMOTE_DEBUG_PORT)
server.set(true)
suspend.set(true)
}
}

/**
* Sets remote debug options for the `launchProtoData` task.
*
* @param enabled if `true` the task will be suspended.
*
* @see remoteDebug
*/
fun Project.protoDataRemoteDebug(enabled: Boolean = true) {
tasks.findByName("launchProtoData")?.remoteDebug(enabled)
}

/**
* Sets remote debug options for the `launchTestProtoData` task.
*
* @param enabled if `true` the task will be suspended.
*
* @see remoteDebug
*/
fun Project.testProtoDataRemoteDebug(enabled: Boolean = true) {
tasks.findByName("launchTestProtoData")?.remoteDebug(enabled)
}
Loading
Loading