From 8295d47119c8e05ed6d8653950ca379ce6926843 Mon Sep 17 00:00:00 2001 From: Florian Schuster Date: Sun, 17 Oct 2021 11:50:16 +0200 Subject: [PATCH] Implement maven deployment and update versions --- .github/workflows/build.yml | 2 +- .github/workflows/deploy-release.yml | 46 ++++ .../{deploy.yml => deploy-snapshot.yml} | 16 +- .idea/gradle.xml | 4 +- .idea/runConfigurations.xml | 13 -- .media/btc.png | Bin 3182 -> 0 bytes CHANGELOG.md | 5 +- README.md | 2 +- build.gradle.kts | 23 +- buildSrc/.gitignore | 3 - buildSrc/build.gradle.kts | 9 - buildSrc/src/main/kotlin/Libs.kt | 205 ------------------ buildSrc/src/main/kotlin/Versions.kt | 79 ------- control-core/build.gradle.kts | 42 +++- control-core/deploy.properties | 3 - .../at/florianschuster/control/StartTest.kt | 16 ++ examples/android-counter/build.gradle.kts | 34 +-- examples/android-github/build.gradle.kts | 55 ++--- examples/kotlin-counter/build.gradle.kts | 2 +- gradle.properties | 34 +-- gradle/deploy.gradle | 33 --- gradle/wrapper/gradle-wrapper.properties | 2 +- 22 files changed, 186 insertions(+), 442 deletions(-) create mode 100644 .github/workflows/deploy-release.yml rename .github/workflows/{deploy.yml => deploy-snapshot.yml} (63%) delete mode 100644 .idea/runConfigurations.xml delete mode 100644 .media/btc.png delete mode 100644 buildSrc/.gitignore delete mode 100644 buildSrc/build.gradle.kts delete mode 100644 buildSrc/src/main/kotlin/Libs.kt delete mode 100644 buildSrc/src/main/kotlin/Versions.kt delete mode 100644 control-core/deploy.properties delete mode 100644 gradle/deploy.gradle diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05918295..c2a4dde0 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,4 +1,4 @@ -name: build +name: "build" on: push diff --git a/.github/workflows/deploy-release.yml b/.github/workflows/deploy-release.yml new file mode 100644 index 00000000..cfb10e5e --- /dev/null +++ b/.github/workflows/deploy-release.yml @@ -0,0 +1,46 @@ +name: "deploy release" + +on: + push: + tags-ignore: + - '*-SNAPSHOT' + +jobs: + all_checks: + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v1 + - name: "Set up Java" + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: "Checks all the things" + run: ./gradlew lint ktlintCheck test jacocoTestCoverageVerification pitest apiCheck assemble + + publish: + needs: [ all_checks ] + runs-on: ubuntu-latest + steps: + - name: "Checkout" + uses: actions/checkout@v1 + - name: "Set up Java" + uses: actions/setup-java@v1 + with: + java-version: 1.8 + - name: "Get tag and save into env" + uses: olegtarasov/get-tag@v2.1 + id: tagName + - name: "Upload release" + run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel + env: + libraryVersionTag: ${{ steps.tagName.outputs.tag }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_PRIVATE_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + - name: "Publish release" + run: ./gradlew closeAndReleaseRepository --no-daemon --no-parallel + env: + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy-snapshot.yml similarity index 63% rename from .github/workflows/deploy.yml rename to .github/workflows/deploy-snapshot.yml index a075a287..eea93148 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy-snapshot.yml @@ -1,9 +1,9 @@ -name: deploy +name: "deploy snapshot" on: push: tags: - - '*' + - '*-SNAPSHOT' jobs: all_checks: @@ -19,7 +19,7 @@ jobs: run: ./gradlew lint ktlintCheck test jacocoTestCoverageVerification pitest apiCheck assemble publish: - needs: [all_checks] + needs: [ all_checks ] runs-on: ubuntu-latest steps: - name: "Checkout" @@ -29,11 +29,11 @@ jobs: with: java-version: 1.8 - name: "Get tag and save into env" - uses: olegtarasov/get-tag@v1 + uses: olegtarasov/get-tag@v2.1 id: tagName - - name: "Build, publish and upload to Bintray" + - name: "Upload release" + run: ./gradlew publishAllPublicationsToMavenCentralRepository --no-daemon --no-parallel env: libraryVersionTag: ${{ steps.tagName.outputs.tag }} - bintrayUser: ${{ secrets.BINTRAY_USER }} - bintrayApiKey: ${{ secrets.BINTRAY_TOKEN }} - run: ./gradlew build publish bintrayUpload \ No newline at end of file + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} diff --git a/.idea/gradle.xml b/.idea/gradle.xml index b0ae76a1..be23598a 100644 --- a/.idea/gradle.xml +++ b/.idea/gradle.xml @@ -4,13 +4,12 @@ diff --git a/.idea/runConfigurations.xml b/.idea/runConfigurations.xml deleted file mode 100644 index e497da99..00000000 --- a/.idea/runConfigurations.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.media/btc.png b/.media/btc.png deleted file mode 100644 index 14246d81e5fdc7ad67376226b9cf2c605ad933f2..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 3182 zcmV-!43YDRP)005u}1^@s6i_d2*000a%Nkl>A73`Cvw|35iRkC*hw6y&)aL3YwiUd06*UIHLRD{rUM>ErZ*zmJdmZr|SC?yMM} zpC688MzcvB)$a?W_}67+|7ee+ff|!)Q`O(|{5%XRcz$}$t0@I$O=<11;83~rF{S_6e253 z30HX@$77Iw)Fj6PDuve1;{k7)1i*DVKpez8a`!cC0G$aV;nfNCjxA)TyezXN)Sd~b z@-DX@rEQn4svn}qvW)$^^gws2KV8oGb?1*n^XSAGZnFn`0<1^f@V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#dh?^gc9pY}Ix4lf z9QPy#yq7W_@Ty1mhG;VctFPpf&4Jovkb`K_j}k?BH?m2YUD?F$stnx>%(m}nFxy9m zNBrz_`s-NEBnH5>Y60-(Y2yJuqysp@s|3IRcu_#54^=)Si3J4$;0-|aaU!5)OA+E_ z)S)tgX*721w`&ukc7UBnGt0h|jxP8r|5gy#pJ!7IcRg3aRo-f^D3x~$fc1>-)j9xf ztdw{_=0XCXak-R88vuz)-nrniWqcoynX|u?%GXFpcC1kSR&A2i@4Se2>{mIgYLlcG zB;Bd{Q8{|4ZO1W;8ZudvjH0I2UF20-Jgc>rVz!~@=RQl2Owm;p7bQveKrj4W8{ zzXMQtCaB9@v95Q)U41`lhaA+BNk2kIXZ+_nOMA)qx;A1<4e&1b2;l;ti%w6y09gEX z^$5_(%2iWJJVZQT{SN)naaBB^BJcJ*0MJRk|%#5QHi_?%o4 zP`0~y7a5OQN96Y^s*PtpUtLI56Gn_9ZKz2MfJEtanE(jh*;Xg*qm%(K0A3Vu!a_Wt zcl6OuCk4ePi;E7<|_aWGe##! zr3?y`0C-g}00zJ^aKr<4#8abod?J8HP2z0m=*ou_JmYivvqd!?$9_lq*&MLyqoa*;yK3iLF7E&7 z%LwE$rV=Rt*2{n_D5Y%x1gkUv2EdB~WW}j4Shb^8X#fm>0dOK2?8x6b+HiBgzf^8- UwcS;Fc>n+a07*qoM6N<$g3ku4egFUf diff --git a/CHANGELOG.md b/CHANGELOG.md index 82a75734..8057ddee 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,12 +4,13 @@ - binary compatibility will now be verified and held up on every release. -## `[0.14.0]` - 2021-XX-XX +## `[0.14.0]` - 2021-10-17 -- Update kotlinx.coroutines to `1.4.3`. +- Update kotlinx.coroutines to `1.5.2`. - Remove kotlin as `api` dependency. - Remove `ControllerLog.default`. - Lazily start controller when accessing `Controller.effects` field (#26) +- `control-core` will now be deployed to mavenCentral ## `[0.13.1]` - 2020-09-13 diff --git a/README.md b/README.md index f7ce717b..5cb1855a 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ test coverage is automatically run by github actions on `[push]` | | threshold | run | output | |---:|:---:|---|---| -| instruction/branch | 90% | `./gradlew test jacocoTestReport` | `./control-core/build/reports/jacoco/` | +| instruction/branch | 94% | `./gradlew test jacocoTestReport` | `./control-core/build/reports/jacoco/` | | mutation | 100% | `./gradlew pitest` | `./control-core/build/reports/pitest/` | ## author diff --git a/build.gradle.kts b/build.gradle.kts index 7990406d..e8c926f9 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,19 +7,22 @@ buildscript { } dependencies { - classpath(Libs.kotlin_gradle_plugin) - classpath(Libs.com_jfrog_bintray_gradle_plugin) - classpath(Libs.com_android_tools_build_gradle) - classpath(Libs.kotlin_serialization) - classpath(Libs.gradle_pitest_plugin) - classpath(Libs.binary_compatibility_validator) + classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:1.5.0") + classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.7.0") + classpath("org.jetbrains.kotlinx:binary-compatibility-validator:0.7.1") + classpath("com.vanniktech:gradle-maven-publish-plugin:0.18.0") + classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.5.31") + + classpath("com.android.tools.build:gradle:4.2.2") + classpath("org.jetbrains.kotlin:kotlin-serialization:1.5.31") } } plugins { - buildSrcVersions jacoco - id("org.jlleitschuh.gradle.ktlint").version(Versions.org_jlleitschuh_gradle_ktlint_gradle_plugin) + id("org.jlleitschuh.gradle.ktlint").version("10.0.0") + `maven-publish` + signing } // ---- api-validation --- // @@ -30,7 +33,7 @@ configure { ignoredProjects.addAll(listOf("kotlin-counter", "android-counter", "android-github")) } -// ---- api-validation --- // +// ---- end api-validation --- // // ---- jacoco --- // @@ -46,7 +49,7 @@ subprojects { } } -// ---- jacoco --- // +// ---- end jacoco --- // allprojects { repositories { diff --git a/buildSrc/.gitignore b/buildSrc/.gitignore deleted file mode 100644 index ea958e57..00000000 --- a/buildSrc/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ - -.gradle/ -build/ diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts deleted file mode 100644 index a53bb063..00000000 --- a/buildSrc/build.gradle.kts +++ /dev/null @@ -1,9 +0,0 @@ -import org.gradle.kotlin.dsl.`kotlin-dsl` - -plugins { - `kotlin-dsl` -} - -repositories { - jcenter() -} \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/Libs.kt b/buildSrc/src/main/kotlin/Libs.kt deleted file mode 100644 index 28e43434..00000000 --- a/buildSrc/src/main/kotlin/Libs.kt +++ /dev/null @@ -1,205 +0,0 @@ -import kotlin.String - -/** - * Generated by https://github.com/jmfayard/buildSrcVersions - * - * Update this file with - * `$ ./gradlew buildSrcVersions` - */ -object Libs { - /** - * https://github.com/Kotlin/kotlinx.serialization - */ - const val kotlinx_serialization_core: String = - "org.jetbrains.kotlinx:kotlinx-serialization-core:" + - Versions.org_jetbrains_kotlinx_kotlinx_serialization - - /** - * https://github.com/Kotlin/kotlinx.coroutines - */ - const val kotlinx_coroutines_core: String = "org.jetbrains.kotlinx:kotlinx-coroutines-core:" + - Versions.org_jetbrains_kotlinx_kotlinx_coroutines - - /** - * https://github.com/reactivecircus/FlowBinding - */ - const val flowbinding_android: String = - "io.github.reactivecircus.flowbinding:flowbinding-android:" + - Versions.io_github_reactivecircus_flowbinding - - /** - * https://github.com/reactivecircus/FlowBinding - */ - const val flowbinding_core: String = "io.github.reactivecircus.flowbinding:flowbinding-core:" + - Versions.io_github_reactivecircus_flowbinding - - /** - * https://github.com/reactivecircus/FlowBinding - */ - const val flowbinding_recyclerview: String = - "io.github.reactivecircus.flowbinding:flowbinding-recyclerview:" + - Versions.io_github_reactivecircus_flowbinding - - /** - * https://kotlinlang.org/ - */ - const val kotlin_gradle_plugin: String = "org.jetbrains.kotlin:kotlin-gradle-plugin:" + - Versions.org_jetbrains_kotlin - - /** - * https://kotlinlang.org/ - */ - const val kotlin_scripting_compiler_embeddable: String = - "org.jetbrains.kotlin:kotlin-scripting-compiler-embeddable:" + - Versions.org_jetbrains_kotlin - - /** - * https://kotlinlang.org/ - */ - const val kotlin_serialization: String = "org.jetbrains.kotlin:kotlin-serialization:" + - Versions.org_jetbrains_kotlin - - /** - * https://kotlinlang.org/ - */ - const val kotlin_stdlib_jdk8: String = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:" + - Versions.org_jetbrains_kotlin - - /** - * https://developer.android.com/jetpack/androidx/releases/fragment#1.3.3 - */ - const val fragment_ktx: String = "androidx.fragment:fragment-ktx:" + Versions.androidx_fragment - - /** - * https://developer.android.com/jetpack/androidx/releases/fragment#1.3.3 - */ - const val fragment_testing: String = "androidx.fragment:fragment-testing:" + - Versions.androidx_fragment - - /** - * https://developer.android.com/testing - */ - const val core_ktx: String = "androidx.test:core-ktx:" + Versions.androidx_test - - /** - * https://developer.android.com/testing - */ - const val androidx_test_rules: String = "androidx.test:rules:" + Versions.androidx_test - - /** - * https://developer.android.com/testing - */ - const val androidx_test_runner: String = "androidx.test:runner:" + Versions.androidx_test - - /** - * https://github.com/ktorio/ktor - */ - const val ktor_client_cio: String = "io.ktor:ktor-client-cio:" + Versions.io_ktor - - /** - * https://github.com/ktorio/ktor - */ - const val ktor_client_json_jvm: String = "io.ktor:ktor-client-json-jvm:" + Versions.io_ktor - - /** - * https://github.com/ktorio/ktor - */ - const val ktor_client_logging_jvm: String = "io.ktor:ktor-client-logging-jvm:" + - Versions.io_ktor - - /** - * https://github.com/ktorio/ktor - */ - const val ktor_client_serialization_jvm: String = "io.ktor:ktor-client-serialization-jvm:" + - Versions.io_ktor - - /** - * http://tools.android.com/ - */ - const val com_android_tools_build_gradle: String = "com.android.tools.build:gradle:" + - Versions.com_android_tools_build_gradle - - const val org_jlleitschuh_gradle_ktlint_gradle_plugin: String = - "org.jlleitschuh.gradle.ktlint:org.jlleitschuh.gradle.ktlint.gradle.plugin:" + - Versions.org_jlleitschuh_gradle_ktlint_gradle_plugin - - const val de_fayard_buildsrcversions_gradle_plugin: String = - "de.fayard.buildSrcVersions:de.fayard.buildSrcVersions.gradle.plugin:" + - Versions.de_fayard_buildsrcversions_gradle_plugin - - const val com_jfrog_bintray_gradle_plugin: String = - "com.jfrog.bintray:com.jfrog.bintray.gradle.plugin:" + - Versions.com_jfrog_bintray_gradle_plugin - - /** - * https://github.com/Kotlin/binary-compatibility-validator - */ - const val binary_compatibility_validator: String = - "org.jetbrains.kotlinx:binary-compatibility-validator:" + - Versions.binary_compatibility_validator - - /** - * https://github.com/floschu/coroutines-test-extensions - */ - const val coroutines_test_extensions: String = - "at.florianschuster.test:coroutines-test-extensions:" + - Versions.coroutines_test_extensions - - /** - * https://developer.android.com/jetpack/androidx/releases/lifecycle#2.3.1 - */ - const val lifecycle_runtime_ktx: String = "androidx.lifecycle:lifecycle-runtime-ktx:" + - Versions.lifecycle_runtime_ktx - - /** - * http://gradle-pitest-plugin.solidsoft.info/ - */ - const val gradle_pitest_plugin: String = "info.solidsoft.gradle.pitest:gradle-pitest-plugin:" + - Versions.gradle_pitest_plugin - - /** - * http://tools.android.com - */ - const val constraintlayout: String = "androidx.constraintlayout:constraintlayout:" + - Versions.constraintlayout - - /** - * https://developer.android.com/testing - */ - const val espresso_core: String = "androidx.test.espresso:espresso-core:" + - Versions.espresso_core - - /** - * http://tools.android.com/ - */ - const val lint_gradle: String = "com.android.tools.lint:lint-gradle:" + Versions.lint_gradle - - const val viewbinding: String = "androidx.databinding:viewbinding:" + Versions.viewbinding - - /** - * https://developer.android.com/jetpack/androidx - */ - const val appcompat: String = "androidx.appcompat:appcompat:" + Versions.appcompat - - /** - * https://developer.android.com/testing - */ - const val junit_ktx: String = "androidx.test.ext:junit-ktx:" + Versions.junit_ktx - - /** - * https://github.com/material-components/material-components-android - */ - const val material: String = "com.google.android.material:material:" + Versions.material - - const val ktlint: String = "com.pinterest:ktlint:" + Versions.ktlint - - /** - * http://mockk.io - */ - const val mockk: String = "io.mockk:mockk:" + Versions.mockk - - /** - * https://github.com/coil-kt/coil - */ - const val coil: String = "io.coil-kt:coil:" + Versions.coil -} diff --git a/buildSrc/src/main/kotlin/Versions.kt b/buildSrc/src/main/kotlin/Versions.kt deleted file mode 100644 index c31a99e4..00000000 --- a/buildSrc/src/main/kotlin/Versions.kt +++ /dev/null @@ -1,79 +0,0 @@ -import kotlin.String -import org.gradle.plugin.use.PluginDependenciesSpec -import org.gradle.plugin.use.PluginDependencySpec - -/** - * Generated by https://github.com/jmfayard/buildSrcVersions - * - * Find which updates are available by running - * `$ ./gradlew buildSrcVersions` - * This will only update the comments. - * - * YOU are responsible for updating manually the dependency version. - */ -object Versions { - const val org_jetbrains_kotlinx_kotlinx_serialization: String = "1.2.0" - - const val org_jetbrains_kotlinx_kotlinx_coroutines: String = "1.4.3" - - const val io_github_reactivecircus_flowbinding: String = "0.12.0" - - const val org_jetbrains_kotlin: String = "1.5.0" - - const val androidx_fragment: String = "1.3.3" - - const val androidx_test: String = "1.3.0" - - const val io_ktor: String = "1.5.4" - - const val com_android_tools_build_gradle: String = "4.2.0" - - const val org_jlleitschuh_gradle_ktlint_gradle_plugin: String = "10.0.0" - - const val de_fayard_buildsrcversions_gradle_plugin: String = "0.7.0" - - const val com_jfrog_bintray_gradle_plugin: String = "1.8.5" - - const val binary_compatibility_validator: String = "0.5.0" - - const val coroutines_test_extensions: String = "0.1.2" - - const val lifecycle_runtime_ktx: String = "2.3.1" - - const val gradle_pitest_plugin: String = "1.5.2" // available: "1.6.0" - - const val constraintlayout: String = "2.0.4" - - const val espresso_core: String = "3.3.0" - - const val lint_gradle: String = "27.2.0" - - const val viewbinding: String = "4.2.0" - - const val appcompat: String = "1.2.0" - - const val junit_ktx: String = "1.1.2" - - const val material: String = "1.3.0" - - const val ktlint: String = "0.40.0" - - const val mockk: String = "1.11.0" - - const val coil: String = "1.2.1" - - /** - * Current version: "6.8.2" - * See issue 19: How to update Gradle itself? - * https://github.com/jmfayard/buildSrcVersions/issues/19 - */ - const val gradleLatestVersion: String = "7.0.1" -} - -/** - * See issue #47: how to update buildSrcVersions itself - * https://github.com/jmfayard/buildSrcVersions/issues/47 - */ -val PluginDependenciesSpec.buildSrcVersions: PluginDependencySpec - inline get() = - id("de.fayard.buildSrcVersions").version(Versions.de_fayard_buildsrcversions_gradle_plugin) diff --git a/control-core/build.gradle.kts b/control-core/build.gradle.kts index 2f7ca66f..d997934d 100644 --- a/control-core/build.gradle.kts +++ b/control-core/build.gradle.kts @@ -2,14 +2,17 @@ plugins { id("kotlin") id("jacoco") id("info.solidsoft.pitest") + id("com.vanniktech.maven.publish") } dependencies { - api(Libs.kotlinx_coroutines_core) - testImplementation(Libs.mockk) - testImplementation(Libs.coroutines_test_extensions) + api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.5.2") + testImplementation("io.mockk:mockk:1.12.0") + testImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") } +// ---- kotlin --- // + tasks.compileTestKotlin { kotlinOptions.freeCompilerArgs = listOf( "-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", @@ -17,6 +20,16 @@ tasks.compileTestKotlin { ) } +// ---- end kotlin --- // + +// ---- jacoco --- // + +tasks.jacocoTestCoverageVerification { + violationRules { + rule { limit { minimum = "0.94".toBigDecimal() } } + } +} + tasks.jacocoTestReport { reports { xml.isEnabled = true @@ -26,18 +39,19 @@ tasks.jacocoTestReport { classDirectories.setFrom( files(classDirectories.files.map { file -> fileTree(file) { - // jacoco cannot handle inline functions - exclude("at/florianschuster/control/DefaultTagKt.class") + // jacoco cannot handle inline functions properly + exclude( + "at/florianschuster/control/DefaultTagKt.class", + "at/florianschuster/control/ExtensionsKt.class" + ) } }) ) } -tasks.jacocoTestCoverageVerification { - violationRules { - rule { limit { minimum = "0.9".toBigDecimal() } } - } -} +// ---- end jacoco --- // + +// ---- pitest --- // pitest { targetClasses.add("at.florianschuster.control.*") @@ -60,4 +74,10 @@ pitest { verbose.set(true) } -apply(from = "$rootDir/gradle/deploy.gradle") +// ---- end pitest --- // + +// ---- publishing --- // + +version = System.getenv("libraryVersionTag") + +// ---- end publishing --- // diff --git a/control-core/deploy.properties b/control-core/deploy.properties deleted file mode 100644 index 1d5d2ea8..00000000 --- a/control-core/deploy.properties +++ /dev/null @@ -1,3 +0,0 @@ -repo=control -name=control-core -description=coroutines flow based uni-directional architecture \ No newline at end of file diff --git a/control-core/src/test/kotlin/at/florianschuster/control/StartTest.kt b/control-core/src/test/kotlin/at/florianschuster/control/StartTest.kt index 818acb30..73b87a22 100644 --- a/control-core/src/test/kotlin/at/florianschuster/control/StartTest.kt +++ b/control-core/src/test/kotlin/at/florianschuster/control/StartTest.kt @@ -91,6 +91,21 @@ internal class StartTest { assertFalse(sut.stateJob.isActive) } + @Test + fun `lazy start mode with effects`() { + val scope = TestCoroutineScope(Job()) + val sut = scope.createSimpleCounterController( + controllerStart = ControllerStart.Lazy + ) + assertFalse(sut.stateJob.isActive) + + sut.effects + assertTrue(sut.stateJob.isActive) + + scope.cancel() + assertFalse(sut.stateJob.isActive) + } + @Test fun `manual start mode`() { val scope = TestCoroutineScope(Job()) @@ -102,6 +117,7 @@ internal class StartTest { sut.currentState sut.state sut.dispatch(1) + sut.effects assertFalse(sut.stateJob.isActive) val started = sut.start() diff --git a/examples/android-counter/build.gradle.kts b/examples/android-counter/build.gradle.kts index 760a654f..682e9741 100644 --- a/examples/android-counter/build.gradle.kts +++ b/examples/android-counter/build.gradle.kts @@ -6,11 +6,11 @@ plugins { } android { - compileSdkVersion(29) + compileSdkVersion(30) defaultConfig { applicationId = "at.florianschuster.control.counterexample" - minSdkVersion(21) - targetSdkVersion(29) + minSdkVersion(23) + targetSdkVersion(30) versionCode = 1 versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -37,20 +37,20 @@ dependencies { implementation(project(":control-core")) implementation(project(":examples:kotlin-counter")) - implementation(Libs.appcompat) - implementation(Libs.constraintlayout) - implementation(Libs.flowbinding_android) - implementation(Libs.flowbinding_core) - implementation(Libs.lifecycle_runtime_ktx) - implementation(Libs.fragment_ktx) - debugImplementation(Libs.fragment_testing) + implementation("androidx.appcompat:appcompat:1.3.1") + implementation("androidx.constraintlayout:constraintlayout:2.1.1") + implementation("io.github.reactivecircus.flowbinding:flowbinding-android:1.2.0") + implementation("io.github.reactivecircus.flowbinding:flowbinding-core:1.2.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") + implementation("androidx.fragment:fragment-ktx:1.3.6") + debugImplementation("androidx.fragment:fragment-testing:1.3.6") - testImplementation(Libs.coroutines_test_extensions) + testImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") - androidTestImplementation(Libs.androidx_test_rules) - androidTestImplementation(Libs.androidx_test_runner) - androidTestImplementation(Libs.core_ktx) - androidTestImplementation(Libs.espresso_core) - androidTestImplementation(Libs.coroutines_test_extensions) - androidTestImplementation(Libs.junit_ktx) + androidTestImplementation("androidx.test:rules:1.4.0") + androidTestImplementation("androidx.test:runner:1.4.0") + androidTestImplementation("androidx.test:core-ktx:1.4.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0") + androidTestImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") + androidTestImplementation("androidx.test.ext:junit-ktx:1.1.3") } diff --git a/examples/android-github/build.gradle.kts b/examples/android-github/build.gradle.kts index b923736c..a88952ff 100644 --- a/examples/android-github/build.gradle.kts +++ b/examples/android-github/build.gradle.kts @@ -7,11 +7,11 @@ plugins { } android { - compileSdkVersion(29) + compileSdkVersion(30) defaultConfig { applicationId = "at.florianschuster.control.githubexample" - minSdkVersion(21) - targetSdkVersion(29) + minSdkVersion(23) + targetSdkVersion(30) versionCode = 1 versionName = "1.0.0" testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" @@ -43,30 +43,31 @@ android { dependencies { implementation(project(":control-core")) - implementation(Libs.appcompat) - implementation(Libs.coil) - implementation(Libs.constraintlayout) - implementation(Libs.flowbinding_android) - implementation(Libs.flowbinding_core) - implementation(Libs.flowbinding_recyclerview) - implementation(Libs.fragment_ktx) - implementation(Libs.kotlinx_serialization_core) - implementation(Libs.ktor_client_cio) - implementation(Libs.ktor_client_json_jvm) - implementation(Libs.ktor_client_logging_jvm) - implementation(Libs.ktor_client_serialization_jvm) - implementation(Libs.lifecycle_runtime_ktx) - implementation(Libs.material) - debugImplementation(Libs.fragment_testing) + implementation("androidx.appcompat:appcompat:1.3.1") + implementation("io.coil-kt:coil:1.4.0") + implementation("androidx.constraintlayout:constraintlayout:2.1.1") + implementation("io.github.reactivecircus.flowbinding:flowbinding-android:1.2.0") + implementation("io.github.reactivecircus.flowbinding:flowbinding-core:1.2.0") + implementation("io.github.reactivecircus.flowbinding:flowbinding-recyclerview:1.2.0") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") + implementation("androidx.fragment:fragment-ktx:1.3.6") + debugImplementation("androidx.fragment:fragment-testing:1.3.6") + implementation("org.jetbrains.kotlinx:kotlinx-serialization-core:1.3.0") + implementation("io.ktor:ktor-client-cio:1.6.4") + implementation("io.ktor:ktor-client-json-jvm:1.6.4") + implementation("io.ktor:ktor-client-logging-jvm:1.6.4") + implementation("io.ktor:ktor-client-serialization-jvm:1.6.4") + implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.3.1") + implementation("com.google.android.material:material:1.4.0") - testImplementation(Libs.coroutines_test_extensions) - testImplementation(Libs.mockk) + testImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") + testImplementation("io.mockk:mockk:1.12.0") - androidTestImplementation(Libs.core_ktx) - androidTestImplementation(Libs.junit_ktx) - androidTestImplementation(Libs.espresso_core) - androidTestImplementation(Libs.androidx_test_rules) - androidTestImplementation(Libs.androidx_test_runner) - androidTestImplementation(Libs.coroutines_test_extensions) - androidTestImplementation(Libs.mockk) + androidTestImplementation("androidx.test:rules:1.4.0") + androidTestImplementation("androidx.test:runner:1.4.0") + androidTestImplementation("androidx.test:core-ktx:1.4.0") + androidTestImplementation("androidx.test.espresso:espresso-core:3.3.0") + androidTestImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") + androidTestImplementation("androidx.test.ext:junit-ktx:1.1.3") + androidTestImplementation("io.mockk:mockk-android:1.12.0") } diff --git a/examples/kotlin-counter/build.gradle.kts b/examples/kotlin-counter/build.gradle.kts index a5e9d6cd..804cfbf8 100644 --- a/examples/kotlin-counter/build.gradle.kts +++ b/examples/kotlin-counter/build.gradle.kts @@ -4,5 +4,5 @@ plugins { dependencies { implementation(project(":control-core")) - testImplementation(Libs.coroutines_test_extensions) + testImplementation("at.florianschuster.test:coroutines-test-extensions:0.1.2") } diff --git a/gradle.properties b/gradle.properties index 23339e0d..c76fd870 100644 --- a/gradle.properties +++ b/gradle.properties @@ -1,21 +1,25 @@ -# Project-wide Gradle settings. -# IDE (e.g. Android Studio) users: -# Gradle settings configured through the IDE *will override* -# any settings specified in this file. -# For more details on how to configure your build environment visit -# http://www.gradle.org/docs/current/userguide/build_environment.html -# Specifies the JVM arguments used for the daemon process. -# The setting is particularly useful for tweaking memory settings. org.gradle.jvmargs=-Xmx1536m -# When configured, Gradle will run in incubating parallel mode. -# This option should only be used with decoupled projects. More details, visit -# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -# org.gradle.parallel=true -# AndroidX package structure to make it clearer which packages are bundled with the -# Android operating system, and which are packaged with your app's APK -# https://developer.android.com/topic/libraries/support-library/androidx-rn +# AndroidX android.useAndroidX=true # Automatically convert third-party libraries to use AndroidX android.enableJetifier=true # Kotlin code style for this project: "official" or "obsolete": kotlin.code.style=official + +# maven +GROUP=at.florianschuster.control +POM_ARTIFACT_ID=control-core +POM_NAME=control-core +POM_DESCRIPTION=coroutines flow based uni-directional architecture +POM_INCEPTION_YEAR=2020 +POM_URL=https://github.com/floschu/control +POM_SCM_URL=https://github.com/floschu/control +POM_SCM_CONNECTION=scm:git@github.com:floschu/control.git +POM_SCM_DEV_CONNECTION=scm:git@github.com:floschu/control.git +POM_LICENCE_NAME=The Apache Software License, Version 2.0 +POM_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt +POM_LICENCE_DIST=repo +POM_DEVELOPER_ID=floschu +POM_DEVELOPER_NAME=Florian Schuster +POM_DEVELOPER_URL=https://github.com/floschu +SONATYPE_HOST=S01 \ No newline at end of file diff --git a/gradle/deploy.gradle b/gradle/deploy.gradle deleted file mode 100644 index 12f43797..00000000 --- a/gradle/deploy.gradle +++ /dev/null @@ -1,33 +0,0 @@ -apply plugin: "com.jfrog.bintray" - -version = System.getenv("libraryVersionTag") -group = "at.florianschuster.control" - -def settings = new Properties() -file("deploy.properties").withInputStream { settings.load(it) } - -project.ext { - mavProjectName = settings.name - mavLibraryDescription = settings.description - mavPublishToMavenLocal = true - mavSiteUrl = "https://github.com/floschu/control" - mavGitUrl = mavSiteUrl + ".git" - mavLibraryLicenses = ["Apache-2.0": 'http://www.apache.org/licenses/LICENSE-2.0.txt'] -} - -bintray { - user = System.getenv("bintrayUser") - key = System.getenv("bintrayApiKey") - publications = ['mavenPublish'] - configurations = ['archives'] - publish = true - pkg { - repo = settings.repo - name = settings.name - version { - released = new Date() - } - } -} - -apply from: "https://raw.githubusercontent.com/floschu/gradle-maven-plugin/master/gradle-mavenizer.gradle" \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index f04eed8c..c4600fb0 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-all.zip