Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
6668bf8
the detekt plugin was added
Neyasbit Nov 2, 2025
fc5a6a8
new lib - detekt
Neyasbit Nov 2, 2025
acdb341
the detekt config was added
Neyasbit Nov 2, 2025
fef74e2
detekt formatting has been applied, where possible.
Neyasbit Nov 2, 2025
2dd3970
fixes after running android app
Neyasbit Nov 3, 2025
0449b19
fixes after running jvm app
Neyasbit Nov 3, 2025
2b48cf8
fixes after running js app
Neyasbit Nov 3, 2025
ff6734d
added scripts to check the code
Neyasbit Nov 3, 2025
f6e3658
the code analyze job has beed added
Neyasbit Nov 3, 2025
47d06e9
update .gitignore
Neyasbit Nov 3, 2025
2378927
disabled ExplicitApiMode
Neyasbit Nov 3, 2025
21f9359
the visibility was changed, after applied explicitApi
Neyasbit Nov 3, 2025
b286fe1
cleanup
Neyasbit Nov 3, 2025
6f16985
the detekt was applied for sample
Neyasbit Nov 3, 2025
28d2809
the detekt plugin has beed added
Neyasbit Nov 3, 2025
3b18bde
cleanup
Neyasbit Nov 3, 2025
a19c0e9
the forgotten parts were added
Neyasbit Nov 3, 2025
7abac9f
try to fix ci
Neyasbit Nov 3, 2025
136f545
try to fix ci 2
Neyasbit Nov 3, 2025
4e516bb
try to fix ci 3
Neyasbit Nov 3, 2025
a94925d
try to fix ci 4
Neyasbit Nov 3, 2025
6df7ec1
added the analyze dependencies for the build
Neyasbit Nov 3, 2025
0082c86
the compilation problem was fixed
Neyasbit Nov 3, 2025
4229751
the compilation problem was fixed for the playground
Neyasbit Nov 3, 2025
60b01e6
the compilation problem was fixed for the playground 2
Neyasbit Nov 3, 2025
0fb7e91
the installation of hooks has been disabled for CI
Neyasbit Nov 4, 2025
0c8048c
the temp to fix wasmJsBrowserTest
Neyasbit Nov 4, 2025
1b89f22
the build gradle files has been fixed
Neyasbit Nov 4, 2025
7bbaa9c
the wasm test fix
Neyasbit Nov 5, 2025
e53558b
the detekt was added to build-logic
Neyasbit Nov 5, 2025
19f3e4e
reordering jobs. The test are preformed first, the the build.
Neyasbit Nov 5, 2025
aac558b
fix - deploy-snapshot
Neyasbit Nov 5, 2025
109a94a
Merge branch 'main' into feature/detekt
Neyasbit Nov 8, 2025
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: 10 additions & 0 deletions .github/workflows/actions/analyze/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Code analyze
description: Analyze

runs:
using: "composite"
steps:
- uses: ./.github/workflows/actions/prepare
- name: Library code Analysis
shell: bash
run: ./gradlew detekt
23 changes: 15 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,14 @@ permissions:
checks: write # required for test-reporter

jobs:
build:
analyze:
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/build
- uses: ./.github/workflows/actions/doc
- uses: ./.github/workflows/actions/analyze

test:
needs: [ build ]
needs: [ analyze ]
runs-on: macos-15
permissions:
id-token: write
Expand All @@ -37,18 +36,26 @@ jobs:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/test

build:
needs: [ test ]
runs-on: macos-15
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/build
- uses: ./.github/workflows/actions/doc

create-swift-package:
needs: [ build, test]
needs: [ build, test ]
if: github.ref == 'refs/heads/main'
runs-on: macos-15
runs-on: macos-13
steps:
- uses: actions/checkout@v4
- uses: ./.github/workflows/actions/createSwiftPackage
with:
version: "main"

deploy-swift-package-snapshot:
needs: [create-swift-package]
needs: [ create-swift-package ]
if: github.ref == 'refs/heads/main'
runs-on: macos-15
steps:
Expand All @@ -59,7 +66,7 @@ jobs:
token: ${{ secrets.PAT }}

deploy-snapshot:
needs: [ test ]
needs: [ build ]
if: github.ref == 'refs/heads/main'
runs-on: macos-15

Expand Down
25 changes: 19 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,21 @@
.idea
*.iml
.kotlin
.gradle
build
.hprof
**/.DS_Store
*.hprof
**/build/
xcuserdata
!src/**/build/
local.properties
.kotlin
.idea
.DS_Store
captures
.externalNativeBuild
.cxx
*.xcodeproj/*
!*.xcodeproj/project.pbxproj
!*.xcodeproj/xcshareddata/
!*.xcodeproj/project.xcworkspace/
!*.xcworkspace/contents.xcworkspacedata
**/xcshareddata/WorkspaceSettings.xcsettings
node_modules/
xcuserdata/
kotlin-js-store/
8 changes: 4 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -117,8 +117,8 @@ val tokens = flow.getAccessToken()

