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

chore(deps): Updated Kotlin from v1.7.0 to v1.9.10, Gradle from v6.7.… #1379

Merged
merged 6 commits into from
Oct 23, 2023
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
5 changes: 4 additions & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

[*.{kt,gradle}]
[*.{kt,kts}]
indent_style = space
indent_size = 4
ktlint_standard_no-wildcard-imports = disabled
ktlint_standard_filename = disabled
ktlint_standard_enum-entry-name-case = disabled
83 changes: 0 additions & 83 deletions kotlin/build.gradle

This file was deleted.

67 changes: 67 additions & 0 deletions kotlin/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
group = "com.looker.sdk"
defaultTasks = mutableListOf("jar")

val kotlinVersion = providers.gradleProperty("kotlinVersion").get()
val googleHttpVersion = providers.gradleProperty("googleHttpVersion").get()

plugins {
kotlin("jvm")
id("com.diffplug.spotless")
}

sourceSets {
main {
kotlin {
setSrcDirs(listOf("src/main/"))
}
}
test {
kotlin {
setSrcDirs(listOf("src/test"))
}
}
}

repositories {
mavenCentral()
maven { url = uri("https://dl.bintray.com/kotlin/ktor") }
maven { url = uri("https://dl.bintray.com/kotlin/kotlinx") }
maven { url = uri("https://jitpack.io") }
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-reflect:$kotlinVersion")

implementation("io.github.cdimascio:dotenv-kotlin:6.2.2")
implementation("org.ini4j:ini4j:0.5.4")

implementation("commons-configuration:commons-configuration:1.10")

implementation(platform("com.google.http-client:google-http-client-bom:$googleHttpVersion"))
drstrangelooker marked this conversation as resolved.
Show resolved Hide resolved
implementation("com.google.http-client:google-http-client")
implementation("com.google.http-client:google-http-client-apache-v2")
implementation("com.google.http-client:google-http-client-gson")

implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.6.4")
implementation("com.google.code.gson:gson:2.8.5")

testImplementation("org.junit.jupiter:junit-jupiter-api:5.3.1")
testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:5.3.1")
testImplementation("org.jetbrains.kotlin:kotlin-test-junit:$kotlinVersion")
}

spotless {
kotlin {
ktlint("0.50.0").setEditorConfigPath("$projectDir/../.editorconfig")
}
}

kotlin {
jvmToolchain(17)
}

tasks.test {
testLogging {
exceptionFormat = org.gradle.api.tasks.testing.logging.TestExceptionFormat.FULL
}
}
2 changes: 1 addition & 1 deletion kotlin/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
kotlinVersion=1.7.10
kotlinVersion=1.9.10
googleHttpVersion=1.43.3
2 changes: 1 addition & 1 deletion kotlin/gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
7 changes: 0 additions & 7 deletions kotlin/settings.gradle

This file was deleted.

10 changes: 10 additions & 0 deletions kotlin/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
rootProject.name = "looker-kotlin-sdk"

pluginManagement {
val kotlinVersion = providers.gradleProperty("kotlinVersion").get()
plugins {
kotlin("jvm") version kotlinVersion
id("com.diffplug.spotless") version "6.20.0"
id("org.gradle.toolchains.foojay-resolver-convention") version "0.7.0"
}
}
4 changes: 2 additions & 2 deletions kotlin/src/main/com/looker/rtl/AuthToken.kt
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ data class AuthToken(
@SerializedName("expires_in")
var expiresIn: Long = 0L,
@SerializedName("refresh_token")
var refreshToken: String? = null
var refreshToken: String? = null,
) {

var expiresAt: LocalDateTime = LocalDateTime.now()
Expand All @@ -53,7 +53,7 @@ data class AuthToken(
token.access_token!!,
token.token_type!!,
token.expires_in!!.toLong(),
token.refresh_token
token.refresh_token,
)

init {
Expand Down
2 changes: 1 addition & 1 deletion kotlin/src/main/com/looker/rtl/Constants.kt
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ fun unQuote(value: String?): String {
enum class ResponseMode {
String,
Binary,
Unknown
Unknown,
}

fun responseMode(contentType: String): ResponseMode {
Expand Down
12 changes: 9 additions & 3 deletions kotlin/src/main/com/looker/rtl/ErrorDoc.kt
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,13 @@ typealias ErrorCodeIndex = HashMap<String, ErrorDocItem>
interface IErrorDocLink {
/** base redirector url */
var redirector: String

/** api version of the error link */
var apiVersion: String

/** HTTP status code */
var statusCode: String

/** REST API Path */
var apiPath: String
}
Expand Down Expand Up @@ -143,7 +146,7 @@ class ErrorDoc(val sdk: APIMethods, val cdnUrl: String = ErrorCodesUrl) : IError
match.groupValues[1],
match.groupValues[2],
match.groupValues[3],
match.groupValues[4]
match.groupValues[4],
)
}

Expand Down Expand Up @@ -182,7 +185,10 @@ class ErrorDoc(val sdk: APIMethods, val cdnUrl: String = ErrorCodesUrl) : IError

override fun specPath(path: String): String {
val rx = Regex("""(:\w+)""")
val result = path.replace(rx) { val x = it.value.substring(1); "{$x}" }
val result = path.replace(rx) {
val x = it.value.substring(1)
"{$x}"
}
return result
}

Expand Down Expand Up @@ -220,5 +226,5 @@ class ErrorDocLink(
override var redirector: String = "",
override var apiVersion: String = "",
override var statusCode: String = "",
override var apiPath: String = ""
override var apiPath: String = "",
) : IErrorDocLink
14 changes: 7 additions & 7 deletions kotlin/src/main/com/looker/rtl/OAuthSession.kt
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ fun base64UrlEncode(bytes: ByteArray): String {
@ExperimentalUnsignedTypes
class OAuthSession(
override val apiSettings: ConfigurationProvider,
override val transport: Transport = Transport(apiSettings)
override val transport: Transport = Transport(apiSettings),
) :
AuthSession(apiSettings, transport) {
private var random = SecureRandom()
Expand All @@ -52,7 +52,7 @@ class OAuthSession(
HttpMethod.POST,
"/api/token",
emptyMap(),
body
body,
)
val token = this.ok<AccessToken>(response)
this.authToken.setToken(token)
Expand All @@ -69,8 +69,8 @@ class OAuthSession(
"grant_type" to "refresh_token",
"refresh_token" to this.activeToken().refreshToken,
"client_id" to config["client_id"],
"redirect_uri" to config["redirect_uri"]
)
"redirect_uri" to config["redirect_uri"],
),
)
}
}
Expand All @@ -94,8 +94,8 @@ class OAuthSession(
"scope" to scope,
"state" to state,
"code_challenge_method" to "S256",
"code_challenge" to codeChallenge
)
"code_challenge" to codeChallenge,
),
)
}

Expand All @@ -107,7 +107,7 @@ class OAuthSession(
"code" to authCode,
"code_verifier" to verifier,
"client_id" to (config["client_id"] ?: error("")),
"redirect_uri" to (config["redirect_uri"] ?: error(""))
"redirect_uri" to (config["redirect_uri"] ?: error("")),
)
}

Expand Down
Loading
Loading