Skip to content

Commit 0d43119

Browse files
Merge pull request #29 from SpineEventEngine/migrate-to-spine2
Migrate to Spine 2 and Java 16
2 parents 05c094f + 604c829 commit 0d43119

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

42 files changed

+268
-159
lines changed

.github/workflows/ci.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
strategy:
1515
fail-fast: false
1616
matrix:
17-
java: [ 11, 15 ]
17+
java: [ 16 ]
1818
os: [ ubuntu-latest, windows-latest, macos-latest ]
1919

2020
runs-on: ${{ matrix.os }}
@@ -39,3 +39,6 @@ jobs:
3939
run: chmod +x gradlew
4040
- name: Build with Gradle
4141
run: ./gradlew build --stacktrace
42+
env:
43+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44+
GITHUB_ACTOR: ${{ secrets.GITHUB_ACTOR }}

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ via the [Google Chat][google-chat].
1717

1818
# Prerequisites
1919

20-
* [JDK 11][jdk11] or newer.
20+
* [JDK 16][jdk16] or newer.
2121
* [Docker SE][docker] v19.03 or newer.
2222

2323
[docker]: https://docs.docker.com/get-docker/
24-
[jdk11]: https://docs.aws.amazon.com/corretto/latest/corretto-11-ug/downloads-list.html
24+
[jdk16]: https://docs.aws.amazon.com/corretto/latest/corretto-16-ug/downloads-list.html
2525

2626
# Build
2727

build.gradle.kts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,6 @@
2626

2727
import net.saliman.gradle.plugin.properties.PropertiesPlugin
2828

29-
plugins {
30-
idea
31-
}
32-
3329
apply(from = "version.gradle.kts")
3430
val botVersion: String by extra
3531

buildSrc/build.gradle.kts

Lines changed: 25 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -28,22 +28,40 @@ plugins {
2828
`kotlin-dsl`
2929
}
3030

31+
3132
repositories {
32-
google()
33+
mavenLocal()
3334
mavenCentral()
35+
google()
3436
gradlePluginPortal()
37+
maven("https://spine.mycloudrepo.io/public/repositories/releases") {
38+
content {
39+
includeGroup("io.spine")
40+
includeGroup("io.spine.tools")
41+
includeGroup("io.spine.gcloud")
42+
}
43+
mavenContent {
44+
releasesOnly()
45+
}
46+
}
47+
maven("https://spine.mycloudrepo.io/public/repositories/snapshots")
48+
maven {
49+
setUrl("https://maven.pkg.github.com/SpineEventEngine/*")
50+
credentials {
51+
username = System.getenv("GITHUB_ACTOR")
52+
password = System.getenv("GITHUB_TOKEN")
53+
}
54+
}
3555
}
3656

57+
val spineBaseVersion = "2.0.0-SNAPSHOT.47"
58+
3759
dependencies {
60+
implementation("io.spine.tools:spine-mc-java:${spineBaseVersion}")
3861
implementation("net.ltgt.gradle:gradle-errorprone-plugin:2.0.2")
3962
implementation("com.google.protobuf:protobuf-gradle-plugin:0.8.17")
40-
implementation("com.github.jengelman.gradle.plugins:shadow:6.1.0")
63+
implementation("gradle.plugin.com.github.jengelman.gradle.plugins:shadow:7.0.0")
4164
implementation("gradle.plugin.com.google.cloud.tools:jib-gradle-plugin:3.1.2")
42-
implementation("io.spine.tools:spine-bootstrap:1.7.1")
4365
implementation("net.saliman:gradle-properties-plugin:1.5.1")
4466
implementation("io.micronaut.gradle:micronaut-gradle-plugin:1.5.4")
4567
}
46-
47-
kotlinDslPluginOptions {
48-
experimentalWarning.set(false)
49-
}

buildSrc/src/main/kotlin/dependency-management.gradle.kts

Lines changed: 44 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import io.spine.internal.dependency.Flogger
3131
import io.spine.internal.dependency.Gson
3232
import io.spine.internal.dependency.Guava
3333
import io.spine.internal.dependency.JavaX
34+
import io.spine.internal.dependency.Log4j2
3435
import io.spine.internal.dependency.Protobuf
3536
import io.spine.internal.dependency.Spine
3637
import io.spine.internal.dependency.Truth
@@ -39,6 +40,29 @@ plugins {
3940
`java-library`
4041
}
4142

