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

Update to the latest config #175

Merged
merged 10 commits into from
Apr 11, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
135 changes: 57 additions & 78 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ import io.spine.internal.dependency.GoogleApis
import io.spine.internal.dependency.Grpc
import io.spine.internal.dependency.JUnit
import io.spine.internal.dependency.PerfMark
import io.spine.internal.gradle.JavadocConfig
import io.spine.internal.gradle.javadoc.JavadocConfig
import io.spine.internal.gradle.applyStandard
import io.spine.internal.gradle.checkstyle.CheckStyleConfig
import io.spine.internal.gradle.excludeProtobufLite
Expand All @@ -50,7 +50,6 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

@Suppress("RemoveRedundantQualifierName") // Cannot use imported things here.
buildscript {
apply(from = "$rootDir/version.gradle.kts")
io.spine.internal.gradle.doApplyStandard(repositories)

val execForkPlugin = io.spine.internal.dependency.ExecForkPlugin
Expand All @@ -59,6 +58,7 @@ buildscript {
repos.gitHub(execForkPlugin.repository)
}

apply(from = "$rootDir/version.gradle.kts")
val mcJavaVersion: String by extra

dependencies {
Expand All @@ -74,37 +74,36 @@ buildscript {
resolutionStrategy {
force(
Kotlin.stdLib,
Kotlin.stdLibCommon
Kotlin.stdLibCommon,
)
}
}
}

repositories.applyStandard()

plugins {
`java-library`
kotlin("jvm")
idea
io.spine.internal.dependency.Protobuf.GradlePlugin.apply { id(id) }

@Suppress("RemoveRedundantQualifierName")
io.spine.internal.dependency.ErrorProne.GradlePlugin.apply { id(id) }
id(io.spine.internal.dependency.ErrorProne.GradlePlugin.id)
id(io.spine.internal.dependency.Protobuf.GradlePlugin.id)
}

spinePublishing {
with(PublishingRepos) {
targetRepositories.addAll(
cloudRepo,
cloudArtifactRegistry,
gitHub("gcloud-java")
)
}
projectsToPublish.addAll(
modules = setOf(
"datastore",
"stackdriver-trace",
"testutil-gcloud",
"pubsub"
)
destinations = with(PublishingRepos) {
setOf(
cloudRepo,
cloudArtifactRegistry,
gitHub("gcloud-java")
)
}
}

val spineBaseVersion: String by extra
Expand All @@ -119,32 +118,13 @@ allprojects {
plugin("idea")
}

val javaVersion = JavaVersion.VERSION_11

java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion
}

kotlin {
explicitApi()
}

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = javaVersion.toString()
freeCompilerArgs = listOf("-Xskip-prerelease-check")
}
}

group = "io.spine.gcloud"
version = extra["versionToPublish"]!!

repositories.applyStandard()
}

