Skip to content

Commit

Permalink
Bump config and all (#1527)
Browse files Browse the repository at this point in the history
* Backing code text in diag messages

* Bump version -> `2.0.0-SNAPSHOT.151`

* Update config and `mc-java`

* Bump version -> `2.0.0-SNAPSHOT.152`

* Bump `mc-java` -> `2.0.0-SNAPSHOT.166`

* Bump Logging -> `2.0.0-SNAPSHOT.185`

* Update config ref.

* Fix `BadImport`

* Remove redundant code

* Update dependency reports

* Bump Gradle -> `7.6.2`

* Update build time

* Bump version -> `2.0.0-SNAPSHOT.153`

* Remove commented block

* Bump `base-type` -> `2.0.0-SNAPSHOT.124`

* Update dependency reports

* Bump gRPC -> `1.57.0`

* Bump `time` -> `2.0.0-SNAPSHOT.133`

* Reference Javadoc tools from `Spine`

* Update dependency reports
  • Loading branch information
alexander-yevsyukov authored Jul 31, 2023
1 parent 277f3f2 commit 281cd6d
Show file tree
Hide file tree
Showing 211 changed files with 3,668 additions and 2,912 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/build-on-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: push

jobs:
build:
name: Build under Ubuntu
runs-on: ubuntu-latest

steps:
Expand All @@ -23,10 +24,10 @@ jobs:

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.5.2
uses: mikepenz/action-junit-report@v3.7.6
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
report_paths: '**/build/test-results/**/TEST-*.xml'
require_tests: true # will fail workflow if test reports not found

- name: Upload code coverage report
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/build-on-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ on: pull_request

jobs:
build:
name: Build under Windows
runs-on: windows-latest

steps:
Expand All @@ -17,15 +18,18 @@ jobs:
distribution: zulu
cache: gradle

- name: Configure Pagefile
uses: al-cheb/[email protected]

- name: Build project and run tests
shell: cmd
# For the reason on `--no-daemon` see https://github.com/actions/cache/issues/454
run: gradlew.bat build --stacktrace --no-daemon

# See: https://github.com/marketplace/actions/junit-report-action
- name: Publish Test Report
uses: mikepenz/action-junit-report@v3.5.2
uses: mikepenz/action-junit-report@v3.7.6
if: always() # always run even if the previous step fails
with:
report_paths: '**/build/test-results/test/TEST-*.xml'
report_paths: '**/build/test-results/**/TEST-*.xml'
require_tests: true # will fail workflow if test reports not found
1 change: 1 addition & 0 deletions .github/workflows/ensure-reports-updated.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:

jobs:
build:
name: Ensure license reports updated
runs-on: ubuntu-latest

steps:
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/increment-guard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:

jobs:
build:
name: Check version increment
runs-on: ubuntu-latest

steps:
Expand Down
141 changes: 38 additions & 103 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022, TeamDev. All rights reserved.
* 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.
Expand All @@ -26,21 +26,20 @@

@file:Suppress("RemoveRedundantQualifierName")

import Build_gradle.Subproject
import io.spine.internal.dependency.ErrorProne
import io.spine.internal.dependency.Grpc
import io.spine.internal.dependency.JUnit
import io.spine.internal.dependency.Spine
import io.spine.internal.dependency.Validation
import io.spine.internal.gradle.VersionWriter
import io.spine.internal.gradle.checkstyle.CheckStyleConfig
import io.spine.internal.gradle.excludeProtobufLite
import io.spine.internal.gradle.forceVersions
import io.spine.internal.gradle.github.pages.updateGitHubPages
import io.spine.internal.gradle.javac.configureErrorProne
import io.spine.internal.gradle.javac.configureJavac
import io.spine.internal.gradle.javadoc.JavadocConfig
import io.spine.internal.gradle.kotlin.applyJvmToolchain
import io.spine.internal.gradle.kotlin.setFreeCompilerArgs
import io.spine.internal.gradle.protobuf.suppressDeprecationsInKotlin
import io.spine.internal.gradle.publish.IncrementGuard
import io.spine.internal.gradle.publish.PublishingRepos
import io.spine.internal.gradle.publish.spinePublishing
Expand All @@ -50,16 +49,27 @@ import io.spine.internal.gradle.report.pom.PomGenerator
import io.spine.internal.gradle.standardToSpineSdk
import io.spine.internal.gradle.testing.configureLogging
import io.spine.internal.gradle.testing.registerTestTasks
import io.spine.protodata.gradle.CodegenSettings
import io.spine.protodata.gradle.plugin.LaunchProtoData
import io.spine.tools.mc.gradle.ModelCompilerOptions
import io.spine.tools.mc.java.gradle.McJavaOptions
import org.gradle.jvm.tasks.Jar
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

buildscript {
standardSpineSdkRepositories()
io.spine.internal.gradle.doForceVersions(configurations)
doForceVersions(configurations)
configurations {
all {
resolutionStrategy {
val spine = io.spine.internal.dependency.Spine
force(
spine.base,
spine.toolBase,
spine.server,
io.spine.internal.dependency.Spine.Logging.lib,
io.spine.internal.dependency.Validation.runtime,
)
}
}
}

dependencies {
classpath(io.spine.internal.dependency.Spine.McJava.pluginLib)
}
Expand Down Expand Up @@ -103,7 +113,8 @@ spinePublishing {
}

dokkaJar {
enabled = true
kotlin = true
java = true
}
}

Expand All @@ -127,16 +138,14 @@ subprojects {
setupJava(javaVersion)
setupKotlin(javaVersion)

val spine = Spine(this)
defineDependencies(spine)
forceConfigurations(spine)
defineDependencies()
forceConfigurations()

val generated = "$projectDir/generated"
applyGeneratedDirectories(generated)
setupTestTasks()
setupCodeGeneration(generated)
setupPublishing()
addTaskDependencies()
configureTaskDependencies()
}

JacocoConfig.applyTo(project)
Expand All @@ -163,7 +172,6 @@ fun Subproject.applyPlugins() {
plugin("pmd-settings")
plugin("dokka-for-java")
plugin("io.spine.mc-java")
plugin("io.spine.protodata")
}

apply<IncrementGuard>()
Expand Down Expand Up @@ -223,17 +231,17 @@ fun Subproject.setupTestTasks() {
/**
* Defines dependencies of this subproject.
*/
fun Subproject.defineDependencies(spine: Spine) {
fun Subproject.defineDependencies() {
dependencies {
ErrorProne.apply {
errorprone(core)
}
// Strangely, Gradle does not see `protoData` via DSL here, so we add using the string.
add("protoData", spine.validation.java)
implementation(spine.validation.runtime)
add("protoData", Validation.java)
implementation(Validation.runtime)

testImplementation(JUnit.runner)
testImplementation(spine.testlib)
testImplementation(Spine.testlib)
}
}

Expand Down Expand Up @@ -300,64 +308,10 @@ fun Subproject.applyGeneratedDirectories(generatedDir: String) {
}
}

/**
* Configures code generation in this project.
*/
fun Subproject.setupCodeGeneration(generatedDir: String) {
/**
* The below arrangement is "unusual" `because:
* 1. `modelCompiler` could not be found after applying plugin via `apply { }` block.
* 2. java { }` cannot be used because it conflicts with `java` of type `JavaPluginExtension`
* already added to the `Project`.
*/
val modelCompiler = extensions.getByType(ModelCompilerOptions::class.java)
modelCompiler.apply {
// Get nested `this` instead of `Project` instance.
val mcOptions = (this@apply as ExtensionAware)
val java = mcOptions.extensions.getByName("java") as McJavaOptions
java.codegen {
validation { skipValidation() }
}
}

val protoData = extensions.getByName("protoData") as CodegenSettings
protoData.apply {
renderers(
"io.spine.validation.java.PrintValidationInsertionPoints",
"io.spine.validation.java.JavaValidationRenderer",

// Suppress warnings in the generated code.
"io.spine.protodata.codegen.java.file.PrintBeforePrimaryDeclaration",
"io.spine.protodata.codegen.java.suppress.SuppressRenderer"
)
plugins(
"io.spine.validation.ValidationPlugin",
)
}

protobuf {
// Do not remove this setting until ProtoData can copy all the directories from
// `build/generated-proto`. Otherwise, the GRPC code won't be picked up.
// See: https://github.com/SpineEventEngine/ProtoData/issues/94
generatedFilesBaseDir = generatedDir
}

/**
* Manually suppress deprecations in the generated Kotlin code until ProtoData does it.
*/
tasks.withType<LaunchProtoData>().forEach { task ->
task.doLast {
sourceSets.forEach { sourceSet ->
suppressDeprecationsInKotlin(generatedDir, sourceSet.name)
}
}
}
}

/**
* Forces dependencies of this project.
*/
fun Subproject.forceConfigurations(spine: Spine) {
fun Subproject.forceConfigurations() {
configurations {
forceVersions()
excludeProtobufLite()
Expand All @@ -374,14 +328,15 @@ fun Subproject.forceConfigurations(spine: Spine) {
Grpc.ProtocPlugin.artifact,
JUnit.runner,

spine.base,
spine.validation.runtime,
spine.time,
spine.baseTypes,
spine.change,
spine.testlib,
spine.toolBase,
spine.pluginBase,
Spine.base,
Validation.runtime,
Spine.time,
Spine.Logging.lib,
Spine.baseTypes,
Spine.change,
Spine.testlib,
Spine.toolBase,
Spine.pluginBase,

Grpc.core,
Grpc.protobuf,
Expand All @@ -405,23 +360,3 @@ fun Subproject.setupPublishing() {
dependsOn("${project.path}:updateGitHubPages")
}
}

/**
* Adds explicit dependencies for the tasks of this subproject.
*/
fun Subproject.addTaskDependencies() {
tasks {
afterEvaluate {
val generateRejections by existing
compileKotlin {
dependsOn(generateRejections)
}

val generateTestRejections by existing
compileTestKotlin {
dependsOn(generateTestRejections)
}
}
}
configureTaskDependencies()
}
29 changes: 20 additions & 9 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2022, TeamDev. All rights reserved.
* 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.
Expand Down Expand Up @@ -62,15 +62,15 @@ val grGitVersion = "4.1.1"
* Please check that this value matches one defined in
* [io.spine.internal.dependency.Kotlin.version].
*/
val kotlinVersion = "1.8.0"
val kotlinVersion = "1.8.22"

/**
* The version of Guava used in `buildSrc`.
*
* Always use the same version as the one specified in [io.spine.internal.dependency.Guava].
* Otherwise, when testing Gradle plugins, clashes may occur.
*/
val guavaVersion = "31.1-jre"
val guavaVersion = "32.1.1-jre"

/**
* The version of ErrorProne Gradle plugin.
Expand All @@ -80,7 +80,7 @@ val guavaVersion = "31.1-jre"
* @see <a href="https://github.com/tbroyer/gradle-errorprone-plugin/releases">
* Error Prone Gradle Plugin Releases</a>
*/
val errorPronePluginVersion = "3.0.1"
val errorPronePluginVersion = "3.1.0"

/**
* The version of Protobuf Gradle Plugin.
Expand All @@ -90,7 +90,7 @@ val errorPronePluginVersion = "3.0.1"
* @see <a href="https://github.com/google/protobuf-gradle-plugin/releases">
* Protobuf Gradle Plugins Releases</a>
*/
val protobufPluginVersion = "0.9.1"
val protobufPluginVersion = "0.9.4"

/**
* The version of Dokka Gradle Plugins.
Expand All @@ -100,14 +100,24 @@ val protobufPluginVersion = "0.9.1"
* @see <a href="https://github.com/Kotlin/dokka/releases">
* Dokka Releases</a>
*/
val dokkaVersion = "1.7.20"
val dokkaVersion = "1.8.10"

/**
* The version of Detekt Gradle Plugin.
*
* @see <a href="https://github.com/detekt/detekt/releases">Detekt Releases</a>
*/
val detektVersion = "1.22.0"
val detektVersion = "1.23.0"

/**
* @see [io.spine.internal.dependency.Kotest]
*/
val kotestJvmPluginVersion = "0.4.10"

/**
* @see [io.spine.internal.dependency.Kover]
*/
val koverVersion = "0.7.2"

configurations.all {
resolutionStrategy {
Expand All @@ -117,8 +127,6 @@ configurations.all {
// Force Kotlin lib versions avoiding using those bundled with Gradle.
"org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-stdlib-common:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlinVersion",
"org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion"
)
}
Expand Down Expand Up @@ -158,4 +166,7 @@ dependencies {

// 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")
}
Loading

0 comments on commit 281cd6d

Please sign in to comment.