43+
repositories {
44+
mavenCentral()
45+
google()
46+
maven("https://spine.mycloudrepo.io/public/repositories/releases") {
47+
content {
48+
includeGroup("io.spine")
49+
includeGroup("io.spine.tools")
50+
includeGroup("io.spine.gcloud")
51+
}
52+
mavenContent {
53+
releasesOnly()
54+
}
55+
}
56+
maven("https://spine.mycloudrepo.io/public/repositories/snapshots")
57+
maven {
58+
setUrl("https://maven.pkg.github.com/SpineEventEngine/*")
59+
credentials {
60+
username = System.getenv("GITHUB_ACTOR")
61+
password = System.getenv("GITHUB_TOKEN")
62+
}
63+
}
64+
}
65+
4266
configurations.all {
4367
resolutionStrategy {
4468
force(
@@ -47,21 +71,30 @@ configurations.all {
4771
Guava.lib,
4872
Guava.testLib,
4973
FindBugs.annotations,
50-
Flogger.lib,
5174
Gson.lib,
5275
JavaX.annotations,
5376
Protobuf.libs,
5477
Truth.libs,
55-
Spine.Stable.base,
56-
Spine.Stable.core,
57-
Spine.Stable.server,
58-
Spine.Stable.client,
59-
Spine.Stable.time,
60-
Spine.Stable.Test.base,
61-
Spine.Stable.Test.core,
62-
Spine.Stable.Test.server,
63-
Spine.Stable.Test.client,
64-
Spine.Stable.Test.time
78+
Spine.base,
79+
Spine.baseTypes,
80+
Spine.core,
81+
Spine.server,
82+
Spine.client,
83+
Spine.time,
84+
Spine.Test.base,
85+
Spine.Test.core,
86+
Spine.Test.server,
87+
Spine.Test.client,
88+
Spine.Test.time,
89+
Flogger.lib,
90+
Log4j2.slf4jBridge,
91+
Log4j2.api,
92+
Log4j2.core,
93+
Log4j2.julBridge,
94+
Log4j2.jclBridge,
95+
"org.slf4j:slf4j-api:2.0.0-alpha2"
6596
)
6697
}
98+
exclude("com.google.guava", "guava-jdk5")
99+
exclude("org.slf4j", "slf4j-jdk14")
67100
}

buildSrc/src/main/kotlin/io/spine/internal/dependency/Log4j2.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,6 @@ object Log4j2 {
3232
const val core = "org.apache.logging.log4j:log4j-core:${version}"
3333
const val api = "org.apache.logging.log4j:log4j-api:${version}"
3434
const val slf4jBridge = "org.apache.logging.log4j:log4j-slf4j18-impl:${version}"
35+
const val jclBridge = "org.apache.logging.log4j:log4j-jcl:${version}"
36+
const val julBridge = "org.apache.logging.log4j:log4j-jul:${version}"
3537
}

buildSrc/src/main/kotlin/io/spine/internal/dependency/Spine.kt

Lines changed: 8 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -29,42 +29,25 @@ package io.spine.internal.dependency
2929
// https://github.com/SpineEventEngine
3030
object Spine {
3131
private const val baseVersion = "2.0.0-SNAPSHOT.47"
32+
private const val baseTypesVersion = "2.0.0-SNAPSHOT.40"
3233
private const val coreVersion = "2.0.0-SNAPSHOT.47"
34+
private const val timeVersion = "2.0.0-SNAPSHOT.40"
35+
private const val gcloudVersion = "2.0.0-SNAPSHOT.4"
3336

3437
const val base = "io.spine:spine-base:${baseVersion}"
38+
const val baseTypes = "io.spine:spine-base-types:${baseTypesVersion}"
3539
const val client = "io.spine:spine-client:${coreVersion}"
3640
const val server = "io.spine:spine-server:${coreVersion}"
37-
const val serverProto = "io.spine:spine-server:${coreVersion}:proto"
3841
const val core = "io.spine:spine-core:${coreVersion}"
42+
const val datastore = "io.spine.gcloud:spine-datastore:${gcloudVersion}"
43+
const val pubsub = "io.spine.gcloud:spine-pubsub:${gcloudVersion}"
44+
const val time = "io.spine:spine-time:${timeVersion}"
3945

4046
object Test {
4147
const val base = "io.spine.tools:spine-testlib:${baseVersion}"
4248
const val client = "io.spine.tools:spine-testutil-client:${coreVersion}"
4349
const val server = "io.spine.tools:spine-testutil-server:${coreVersion}"
4450
const val core = "io.spine.tools:spine-testutil-core:${coreVersion}"
45-
}
46-
47-
object Stable {
48-
49-
const val version = "1.7.4"
50-
const val coreVersion = "1.7.5"
51-
const val timeVersion = "1.7.1"
52-
const val gcloudVersion = "1.7.1"
53-
54-
const val base = "io.spine:spine-base:${version}"
55-
const val client = "io.spine:spine-client:${coreVersion}"
56-
const val server = "io.spine:spine-server:${coreVersion}"
57-
const val core = "io.spine:spine-core:${coreVersion}"
58-
const val time = "io.spine:spine-time:${timeVersion}"
59-
const val datastore = "io.spine.gcloud:spine-datastore:${gcloudVersion}"
60-
const val pubsub = "io.spine.gcloud:spine-pubsub:${gcloudVersion}"
61-
62-
object Test {
63-
const val base = "io.spine:spine-testlib:${version}"
64-
const val client = "io.spine:spine-testutil-client:${coreVersion}"
65-
const val server = "io.spine:spine-testutil-server:${coreVersion}"
66-
const val core = "io.spine:spine-testutil-core:${coreVersion}"
67-
const val time = "io.spine:spine-testutil-time:${timeVersion}"
68-
}
51+
const val time = "io.spine:spine-testutil-time:${timeVersion}"
6952
}
7053
}

buildSrc/src/main/kotlin/java-convention.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,8 +42,8 @@ plugins {
4242
}
4343

4444
java {
45-
sourceCompatibility = JavaVersion.VERSION_11
46-
targetCompatibility = JavaVersion.VERSION_11
45+
sourceCompatibility = JavaVersion.VERSION_16
46+
targetCompatibility = JavaVersion.VERSION_16
4747
}
4848

4949
dependencies {
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
/*
2+
* Copyright 2021, TeamDev. All rights reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Redistribution and use in source and/or binary forms, with or without
11+
* modification, must retain the above copyright notice and the following
12+
* disclaimer.
13+
*
14+
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
15+
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
16+
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
17+
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
18+
* OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
19+
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
20+
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
21+
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
22+
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23+
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24+
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25+
*/
26+
27+
import com.google.protobuf.gradle.protoc
28+
import io.spine.internal.dependency.Protobuf
29+
import io.spine.internal.dependency.Spine
30+
import org.gradle.plugins.ide.idea.model.Module
31+
import org.gradle.plugins.ide.idea.model.ModuleLibrary
32+
33+
plugins {
34+
`java-library`
35+
idea
36+
id("com.google.protobuf")
37+
id("io.spine.mc-java")
38+
}
39+
40+
41+
val generatedRootDir = "${projectDir}/generated"
42+
val generatedSpineDir = file("${generatedRootDir}/main/spine")
43+
val generatedTestSpineDir = file("${generatedRootDir}/test/spine")
44+
45+
sourceSets {
46+
main {
47+
java {
48+
srcDir(generatedSpineDir)
49+
}
50+
}
51+
test {
52+
java {
53+
srcDir(generatedTestSpineDir)
54+
}
55+
}
56+
}
57+
58+
idea {
59+
module {
60+
sourceDirs.add(generatedSpineDir)
61+
generatedSourceDirs.add(generatedSpineDir)
62+
testSourceDirs.add(generatedTestSpineDir)
63+
iml {
64+
beforeMerged(Action<Module> {
65+
dependencies.clear()
66+
})
67+
whenMerged(Action<Module> {
68+
dependencies.forEach {
69+
(it as ModuleLibrary).isExported = true
70+
}
71+
})
72+
}
73+
}
74+
}
75+
76+
dependencies {
77+
Protobuf.libs.forEach { implementation(it) }
78+
implementation(Spine.base)
79+
implementation(Spine.baseTypes)
80+
testImplementation(Spine.Test.base)
81+
}
82+
83+
protobuf.protobuf.protoc {
84+
artifact = Protobuf.compiler
85+
}

cloudbuild.yaml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,11 @@ steps:
2828
# The following step starts the build process using Gradle official image, performs the build
2929
# and runs `jib` for the specified `GCP_PROJECT` in order to build and deploy the container
3030
# image to the Google Container Registry.
31-
- name: 'gradle:6.9-jdk11'
31+
- name: 'gradle:7.2-jdk16'
3232
entrypoint: 'gradle'
3333
args: [ 'build', 'jib', '-PGCP_PROJECT=${PROJECT_ID}' ]
34+
env: ["GITHUB_ACTOR=CloudBuild"]
35+
secretEnv: ["GITHUB_TOKEN"]
3436
# The following step deploys the previously produced container image to the Cloud Run environment
3537
# with the pre-configured `GCP_PROJECT_ID` environment variable.
3638
- name: 'google/cloud-sdk:slim'
@@ -46,3 +48,7 @@ steps:
4648
timeout: 1200s
4749
substitutions:
4850
_SERVICE_NAME: "chat-bot-server"
51+
availableSecrets:
52+
secretManager:
53+
- versionName: projects/1032487587652/secrets/GithubToken/latest
54+
env: "GITHUB_TOKEN"

0 commit comments

Comments
 (0)