Skip to content

Commit

Permalink
Merge pull request #93 from russhwolf/0.8
Browse files Browse the repository at this point in the history
Version 0.8
  • Loading branch information
russhwolf authored Aug 27, 2021
2 parents 9627b2a + 5e5faad commit e2d095f
Show file tree
Hide file tree
Showing 36 changed files with 361 additions and 333 deletions.
10 changes: 1 addition & 9 deletions .idea/codeStyles/Project.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 11 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
# Changelog #

## v0.8 *(2021-08-26)* ##

- Update to Kotlin 1.5.30 and Gradle 7.1
- Add new Apple ARM targets
- Enable hierarchical project model
- Update `multiplatform-settings-coroutines` to use coroutines version 1.5.1
- Update `multiplatform-settings-datastore` to use DataStore release version 1.0.0
- Update `multiplatform-settings-serialization` to use serialization version 1.2.2
- Other dependency version updates

## v0.7.7 *(2021-05-20)* ##

- Fix missing Kotlin 1.5.0 updates
- Update `multiplatform-settings-coroutines` to use coroutines version 1.5.0
- Update `multiplatform-settings-datastore` to use DataStore version 1.0.0-beta01
- Update `multiplatform-settings-serealization` to use serialization version 1.2.1
- Update `multiplatform-settings-serialization` to use serialization version 1.2.1

## v0.7.6 *(2021-04-27)* ##

Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ Then, simply add the dependency to your common source-set dependencies
commonMain {
dependencies {
// ...
implementation("com.russhwolf:multiplatform-settings:0.7.7")
implementation("com.russhwolf:multiplatform-settings:0.8")
}
}
```
Expand Down Expand Up @@ -144,7 +144,7 @@ val factory: Settings.Factory = AppleSettings.Factory()
To create a `Settings` instance from common without needing to pass platform-specific dependencies, add the `multiplatform-settings-no-arg` gradle dependency. This exports `multiplatform-settings` as an API dependency, so you can use it as a replacement for that default dependency.

```kotlin
implementation("com.russhwolf:multiplatform-settings-no-arg:0.7.7")
implementation("com.russhwolf:multiplatform-settings-no-arg:0.8")
```

Then from common code, you can write
Expand Down Expand Up @@ -238,7 +238,7 @@ Note that for the `AppleSettings` implementation, some entries are unremovable a
A testing dependency is available to aid in testing code that interacts with this library.

```kotlin
implementation("com.russhwolf:multiplatform-settings-test:0.7.7")
implementation("com.russhwolf:multiplatform-settings-test:0.8")
```

This includes a `MockSettings` implementation of the `Settings` interface, which is backed by an in-memory `MutableMap` on all platforms.
Expand Down Expand Up @@ -309,7 +309,7 @@ On Apple platforms, the `AppleSettings` listeners are designed to work within th
A `kotlinx-serialization` integration exists so it's easier to save non-primitive data

```kotlin
implementation("com.russhwolf:multiplatform-settings-serialization:0.7.7")
implementation("com.russhwolf:multiplatform-settings-serialization:0.8")
```

This essentially uses the `Settings` store as a serialization format. Thus for a serializable class
Expand Down Expand Up @@ -346,10 +346,10 @@ Usage requires accepting both the `@ExperimentalSettingsApi` and `@ExperimentalS
A separate `multiplatform-settings-coroutines` dependency includes various coroutine APIs.

```kotlin
implementation("com.russhwolf:multiplatform-settings-coroutines:0.7.7")
implementation("com.russhwolf:multiplatform-settings-coroutines:0.8")

// Or, if you use native-mt coroutines release
implementation("com.russhwolf:multiplatform-settings-coroutines-native-mt:0.7.7")
implementation("com.russhwolf:multiplatform-settings-coroutines-native-mt:0.8")
```

