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

1.0.0 beta04 #162

Merged
merged 21 commits into from
Sep 21, 2020
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
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