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 dependencies #37

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
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
10 changes: 0 additions & 10 deletions build-logic/build.gradle.kts

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,12 @@ import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.api.provider.Provider
import org.gradle.kotlin.dsl.getByType

@Suppress("UnstableApiUsage")
val Project.catalogs: VersionCatalogsExtension
get() = extensions.getByType(VersionCatalogsExtension::class)

@Suppress("UnstableApiUsage")
val Project.libsCatalog: VersionCatalog
get() = catalogs.named("libs")

@Suppress("UnstableApiUsage")
fun VersionCatalog.dependency(alias: String): Provider<MinimalExternalModuleDependency> {
return findDependency(alias).get()
}
return findLibrary(alias).get()
}
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import buildtools.dependency
import buildtools.libsCatalog
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import org.gradle.kotlin.dsl.assign
import org.jetbrains.kotlin.gradle.dsl.JvmTarget

plugins {
kotlin("jvm")
`java-library`
}

val invalidQualifiers = setOf("alpha", "beta", "rc", "nightly")
@Suppress("UnstableApiUsage")
val kotlinVersion = project.libsCatalog.dependency("gradle-kotlin-jvm").get().versionConstraint.requiredVersion
configurations.all {
resolutionStrategy {
Expand Down Expand Up @@ -36,6 +37,13 @@ java {
}
}

kotlin {
compilerOptions {
jvmTarget.set(JvmTarget.JVM_11)
freeCompilerArgs.add("-Xjsr305=strict")
}
}

tasks {
withType<Test>() {
maxParallelForks = Runtime.getRuntime().availableProcessors()
Expand All @@ -45,13 +53,4 @@ tasks {
setEvents(listOf("passed", "skipped", "failed", "standardOut", "standardError"))
}
}

withType<KotlinCompile>() {
kotlinOptions {
freeCompilerArgs = listOf("-Xjsr305=strict", "-Xopt-in=kotlin.RequiresOptIn")
languageVersion = "1.6"
apiVersion = "1.6"
jvmTarget = "$jvmVersion"
}
}
}
2 changes: 0 additions & 2 deletions build-logic/settings.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
enableFeaturePreview("VERSION_CATALOGS")

dependencyResolutionManagement {
repositories {
mavenLocal()
Expand Down
18 changes: 0 additions & 18 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

plugins {
alias(libs.plugins.kotlin.jvm)
alias(libs.plugins.tasktree)
alias(libs.plugins.semver)
alias(libs.plugins.nexus.publish)
alias(libs.plugins.dependencyUpdates)
alias(libs.plugins.dependencyCheck)
alias(libs.plugins.githubRelease)
`maven-publish`
Expand Down Expand Up @@ -60,18 +57,3 @@ githubRelease {
apiEndpoint("https://api.github.com") // should only change for github enterprise users
client // This is the okhttp client used for http requests
}

fun isNonStable(version: String): Boolean {
val stableKeyword = listOf("RELEASE", "FINAL", "GA").any { version.toUpperCase().contains(it) }
val regex = "^[0-9,.v-]+(-r)?$".toRegex()
val isStable = stableKeyword || regex.matches(version)
return isStable.not()
}

// https://github.com/ben-manes/gradle-versions-plugin/discussions/482
tasks.named<DependencyUpdatesTask>("dependencyUpdates").configure {
// reject all non stable versions
rejectVersionIf {
isNonStable(candidate.version)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ sealed interface KJWTValidationError: KJWTVerificationError {
data class RequiredClaimIsInvalid(val name: String): KJWTValidationError
}

typealias ClaimsValidatorResult = ValidatedNel<out KJWTVerificationError, JWTClaims>
typealias ClaimsValidatorResult = ValidatedNel<KJWTVerificationError, JWTClaims>
typealias ClaimsValidator = (JWTClaims) -> ClaimsValidatorResult

object ClaimsVerification {
Expand Down
12 changes: 9 additions & 3 deletions core/src/main/kotlin/io/github/nefilim/kjwt/JWT.kt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ fun String?.toJWTKeyID(): JWTKeyID? = this?.let { JWTKeyID(it)}

@Serializable
data class JOSEHeader<T: JWSAlgorithm>(
@SerialName("alg") @Serializable(JWSAlgorithmSerializer::class) val algorithm: T,
@SerialName("typ") @Serializable(JOSETypeSerializer::class) val type: JOSEType? = null,
@SerialName("kid") val keyID: JWTKeyID? = null,
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@SerialName("alg")
@Serializable(JWSAlgorithmSerializer::class)
val algorithm: T,
@SerialName("typ")
@Serializable(JOSETypeSerializer::class)
val type: JOSEType? = null,
@SerialName("kid")
val keyID: JWTKeyID? = null,
) {
fun toJSON(): String {
return if (keyID != null && keyID.id.isNotBlank())
Expand Down
6 changes: 0 additions & 6 deletions core/src/main/kotlin/io/github/nefilim/kjwt/Serializers.kt
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
package io.github.nefilim.kjwt

import kotlinx.serialization.ExperimentalSerializationApi
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializer
import kotlinx.serialization.descriptors.PrimitiveKind
import kotlinx.serialization.descriptors.PrimitiveSerialDescriptor
import kotlinx.serialization.descriptors.SerialDescriptor
Expand All @@ -13,8 +11,6 @@ class UnsupportedAlgorithmException(val algorithm: String): Exception("unsupport

private val AllJWSAlgorithmToHeaderIDs = AllAlgorithms.associateBy { it.headerID }

@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = JWSAlgorithm::class)
object JWSAlgorithmSerializer: KSerializer<JWSAlgorithm> {

override fun deserialize(decoder: Decoder): JWSAlgorithm {
Expand All @@ -29,8 +25,6 @@ object JWSAlgorithmSerializer: KSerializer<JWSAlgorithm> {
override val descriptor: SerialDescriptor = PrimitiveSerialDescriptor("JWSAlgorithm", PrimitiveKind.STRING)
}

@OptIn(ExperimentalSerializationApi::class)
@Serializer(forClass = JWSAlgorithm::class)
object JOSETypeSerializer: KSerializer<JOSEType> {

override fun deserialize(decoder: Decoder): JOSEType {
Expand Down
4 changes: 2 additions & 2 deletions core/src/test/kotlin/io/github/nefilim/kjwt/JWTSpec.kt
Original file line number Diff line number Diff line change
Expand Up @@ -284,7 +284,7 @@ class JWTSpec: WordSpec() {
issuedNow()
}

fun standardValidation(claims: JWTClaims): ValidatedNel<out KJWTVerificationError, JWTClaims> =
fun standardValidation(claims: JWTClaims): ValidatedNel<KJWTVerificationError, JWTClaims> =
validateClaims(notBefore(), expired(), issuer("thecompany"), subject("1234567890"), audience("http://thecompany.com"))(claims)

standardValidation(jwt).shouldBeValid()
Expand Down Expand Up @@ -313,7 +313,7 @@ class JWTSpec: WordSpec() {
}

"cross timezone issues and validation" {
fun standardValidation(claims: JWTClaims): ValidatedNel<out KJWTVerificationError, JWTClaims> =
fun standardValidation(claims: JWTClaims): ValidatedNel<KJWTVerificationError, JWTClaims> =
validateClaims(notBefore(), expired())(claims)

val utcClock = Clock.systemUTC()
Expand Down
8 changes: 2 additions & 6 deletions google-kms-grpc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
import com.google.protobuf.gradle.generateProtoTasks
import com.google.protobuf.gradle.id
import com.google.protobuf.gradle.plugins
import com.google.protobuf.gradle.protobuf
import com.google.protobuf.gradle.protoc
import com.google.protobuf.gradle.*

plugins {
`java-library`
Expand Down Expand Up @@ -47,7 +43,7 @@ protobuf {
artifact = libs.grpc.protoc.java.get().toString()
}
id("grpckt") {
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.2.0:jdk7@jar" // libs.grpc.protoc.kotlin.get().toString()
artifact = "io.grpc:protoc-gen-grpc-kotlin:1.4.1:jdk8@jar" // libs.grpc.protoc.kotlin.get().toString()
}
}
generateProtoTasks {
Expand Down
3 changes: 2 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
org.gradle.jvmargs=-Xmx512M -XX:MaxMetaspaceSize=512m
org.gradle.jvmargs=-Xmx2g
kotlin.code.style=official
75 changes: 34 additions & 41 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,43 +1,49 @@
## Generated by $ ./gradlew refreshVersionsCatalog

[plugins]

dependencyCheck = { id = "org.owasp.dependencycheck", version.ref = "owasp-dependencycheck" }
githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "gradle-github-release" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradle-nexus-publish" }
protobuf = { id = "com.google.protobuf", version.ref = "gradle-protobuf-plugin" }
semver = { id = "io.github.nefilim.gradle.semver-plugin", version.ref = "gradle-semver" }
tasktree = { id = "com.dorongold.task-tree", version.ref = "gradle-tasktree" }

[versions]
kotlin = "1.6.21"
kotlinXCoroutines = "1.6.4"
kotlinXSerialization = "1.4.1"

kotlin = "2.1.0"
kotlinXCoroutines = "1.10.1"
kotlinXSerialization = "1.7.3"

# third party
arrow = "1.0.1"
google-kms = "0.94.0"
gradle-github-release = "2.2.12"
gradle-nexus-publish = "1.1.0"
gradle-protobuf-plugin = "0.8.18"
gradle-semver = "0.3.+"
gradle-tasktree = "2.1.0"
arrow = "1.2.4"
google-kms = "0.149.0"
gradle-github-release = "2.4.1"
gradle-nexus-publish = "2.0.0"
gradle-protobuf-plugin = "0.9.4"
gradle-semver = "0.3.13"
gradle-tasktree = "4.0.0"
gradle-testlogger = "3.1.0"
gradle-versions = "0.39.0"
grpc = "1.43.1"
grpc-kotlin = "1.2.0"
jib = "3.1.4"
jib-extension = "0.1.0"
kotest = "5.0.3"
kotestExtensionsArrow = "1.2.1"
kover = "0.4.4"
kotlinLogging = "2.1.21"
logback = "1.2.10"
nimbus = "9.15.2"
owasp-dependencycheck = "6.5.1"
protobuf = "3.19.1"
slf4j = "1.7.4"
grpc = "1.69.0"
grpc-kotlin = "1.4.1"
kotest = "5.9.1"
kotestExtensionsArrow = "1.4.0"
kotlinLogging = "3.0.5"
logback = "1.5.15"
nimbus = "9.48"
owasp-dependencycheck = "11.1.1"
protobuf = "4.29.2"

[libraries]

kotlin-reflect = { module = "org.jetbrains.kotlin:kotlin-reflect", version.ref = "kotlin" }
kotlinx-coroutines-core = { module = "org.jetbrains.kotlinx:kotlinx-coroutines-core", version.ref = "kotlinXCoroutines" }
kotlinx-serialization-json = { module = "org.jetbrains.kotlinx:kotlinx-serialization-json", version.ref = "kotlinXSerialization" }

arrow-stack = { module = "io.arrow-kt:arrow-stack", version.ref = "arrow" }
arrow-core = { module = "io.arrow-kt:arrow-core", version.ref = "arrow" }
arrow-fx = { module = "io.arrow-kt:arrow-fx-coroutines", version.ref = "arrow" }
arrow-meta = { module = "io.arrow-kt:arrow-meta", version.ref = "arrow" }
arrow-optics = { module = "io.arrow-kt:arrow-optics", version.ref = "arrow" }
arrow-opticsKSP = { module = "io.arrow-kt:arrow-optics-ksp-plugin", version.ref = "arrow" }

google-kms-protobuf = { module = "com.google.api.grpc:proto-google-cloud-kms-v1", version.ref = "google-kms" }
gradle-nexusPublish = { module = "io.github.gradle-nexus:publish-plugin", version.ref = "gradle-nexus-publish" }
Expand All @@ -62,16 +68,3 @@ protobuf-protoc = { module = "com.google.protobuf:protoc", version.ref = "protob

kotlinLogging = { module = "io.github.microutils:kotlin-logging-jvm", version.ref = "kotlinLogging" }
logbackClassic = { module = "ch.qos.logback:logback-classic", version.ref = "logback" }
slf4jAPI = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" }

[plugins]
dependencyCheck = { id = "org.owasp.dependencycheck", version.ref = "owasp-dependencycheck" }
dependencyUpdates = { id = "com.github.ben-manes.versions", version.ref = "gradle-versions" }
githubRelease = { id = "com.github.breadmoirai.github-release", version.ref = "gradle-github-release" }
kotlin-jvm = { id = "org.jetbrains.kotlin.jvm", version.ref = "kotlin" }
kotlinx-serialization = { id = "org.jetbrains.kotlin.plugin.serialization", version.ref = "kotlin" }
nexus-publish = { id = "io.github.gradle-nexus.publish-plugin", version.ref = "gradle-nexus-publish" }
protobuf = { id = "com.google.protobuf", version.ref = "gradle-protobuf-plugin" }
semver = { id = "io.github.nefilim.gradle.semver-plugin", version.ref = "gradle-semver" }
tasktree = { id = "com.dorongold.task-tree", version.ref = "gradle-tasktree" }
testlogger = { id = "com.adarshr.test-logger", version.ref = "gradle-testlogger" }
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
4 changes: 3 additions & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Loading