This adds flow extensions for all types which use the listener APIs internally.
Expand Down Expand Up @@ -389,7 +389,7 @@ val blockingSettings: Settings = suspendSettings.toBlockingSettings()
An implementation of `FlowSettings` on the Android exists in the `multiplatform-settings-datastore` dependency, based on [Jetpack DataStore](https://developer.android.com/jetpack/androidx/releases/datastore)

```kotlin
implementation("com.russhwolf:multiplatform-settings-datastore:0.7.7")
implementation("com.russhwolf:multiplatform-settings-datastore:0.8")
```

This provides a `DataStoreSettings` class
Expand Down
2 changes: 1 addition & 1 deletion azure-pipelines-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean publishIosArm32PublicationToMavenRepository publishIosArm64PublicationToMavenRepository publishIosX64PublicationToMavenRepository publishMacosX64PublicationToMavenRepository publishWatchosArm32PublicationToMavenRepository publishWatchosArm64PublicationToMavenRepository publishWatchosX86PublicationToMavenRepository publishTvosArm64PublicationToMavenRepository publishTvosX64PublicationToMavenRepository'
tasks: 'clean publishKotlinMultiplatformPublicationToMavenRepository publishIosArm32PublicationToMavenRepository publishIosArm64PublicationToMavenRepository publishIosSimulatorArm64PublicationToMavenRepository publishIosX64PublicationToMavenRepository publishMacosX64PublicationToMavenRepository publishMacosArm64PublicationToMavenRepository publishWatchosArm32PublicationToMavenRepository publishWatchosArm64PublicationToMavenRepository publishWatchosSimulatorArm64PublicationToMavenRepository publishWatchosX86PublicationToMavenRepository publishWatchosX64PublicationToMavenRepository publishTvosArm64PublicationToMavenRepository publishTvosSimulatorArm64PublicationToMavenRepository publishTvosX64PublicationToMavenRepository'
env:
ORG_GRADLE_PROJECT_sonatypeUsername: $(sonatype_username)
ORG_GRADLE_PROJECT_sonatypePassword: $(sonatype_password)
Expand Down
21 changes: 12 additions & 9 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean macosX64Test iosX64Test watchosX86Test tvosX64Test publishKotlinMultiplatformPublicationToMavenLocal publishIosArm32PublicationToMavenLocal publishIosArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal publishMacosX64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosArm64PublicationToMavenLocal publishWatchosX86PublicationToMavenLocal publishTvosArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal'
tasks: 'clean macosX64Test iosX64Test watchosX64Test watchosX86Test tvosX64Test publishKotlinMultiplatformPublicationToMavenLocal publishIosArm32PublicationToMavenLocal publishIosArm64PublicationToMavenLocal publishIosSimulatorArm64PublicationToMavenLocal publishIosX64PublicationToMavenLocal publishMacosX64PublicationToMavenLocal publishMacosArm64PublicationToMavenLocal publishWatchosArm32PublicationToMavenLocal publishWatchosArm64PublicationToMavenLocal publishWatchosSimulatorArm64PublicationToMavenLocal publishWatchosX86PublicationToMavenLocal publishWatchosX64PublicationToMavenLocal publishTvosArm64PublicationToMavenLocal publishTvosSimulatorArm64PublicationToMavenLocal publishTvosX64PublicationToMavenLocal'

- task: Gradle@2
inputs:
Expand All @@ -80,15 +80,18 @@ jobs:
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean iosTest'
tasks: 'clean iosX64Test'

- task: Xcode@5
inputs:
actions: 'build'
configuration: 'Debug'
scheme: 'SettingsDemo'
sdk: 'iphoneos'
packageApp: false
# TODO disabled because embedAndSign task needs more signing/provisioning config
# - task: Xcode@5
# inputs:
# actions: 'build'
# configuration: 'Debug'
# scheme: 'SettingsDemo'
# sdk: 'iphoneos'
# packageApp: false
# signingOption: default
# args: '-allowProvisioningUpdates'

# TODO Disabled because it isn't working in Azure
# - task: Xcode@5
Expand Down
2 changes: 1 addition & 1 deletion buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
*/

plugins {
kotlin("jvm") version "1.5.0"
kotlin("jvm") version "1.5.30"
}

repositories {
Expand Down
32 changes: 9 additions & 23 deletions buildSrc/src/main/kotlin/BuildHelpers.kt
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,8 @@ import org.jetbrains.kotlin.gradle.plugin.mpp.KotlinNativeTarget
import org.jetbrains.kotlin.gradle.targets.js.KotlinJsTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTarget
import org.jetbrains.kotlin.gradle.targets.js.ir.KotlinJsIrTargetPreset
import org.jetbrains.kotlin.konan.target.Architecture
import org.jetbrains.kotlin.konan.target.KonanTarget

private val Project.kotlin: KotlinMultiplatformExtension
get() = extensions.getByType(KotlinMultiplatformExtension::class.java)
Expand Down Expand Up @@ -83,12 +85,13 @@ private fun KotlinMultiplatformExtension.buildAllTargets(targetPresets: NamedDom

sourceSets.all {
it.languageSettings.apply {
useExperimentalAnnotation("kotlin.RequiresOptIn")
optIn("kotlin.RequiresOptIn")
}
}
targets.configureEach {
it.compilations.configureEach {
it.kotlinOptions.allWarningsAsErrors = true
// TODO reenable this once duplicate library warnings are cleared
// it.kotlinOptions.allWarningsAsErrors = true
}
}

Expand Down Expand Up @@ -137,32 +140,15 @@ private fun KotlinMultiplatformExtension.linkNativeSourceSets() {
dependsOn(appleTest)
}

// TODO this is just here to make the IDE happy (ish) while we wait for HMPP to improve
if (ideaActive) {
findByName("macosX64Main")?.apply {
kotlin.srcDirs(*nativeMain.kotlin.srcDirs.toTypedArray())
kotlin.srcDirs(*appleMain.kotlin.srcDirs.toTypedArray())
kotlin.srcDirs(*apple64Main.kotlin.srcDirs.toTypedArray())
}
findByName("macosX64Test")?.apply {
kotlin.srcDirs(*nativeTest.kotlin.srcDirs.toTypedArray())
kotlin.srcDirs(*appleTest.kotlin.srcDirs.toTypedArray())
kotlin.srcDirs(*apple64Test.kotlin.srcDirs.toTypedArray())
}
findByName("jvmMain")?.apply {
kotlin.srcDirs(*multithreadedMain.kotlin.srcDirs.toTypedArray())
}
findByName("jvmTest")?.apply {
kotlin.srcDirs(*multithreadedTest.kotlin.srcDirs.toTypedArray())
}
}

targets
.withType(KotlinNativeTarget::class.java)
.matching { it.konanTarget.family.isAppleFamily }
.configureEach {
it.apply {
if (konanTarget.architecture.bitness == 32 || it.name == "watchosArm64") {
if (
konanTarget.architecture !in listOf(Architecture.X64, Architecture.ARM64) ||
konanTarget in listOf<KonanTarget>(KonanTarget.WATCHOS_ARM64)
) {
compilations.getByName("main").defaultSourceSet.dependsOn(apple32Main)
compilations.getByName("test").defaultSourceSet.dependsOn(apple32Test)
} else {
Expand Down
22 changes: 11 additions & 11 deletions buildSrc/src/main/kotlin/Versions.kt
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@
@file:Suppress("KDocMissingDocumentation")

object Versions {
const val multiplatformSettings = "0.7.7"
const val multiplatformSettings = "0.8"

const val minSdk = 15
const val compileSdk = 30

const val androidxDatastore = "1.0.0-beta01"
const val androidxDatastore = "1.0.0"
const val androidxPreference = "1.1.1"
const val androidxStartup = "1.0.0"
const val androidxTest = "1.3.0"
const val androidxTestExt = "1.1.2"
const val androidxStartup = "1.1.0"
const val androidxTest = "1.4.0"
const val androidxTestExt = "1.1.3"
const val binaryCompatibilityValidator = "0.2.4"
const val coroutines = "1.5.0"
const val coroutinesNativeMt = "1.5.0-native-mt"
const val coroutines = "1.5.1"
const val coroutinesNativeMt = "1.5.1-native-mt"
const val junit = "4.13.2"
const val robolectric = "4.5.1"
const val serializationPlugin = "1.5.0"
const val serializationRuntime = "1.2.1"
const val turbine = "0.5.0"
const val robolectric = "4.6.1"
const val serializationPlugin = "1.5.30"
const val serializationRuntime = "1.2.2"
const val turbine = "0.6.0"
}
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@
org.gradle.jvmargs=-Xmx2g
android.useAndroidX=true
kotlin.js.compiler=both
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
#

#Sun Jun 09 17:45:17 EDT 2019
distributionUrl=https\://services.gradle.org/distributions/gradle-7.0-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1-all.zip
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2021 Russell Wolf
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.russhwolf.settings.coroutines

import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext

internal actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T =
kotlinx.coroutines.runBlocking(context, block)
Original file line number Diff line number Diff line change
Expand Up @@ -41,17 +41,17 @@ abstract class BaseCoroutineExtensionsTest {
settings.setter("foo", firstValue)
settings.flowBuilder("foo", defaultValue)
.test {
assertEquals(firstValue, expectItem())
assertEquals(firstValue, awaitItem())
expectNoEvents()
settings.setter("foo", firstValue)
expectNoEvents()
settings.setter("bar", firstValue)
expectNoEvents()
settings.setter("foo", secondValue)
assertEquals(secondValue, expectItem())
assertEquals(secondValue, awaitItem())
expectNoEvents()
settings.remove("foo")
assertEquals(defaultValue, expectItem())
assertEquals(defaultValue, awaitItem())
expectNoEvents()
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2021 Russell Wolf
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.russhwolf.settings.coroutines

import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext

internal actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T =
kotlinx.coroutines.runBlocking(context, block)
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ package com.russhwolf.settings.coroutines

import com.russhwolf.settings.ExperimentalSettingsApi
import com.russhwolf.settings.Settings
import kotlinx.coroutines.runBlocking

/**
* Wraps this [SuspendSettings] in the [Settings] interface.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
/*
* Copyright 2021 Russell Wolf
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.russhwolf.settings.coroutines

import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext
import kotlin.coroutines.EmptyCoroutineContext

internal expect fun <T> runBlocking(
context: CoroutineContext = EmptyCoroutineContext,
block: suspend CoroutineScope.() -> T
): T
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
package com.russhwolf.settings.coroutines

import kotlinx.coroutines.runBlocking

public actual fun suspendTest(block: suspend () -> Unit): Unit = runBlocking { block() }
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
/*
* Copyright 2021 Russell Wolf
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package com.russhwolf.settings.coroutines

import kotlinx.coroutines.CoroutineScope
import kotlin.coroutines.CoroutineContext

internal actual fun <T> runBlocking(context: CoroutineContext, block: suspend CoroutineScope.() -> T): T =
kotlinx.coroutines.runBlocking(context, block)
Loading

0 comments on commit e2d095f

Please sign in to comment.