Skip to content

Commit

Permalink
Update dependency versions (#127)
Browse files Browse the repository at this point in the history
* Updated dependencies:
retorofit 2.9.0 -> 2.11.0
okhttp 4.10.0 -> 4.12.0
slf4j-api 1.7.12 -> 2.0.16

* Get rid of kotlin dsl version

* Add linux requirement for stable qodana checks

* Make Publish to Space configuration of type deployment

* Add missing test dependency

* Ignore test which we don't run for a while anyway, so we can make the build green.

* Fix code problems found by Qodana
  • Loading branch information
Andronnix authored Oct 2, 2024
1 parent 3a73c6b commit 7204599
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 15 deletions.
7 changes: 5 additions & 2 deletions .teamcity/settings.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import jetbrains.buildServer.configs.kotlin.buildSteps.script
import jetbrains.buildServer.configs.kotlin.triggers.schedule
import jetbrains.buildServer.configs.kotlin.triggers.vcs

version = "2023.05"

project {
description = "REST API client written in Kotlin"

Expand Down Expand Up @@ -159,6 +157,10 @@ project {
param("env.QODANA_TOKEN", "credentialsJSON:74c92ed1-94f9-433a-8576-5e5185a7ad54")
}

requirements {
equals("teamcity.agent.jvm.os.name", "Linux")
}

triggers {
vcs {
branchFilter = """
Expand Down Expand Up @@ -210,6 +212,7 @@ project {
buildType {
id("Publish")
name = "Publish to Space"
type = BuildTypeSettings.Type.DEPLOYMENT

requirements {
exists("docker.version")
Expand Down
12 changes: 6 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,18 +31,18 @@ configure(project(':teamcity-rest-client-api')) {

configure(project(":teamcity-rest-client-impl")) {
dependencies {
implementation "com.squareup.retrofit2:retrofit:2.9.0"
implementation "com.squareup.retrofit2:converter-gson:2.9.0"
implementation "com.squareup.okhttp3:okhttp:4.10.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.10.0"
implementation "com.squareup.retrofit2:retrofit:2.11.0"
implementation "com.squareup.retrofit2:converter-gson:2.11.0"
implementation "com.squareup.okhttp3:okhttp:4.12.0"
implementation "com.squareup.okhttp3:logging-interceptor:4.12.0"
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8"
implementation "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1"

implementation 'org.slf4j:slf4j-api:1.7.12'
implementation "org.slf4j:slf4j-api:2.0.16"
testImplementation "org.slf4j:slf4j-log4j12:2.0.16"

testImplementation "junit:junit:4.12"
testImplementation "org.assertj:assertj-core:3.12.2"
testImplementation "org.slf4j:slf4j-log4j12:1.7.12"
testImplementation "org.jetbrains.kotlin:kotlin-test"
testImplementation "org.jetbrains.kotlin:kotlin-reflect"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ private class RetryInterceptor(
private val expBackOffFactor: Int = 2
private val expBackOffJitter: Double = 0.1

private fun okhttp3.Response.retryRequired(): Boolean {
private fun Response.retryRequired(): Boolean {
val code = code
if (code < 400) return false

Expand All @@ -79,14 +79,14 @@ private class RetryInterceptor(
code == 429 // Too many requests == rate limited
}

override fun intercept(chain: Interceptor.Chain): okhttp3.Response {
override fun intercept(chain: Interceptor.Chain): Response {
val request = chain.request()

var nextDelay = initialDelayMs
var attempt = 1
while (true) {
var error: IOException? = null
val response: okhttp3.Response? = try {
val response: Response? = try {
chain.proceed(request)
} catch (e: IOException) {
error = e
Expand Down Expand Up @@ -1315,7 +1315,7 @@ private class VcsRootLocatorImpl(private val instance: TeamCityCoroutinesInstanc

override fun allSeq(): Sequence<VcsRoot> = lazyPagingSequence(instance,
getFirstBean = {
LOG.debug("Retrieving vcs roots from ${instance.serverUrl}")
LOG.debug("Retrieving sequentially vcs roots from ${instance.serverUrl}")
instance.service.vcsRoots()
},
convertToPage = { bean -> Page(bean.`vcs-root`.map { VcsRootImpl(it, false, instance) }, bean.nextHref) })
Expand Down Expand Up @@ -2412,7 +2412,7 @@ private class BuildQueueImpl(private val instance: TeamCityCoroutinesInstanceImp
instance,
getFirstBean = {
val buildLocator = if (parameters.isNotEmpty()) parameters.joinToString(",") else null
LOG.debug("Retrieving queued builds from ${instance.serverUrl} using query '$buildLocator'")
LOG.debug("Retrieving sequentially queued builds from ${instance.serverUrl} using query '$buildLocator'")
instance.service.queuedBuilds(
locator = buildLocator,
fields = BuildBean.buildCustomFieldsFilter(prefetchFieldsCopy, wrap = true)
Expand Down Expand Up @@ -2441,7 +2441,7 @@ private open class TestRunImpl(
checkNotNull(fromFullBeanIf(TestRunField.NAME !in prefetchedFields, TestOccurrenceBean::name))
}

private val duration = SuspendingLazy {
private val duration = SuspendingLazy<Duration> {
val duration = fromFullBeanIf(TestRunField.DURATION !in prefetchedFields, TestOccurrenceBean::duration) ?: 0L
Duration.ofMillis(duration)
}
Expand Down Expand Up @@ -2524,7 +2524,7 @@ private open class TestRunImpl(

final override suspend fun getStatus() = status.getValue()

override suspend fun getDuration() = duration.getValue()
override suspend fun getDuration(): Duration = duration.getValue()

override suspend fun getDetails(): String = details.getValue()

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ package org.jetbrains.teamcity.rest
import kotlinx.coroutines.flow.toList
import kotlinx.coroutines.runBlocking
import org.junit.Before
import org.junit.Ignore
import org.junit.Test
import kotlin.test.assertEquals
import kotlin.test.assertTrue
Expand Down Expand Up @@ -40,6 +41,7 @@ class BuildAgentTest {
}

@Test
@Ignore("Requires a running agent which we don't have yet. See TW-90032")
fun compatible_with_configuration() {
val compatibleAgents = publicInstance().buildAgents()
.compatibleWith(manyTestsBuildConfiguration)
Expand Down

0 comments on commit 7204599

Please sign in to comment.