diff --git a/build.gradle.kts b/build.gradle.kts index c2f89fada..16f6e35a0 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -15,6 +15,7 @@ @file:Suppress("MagicNumber") +import formatting.sortDependencies import io.gitlab.arturbosch.detekt.* import kotlinx.knit.* import kotlinx.validation.* @@ -333,6 +334,16 @@ val generateDependencyGraph by tasks.registering { } } +val sortDependencies by tasks.registering { + + description = "sort all dependencies in a gradle kts file" + group = "refactor" + + doLast { + sortDependencies() + } +} + subprojects { // force update all transitive dependencies (prevents some library leaking an old version) diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index b8b4d8f8e..2d467516b 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -13,19 +13,25 @@ * limitations under the License. */ -repositories { - jcenter() -} - plugins { `kotlin-dsl` } +repositories { + google() + jcenter() + maven("https://oss.sonatype.org/content/repositories/snapshots") +} + kotlinDslPluginOptions { experimentalWarning.set(false) } dependencies { + compileOnly(gradleApi()) + implementation("org.jetbrains.kotlin:kotlin-compiler-embeddable:1.4.10") // update Dependencies.kt as well + implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.10") // update Dependencies.kt as well + implementation("com.android.tools.build:gradle:4.0.0") // update Dependencies.kt as well } diff --git a/buildSrc/src/main/kotlin/formatting/dependencies.kt b/buildSrc/src/main/kotlin/formatting/dependencies.kt new file mode 100644 index 000000000..6e085e21b --- /dev/null +++ b/buildSrc/src/main/kotlin/formatting/dependencies.kt @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2020 Rick Busarow + * 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 formatting + + +import formatting.GradleDependencyVisitor.Properties +import org.gradle.api.Project +import org.jetbrains.kotlin.psi.* +import util.psi.asKtFile +import util.psi.visitor.KotlinVisitor +import java.io.File +import kotlin.properties.Delegates +import kotlin.system.measureTimeMillis + +fun Project.sortDependencies() { + + val totalParseTime = measureTimeMillis { + + subprojects.forEach { + + val maybeGradleFile = File("${it.projectDir}/build.gradle.kts") + + if (maybeGradleFile.exists()) { + + val gradle = maybeGradleFile.asKtFile() + + val props = GradleDependencyVisitor().parse(gradle) + + val old = props.oldDependencies ?: "---------------" + val new = props.newDependencies ?: "---------------" + + val newText = gradle.text.replace(old, new) + + maybeGradleFile.writeText(newText) + } + } + } + + println("total parsing time: $totalParseTime ms") + +} + +class GradleDependencyVisitor : KotlinVisitor() { + + class Properties { + var root: KtFile by Delegates.notNull() + var oldDependencies: String? = null + var newDependencies: String? = null + } + + override val properties = Properties() + + override fun visitKtFile(file: KtFile) { + properties.root = file + + super.visitKtFile(file) + } + + override fun visitCallExpression(expression: KtCallExpression) { + super.visitCallExpression(expression) + + if (expression.text.startsWith("dependencies {")) { + + val declarations = expression.children + .mapNotNull { it as? KtLambdaArgument } + .map { lambdaArg -> + lambdaArg.children.mapNotNull { it as? KtLambdaExpression } + .map { lambdaExpression -> + lambdaExpression.children.mapNotNull { it as? KtExpression } + .map { ktExpression -> + ktExpression.children.mapNotNull { declarationExpression -> + properties.oldDependencies = declarationExpression.text + declarationExpression as? KtExpression + } + .map { declarationExpression -> + declarationExpression.children.mapNotNull { it as? KtCallExpression } + .map { it.text } + } + } + } + } + .flatten() + .flatten() + .flatten() + .flatten() + .groupBy { it.split("[(.]".toRegex()).take(2).joinToString("-") } + + val comparator = compareBy({ it.startsWith("kapt") }, { it }) + + val sortedKeys = declarations.keys.sortedWith(comparator) + + val newDeps = sortedKeys.joinToString("\n\n") { key -> + + declarations.getValue(key) + .toSet() + .sortedBy { + @Suppress("DefaultLocale") + it.toLowerCase() + } + .joinToString("\n") { " $it" } + }.trim() + + properties.newDependencies = newDeps + } + } +} diff --git a/buildSrc/src/main/kotlin/util/psi/ktFile.kt b/buildSrc/src/main/kotlin/util/psi/ktFile.kt new file mode 100644 index 000000000..f4d635737 --- /dev/null +++ b/buildSrc/src/main/kotlin/util/psi/ktFile.kt @@ -0,0 +1,46 @@ +@file:Suppress("TooManyFunctions") + +package util.psi + +import org.jetbrains.kotlin.com.intellij.openapi.util.Key +import org.jetbrains.kotlin.idea.KotlinLanguage +import org.jetbrains.kotlin.psi.KtClass +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtImportDirective +import java.io.File +import java.io.FileNotFoundException + +val RELATIVE_PATH: Key = Key("relativePath") +val ABSOLUTE_PATH: Key = Key("absolutePath") + +fun File.asKtFile(): KtFile = + (psiFileFactory.createFileFromText(name, KotlinLanguage.INSTANCE, readText()) as? KtFile)?.apply { + putUserData(ABSOLUTE_PATH, this@asKtFile.absolutePath) + } ?: throw FileNotFoundException("could not find file $this") + +fun KtFile.asFile(): File = File(absolutePath()) + +fun KtFile.absolutePath(): String = + getUserData(ABSOLUTE_PATH) ?: error("KtFile '$name' expected to have an absolute path.") + +fun KtFile.relativePath(): String = getUserData(RELATIVE_PATH) + ?: error("KtFile '$name' expected to have an relative path.") + +fun KtFile.replaceClass(oldClass: KtClass, newClass: KtClass): KtFile { + + val newText = text.replace(oldClass.text, newClass.text) + + val path = absolutePath() + + return (psiFileFactory.createFileFromText(name, KotlinLanguage.INSTANCE, newText) as KtFile).apply { + putUserData(ABSOLUTE_PATH, path) + } +} + +fun KtFile.write(path: String = absolutePath()) { + + val javaFile = File(path) + + javaFile.mkdirs() + javaFile.writeText(text) +} diff --git a/buildSrc/src/main/kotlin/util/psi/psi.kt b/buildSrc/src/main/kotlin/util/psi/psi.kt new file mode 100644 index 000000000..e999c078f --- /dev/null +++ b/buildSrc/src/main/kotlin/util/psi/psi.kt @@ -0,0 +1,34 @@ +package util.psi + +import org.jetbrains.kotlin.cli.common.CLIConfigurationKeys +import org.jetbrains.kotlin.cli.common.messages.MessageRenderer +import org.jetbrains.kotlin.cli.common.messages.PrintingMessageCollector +import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles +import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment +import org.jetbrains.kotlin.com.intellij.openapi.util.Disposer +import org.jetbrains.kotlin.com.intellij.psi.PsiFileFactory +import org.jetbrains.kotlin.config.CompilerConfiguration +import org.jetbrains.kotlin.psi.KtPsiFactory +import sun.java2d.* + +val configuration = CompilerConfiguration().apply { + put( + CLIConfigurationKeys.MESSAGE_COLLECTOR_KEY, + PrintingMessageCollector( + System.err, + MessageRenderer.PLAIN_FULL_PATHS, + false + ) + ) +} + +private val psiProject by lazy { + KotlinCoreEnvironment.createForProduction( + Disposer.newDisposable(), + configuration, + EnvironmentConfigFiles.JVM_CONFIG_FILES + ).project +} + +val psiFileFactory: PsiFileFactory = PsiFileFactory.getInstance(psiProject) +val psiElementFactory = KtPsiFactory(psiProject, false) diff --git a/buildSrc/src/main/kotlin/util/psi/visitor/KotlinVisitor.kt b/buildSrc/src/main/kotlin/util/psi/visitor/KotlinVisitor.kt new file mode 100644 index 000000000..2fd5b147d --- /dev/null +++ b/buildSrc/src/main/kotlin/util/psi/visitor/KotlinVisitor.kt @@ -0,0 +1,19 @@ +package util.psi.visitor + +import org.jetbrains.kotlin.psi.KtFile +import org.jetbrains.kotlin.psi.KtTreeVisitorVoid +import kotlin.properties.Delegates + +abstract class KotlinVisitor : KtTreeVisitorVoid() { + + protected var root: KtFile by Delegates.notNull() + private set + + abstract val properties: T + + fun parse(file: KtFile): T { + root = file + file.accept(this) + return properties + } +} diff --git a/dispatch-android-espresso/build.gradle.kts b/dispatch-android-espresso/build.gradle.kts index 5f656bbb1..5b5387193 100644 --- a/dispatch-android-espresso/build.gradle.kts +++ b/dispatch-android-espresso/build.gradle.kts @@ -42,20 +42,19 @@ android { dependencies { + implementation(Libs.AndroidX.Test.Espresso.core) + implementation(Libs.AndroidX.Test.runner) implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.android) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) - implementation(Libs.AndroidX.Test.runner) - implementation(Libs.AndroidX.Test.Espresso.core) - testImplementation(Libs.JUnit.jUnit4) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.runner) testImplementation(Libs.MockK.core) testImplementation(Libs.Robolectric.core) + testImplementation(project(":dispatch-internal-test")) } diff --git a/dispatch-android-espresso/samples/build.gradle.kts b/dispatch-android-espresso/samples/build.gradle.kts index d687f86d9..875c0b5f1 100644 --- a/dispatch-android-espresso/samples/build.gradle.kts +++ b/dispatch-android-espresso/samples/build.gradle.kts @@ -39,31 +39,27 @@ android { } dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) - implementation(project(":dispatch-core")) implementation(project(":dispatch-android-espresso")) implementation(project(":dispatch-android-lifecycle")) implementation(project(":dispatch-android-lifecycle-extensions")) implementation(project(":dispatch-android-viewmodel")) + implementation(project(":dispatch-core")) - testImplementation(project(":dispatch-internal-test")) - + testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(Libs.AndroidX.Test.runner) testImplementation(Libs.JUnit.jUnit4) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - - testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.AndroidX.Test.Espresso.core) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - + testImplementation(Libs.Kotlinx.Coroutines.test) testImplementation(Libs.Robolectric.core) - testImplementation(Libs.Kotlinx.Coroutines.test) + testImplementation(project(":dispatch-internal-test")) } diff --git a/dispatch-android-lifecycle-extensions/build.gradle.kts b/dispatch-android-lifecycle-extensions/build.gradle.kts index 9ea50c567..a0f80e9c4 100644 --- a/dispatch-android-lifecycle-extensions/build.gradle.kts +++ b/dispatch-android-lifecycle-extensions/build.gradle.kts @@ -45,32 +45,29 @@ android { dependencies { + api(project(":dispatch-android-lifecycle")) + api(project(":dispatch-core")) + implementation(Libs.AndroidX.Fragment.core) implementation(Libs.AndroidX.Lifecycle.common) - testImplementation(Libs.AndroidX.Lifecycle.runtime) - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.android) implementation(Libs.Kotlinx.Coroutines.core) - api(project(":dispatch-android-lifecycle")) - api(project(":dispatch-core")) - testImplementation(project(":dispatch-test-junit4")) - testImplementation(project(":dispatch-test-junit5")) - testImplementation(project(":dispatch-internal-test")) - testImplementation(project(":dispatch-internal-test-android")) - + testImplementation(Libs.AndroidX.Lifecycle.runtime) + testImplementation(Libs.AndroidX.Test.Arch.core) + testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(Libs.AndroidX.Test.runner) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) testImplementation(Libs.Kotlinx.Coroutines.test) - - testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.AndroidX.Test.Espresso.core) - testImplementation(Libs.AndroidX.Test.Arch.core) + testImplementation(Libs.RickBusarow.Hermit.junit5) testImplementation(Libs.Robolectric.core) - testImplementation(Libs.RickBusarow.Hermit.junit5) + testImplementation(project(":dispatch-internal-test")) + testImplementation(project(":dispatch-internal-test-android")) + testImplementation(project(":dispatch-test-junit4")) + testImplementation(project(":dispatch-test-junit5")) } diff --git a/dispatch-android-lifecycle-extensions/samples/build.gradle.kts b/dispatch-android-lifecycle-extensions/samples/build.gradle.kts index 5450bf9c2..bbb32355d 100644 --- a/dispatch-android-lifecycle-extensions/samples/build.gradle.kts +++ b/dispatch-android-lifecycle-extensions/samples/build.gradle.kts @@ -43,10 +43,7 @@ dependencies { implementation(Libs.AndroidX.Fragment.ktx) implementation(Libs.AndroidX.Lifecycle.common) implementation(Libs.AndroidX.Lifecycle.liveData) - testImplementation(Libs.AndroidX.Lifecycle.runtime) - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-android-espresso")) @@ -56,19 +53,18 @@ dependencies { implementation(project(":dispatch-internal-test-android")) implementation(project(":dispatch-test")) implementation(project(":dispatch-test-junit5")) + + testImplementation(Libs.AndroidX.Lifecycle.runtime) + testImplementation(Libs.AndroidX.Test.Arch.core) + testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(Libs.AndroidX.Test.runner) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) - - testImplementation(Libs.AndroidX.Test.Arch.core) - testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.AndroidX.Test.Espresso.core) testImplementation(Libs.Robolectric.core) } diff --git a/dispatch-android-lifecycle/build.gradle.kts b/dispatch-android-lifecycle/build.gradle.kts index dce6cbf86..ae7571d4b 100644 --- a/dispatch-android-lifecycle/build.gradle.kts +++ b/dispatch-android-lifecycle/build.gradle.kts @@ -45,37 +45,30 @@ android { dependencies { + api(project(":dispatch-core")) + implementation(Libs.AndroidX.Fragment.core) implementation(Libs.AndroidX.Lifecycle.common) implementation(Libs.AndroidX.Lifecycle.liveData) - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.android) implementation(Libs.Kotlinx.Coroutines.core) - api(project(":dispatch-core")) - testImplementation(project(":dispatch-test-junit4")) - testImplementation(project(":dispatch-test-junit5")) - testImplementation(project(":dispatch-internal-test")) - testImplementation(project(":dispatch-internal-test-android")) - testImplementation(Libs.AndroidX.Lifecycle.runtime) - testImplementation(Libs.AndroidX.Test.Arch.core) testImplementation(Libs.AndroidX.Test.Espresso.core) testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.JUnit.jUnit5) - testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlinx.Coroutines.test) - testImplementation(Libs.RickBusarow.Hermit.coroutines) testImplementation(Libs.RickBusarow.Hermit.junit5) - testImplementation(Libs.Robolectric.core) + + testImplementation(project(":dispatch-internal-test")) + testImplementation(project(":dispatch-internal-test-android")) + testImplementation(project(":dispatch-test-junit4")) + testImplementation(project(":dispatch-test-junit5")) } diff --git a/dispatch-android-lifecycle/samples/build.gradle.kts b/dispatch-android-lifecycle/samples/build.gradle.kts index 60f138ee3..154ac2f7c 100644 --- a/dispatch-android-lifecycle/samples/build.gradle.kts +++ b/dispatch-android-lifecycle/samples/build.gradle.kts @@ -41,13 +41,10 @@ android { dependencies { implementation(Libs.AndroidX.Lifecycle.common) - implementation(Libs.AndroidX.Lifecycle.liveData) implementation(Libs.AndroidX.Lifecycle.extensions) + implementation(Libs.AndroidX.Lifecycle.liveData) implementation(Libs.AndroidX.Lifecycle.viewModel) - testImplementation(Libs.AndroidX.Lifecycle.runtime) - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-android-espresso")) @@ -57,24 +54,22 @@ dependencies { implementation(project(":dispatch-internal-test-android")) implementation(project(":dispatch-test")) implementation(project(":dispatch-test-junit5")) + + testImplementation(Libs.AndroidX.Fragment.ktx) + testImplementation(Libs.AndroidX.Lifecycle.runtime) + testImplementation(Libs.AndroidX.Test.Arch.core) + testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(Libs.AndroidX.Test.runner) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) testImplementation(Libs.Kotlinx.Knit.test) - testImplementation(Libs.RickBusarow.Hermit.coroutines) testImplementation(Libs.RickBusarow.Hermit.junit5) - - testImplementation(Libs.AndroidX.Fragment.ktx) - testImplementation(Libs.AndroidX.Test.Arch.core) - testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.AndroidX.Test.Espresso.core) testImplementation(Libs.Robolectric.core) } diff --git a/dispatch-android-viewmodel/build.gradle.kts b/dispatch-android-viewmodel/build.gradle.kts index be6b3784d..b514c8950 100644 --- a/dispatch-android-viewmodel/build.gradle.kts +++ b/dispatch-android-viewmodel/build.gradle.kts @@ -41,23 +41,21 @@ android { } dependencies { - implementation(Libs.AndroidX.Lifecycle.viewModel) + api(project(":dispatch-core")) + implementation(Libs.AndroidX.Lifecycle.viewModel) implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.android) implementation(Libs.Kotlinx.Coroutines.core) - api(project(":dispatch-core")) - testImplementation(project(":dispatch-test-junit5")) - testImplementation(project(":dispatch-internal-test")) - + testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(Libs.AndroidX.Test.runner) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) testImplementation(Libs.Kotlinx.Coroutines.test) - testImplementation(Libs.AndroidX.Test.runner) - testImplementation(Libs.AndroidX.Test.Espresso.core) + testImplementation(project(":dispatch-internal-test")) + testImplementation(project(":dispatch-test-junit5")) } diff --git a/dispatch-android-viewmodel/samples/build.gradle.kts b/dispatch-android-viewmodel/samples/build.gradle.kts index 253cce72c..c84f82c02 100644 --- a/dispatch-android-viewmodel/samples/build.gradle.kts +++ b/dispatch-android-viewmodel/samples/build.gradle.kts @@ -39,24 +39,22 @@ android { } dependencies { + implementation(Libs.AndroidX.Lifecycle.viewModel) implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.core) - implementation(project(":dispatch-core")) - implementation(project(":dispatch-test-junit5")) implementation(project(":dispatch-android-espresso")) implementation(project(":dispatch-android-viewmodel")) + implementation(project(":dispatch-core")) + implementation(project(":dispatch-test-junit5")) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) } diff --git a/dispatch-core/build.gradle.kts b/dispatch-core/build.gradle.kts index fd4808f92..192adb5a7 100644 --- a/dispatch-core/build.gradle.kts +++ b/dispatch-core/build.gradle.kts @@ -22,22 +22,18 @@ plugins { } dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) testImplementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - - testImplementation(Libs.MockK.core) - testImplementation(Libs.Kotlinx.Coroutines.test) - + testImplementation(Libs.MockK.core) testImplementation(Libs.RickBusarow.Hermit.junit5) testImplementation(project(":dispatch-internal-test")) diff --git a/dispatch-core/samples/build.gradle.kts b/dispatch-core/samples/build.gradle.kts index 3e8eef15a..e34d75c6e 100644 --- a/dispatch-core/samples/build.gradle.kts +++ b/dispatch-core/samples/build.gradle.kts @@ -23,8 +23,8 @@ plugins { sourceSets["test"].java.srcDir("test") dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) @@ -33,10 +33,8 @@ dependencies { testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) } diff --git a/dispatch-detekt/samples/build.gradle.kts b/dispatch-detekt/samples/build.gradle.kts index 7b3c599db..7e08761f9 100644 --- a/dispatch-detekt/samples/build.gradle.kts +++ b/dispatch-detekt/samples/build.gradle.kts @@ -23,8 +23,8 @@ plugins { sourceSets["test"].java.srcDir("test") dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) @@ -34,10 +34,8 @@ dependencies { testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) } diff --git a/dispatch-internal-test-android/build.gradle.kts b/dispatch-internal-test-android/build.gradle.kts index a1efd7642..70cfb0d12 100644 --- a/dispatch-internal-test-android/build.gradle.kts +++ b/dispatch-internal-test-android/build.gradle.kts @@ -41,6 +41,7 @@ android { } } dependencies { + implementation(Libs.AndroidX.Fragment.core) implementation(Libs.AndroidX.Lifecycle.common) implementation(Libs.AndroidX.Lifecycle.runtime) diff --git a/dispatch-internal-test/build.gradle.kts b/dispatch-internal-test/build.gradle.kts index 6c65e9b89..f761e98b7 100644 --- a/dispatch-internal-test/build.gradle.kts +++ b/dispatch-internal-test/build.gradle.kts @@ -20,22 +20,18 @@ plugins { } dependencies { - implementation(Libs.Kotlin.reflect) - implementation(Libs.Kotlin.stdlib) - - implementation(Libs.Kotlinx.Coroutines.core) + api(project(":dispatch-core")) implementation(Libs.JUnit.jUnit5) implementation(Libs.JUnit.jUnit5Vintage) implementation(Libs.Kotest.assertions) implementation(Libs.Kotest.properties) implementation(Libs.Kotest.runner) - + implementation(Libs.Kotlin.reflect) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlin.test) implementation(Libs.Kotlin.testCommon) - + implementation(Libs.Kotlinx.Coroutines.core) implementation(Libs.Kotlinx.Coroutines.test) - api(project(":dispatch-core")) - } diff --git a/dispatch-sample/build.gradle.kts b/dispatch-sample/build.gradle.kts index 7a896e303..ebb3c78bf 100644 --- a/dispatch-sample/build.gradle.kts +++ b/dispatch-sample/build.gradle.kts @@ -43,6 +43,11 @@ android { dependencies { + androidTestImplementation(Libs.AndroidX.Test.Espresso.core) + androidTestImplementation(Libs.AndroidX.Test.runner) + + androidTestImplementation(project(":dispatch-android-espresso")) + implementation(Libs.AndroidX.activity) implementation(Libs.AndroidX.appcompat) implementation(Libs.AndroidX.constraintLayout) @@ -50,18 +55,15 @@ dependencies { implementation(Libs.AndroidX.Fragment.ktx) implementation(Libs.AndroidX.Lifecycle.common) implementation(Libs.AndroidX.Lifecycle.extensions) - implementation(Libs.JakeWharton.timber) - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlinx.Coroutines.android) implementation(Libs.Kotlinx.Coroutines.core) - implementation(project(":dispatch-core")) implementation(project(":dispatch-android-lifecycle")) implementation(project(":dispatch-android-lifecycle-extensions")) implementation(project(":dispatch-android-viewmodel")) + implementation(project(":dispatch-core")) testImplementation(Libs.JUnit.jUnit4) testImplementation(Libs.JUnit.jUnit5) @@ -72,9 +74,4 @@ dependencies { testImplementation(project(":dispatch-test-junit4")) testImplementation(project(":dispatch-test-junit5")) - - androidTestImplementation(project(":dispatch-android-espresso")) - - androidTestImplementation(Libs.AndroidX.Test.runner) - androidTestImplementation(Libs.AndroidX.Test.Espresso.core) } diff --git a/dispatch-test-junit4/build.gradle.kts b/dispatch-test-junit4/build.gradle.kts index c02382e74..639a838fe 100644 --- a/dispatch-test-junit4/build.gradle.kts +++ b/dispatch-test-junit4/build.gradle.kts @@ -22,22 +22,20 @@ plugins { } dependencies { - implementation(Libs.Kotlin.stdlib) + api(project(":dispatch-test")) + implementation(Libs.JUnit.jUnit4) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(Libs.Kotlinx.Coroutines.test) implementation(project(":dispatch-core")) - api(project(":dispatch-test")) - implementation(Libs.JUnit.jUnit4) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.MockK.core) testImplementation(project(":dispatch-internal-test")) diff --git a/dispatch-test-junit4/samples/build.gradle.kts b/dispatch-test-junit4/samples/build.gradle.kts index 5bcb76da3..d91633e7d 100644 --- a/dispatch-test-junit4/samples/build.gradle.kts +++ b/dispatch-test-junit4/samples/build.gradle.kts @@ -21,8 +21,8 @@ plugins { sourceSets["test"].java.srcDir("test") dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) @@ -32,10 +32,8 @@ dependencies { testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) } diff --git a/dispatch-test-junit5/build.gradle.kts b/dispatch-test-junit5/build.gradle.kts index 59a191ab9..92c1d6c41 100644 --- a/dispatch-test-junit5/build.gradle.kts +++ b/dispatch-test-junit5/build.gradle.kts @@ -22,23 +22,21 @@ plugins { } dependencies { - implementation(Libs.Kotlin.stdlib) - implementation(Libs.Kotlin.reflect) + api(project(":dispatch-test")) + implementation(Libs.JUnit.jUnit5) + implementation(Libs.Kotlin.reflect) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(Libs.Kotlinx.Coroutines.test) implementation(project(":dispatch-core")) - api(project(":dispatch-test")) - implementation(Libs.JUnit.jUnit5) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.MockK.core) testImplementation(project(":dispatch-internal-test")) diff --git a/dispatch-test-junit5/samples/build.gradle.kts b/dispatch-test-junit5/samples/build.gradle.kts index e97168792..6a4fa3810 100644 --- a/dispatch-test-junit5/samples/build.gradle.kts +++ b/dispatch-test-junit5/samples/build.gradle.kts @@ -23,8 +23,8 @@ plugins { sourceSets["test"].java.srcDir("test") dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) @@ -34,10 +34,8 @@ dependencies { testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) } diff --git a/dispatch-test/build.gradle.kts b/dispatch-test/build.gradle.kts index 1d2cda897..4427a75d0 100644 --- a/dispatch-test/build.gradle.kts +++ b/dispatch-test/build.gradle.kts @@ -22,23 +22,21 @@ plugins { } dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.JUnit.jUnit4) + implementation(Libs.JUnit.jUnit5) + implementation(Libs.JUnit.jUnit5Vintage) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(Libs.Kotlinx.Coroutines.test) implementation(project(":dispatch-core")) - implementation(Libs.JUnit.jUnit4) - implementation(Libs.JUnit.jUnit5) - implementation(Libs.JUnit.jUnit5Vintage) testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.MockK.core) testImplementation(project(":dispatch-internal-test")) diff --git a/dispatch-test/samples/build.gradle.kts b/dispatch-test/samples/build.gradle.kts index 7b3c599db..7e08761f9 100644 --- a/dispatch-test/samples/build.gradle.kts +++ b/dispatch-test/samples/build.gradle.kts @@ -23,8 +23,8 @@ plugins { sourceSets["test"].java.srcDir("test") dependencies { - implementation(Libs.Kotlin.stdlib) + implementation(Libs.Kotlin.stdlib) implementation(Libs.Kotlinx.Coroutines.core) implementation(project(":dispatch-core")) @@ -34,10 +34,8 @@ dependencies { testImplementation(Libs.Kotest.assertions) testImplementation(Libs.Kotest.properties) testImplementation(Libs.Kotest.runner) - testImplementation(Libs.Kotlin.test) testImplementation(Libs.Kotlin.testCommon) - testImplementation(Libs.Kotlinx.Coroutines.test) }