Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
a7168a0
Add `CallerFinder` from Logging
alexander-yevsyukov May 5, 2024
1000949
Auto-updated by IDEA
alexander-yevsyukov May 5, 2024
3f110aa
Bump version -> `2.0.0-SNAPSHOT.184`
alexander-yevsyukov May 5, 2024
8abe9b1
Update `config`
alexander-yevsyukov May 5, 2024
bdbe997
Rename .java to .kt
alexander-yevsyukov May 5, 2024
3e5b171
Convert `StackGetter` to Kotlin
alexander-yevsyukov May 5, 2024
2dcd851
Move stub classed under the `given` package
alexander-yevsyukov May 5, 2024
4fa686c
Move stub classed under the `given` package
alexander-yevsyukov May 5, 2024
4d8c6a4
Rename .java to .kt
alexander-yevsyukov May 5, 2024
aed1fee
Convert stack getter impl to Kotlin
alexander-yevsyukov May 5, 2024
3c610e9
Rename .java to .kt
alexander-yevsyukov May 5, 2024
acae8c8
Convert `CallFinder` to Kotlin
alexander-yevsyukov May 5, 2024
76f7aab
Add a simple test for checking the caller of self
alexander-yevsyukov May 5, 2024
937a471
Update build time
alexander-yevsyukov May 5, 2024
d2a18a8
Improve method name and docs
alexander-yevsyukov May 5, 2024
aa7dd0e
Move check functions into the same file with the interface
alexander-yevsyukov May 6, 2024
c358045
Update build time
alexander-yevsyukov May 6, 2024
e91b7b3
Test `CallerFinder.stackForCallerOf()`
alexander-yevsyukov May 6, 2024
edcb1a2
Update build time
alexander-yevsyukov May 6, 2024
071bd27
Annotate methods with `@JvmStatic`
alexander-yevsyukov May 6, 2024
2199137
Update build time
alexander-yevsyukov May 6, 2024
ea4f2a9
Remove dependency on Logging
alexander-yevsyukov May 6, 2024
8191d8d
Update dependency reports
alexander-yevsyukov May 6, 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
2 changes: 1 addition & 1 deletion .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.7.6
uses: mikepenz/action-junit-report@v4.0.3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,9 @@ jobs:
distribution: zulu
cache: gradle

# See: https://github.com/al-cheb/configure-pagefile-action
- name: Configure Pagefile
uses: al-cheb/configure-pagefile-action@v1.2
uses: al-cheb/configure-pagefile-action@v1.3

- name: Build project and run tests
shell: cmd
Expand All @@ -28,7 +29,7 @@ jobs:

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.7.6
uses: mikepenz/action-junit-report@v4.0.3
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/**/TEST-*.xml'
Expand Down
8 changes: 4 additions & 4 deletions .idea/kotlinc.xml

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

3 changes: 2 additions & 1 deletion .idea/misc.xml

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

101 changes: 63 additions & 38 deletions buildSrc/build.gradle.kts
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 @@ -169,49 +169,74 @@ tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
}

