Skip to content

Commit

Permalink
Refactor!: Updated Kotlin, Gradle 8.1.1, and other dependencies (#1018)
Browse files Browse the repository at this point in the history
* refactor: Updated Kotlin dependencies, gradlew version, and update minio to newer syntax.

* test: Switched from depreciated failure call.

* Refactor: Updated Kotlin Dependencies and Gradle (#1)

BREAKING CHANGE: New requires Gradle version of 7.6.1 or greater to address JacksonDatabind update.

* test: Adjusted tests for earliest compatible version of Gradle 7.6.1 and error message thrown.

---------

Co-authored-by: Slava Miligoulo <[email protected]>
  • Loading branch information
Slava-Miligoulo-Target and Slava Miligoulo committed Jun 24, 2023
1 parent 83ad620 commit 3e8d6c7
Show file tree
Hide file tree
Showing 184 changed files with 865 additions and 420 deletions.
3 changes: 3 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
// To upgrade versions, run the following (change the version number in the command):
//VERSION=8.1.1; SHA256SUM=$(wget -O- -q "https://services.gradle.org/distributions/gradle-$VERSION-all.zip.sha256"); ./gradlew wrapper --gradle-version $VERSION --distribution-type all --gradle-distribution-sha256-sum $SHA256SUM

buildscript {
repositories {
maven { url "https://plugins.gradle.org/m2/" }
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
plugins {
id "org.jetbrains.kotlin.jvm" version "1.8.10"
id "org.jetbrains.kotlin.jvm" version "1.8.22"
}

repositories {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ open class UIRestUrlVerificationTask : DefaultTask(), VerificationTask {
this.ignoreFailures = ignoreFailures
}


override fun getIgnoreFailures(): Boolean =
this.ignoreFailures

Expand Down
4 changes: 2 additions & 2 deletions example-data/kover-gradle/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
kotlin_version=1.8.0
kotest_version=5.5.5
kotlin_version=1.8.22
kotest_version=5.6.2
strikt_version=0.34.1
wiremockVersion=2.32.0

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ package example

import io.kotest.core.spec.style.StringSpec
import strikt.api.expectThat
import strikt.assertions.*
import strikt.assertions.isEqualTo

class FooTest : StringSpec() {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package projektor.example.spock

import spock.lang.Specification
import spock.lang.Ignore
import spock.lang.Specification

@Ignore
class IgnoreEntireSpec extends Specification {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package projektor.example.spock

import spock.lang.Specification
import spock.lang.Ignore
import spock.lang.Specification

class IgnoreSomeMethodsAndSomeFailingSpec extends Specification {
def "should run test case 1"() {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package projektor.example.spock

import spock.lang.Specification
import spock.lang.Ignore
import spock.lang.Specification

class IgnoreSomeMethodsSpec extends Specification {
def "should run test case 1"() {
Expand Down
2 changes: 1 addition & 1 deletion functional-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ task functionalTest(type: YarnTask) {

// https://github.com/psxpaul/gradle-execfork-plugin
task startServerDaemon(type: com.github.psxpaul.task.JavaExecFork) {
dependsOn ':server:server-app:assembleFull'
dependsOn ':server:server-app:assembleFull','yarnSetup'
classpath = tasks.getByPath(':server:server-app:shadowJar').outputs.files
main = 'io.ktor.server.netty.EngineMain'
stopAfter = functionalTest
Expand Down
13 changes: 8 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
kotlin_version=1.8.0
kotest_version=5.5.5
kotlin_version=1.8.22
kotest_version=5.6.2
spockVersion=2.1-groovy-3.0
strikt_version=0.34.1
#Upgrade to version 3.0.0 once released
wiremockVersion=2.35.0

github_api_version=1.315
logbackVersion=1.4.5
okHttpVersion=4.10.0
retrofitVersion=2.9.0

jacksonDatabindVersion=2.14.2
jacksonVersion=2.14.1
auth0_version=4.4.0
jacksonDatabindVersion=2.15.2
jacksonVersion=2.15.2

postgresDriverVersion=42.5.1
postgresDriverVersion=42.5.4

org.gradle.parallel=true
org.gradle.caching=true
6 changes: 3 additions & 3 deletions gradle/kotlin.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ apply plugin: "org.jlleitschuh.gradle.ktlint"
sourceCompatibility = 11

compileKotlin {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = "$sourceCompatibility"
}
compileTestKotlin {
kotlinOptions.jvmTarget = "11"
kotlinOptions.jvmTarget = "$sourceCompatibility"
}

dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
implementation "org.jetbrains.kotlin:kotlin-reflect:$kotlin_version"

testImplementation "io.kotest:kotest-runner-junit5-jvm:${kotest_version}"
Expand Down
3 changes: 2 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6.1-bin.zip
distributionSha256Sum=5625a0ae20fe000d9225d000b36909c7a0e0e8dda61c19b12da769add847c975
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1.1-all.zip
networkTimeout=10000
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
12 changes: 11 additions & 1 deletion publishers/gradle-plugin/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,17 @@ check.dependsOn functionalTest

// https://github.com/psxpaul/gradle-execfork-plugin
task startServerDaemon(type: com.github.psxpaul.task.JavaExecFork) {
dependsOn ':server:server-app:shadowJar'
dependsOn ':server:server-app:shadowJar',
'compileFunctionalTestGroovy',
'compileGroovy',
'compileTestGroovy',
'compileTestFixturesGroovy',
'compileFunctionalTestJava',
'pluginUnderTestMetadata',
'test',
'processFunctionalTestResources',
'processTestResources',
'validatePlugins'
classpath = tasks.getByPath(':server:server-app:shadowJar').outputs.files
main = 'io.ktor.server.netty.EngineMain'
stopAfter = functionalTest
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ package projektor.plugin.functionaltest

import projektor.plugin.SpecFileConfig
import projektor.plugin.SpecWriter
import projektor.server.api.TestOutput
import projektor.server.api.TestRun
import projektor.server.api.TestSuite
import projektor.server.api.TestOutput
import retrofit2.Response

import static org.gradle.testkit.runner.TaskOutcome.FAILED
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import org.gradle.testkit.runner.GradleRunner
import org.junit.Rule
import org.junit.rules.TemporaryFolder
import projektor.plugin.PluginOutput
import projektor.plugin.SpecWriter
import projektor.server.client.ProjektorAttachmentsApi
import projektor.server.client.ProjektorClientBuilder
import projektor.server.client.ProjektorTestRunApi
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import org.gradle.testkit.runner.TaskOutcome
import projektor.plugin.AttachmentsWriter
import projektor.plugin.BuildFileWriter
import projektor.plugin.SpecWriter
import projektor.server.api.attachments.Attachments
import projektor.server.api.TestRun
import projektor.server.api.attachments.Attachments
import retrofit2.Response

class SingleProjectAttachmentsFunctionalSpec extends ProjektorPluginFunctionalSpecification {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ import projektor.plugin.coverage.CodeCoverageTaskConfigurator

class ProjektorPublishPlugin implements Plugin<Project> {
void apply(Project project) {
if (GradleVersion.current() < GradleVersion.version("7.0")) {
throw new GradleException("This version of the Projektor Gradle plugin supports Gradle 7.0+ only. Please upgrade the version of Gradle your project uses.")
if (GradleVersion.current() < GradleVersion.version("7.6.1")) {
throw new GradleException("This version of the Projektor Gradle plugin supports Gradle 7.6.1+ only. Please upgrade the version of Gradle your project uses.")
}

ProjektorPublishPluginExtension extension = project.extensions.create('projektor', ProjektorPublishPluginExtension.class) as ProjektorPublishPluginExtension
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,7 @@ class CoverageMultiTaskSpec extends SingleProjectSpec {

where:
gradleVersion | _
GradleVersion.version("7.0") | _
GradleVersion.version("7.2") | _
GradleVersion.version("7.6.1") | _
GradleVersion.current() | _
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,7 @@ class KoverCoverageMultiTaskSpec extends SingleProjectSpec {

where:
gradleVersion | _
GradleVersion.version("7.0") | _
GradleVersion.version("7.2") | _
GradleVersion.version("7.3") | _
GradleVersion.version("7.6.1") | _
GradleVersion.current() | _
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,7 @@ class KoverCoverageSingleProjectSpec extends SingleProjectSpec {

where:
gradleVersion | _
GradleVersion.version("7.0") | _
GradleVersion.version("7.2") | _
GradleVersion.version("7.3") | _
GradleVersion.version("7.6.1") | _
GradleVersion.current() | _
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,9 +69,7 @@ class CoverageGradleVersionSingleProjectSpec extends SingleProjectSpec {

where:
gradleVersion | _
GradleVersion.version("7.0") | _
GradleVersion.version("7.2") | _
GradleVersion.version("7.3") | _
GradleVersion.version("7.6.1") | _
GradleVersion.current() | _
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import spock.lang.Unroll

class MinimumVersionSpec extends SingleProjectSpec {
@Unroll
def "when running with Gradle version #gradleVersion less than Gradle 7 should fail"() {
def "when running with Gradle version #gradleVersion less than Gradle 7.6.1 should fail"() {
given:
buildFile << """
projektor {
Expand All @@ -30,7 +30,7 @@ class MinimumVersionSpec extends SingleProjectSpec {
.buildAndFail()

then:
result.output.contains("This version of the Projektor Gradle plugin supports Gradle 7.0+ only. Please upgrade the version of Gradle your project uses.")
result.output.contains("This version of the Projektor Gradle plugin supports Gradle 7.6.1+ only. Please upgrade the version of Gradle your project uses.")

and:
List<LoggedRequest> resultsRequests = resultsStubber.findResultsRequests()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,8 @@ class ResultsGradleVersionSingleProjectSpec extends SingleProjectSpec {
resultsRequests.size() == 1

where:
gradleVersion | _
"7.0" | _
"7.2" | _
"7.3" | _
GradleVersion.current().version | _
gradleVersion | _
GradleVersion.version("7.6.1").version | _
GradleVersion.current().version | _
}
}
4 changes: 2 additions & 2 deletions publishers/node-script/publish-functional-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ task allFunctionalTests(dependsOn: [functionalTest, functionalTestWithToken])

// https://github.com/psxpaul/gradle-execfork-plugin
task startServerDaemon(type: com.github.psxpaul.task.JavaExecFork) {
dependsOn ':server:server-app:shadowJar'
dependsOn ':server:server-app:shadowJar','yarnSetup'
classpath = tasks.getByPath(':server:server-app:shadowJar').outputs.files
main = 'io.ktor.server.netty.EngineMain'
stopAfter = functionalTest
Expand All @@ -60,7 +60,7 @@ task startServerDaemon(type: com.github.psxpaul.task.JavaExecFork) {

// https://github.com/psxpaul/gradle-execfork-plugin
task startServerDaemonWithToken(type: com.github.psxpaul.task.JavaExecFork) {
dependsOn ':server:server-app:shadowJar'
dependsOn ':server:server-app:shadowJar','yarnSetup'
classpath = tasks.getByPath(':server:server-app:shadowJar').outputs.files
main = 'io.ktor.server.netty.EngineMain'
stopAfter = functionalTest
Expand Down
4 changes: 2 additions & 2 deletions server/notification/github/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ apply from: "../../../gradle/kotlin.gradle"

dependencies {
// https://github-api.kohsuke.org/
api "org.kohsuke:github-api:1.313"
api "org.kohsuke:github-api:$github_api_version"

implementation "com.auth0:java-jwt:3.19.4"
implementation "com.auth0:java-jwt:$auth0_version"
implementation "org.bouncycastle:bcpkix-jdk15on:1.70"
implementation "org.bouncycastle:bcprov-jdk15on:1.70"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import org.bouncycastle.openssl.jcajce.JcaPEMKeyConverter
import java.io.StringReader
import java.security.Security
import java.security.interfaces.RSAPrivateKey
import java.util.*
import java.util.Date

open class JwtProvider(private val jwtTokenConfig: JwtTokenConfig) {
init {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package projektor.notification.github.auth

import java.util.*
import java.util.Base64

object PrivateKeyEncoder {
fun base64Encode(keyContents: String): String =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package projektor.notification.github.comment

import org.kohsuke.github.*
import org.kohsuke.github.GHFileNotFoundException
import org.kohsuke.github.GHIssueComment
import org.kohsuke.github.GHIssueState
import org.kohsuke.github.GHRepository
import org.kohsuke.github.GitHubBuilder
import org.slf4j.LoggerFactory
import projektor.notification.github.GitHubClientConfig
import projektor.notification.github.auth.JwtProvider
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ package projektor.notification.github.auth
import com.auth0.jwt.JWT
import io.kotest.core.spec.style.StringSpec
import strikt.api.expectThat
import strikt.assertions.*
import strikt.assertions.isNotNull

class JwtProviderSpec : StringSpec() {
init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,11 @@ import projektor.notification.github.GitHubWireMockStubber
import projektor.notification.github.WireMockTestListener
import projektor.notification.github.auth.MockJwtProvider
import strikt.api.expectThat
import strikt.assertions.*
import strikt.assertions.contains
import strikt.assertions.hasSize
import strikt.assertions.isEqualTo
import strikt.assertions.isNotNull
import strikt.assertions.isNull
import kotlin.test.assertNotNull

class GitHubCommentClientSpec : StringSpec() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import java.math.BigDecimal
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
import java.util.*
import java.util.TimeZone

class GitHubCommentCreatorSpec : StringSpec() {
init {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,10 @@ import projektor.notification.github.GitHubWireMockStubber
import projektor.notification.github.WireMockTestListener
import projektor.notification.github.auth.MockJwtProvider
import strikt.api.expectThat
import strikt.assertions.*
import strikt.assertions.contains
import strikt.assertions.hasSize
import strikt.assertions.isEqualTo
import strikt.assertions.isNull
import java.time.LocalDate
import java.time.LocalDateTime
import java.time.LocalTime
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
package projektor.notification.github

import com.github.tomakehurst.wiremock.WireMockServer
import com.github.tomakehurst.wiremock.client.WireMock.*
import com.github.tomakehurst.wiremock.client.WireMock.aResponse
import com.github.tomakehurst.wiremock.client.WireMock.get
import com.github.tomakehurst.wiremock.client.WireMock.patch
import com.github.tomakehurst.wiremock.client.WireMock.patchRequestedFor
import com.github.tomakehurst.wiremock.client.WireMock.post
import com.github.tomakehurst.wiremock.client.WireMock.postRequestedFor
import com.github.tomakehurst.wiremock.client.WireMock.urlEqualTo

class GitHubWireMockStubber(private val wireMockServer: WireMockServer) {
fun stubRepositoryRequests(orgName: String, repoName: String) {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
package projektor.parser.coverage.cobertura

import projektor.parser.coverage.cobertura.model.CoverageClass
import projektor.parser.coverage.cobertura.model.Coverage
import projektor.parser.coverage.cobertura.model.Pkg
import projektor.parser.coverage.cobertura.model.CoverageClass
import projektor.parser.coverage.cobertura.model.CoverageLine
import projektor.parser.coverage.cobertura.model.Pkg
import projektor.server.example.coverage.CoberturaXmlLoader
import projektor.server.example.coverage.JacocoXmlLoader
import spock.lang.Specification
Expand Down
1 change: 1 addition & 0 deletions server/parsing/coverage-parser/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ dependencies {

implementation "com.fasterxml.jackson.core:jackson-databind:$jacksonDatabindVersion"
implementation "com.fasterxml.jackson.module:jackson-module-kotlin:$jacksonVersion"
implementation project(path: ':server:parsing:jest-xml-parser')

testImplementation(project(':server:test:coverage-fixtures'))
}
Loading

0 comments on commit 3e8d6c7

Please sign in to comment.