+
Skip to content
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
74 changes: 0 additions & 74 deletions JACOCO_USAGE.md

This file was deleted.

26 changes: 0 additions & 26 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ import com.diffplug.gradle.spotless.SpotlessExtension
import io.gitlab.arturbosch.detekt.DetektCreateBaselineTask
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.gradle.testing.jacoco.plugins.JacocoPluginExtension
import org.gradle.testing.jacoco.tasks.JacocoReport

plugins {
alias(libs.plugins.android.application) apply false
Expand All @@ -23,7 +21,6 @@ allprojects {
apply(plugin = "org.jetbrains.dokka")
apply(plugin = "com.vanniktech.maven.publish")
apply(plugin = "com.diffplug.spotless")
apply(plugin = "jacoco")
configure<SpotlessExtension> {
ratchetFrom("origin/main")
format("misc") {
Expand Down Expand Up @@ -53,10 +50,6 @@ allprojects {
allRules = true
}

configure<JacocoPluginExtension> {
toolVersion = "0.8.11"
}

val detektProjectBaseline by
tasks.registering(DetektCreateBaselineTask::class) {
description = "Overrides current baseline."
Expand All @@ -75,25 +68,6 @@ allprojects {

tasks.dokkaHtmlMultiModule { outputDirectory.set(rootDir.resolve("docs/")) }

// JaCoCo multi-module report
tasks.register<JacocoReport>("jacocoRootReport") {
group = "verification"
description = "Generate Jacoco coverage reports for all modules."

dependsOn(subprojects.map { it.tasks.withType<Test>() })

reports {
xml.required.set(true)
html.required.set(true)
}

val sourceDirs = subprojects.map { it.file("src/main/java") } + subprojects.map { it.file("src/main/kotlin") }

sourceDirectories.setFrom(sourceDirs)
classDirectories.setFrom(subprojects.map { it.file("build/tmp/kotlin-classes/debug") })
executionData.setFrom(subprojects.map { it.fileTree("build").include("**/*.exec", "**/*.ec") })
}

subprojects {
plugins.withType<JavaPlugin> {
the<JavaPluginExtension>().toolchain {
Expand Down
49 changes: 2 additions & 47 deletions source/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,13 +1,11 @@
import org.jetbrains.dokka.gradle.DokkaTaskPartial
import org.gradle.testing.jacoco.tasks.JacocoReport

plugins {
alias(libs.plugins.android.library)
alias(libs.plugins.kotlin.android)
alias(libs.plugins.kotlin.plugin.serialization)
alias(libs.plugins.ksp)
alias(libs.plugins.mavenPublish)
jacoco
}

android {
Expand All @@ -21,8 +19,8 @@ android {
}

buildTypes {
debug {
isMinifyEnabled = false
debug {
isMinifyEnabled = false
enableUnitTestCoverage = true
enableAndroidTestCoverage = true
}
Expand Down Expand Up @@ -88,46 +86,3 @@ dependencies {

ksp(libs.clerk.automap.processor)
}

// JaCoCo configuration
tasks.register<JacocoReport>("jacocoTestReport") {
group = "verification"
description = "Generate Jacoco coverage reports for the debug build."

dependsOn("testDebugUnitTest")

reports {
xml.required.set(true)
html.required.set(true)
}

val fileFilter = listOf(
"**/R.class",
"**/R\$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*",
"**/*\$WhenMappings.*",
"**/*\$serializer.*",
"**/*\$\$serializer.*"
)

val debugTree = fileTree("${buildDir}/tmp/kotlin-classes/debug") {
exclude(fileFilter)
}

val mainSrc = "${project.projectDir}/src/main/java"
val kotlinSrc = "${project.projectDir}/src/main/kotlin"

sourceDirectories.setFrom(files(mainSrc, kotlinSrc))
classDirectories.setFrom(files(debugTree))
executionData.setFrom(fileTree(buildDir) {
include("**/*.exec", "**/*.ec")
})
}

// Ensure jacocoTestReport runs after tests
tasks.named("check") {
dependsOn("jacocoTestReport")
}
19 changes: 14 additions & 5 deletions source/src/main/kotlin/com/clerk/session/Session.kt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package com.clerk.session

import com.clerk.Clerk
import com.clerk.network.ClerkApi
import com.clerk.network.model.client.Client
import com.clerk.network.model.error.ClerkErrorResponse
import com.clerk.network.model.token.TokenResource
import com.clerk.network.model.userdata.PublicUserData
Expand Down Expand Up @@ -141,19 +142,27 @@ data class SessionActivity(
)

/** Deletes the current session. */
suspend fun Session.delete() {
ClerkApi.session.deleteSessions()
suspend fun Session.delete(): ClerkResult<Client, ClerkErrorResponse> {
return ClerkApi.session.deleteSessions()
}

/**
* Fetches a fresh JWT for the session.
*
* @param options The options to use when fetching the token.
* @return The [TokenResource] if the token was fetched successfully, null otherwise.
* @return The [ClerkResult] containing the [TokenResource] if successful, or [ClerkErrorResponse]
* if failed.
* @see GetTokenOptions
*/
suspend fun Session.fetchToken(options: GetTokenOptions = GetTokenOptions()): TokenResource? {
return SessionTokenFetcher().getToken(this, options)
suspend fun Session.fetchToken(
options: GetTokenOptions = GetTokenOptions()
): ClerkResult<TokenResource, ClerkErrorResponse> {
val token = SessionTokenFetcher().getToken(this, options)
return if (token != null) {
ClerkResult.success(token)
} else {
ClerkResult.apiFailure(ClerkErrorResponse(errors = emptyList(), clerkTraceId = "local-error"))
}
}

/**
Expand Down
14 changes: 14 additions & 0 deletions source/src/main/kotlin/com/clerk/signin/SignIn.kt
Original file line number Diff line number Diff line change
Expand Up @@ -518,6 +518,20 @@ data class SignIn(
override val strategy: String = PASSWORD,
) : Strategy

@AutoMap
@Serializable
data class ResetPasswordEmailCode(
val identifier: String,
override val strategy: String = RESET_PASSWORD_EMAIL_CODE,
) : Strategy

@AutoMap
@Serializable
data class ResetPasswordPhoneCode(
val identifier: String,
override val strategy: String = RESET_PASSWORD_PHONE_CODE,
) : Strategy

/**
* Transfer strategy for account transfer scenarios.
*
Expand Down
Loading
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载