dependencies {
implementation("com.fasterxml.jackson.core:jackson-databind:$jacksonVersion")
implementation("com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion")

@Suppress(
"VulnerableLibrariesLocal", "RedundantSuppression" /*
`artifactregistry-auth-common` has transitive dependency on Gson and Apache `commons-codec`.

Gson from version `2.8.6` until `2.8.9` is vulnerable to Deserialization of Untrusted Data
(https://devhub.checkmarx.com/cve-details/CVE-2022-25647/).
api("com.github.jk1:gradle-license-report:$licenseReportVersion")
dependOnAuthCommon()

listOf(
"com.fasterxml.jackson.core:jackson-databind:$jacksonVersion",
"com.fasterxml.jackson.dataformat:jackson-dataformat-xml:$jacksonVersion",
"com.github.jk1:gradle-license-report:$licenseReportVersion",
"com.google.guava:guava:$guavaVersion",
"com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion",
"gradle.plugin.com.github.johnrengelman:shadow:${shadowVersion}",
"io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion",
"io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion",
// https://github.com/srikanth-lingala/zip4j
"net.lingala.zip4j:zip4j:2.10.0",
"net.ltgt.gradle:gradle-errorprone-plugin:${errorPronePluginVersion}",
"org.ajoberstar.grgit:grgit-core:${grGitVersion}",
"org.jetbrains.dokka:dokka-base:${dokkaVersion}",
"org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}",
"org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion",
"org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion"
).forEach {
implementation(it)
}
}

Apache `commons-codec` before 1.13 is vulnerable to information exposure
(https://devhub.checkmarx.com/cve-details/Cxeb68d52e-5509/).
dependOnBuildSrcJar()

We use Gson `2.10.1`and we force it in `forceProductionDependencies()`.
We use `commons-code` with version `1.16.0`, forcing it in `forceProductionDependencies()`.
/**
* Adds a dependency on a `buildSrc.jar`, iff:
* 1) the `src` folder is missing, and
* 2) `buildSrc.jar` is present in `buildSrc/` folder instead.
*
* This approach is used in the scope of integration testing.
*/
fun Project.dependOnBuildSrcJar() {
val srcFolder = this.rootDir.resolve("src")
val buildSrcJar = rootDir.resolve("buildSrc.jar")
if (!srcFolder.exists() && buildSrcJar.exists()) {
logger.info("Adding the pre-compiled 'buildSrc.jar' to 'implementation' dependencies.")
dependencies {
implementation(files("buildSrc.jar"))
}
}
}

So, we should be safe with the current version `artifactregistry-auth-common` until
we migrate to a later version. */
)
/**
* Includes the `implementation` dependency on `artifactregistry-auth-common`,
* with the version defined in [googleAuthToolVersion].
*
* `artifactregistry-auth-common` has transitive dependency on Gson and Apache `commons-codec`.
* Gson from version `2.8.6` until `2.8.9` is vulnerable to Deserialization of Untrusted Data
* (https://devhub.checkmarx.com/cve-details/CVE-2022-25647/).
*
* Apache `commons-codec` before 1.13 is vulnerable to information exposure
* (https://devhub.checkmarx.com/cve-details/Cxeb68d52e-5509/).
*
* We use Gson `2.10.1` and we force it in `forceProductionDependencies()`.
* We use `commons-code` with version `1.16.0`, forcing it in `forceProductionDependencies()`.
*
* So, we should be safe with the current version `artifactregistry-auth-common` until
* we migrate to a later version.
*/
fun DependencyHandlerScope.dependOnAuthCommon() {
@Suppress("VulnerableLibrariesLocal", "RedundantSuppression")
implementation(
"com.google.cloud.artifactregistry:artifactregistry-auth-common:$googleAuthToolVersion"
) {
exclude(group = "com.google.guava")
}

implementation("com.google.guava:guava:$guavaVersion")
api("com.github.jk1:gradle-license-report:$licenseReportVersion")
implementation("org.ajoberstar.grgit:grgit-core:${grGitVersion}")
implementation("net.ltgt.gradle:gradle-errorprone-plugin:${errorPronePluginVersion}")

// Add explicit dependency to avoid warning on different Kotlin runtime versions.
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")

implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$detektVersion")
implementation("com.google.protobuf:protobuf-gradle-plugin:$protobufPluginVersion")
implementation("org.jetbrains.dokka:dokka-gradle-plugin:${dokkaVersion}")
implementation("org.jetbrains.dokka:dokka-base:${dokkaVersion}")
implementation("gradle.plugin.com.github.johnrengelman:shadow:${shadowVersion}")

// https://github.com/srikanth-lingala/zip4j
implementation("net.lingala.zip4j:zip4j:2.10.0")

implementation("io.kotest:kotest-gradle-plugin:$kotestJvmPluginVersion")
implementation("org.jetbrains.kotlinx:kover-gradle-plugin:$koverVersion")
}
34 changes: 33 additions & 1 deletion buildSrc/src/main/kotlin/DokkaExts.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 @@ -143,6 +143,7 @@ fun TaskContainer.dokkaHtmlTask(): DokkaTask? = this.findByName("dokkaHtml") as
* Dokka can properly generate documentation for either Kotlin or Java depending on
* the configuration, but not both.
*/
@Suppress("unused")
internal fun GradleDokkaSourceSetBuilder.onlyJavaSources(): FileCollection {
return sourceRoots.filter(File::isJavaSourceDirectory)
}
Expand All @@ -167,6 +168,19 @@ fun Project.dokkaKotlinJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaKotlin
}
}

