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

2.2.1 - fixes #35

Merged
merged 5 commits into from
Dec 13, 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
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -170,3 +170,4 @@ hs_err_pid*
# yarn.lock location & other
/kotlin-js-store/**
/.idea/appInsightsSettings.xml
/.idea/deploymentTargetSelector.xml
9 changes: 4 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask

Check warning on line 1 in build.gradle.kts

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

build.gradle.kts#L1

The file does not contain a package declaration.
import nl.littlerobots.vcu.plugin.versionCatalogUpdate
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnLockMismatchReport
import org.jetbrains.kotlin.gradle.targets.js.yarn.YarnRootExtension
Expand Down Expand Up @@ -75,10 +76,8 @@
}

dependencyAnalysis {
issues {
all {
ignoreKtx(true)
}
structure {
ignoreKtx(true)
}
}

Expand Down Expand Up @@ -134,7 +133,7 @@
autoCorrect = false
}

withType<com.github.benmanes.gradle.versions.updates.DependencyUpdatesTask>().configureEach {
withType<DependencyUpdatesTask>().configureEach {
outputFormatter = "json"

fun stabilityLevel(version: String): Int {
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ object Config {

const val majorRelease = 2
const val minorRelease = 2
const val patch = 0
const val patch = 1
const val postfix = "rc"
const val versionName = "$majorRelease.$minorRelease.$patch-$postfix"
const val url = "https://github.com/respawn-app/FlowMVI"
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/src/main/kotlin/ConfigureAndroid.kt
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import com.android.build.gradle.LibraryExtension
import org.gradle.api.Project

fun Project.configureAndroid(
commonExtension: CommonExtension<*, *, *, *, *>,
commonExtension: CommonExtension<*, *, *, *, *, *>,
) = commonExtension.apply {
compileSdk = Config.compileSdk
val libs by versionCatalog
Expand Down
54 changes: 26 additions & 28 deletions buildSrc/src/main/kotlin/ConfigureMultiplatform.kt
Original file line number Diff line number Diff line change
Expand Up @@ -45,34 +45,32 @@ fun Project.configureMultiplatform(
jvm()
}

if (iOs) {
sequence {
if (iOs) {
yield(iosX64())
yield(iosArm64())
yield(iosSimulatorArm64())
}
if (macOs) {
yield(macosArm64())
yield(macosX64())
}
if (tvOs) {
yield(tvosX64())
yield(tvosArm64())
yield(tvosSimulatorArm64())
}
if (watchOs) {
yield(watchosX64())
yield(watchosArm64())
yield(watchosDeviceArm64())
yield(watchosSimulatorArm64())
}
}.forEach {
it.binaries.framework {
binaryOption("bundleId", Config.artifactId)
binaryOption("bundleVersion", Config.versionName)
baseName = Config.artifactId
}
sequence {
if (iOs) {
yield(iosX64())
yield(iosArm64())
yield(iosSimulatorArm64())
}
if (macOs) {
yield(macosArm64())
yield(macosX64())
}
if (tvOs) {
yield(tvosX64())
yield(tvosArm64())
yield(tvosSimulatorArm64())
}
if (watchOs) {
yield(watchosX64())
yield(watchosArm64())
yield(watchosDeviceArm64())
yield(watchosSimulatorArm64())
}
}.forEach {
it.binaries.framework {
binaryOption("bundleId", Config.artifactId)
binaryOption("bundleVersion", Config.versionName)
baseName = Config.artifactId
}
}

Expand Down
5 changes: 2 additions & 3 deletions buildSrc/src/main/kotlin/ConfigurePublication.kt
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
@file:Suppress("MissingPackageDeclaration", "unused")

import com.android.build.api.dsl.LibraryExtension
import com.android.build.gradle.internal.cxx.configure.gradleLocalProperties
import com.android.build.gradle.tasks.BundleAar
import org.gradle.api.Project
import org.gradle.api.publish.PublishingExtension
Expand All @@ -17,7 +16,7 @@ import org.gradle.plugins.signing.Sign
* Configures Maven publishing to sonatype for this project
*/
fun Project.publishMultiplatform() {
val properties = gradleLocalProperties(rootDir)
val properties by localProperties
val isReleaseBuild = properties["release"]?.toString().toBoolean()

val javadocTask = tasks.named("emptyJavadocJar") // TODO: dokka does not support kmp javadocs yet
Expand Down Expand Up @@ -52,7 +51,7 @@ fun Project.publishAndroid(ext: LibraryExtension) = with(ext) {
}

afterEvaluate {
val properties = gradleLocalProperties(rootDir)
val properties by localProperties
val isReleaseBuild = properties["release"]?.toString().toBoolean()

requireNotNull(extensions.findByType<PublishingExtension>()).apply {
Expand Down
10 changes: 10 additions & 0 deletions buildSrc/src/main/kotlin/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,10 @@ import org.gradle.api.artifacts.VersionCatalog
import org.gradle.api.artifacts.VersionCatalogsExtension
import org.gradle.kotlin.dsl.getByType
import org.gradle.plugin.use.PluginDependency
import java.io.File
import java.io.FileInputStream
import java.util.Base64
import java.util.Properties

/**
* Load version catalog for usage in places where it is not available yet with gradle 7.x.
Expand Down Expand Up @@ -50,3 +53,10 @@ fun List<String>.toJavaArrayString() = buildString {
}

fun String.toBase64() = Base64.getEncoder().encodeToString(toByteArray())

val Project.localProperties
get() = lazy {
Properties().apply {
load(FileInputStream(File(rootProject.rootDir, "local.properties")))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import pro.respawn.flowmvi.api.MVIAction
import pro.respawn.flowmvi.api.MVIIntent

// TODO: KMP Does not support sharing code between Android and JVM, hence the duplicate

Check notice on line 9 in core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt

View check run for this annotation

Codacy Production / Codacy Static Code Analysis

core/src/androidMain/kotlin/pro/respawn/flowmvi/dsl/AndroidDsl.kt#L9

This comment contains 'TODO:' that has been defined as forbidden in detekt.

/**
* An alias for [IntentReceiver.send]
*/
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
package pro.respawn.flowmvi.api

import kotlinx.coroutines.withContext
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.cancellation.CancellationException

Expand Down Expand Up @@ -29,9 +28,7 @@ public fun interface Recoverable<S : MVIState, I : MVIIntent, A : MVIAction> : C
throw e
} catch (expected: Exception) {
if (coroutineContext[Recoverable] != null) throw expected
withContext(this@Recoverable) {
recover(expected)
}
recover(expected)
}

@DelicateStoreApi
Expand Down
18 changes: 9 additions & 9 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,24 +2,24 @@
activity = "1.8.1"
compose = "1.5.4"
compose-plugin = "1.5.11"
compose-compiler = "1.5.5"
compose-compiler = "1.5.6"
composeDetektPlugin = "1.3.0"
core-ktx = "1.12.0"
coroutines = "1.7.3"
dependencyAnalysisPlugin = "1.26.0"
detekt = "1.23.3"
detektFormattingPlugin = "1.23.3"
dependencyAnalysisPlugin = "1.28.0"
detekt = "1.23.4"
detektFormattingPlugin = "1.23.4"
dokka = "1.9.10"
fragment = "1.6.2"
gradleAndroid = "8.2.0"
gradleAndroid = "8.3.0-alpha17"
gradleDoctorPlugin = "0.9.1"
junit = "4.13.2"
koin = "3.5.0"
koin-compose = "1.1.1-RC1"
kotest = "5.8.0"
kotest-plugin = "5.8.0"
# @pin
kotlin = "1.9.20"
kotlin = "1.9.21"
kotlinx-atomicfu = "0.23.1"
lifecycle = "2.6.2"
material = "1.10.0"
Expand Down Expand Up @@ -48,8 +48,8 @@ dokka-android = { module = "org.jetbrains.dokka:android-documentation-plugin", v
gradle-versions = { module = "com.github.ben-manes:gradle-versions-plugin", version.ref = "versionsPlugin" }
junit = { module = "junit:junit", version.ref = "junit" }
koin-android = { module = "io.insert-koin:koin-android", version.ref = "koin" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" }
koin-android-compose = { module = "io.insert-koin:koin-androidx-compose", version.ref = "koin" }
koin-compose = { module = "io.insert-koin:koin-compose", version.ref = "koin-compose" }
koin-core = { module = "io.insert-koin:koin-core", version.ref = "koin" }
koin-test = { module = "io.insert-koin:koin-test", version.ref = "koin" }
kotest-assertions = { module = "io.kotest:kotest-assertions-core", version.ref = "kotest" }
Expand Down Expand Up @@ -88,15 +88,15 @@ unittest = [
]

[plugins]
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
androidApplication = { id = "com.android.application", version.ref = "gradleAndroid" }
androidLibrary = { id = "com.android.library", version.ref = "gradleAndroid" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
atomicfu = { id = "kotlinx-atomicfu", version.ref = "kotlinx-atomicfu" }
dependencyAnalysis = { id = "com.autonomousapps.dependency-analysis", version.ref = "dependencyAnalysisPlugin" }
detekt = { id = "io.gitlab.arturbosch.detekt", version.ref = "detekt" }
dokka = { id = "org.jetbrains.dokka", version.ref = "dokka" }
gradleDoctor = { id = "com.osacky.doctor", version.ref = "gradleDoctorPlugin" }
jetbrainsCompose = { id = "org.jetbrains.compose", version.ref = "compose-plugin" }
kotest = { id = "io.kotest.multiplatform", version.ref = "kotest-plugin" }
kotlinMultiplatform = { id = "org.jetbrains.kotlin.multiplatform", version.ref = "kotlin" }
version-catalog-update = { id = "nl.littlerobots.version-catalog-update", version.ref = "versionCatalogUpdatePlugin" }
versions = { id = "com.github.ben-manes.versions", version.ref = "versionsPlugin" }