Perform refresh or endSession:
```kotlin
tokens.refresh_token?.let { client.refreshToken(refreshToken = it) }
tokens.id_token?.let { client.endSession(idToken = it) }
tokens.refreshToken?.let { client.refreshToken(refreshToken = it) }
tokens.idToken?.let { client.endSession(idToken = it) }
```

# Token Store (experimental)
Expand Down Expand Up @@ -183,14 +183,14 @@ If you have configured a ```postLogoutRedirectUri``` and want to perform a Logou
you can use the endSession flow:
```kotlin
val flow = authFlowFactory.createEndSessionFlow(client)
tokens.id_token?.let { flow.endSession(it) }
tokens.idToken?.let { flow.endSession(it) }
```
That way, browser cookies should be cleared so the next time a client wants to login, it get's prompted for username and password again.

# JWT Parsing
We provide simple JWT parsing (without any validation):
```kotlin
val jwt = tokens.id_token?.let { Jwt.parse(it) }
val jwt = tokens.idToken?.let { Jwt.parse(it) }
println(jwt?.payload?.aud) // print audience
println(jwt?.payload?.iss) // print issuer
println(jwt?.payload?.additionalClaims?.get("email")) // get claim
Expand Down
5 changes: 5 additions & 0 deletions build-logic/convention/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ dependencies {
compileOnly(libs.nexusPublish.gradlePlugin)
compileOnly(libs.multiplatform.swiftpackage.gradlePlugin)
compileOnly(libs.dokka.gradlePlugin)
implementation(libs.detekt.gradle)

// https://github.com/gradle/gradle/issues/15383
implementation(files(libs.javaClass.superclass.protectionDomain.codeSource.location))
Expand Down Expand Up @@ -60,5 +61,9 @@ gradlePlugin {
id = "org.publicvalue.convention.multiplatformSwiftPackage"
implementationClass = "org.publicvalue.convention.MultiplatformSwiftPackageConventionPlugin"
}
register("customDetekt") {
id = "org.publicvalue.convention.detekt"
implementationClass = "org.publicvalue.convention.DetektPlugin"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.publicvalue.convention.config.configureKotlinAndroid

class AndroidApplicationConventionPlugin : Plugin<Project> {
@Suppress("unused")
internal class AndroidApplicationConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
Expand All @@ -18,4 +19,4 @@ class AndroidApplicationConventionPlugin : Plugin<Project> {
}
}
}
}
}
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
package org.publicvalue.convention

import com.android.build.gradle.LibraryExtension
import org.publicvalue.convention.config.configureKotlinAndroid
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.publicvalue.convention.config.configureKotlinAndroid

class AndroidLibraryConventionPlugin : Plugin<Project> {
@Suppress("unused")
internal class AndroidLibraryConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
Expand All @@ -19,4 +20,4 @@ class AndroidLibraryConventionPlugin : Plugin<Project> {
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,10 @@ package org.publicvalue.convention
import org.gradle.api.Plugin
import org.gradle.api.Project

class ComposeMultiplatformConventionPlugin : Plugin<Project> {
@Suppress("unused")
internal class ComposeMultiplatformConventionPlugin : Plugin<Project> {
override fun apply(target: Project) = with(target) {
pluginManager.apply("org.jetbrains.compose")
pluginManager.apply("org.jetbrains.kotlin.plugin.compose")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
package org.publicvalue.convention

import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.dependencies

@Suppress("unused")
internal class DetektPlugin : Plugin<Project> {
override fun apply(target: Project) {
val settingsPath = target.rootProject.file("settings.gradle.kts").absolutePath
val projectBuildGradlePath = target.rootProject.file("build.gradle.kts").absolutePath
val buildLogic = target.rootProject.file("build-logic/convention/src").absolutePath
target.subprojects {
val targetBuildGradlePath = file("build.gradle.kts").absolutePath
afterEvaluate {
plugins.apply(libs.plugins.detekt.get().pluginId)

configure<DetektExtension> {
buildUponDefaultConfig = true
autoCorrect = true
baseline = file("code-quality/baseline.xml")
source.setFrom(
"src/main/kotlin",
"src/commonMain/kotlin",
"src/commonTest",
"src/iosMain",
"src/jvmMain",
"src/wasmJsMain",
"src/androidMain",
"src/nativeMain",
"src/jsMain",
targetBuildGradlePath,
projectBuildGradlePath,
settingsPath,
buildLogic
)
}

dependencies {
add("detektPlugins", libs.detekt.formatting)
add("detektPlugins", libs.detekt.rules.libraries)
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType
import org.publicvalue.convention.config.configureKotlin

class KotlinMultiplatformConventionPlugin : Plugin<Project> {
@Suppress("unused")
internal class KotlinMultiplatformConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
// use mobile plugin and add jvm target
Expand All @@ -26,8 +27,13 @@ class KotlinMultiplatformConventionPlugin : Plugin<Project> {
}
}

fun Project.addKspDependencyForAllTargets(dependencyNotation: Any) = addKspDependencyForAllTargets("", dependencyNotation)
fun Project.addKspTestDependencyForAllTargets(dependencyNotation: Any) = addKspDependencyForAllTargets("Test", dependencyNotation)
fun Project.addKspDependencyForAllTargets(dependencyNotation: Any) = addKspDependencyForAllTargets(
"",
dependencyNotation
)
fun Project.addKspTestDependencyForAllTargets(
dependencyNotation: Any
) = addKspDependencyForAllTargets("Test", dependencyNotation)

private fun Project.addKspDependencyForAllTargets(
configurationNameSuffix: String,
Expand Down Expand Up @@ -57,10 +63,10 @@ fun KotlinMultiplatformExtension.addParcelizeAnnotation(annotationClass: String)
compilerOptions {
freeCompilerArgs.addAll(
"-P",
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=${annotationClass}"
"plugin:org.jetbrains.kotlin.parcelize:additionalAnnotation=$annotationClass"
)
}
}
}

fun String.capitalized() = replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
fun String.capitalized() = replaceFirstChar { if (it.isLowerCase()) it.titlecase() else it.toString() }
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import org.gradle.api.Project
import org.gradle.kotlin.dsl.configure
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
import org.publicvalue.convention.config.configureAndroidTarget
import org.publicvalue.convention.config.configureKotlin

/**
* No JVM target, only android + ios
*/
class KotlinMultiplatformMobileConventionPlugin : Plugin<Project> {
@Suppress("unused")
internal class KotlinMultiplatformMobileConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
Expand All @@ -19,6 +19,7 @@ class KotlinMultiplatformMobileConventionPlugin : Plugin<Project> {

extensions.configure<KotlinMultiplatformExtension> {
applyDefaultHierarchyTemplate()
explicitApi()

if (pluginManager.hasPlugin("com.android.library")) {
this.configureAndroidTarget()
Expand All @@ -27,4 +28,4 @@ class KotlinMultiplatformMobileConventionPlugin : Plugin<Project> {
// configureKotlin()
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,8 @@ import org.gradle.plugins.signing.SigningExtension
import org.jetbrains.compose.internal.utils.getLocalProperty
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension

class MavenCentralPublishConventionPlugin : Plugin<Project> {
@Suppress("unused", "LongMethod")
internal class MavenCentralPublishConventionPlugin : Plugin<Project> {
override fun apply(target: Project) {
with(target) {
with(pluginManager) {
Expand All @@ -24,14 +25,14 @@ class MavenCentralPublishConventionPlugin : Plugin<Project> {
}

extensions.configure<KotlinMultiplatformExtension> {
explicitApi()
if (pluginManager.hasPlugin("com.android.library")) {
androidTarget {
publishLibraryVariants("release")
}
}
}


val javadocJar = tasks.register("javadocJar", Jar::class.java) {
archiveClassifier.set("javadoc")
from(tasks.getByName("dokkaHtml"))
Expand Down Expand Up @@ -72,7 +73,9 @@ class MavenCentralPublishConventionPlugin : Plugin<Project> {
}
scm {
connection.set("scm:git:github.com/kalinjul/kotlin-multiplatform-oidc.git")
developerConnection.set("scm:git:ssh://github.com/kalinjul/kotlin-multiplatform-oidc.git")
developerConnection.set(
"scm:git:ssh://github.com/kalinjul/kotlin-multiplatform-oidc.git"
)
url.set("https://github.com/kalinjul/kotlin-multiplatform-oidc/tree/main")
}
}
Expand All @@ -90,7 +93,6 @@ class MavenCentralPublishConventionPlugin : Plugin<Project> {
sign(publishing.publications)
}


//region Fix Gradle warning about signing tasks using publishing task outputs without explicit dependencies
// https://github.com/gradle/gradle/issues/26091
tasks.withType<AbstractPublishToMaven>().configureEach {
Expand All @@ -100,4 +102,4 @@ class MavenCentralPublishConventionPlugin : Plugin<Project> {
//endregion
}
}
}
}
Loading