Skip to content

Commit

Permalink
1.0.0 beta04 (#162)
Browse files Browse the repository at this point in the history
* update version to 1.0.0-beta04 (#137)

* Kotest 4.1.0 (#138)

* update Kotest to 4.1.0

* update Kotest to 4.1.0

* update Kotest to 4.1.0

* update Kotest to 4.1.0

* Revert "update Kotest to 4.1.0"

This reverts commit 833c838

* fix version parsing in DocsTasks

* add `release/*` matcher to ci.yml

* dispatch-internal-test-android module (#139)

* add hermit dependency (#140)

* add hermit dependency

* add Hermit to the dependency matchers in DocsTasks

* Lifecycle coroutine scope leak fixes (#141)

* - automatically cancel LifecycleCoroutineScope when lifecycle reaches DESTROYED (fixes #135)
- automatically remove lifecycleScope extension property from cache when lifecycle reaches DESTROYED (fixes #136)

* dispatch-internal-test-android module

* update lifecycle handling

* update lifecycle handling

* update lifecycle handling

* convert LifecycleScopeExtensionTest from Kotest to JUnit5 to fix some weird recursive behavior

* convert LifecycleScopeExtensionTest from Kotest to JUnit5 to fix some weird recursive behavior

* remove workspace.xml backup which shouldn't have been added to git

* update docs from main branch

* update change log (#142)

* Change LifecycleCoroutineScope argument to a CoroutineContext, add LifecycleCoroutineScopeFactory (#145)

* change LifecycleCoroutineScope argument to CoroutineContext

* MainImmediateProvidedContext -> MainImmediateContext

* MainImmediateProvidedContext -> MainImmediateContext

* update docs

* MainImmediateProvidedContext -> MainImmediateContext

* Misc cleanup (#146)

* LifecycleScopeFactory README example cleanup

* remove duplicate dependency declarations in android-lifecycle gradle config

* android-lifecycle sample annotation consolidation

* lifecycleScope extension sample rename

* MainImmediateCoroutineScope factory function formatting

* update docs

* - remove tabs (#147)

- consolidate capitalization for modules and kdoc
- add lifecycle-extensions
- dtekt -> detekt

* update Detekt to 1.10.0 (#148)

* update Knit to 0.1.4 (#149)

* coroutines 1.3.7 -> 1.3.8 (#150)

* Detekt cleanup (#151)

* Detekt cleanup

* add detekt to CI, remove Lint

* add dependency graph generator task

* DefaultDispatcherProvider (#153)

* add DefaultDispatcherProvider singleton holder (fixes #152)

* update docs for DefaultDispatcherProvider

* add resolution strategies for coroutines and dispatch (#155)

* cleanup of LifecycleCoroutineScope samples (#156)

* add ViewLifecycleCoroutineScope (#158)

* add ViewLifecycleCoroutineScope

* add ViewLifecycleCoroutineScope docs

* Lifecycle coroutine scope context parameter (#160)

* Add a CoroutineContext parameter to the Lifecycle launch and suspend functions

* add tests

* update docs
  • Loading branch information
RBusarow authored Sep 21, 2020
1 parent 42eb046 commit 59618b6
Show file tree
Hide file tree
Showing 214 changed files with 4,490 additions and 928 deletions.
16 changes: 3 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
branches:
- dev
- main
- release/*

jobs:

Expand All @@ -25,16 +26,5 @@ jobs:
java-version: 1.8
- name: all tests
run: ./gradlew test

lint:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v1
- name: Set up JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- name: lint
run: ./gradlew lint
- name: detekt
run: ./gradlew detekt
2 changes: 1 addition & 1 deletion .idea/codeStyles/Project.xml

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

2 changes: 1 addition & 1 deletion .idea/codeStyles/codeStyleConfig.xml

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

28 changes: 28 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,37 @@

## Version 1.0.0-beta04

### Features
* [DefaultDispatcherProvider] is now a mutable singleton which allows for a custom global default.

### Bug fixes

#### dispatch-test-junit5
* [CoroutineTestExtension] will now properly call `Dispatchers.setMain(...)` when injecting a
CoroutineScope into a function or when not injecting at all.
([#130](https://github.com/RBusarow/Dispatch/issues/130))

#### dispatch-android-lifecycle
* [LifecycleCoroutineScope] will now be automatically cancelled when the associated [Lifecycle][Android Lifecycle] drops to the [Destroyed][Android Lifecycle] state.
([#135](https://github.com/RBusarow/Dispatch/issues/135))

#### dispatch-android-lifecycle-extensions
* Cached [LifecycleCoroutineScopes][LifecycleCoroutineScope] will now be removed from the cache when
they are destroyed. ([#136](https://github.com/RBusarow/Dispatch/issues/136))
* Fixed a race condition where multiple [LifecycleCoroutineScopes][LifecycleCoroutineScope] may be
created for concurrent cache misses. ([#136](https://github.com/RBusarow/Dispatch/issues/136))

### Deprecations
* The [DefaultDispatcherProvider] class constructor has been changed to an object factory function
(`operator fun invoke(): DispatcherProvider`) and deprecated. This function will be removed prior
to the 1.0 release.

### Breaking changes
* [DefaultDispatcherProvider] has been changed from a `class` to an `object`, and its functionality
changed. It is now a singleton holder for a default `DispatcherProvider` instance. To create a
default `DispatcherProvider`, use the interface's companion object factory function
(`DispatcherProvider()`).

## Version 1.0.0-beta03

### Renames
Expand Down Expand Up @@ -52,6 +77,7 @@

<!--- MODULE dispatch-core-->
<!--- INDEX -->
[DefaultDispatcherProvider]: https://rbusarow.github.io/Dispatch/dispatch-core//dispatch.core/-default-dispatcher-provider/index.html
<!--- MODULE dispatch-test-->
<!--- INDEX -->
[TestProvidedCoroutineScope]: https://rbusarow.github.io/Dispatch/dispatch-test//dispatch.test/-test-provided-coroutine-scope/index.html
Expand All @@ -64,6 +90,7 @@
<!--- INDEX -->
<!--- MODULE dispatch-android-lifecycle-->
<!--- INDEX -->
[LifecycleCoroutineScope]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-lifecycle-coroutine-scope/index.html
<!--- MODULE dispatch-android-lifecycle-extensions-->
<!--- INDEX -->
[lifecycleScope]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle-extensions//dispatch.android.lifecycle/androidx.lifecycle.-lifecycle-owner/lifecycle-scope.html
Expand All @@ -72,6 +99,7 @@
[viewModelScope]: https://rbusarow.github.io/Dispatch/dispatch-android-viewmodel//dispatch.android.viewmodel/-coroutine-view-model/view-model-scope.html
<!--- END -->

[Android Lifecycle]: https://developer.android.com/reference/androidx/lifecycle/Lifecycle.html
[androidx-lifecycleScope]: https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:lifecycle/lifecycle-runtime-ktx/src/main/java/androidx/lifecycle/Lifecycle.kt;l=44
[Detekt]: https://github.com/detekt/detekt
[dispatch-android-espresso]: https://rbusarow.github.io/Dispatch/android-espresso//index.html
Expand Down
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -361,8 +361,8 @@ dependencies {
*/

// core coroutines
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.7")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.3.8")
implementation("org.jetbrains.kotlinx:kotlinx-coroutines-android:1.3.8")

// everything provides :core via "api", so you only need this if you have no other "implementation" dispatch artifacts
implementation("com.rickbusarow.dispatch:dispatch-core:1.0.0-beta04")
Expand All @@ -386,7 +386,7 @@ dependencies {
*/

// core coroutines-test
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.7")
testImplementation("org.jetbrains.kotlinx:kotlinx-coroutines-test:1.3.8")

// you only need this if you don't have the -junit4 or -junit5 artifacts
testImplementation("com.rickbusarow.dispatch:dispatch-test:1.0.0-beta04")
Expand Down Expand Up @@ -480,9 +480,9 @@ limitations under the License.
<!--- MODULE dispatch-android-lifecycle-->
<!--- INDEX -->
[LifecycleCoroutineScope]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-lifecycle-coroutine-scope/index.html
[launchOnCreate]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-lifecycle-coroutine-scope/launch-on-create.html
[launchOnStart]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-lifecycle-coroutine-scope/launch-on-start.html
[launchOnResume]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-lifecycle-coroutine-scope/launch-on-resume.html
[launchOnCreate]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-view-lifecycle-coroutine-scope/launch-on-create.html
[launchOnStart]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-view-lifecycle-coroutine-scope/launch-on-start.html
[launchOnResume]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/-view-lifecycle-coroutine-scope/launch-on-resume.html
[onNextCreate]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/androidx.lifecycle.-lifecycle-owner/on-next-create.html
[onNextStart]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/androidx.lifecycle.-lifecycle-owner/on-next-start.html
[onNextResume]: https://rbusarow.github.io/Dispatch/dispatch-android-lifecycle//dispatch.android.lifecycle/androidx.lifecycle.-lifecycle-owner/on-next-resume.html
Expand Down
167 changes: 77 additions & 90 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,9 @@

@file:Suppress("MagicNumber")

import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.*
import kotlinx.knit.*
import kotlinx.validation.*
import org.gradle.kotlin.dsl.*
import org.jetbrains.dokka.gradle.*
import org.jetbrains.kotlin.gradle.tasks.*
import java.net.*
Expand Down Expand Up @@ -49,6 +48,8 @@ plugins {
id("io.gitlab.arturbosch.detekt") version Libs.Detekt.version
}

apply(plugin = "base")

allprojects {

repositories {
Expand Down Expand Up @@ -214,12 +215,6 @@ fun linkModuleDocs(
}
}

val clean by tasks.registering {
doLast {
delete("build")
}
}

subprojects {
tasks.withType<KotlinCompile>()
.configureEach {
Expand Down Expand Up @@ -263,6 +258,54 @@ val copyRootFiles by tasks.registering {
}
}

detekt {
parallel = true
config = files("$rootDir/detekt/detekt-config.yml")

val unique = "${rootProject.relativePath(projectDir)}/${project.name}"

reports {
xml {
enabled = false
destination = file("$rootDir/build/detekt-reports/$unique-detekt.xml")
}
html {
enabled = true
destination = file("$rootDir/build/detekt-reports/$unique-detekt.html")
}
txt {
enabled = false
destination = file("$rootDir/build/detekt-reports/$unique-detekt.txt")
}
}
}

dependencies {
detekt(Libs.Detekt.cli)
detektPlugins(project(path = ":dispatch-detekt"))
}

apply(plugin = Plugins.binaryCompatilibity)

extensions.configure<ApiValidationExtension> {

/**
* Packages that are excluded from public API dumps even if they
* contain public API.
*/
ignoredPackages = mutableSetOf("sample", "samples")

/**
* Sub-projects that are excluded from API validation
*/
ignoredProjects = mutableSetOf(
"dispatch-internal-test",
"dispatch-internal-test-android",
"dispatch-sample",
"samples"
)
}

apply(plugin = Plugins.knit)

extensions.configure<KnitPluginExtension> {
Expand All @@ -280,93 +323,37 @@ tasks.getByName("knitPrepare") {
dependsOn(subprojects.mapNotNull { it.tasks.findByName("dokka") })
}

subprojects {

apply {
plugin("io.gitlab.arturbosch.detekt")
}

detekt {
parallel = true
config = files("$rootDir/detekt/detekt-config.yml")

val unique = "${rootProject.relativePath(projectDir)}/${project.name}"
val generateDependencyGraph by tasks.registering {

idea {
path = "$rootDir/.idea"
codeStyleScheme = "$rootDir/.idea/Project.xml"
inspectionsProfile = "$rootDir/.idea/Project-Default.xml"
report = "${project.projectDir}/reports/build/detekt-reports"
mask = "*.kt"
}

reports {
xml {
enabled = false
destination = file("$rootDir/build/detekt-reports/$unique-detekt.xml")
}
html {
enabled = true
destination = file("$rootDir/build/detekt-reports/$unique-detekt.html")
}
txt {
enabled = false
destination = file("$rootDir/build/detekt-reports/$unique-detekt.txt")
}
}
}
}
description = "generate a visual dependency graph"
group = "refactor"

allprojects {
dependencies {
detekt(Libs.Detekt.cli)
detektPlugins(project(path = ":dispatch-detekt"))
doLast {
createDependencyGraph()
}
}

val analysisDir = file(projectDir)
val baselineFile = file("$rootDir/detekt/project-baseline.xml")
val configFile = file("$rootDir/detekt/detekt-config.yml")
val formatConfigFile = file("$rootDir/config/detekt/format.yml")
val statisticsConfigFile = file("$rootDir/config/detekt/statistics.yml")

val kotlinFiles = "**/*.kt"
val kotlinScriptFiles = "**/*.kts"
val resourceFiles = "**/resources/**"
val buildFiles = "**/build/**"
val testFiles = "**/src/test/**"

val detektAll by tasks.registering(Detekt::class) {
subprojects {

description = "Runs the whole project at once."
parallel = true
buildUponDefaultConfig = true
setSource(files(rootDir))
config.setFrom(files(configFile))
include(kotlinFiles, kotlinScriptFiles)
exclude(resourceFiles, buildFiles, testFiles)
reports {
xml.enabled = false
html.enabled = false
txt.enabled = false
// force update all transitive dependencies (prevents some library leaking an old version)
configurations.all {
resolutionStrategy {
force(
// androidx is currently leaking coroutines 1.1.1 everywhere
Libs.Kotlinx.Coroutines.core,
Libs.Kotlinx.Coroutines.test,
Libs.Kotlinx.Coroutines.android,
// prevent dependency libraries from leaking their own old version of this library
Libs.RickBusarow.Dispatch.core,
Libs.RickBusarow.Dispatch.detekt,
Libs.RickBusarow.Dispatch.espresso,
Libs.RickBusarow.Dispatch.lifecycle,
Libs.RickBusarow.Dispatch.lifecycleExtensions,
Libs.RickBusarow.Dispatch.viewModel,
Libs.RickBusarow.Dispatch.Test.core,
Libs.RickBusarow.Dispatch.Test.jUnit4,
Libs.RickBusarow.Dispatch.Test.jUnit5
)
}
}
}

tasks.findByName("detekt")
?.finalizedBy(detektAll)

apply(plugin = Plugins.binaryCompatilibity)

extensions.configure<ApiValidationExtension> {

/**
* Packages that are excluded from public API dumps even if they
* contain public API.
*/
ignoredPackages = mutableSetOf("sample", "samples")

/**
* Sub-projects that are excluded from API validation
*/
ignoredProjects = mutableSetOf("dispatch-internal-test", "dispatch-sample", "samples")
}
Loading

0 comments on commit 59618b6

Please sign in to comment.