subprojects {

apply {
plugin("com.google.protobuf")
plugin("net.ltgt.errorprone")
Expand All @@ -154,16 +134,29 @@ subprojects {
plugin("pmd-settings")
}

tasks {
withType<JavaCompile> {
val javaVersion = JavaVersion.VERSION_11

java {
sourceCompatibility = javaVersion
targetCompatibility = javaVersion

tasks.withType<JavaCompile>().configureEach {
configureJavac()
configureErrorProne()
}
withType<Test> {
configureLogging()
}

kotlin {
explicitApi()

tasks.withType<KotlinCompile>().configureEach {
kotlinOptions {
jvmTarget = javaVersion.toString()
freeCompilerArgs = listOf("-Xskip-prerelease-check")
}
}
registerTestTasks()
}

LicenseReporter.generateReportIn(project)
JavadocConfig.applyTo(project)
CheckStyleConfig.applyTo(project)
Expand All @@ -174,8 +167,9 @@ subprojects {
google()
}

configurations.forceVersions()
configurations {
forceVersions()
excludeProtobufLite()
all {
resolutionStrategy {
force(
Expand All @@ -197,10 +191,8 @@ subprojects {
}
}
}
configurations.excludeProtobufLite()

val spineCoreVersion: String by extra

dependencies {
ErrorProne.apply {
errorprone(core)
Expand All @@ -218,7 +210,6 @@ subprojects {
)
}

val sourcesRootDir = "$projectDir/src"
val generatedRootDir = "$projectDir/generated"
val generatedJavaDir = "$generatedRootDir/main/java"
val generatedTestJavaDir = "$generatedRootDir/test/java"
Expand All @@ -229,50 +220,35 @@ subprojects {

sourceSets {
main {
java.srcDirs(generatedJavaDir, "$sourcesRootDir/main/java", generatedSpineDir)
java.srcDirs(generatedJavaDir, generatedSpineDir)
resources.srcDir("$generatedRootDir/main/resources")
proto.srcDirs("$sourcesRootDir/main/proto")
}
test {
java.srcDirs(generatedTestJavaDir, "$sourcesRootDir/test/java", generatedTestSpineDir)
java.srcDirs(generatedTestJavaDir, generatedTestSpineDir)
resources.srcDir("$generatedRootDir/test/resources")
proto.srcDir("$sourcesRootDir/test/proto")
}
}

val copyCredentials by tasks.registering(Copy::class) {
val resourceDir = "$projectDir/src/test/resources"
val fileName = "spine-dev.json"
val sourceFile = file("$rootDir/$fileName")

from(sourceFile)
into(resourceDir)
}

tasks.processTestResources {
dependsOn(copyCredentials)
}

tasks.test {
useJUnitPlatform {
includeEngines("junit-jupiter")
tasks {
registerTestTasks()
withType<Test>().configureEach {
configureLogging()
useJUnitPlatform {
includeEngines("junit-jupiter")
}
}
}

tasks.register("sourceJar", Jar::class) {
from(sourceSets.main.get().allJava)
archiveClassifier.set("sources")
}

tasks.register("testOutputJar", Jar::class) {
from(sourceSets.test.get().output)
archiveClassifier.set("test")
}
val copyCredentials by registering(Copy::class) {
val resourceDir = "$projectDir/src/test/resources"
val fileName = "spine-dev.json"
val sourceFile = file("$rootDir/$fileName")

tasks.register("javadocJar", Jar::class) {
from("$projectDir/build/docs/javadoc")
archiveClassifier.set("javadoc")
dependsOn(tasks.javadoc)
from(sourceFile)
into(resourceDir)
}
processTestResources {
dependsOn(copyCredentials)
}
}

// Apply the same IDEA module configuration for each of sub-projects.
Expand All @@ -299,7 +275,10 @@ subprojects {
allowInternalJavadoc.set(true)
rootFolder.set(rootDir)
}
project.tasks["publish"].dependsOn("${project.path}:updateGitHubPages")

project.tasks.named("publish") {
dependsOn("${project.path}:updateGitHubPages")
}
}

JacocoConfig.applyTo(project)
Expand Down
7 changes: 2 additions & 5 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,14 @@
* This script uses two declarations of the constant [licenseReportVersion] because
* currently there is no way to define a constant _before_ a build script of `buildSrc`.
* We cannot use imports or do something else before the `buildscript` or `plugin` clauses.
*
* Therefore, when a version of [io.spine.internal.dependency.LicenseReport] changes, it should be
* changed in the Kotlin object _and_ in this file below twice.
*/

plugins {
java
groovy
`kotlin-dsl`
pmd
val licenseReportVersion = "2.0"
val licenseReportVersion = "2.1"
id("com.github.jk1.dependency-license-report").version(licenseReportVersion)
}

Expand All @@ -57,7 +54,7 @@ repositories {
val jacksonVersion = "2.13.0"

val googleAuthToolVersion = "2.1.2"
val licenseReportVersion = "2.0"
val licenseReportVersion = "2.1"
val grGitVersion = "3.1.1"

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,6 @@ package io.spine.internal.dependency

// https://www.mojohaus.org/animal-sniffer/animal-sniffer-maven-plugin/
object AnimalSniffer {
private const val version = "1.19"
private const val version = "1.21"
const val lib = "org.codehaus.mojo:animal-sniffer-annotations:${version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,8 @@ package io.spine.internal.dependency
*
* [AssertK](https://github.com/willowtreeapps/assertk)
*/
@Suppress("unused")
object AssertK {
private const val version = "0.23.1"
private const val version = "0.25"
const val libJvm = "com.willowtreeapps.assertk:assertk-jvm:${version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
package io.spine.internal.dependency

// https://www.bouncycastle.org/java.html
@Suppress("unused")
object BouncyCastle {
const val libPkcsJdk15 = "org.bouncycastle:bcpkix-jdk15on:1.68"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,5 +30,5 @@ package io.spine.internal.dependency
// See `io.spine.internal.gradle.checkstyle.CheckStyleConfig`.
@Suppress("unused")
object CheckStyle {
const val version = "9.2"
const val version = "10.1"
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ package io.spine.internal.dependency

// https://checkerframework.org/
object CheckerFramework {
private const val version = "3.21.0"
private const val version = "3.21.3"
const val annotations = "org.checkerframework:checker-qual:${version}"
@Suppress("unused")
val dataflow = listOf(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ package io.spine.internal.dependency
* [Commons CLI](https://commons.apache.org/proper/commons-cli/)
*/
object CommonsCli {
private const val version = "1.4"
private const val version = "1.5.0"
const val lib = "commons-cli:commons-cli:${version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,6 @@ package io.spine.internal.dependency
// https://github.com/Kotlin/dokka
@Suppress("unused")
object Dokka {
const val version = "1.5.0"
const val version = "1.6.10"
const val pluginId = "org.jetbrains.dokka"
}
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ package io.spine.internal.dependency
@Suppress("unused")
object Grpc {
@Suppress("MemberVisibilityCanBePrivate")
const val version = "1.43.1"
const val version = "1.45.0"
const val api = "io.grpc:grpc-api:${version}"
const val auth = "io.grpc:grpc-auth:${version}"
const val core = "io.grpc:grpc-core:${version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,6 @@ package io.spine.internal.dependency
* [Gson](https://github.com/google/gson)
*/
object Gson {
private const val version = "2.8.9"
private const val version = "2.9.0"
const val lib = "com.google.code.gson:gson:${version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ package io.spine.internal.dependency
*/
// https://github.com/google/guava
object Guava {
private const val version = "31.0.1-jre"
private const val version = "31.1-jre"
const val lib = "com.google.guava:guava:${version}"
const val testLib = "com.google.guava:guava-testlib:${version}"
}
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ package io.spine.internal.dependency
@Suppress("unused")
object HttpClient {
// https://github.com/googleapis/google-http-java-client
const val version = "1.40.1"
const val version = "1.41.5"
const val google = "com.google.http-client:google-http-client:${version}"
const val jackson2 = "com.google.http-client:google-http-client-jackson2:${version}"
const val gson = "com.google.http-client:google-http-client-gson:${version}"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,11 +28,12 @@ package io.spine.internal.dependency

@Suppress("unused")
object Jackson {
private const val version = "2.13.1"
private const val version = "2.13.2"
private const val databindVersion = "2.13.2.2"
// https://github.com/FasterXML/jackson-core
const val core = "com.fasterxml.jackson.core:jackson-core:${version}"
// https://github.com/FasterXML/jackson-databind
const val databind = "com.fasterxml.jackson.core:jackson-databind:${version}"
const val databind = "com.fasterxml.jackson.core:jackson-databind:${databindVersion}"
// https://github.com/FasterXML/jackson-dataformat-xml/releases
const val dataformatXml = "com.fasterxml.jackson.dataformat:jackson-dataformat-xml:${version}"
// https://github.com/FasterXML/jackson-dataformats-text/releases
Expand Down
Loading