/**
* Tells if this task belongs to the execution graph which contains publishing tasks.
*
* The task `"publishToMavenLocal"` is excluded from the check because it is a part of
* the local testing workflow.
*/
fun DokkaTask.isInPublishingGraph(): Boolean =
project.gradle.taskGraph.allTasks.any {
with(it.name) {
startsWith("publish") && !startsWith("publishToMavenLocal")
}
}

/**
* Locates or creates `dokkaJavaJar` task in this [Project].
*
Expand All @@ -182,3 +196,21 @@ fun Project.dokkaJavaJar(): TaskProvider<Jar> = tasks.getOrCreate("dokkaJavaJar"
this@getOrCreate.dependsOn(dokkaTask)
}
}

/**
* Disables Dokka and Javadoc tasks in this `Project`.
*
* This function could be useful to improve build speed when building subprojects containing
* test environments or integration test projects.
*/
@Suppress("unused")
fun Project.disableDocumentationTasks() {
gradle.taskGraph.whenReady {
tasks.forEach { task ->
val lowercaseName = task.name.toLowerCase()
if (lowercaseName.contains("dokka") || lowercaseName.contains("javadoc")) {
task.enabled = false
}
}
}
}
5 changes: 4 additions & 1 deletion buildSrc/src/main/kotlin/dokka-for-java.gradle.kts
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 @@ -37,4 +37,7 @@ dependencies {

tasks.withType<DokkaTask>().configureEach {
configureForJava()
onlyIf {
(it as DokkaTask).isInPublishingGraph()
}
}
5 changes: 4 additions & 1 deletion buildSrc/src/main/kotlin/dokka-for-kotlin.gradle.kts
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 @@ -36,4 +36,7 @@ dependencies {

tasks.withType<DokkaTask>().configureEach {
configureForKotlin()
onlyIf {
(it as DokkaTask).isInPublishingGraph()
}
}
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

/**
* Kotlin Coroutines.
*
* @see <a href="https://github.com/Kotlin/kotlinx.coroutines">GitHub projecet</a>
*/
@Suppress("unused")
object Coroutines {
const val version = "1.6.4"
const val jdk8 = "org.jetbrains.kotlinx:kotlinx-coroutines-jdk8:$version"
const val core = "org.jetbrains.kotlinx:kotlinx-coroutines-core:$version"
const val bom = "org.jetbrains.kotlinx:kotlinx-coroutines-bom:$version"
const val coreJvm = "org.jetbrains.kotlinx:kotlinx-coroutines-core-jvm:$version"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
/*
* 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

/**
* gRPC-Kotlin/JVM.
*
* @see <a href="https://github.com/grpc/grpc-kotlin">GitHub project</a>
*/
@Suppress("unused")
object GrpcKotlin {
const val version = "1.3.0"
const val stub = "io.grpc:grpc-kotlin-stub:$version"

object ProtocPlugin {
const val id = "grpckt"
const val artifact = "io.grpc:protoc-gen-grpc-kotlin:$version:jdk8@jar"
}
}
Loading