Skip to content

Commit

Permalink
Merge pull request #174 from nhaarman/update-build
Browse files Browse the repository at this point in the history
Update build
  • Loading branch information
nhaarman authored May 11, 2021
2 parents e38f33a + bc0bc6c commit a3bb863
Show file tree
Hide file tree
Showing 47 changed files with 284 additions and 204 deletions.
3 changes: 2 additions & 1 deletion .circleci/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
#!/usr/bin/env bash

./ktlint

./gradlew clean \
test \
ktlint \
\
:ext-acorn-android-testing:lint \
:ext-acorn-android-timber:lint \
Expand Down
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.

14 changes: 13 additions & 1 deletion .idea/misc.xml

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

15 changes: 0 additions & 15 deletions .ops/ktlint.gradle

This file was deleted.

4 changes: 4 additions & 0 deletions .ops/pitest.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ def hasAndroid = plugins.hasPlugin("com.android.library") || plugins.hasPlugin("
if (!hasAndroid && project.name != "ext-acorn-android-lint") {
project.apply plugin: "info.solidsoft.pitest"

project.dependencies {
pitest("org.pitest:pitest-junit5-plugin:0.14")
}

pitest {
targetClasses = ["com.*", "acorn.*"]
pitestVersion = "1.4.9"
Expand Down
28 changes: 28 additions & 0 deletions .ops/publishing-android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
apply plugin: "maven-publish"
apply plugin: "org.jetbrains.dokka-android"

apply from: "$rootDir/.ops/dokka.gradle"
apply from: "$rootDir/.ops/publishing-base.gradle"

task javadocJar(type: Jar, dependsOn: javadoc) {
archiveClassifier.set("javadoc")
from(javadoc.destinationDir)
}

task sourcesJar(type: Jar) {
archiveClassifier.set('sources')
from android.sourceSets.main.java.srcDirs
}

afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
from components.release

artifact javadocJar
artifact sourcesJar
}
}
}
}
19 changes: 0 additions & 19 deletions .ops/publishing.gradle → .ops/publishing-base.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
def hasAndroid = plugins.hasPlugin("com.android.library") || plugins.hasPlugin("com.android.application")

publishing {
def sonatype_username = "${findProperty('sonatype_username') ?: System.getenv("sonatype_username")}"
def sonatype_password = "${findProperty('sonatype_password') ?: System.getenv("sonatype_password")}"
Expand All @@ -24,25 +22,8 @@ publishing {
}
}

task sourcesJar(type: Jar) {
classifier = "sources"
if (hasAndroid) {
from(android.sourceSets["main"].java.srcDirs)
} else {
from(sourceSets["main"].allSource)
}
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = "javadoc"
from(javadoc.destinationDir)
}

publications {
maven(MavenPublication) {
from(components[hasAndroid ? "android" : "java"])
artifact(sourcesJar)
artifact(javadocJar)

version = git.versionName()

Expand Down
18 changes: 18 additions & 0 deletions .ops/publishing-kotlin.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
apply plugin: "org.jetbrains.dokka"
apply plugin: "maven-publish"

apply from: "$rootDir/.ops/dokka.gradle"
apply from: "$rootDir/.ops/publishing-base.gradle"

java {
withJavadocJar()
withSourcesJar()
}

publishing {
publications {
maven(MavenPublication) {
from(components.java)
}
}
}
2 changes: 1 addition & 1 deletion .ops/testing.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ if (!hasAndroid) {
}
} else {
project.apply plugin: "de.mannodermaus.android-junit5"
android.testOptions.junitPlatform {
junitPlatform {
configurationParameter "junit.jupiter.extensions.autodetection.enabled", "true"
}
}
Expand Down
40 changes: 19 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,22 +1,20 @@
buildscript {
ext.kotlinVersion = "1.3.50"
ext.kotlinVersion = "1.4.32"

repositories {
google()
mavenCentral()
}

configurations.maybeCreate("pitest")
dependencies {
classpath("com.android.tools.build:gradle:3.5.1")
classpath("com.android.tools.build:gradle:4.1.3")
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.5.2.0")
classpath("com.adarshr:gradle-test-logger-plugin:1.7.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.17")
classpath("org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.17")
classpath("digital.wup:android-maven-publish:3.6.2")
classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.4.5")
pitest("org.pitest:pitest-junit5-plugin:0.9")
classpath("de.mannodermaus.gradle.plugins:android-junit5:1.7.1.1")
classpath("com.adarshr:gradle-test-logger-plugin:3.0.0")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:0.9.18")
classpath("org.jetbrains.dokka:dokka-android-gradle-plugin:0.9.18")
classpath("digital.wup:android-maven-publish:3.6.3")
classpath("info.solidsoft.gradle.pitest:gradle-pitest-plugin:1.6.0")
}
}

Expand Down Expand Up @@ -80,25 +78,25 @@ subprojects {
sourceCompatibility 1.8
targetCompatibility 1.8
}

kotlinOptions {
jvmTarget = "1.8"
}
}
}

if (project.hasProperty("check")) {
project.apply from: "$rootDir/.ops/ktlint.gradle"
if (project.hasProperty("publishing")) {
project.apply from: "$rootDir/.ops/publishing-android.gradle"
}
} else {
if (project.hasProperty("publishing")) {
project.apply from: "$rootDir/.ops/publishing-kotlin.gradle"
}
}

if (project.name != "docs" && (project.hasProperty("test") || project.hasProperty("android"))) {
project.apply from: "$rootDir/.ops/testing.gradle"
project.apply from: "$rootDir/.ops/pitest.gradle"
}

if (project.hasProperty("dokka")) {
project.apply from: "$rootDir/.ops/dokka.gradle"
}

if (project.hasProperty("publishing")) {
project.apply from: "$rootDir/.ops/publishing.gradle"
}
}
}

Expand Down
36 changes: 17 additions & 19 deletions dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -5,54 +5,52 @@ dependencyManagement {
dependency "org.jetbrains.kotlin:kotlin-stdlib:$kotlinVersion"

// core dependencies
dependency "androidx.annotation:annotation:1.1.0"
dependency "androidx.annotation:annotation:1.2.0"

// ext-acorn-android
dependency "androidx.appcompat:appcompat:1.1.0"
dependency "androidx.appcompat:appcompat:1.2.0"
dependency "androidx.interpolator:interpolator:1.0.0"

// ext-acorn-rx
dependency "io.arrow-kt:arrow-core:0.10.0"
dependency "io.reactivex.rxjava2:rxjava:2.2.13"
dependency "io.reactivex.rxjava2:rxjava:2.2.21"
dependency "io.reactivex.rxjava2:rxkotlin:2.4.0"

// ext-acorn-android-timber
dependency "com.jakewharton.timber:timber:4.7.1"

// ext-acorn-android-lifecycle
dependency "androidx.lifecycle:lifecycle-runtime:2.1.0"
dependency "androidx.lifecycle:lifecycle-runtime:2.3.1"


// "Hello"-sample apps
dependency "androidx.core:core-ktx:1.1.0"
dependency "com.google.android.material:material:1.0.0"
dependency "androidx.constraintlayout:constraintlayout:2.0.0-beta2"
dependency "androidx.core:core-ktx:1.3.2"
dependency "com.google.android.material:material:1.3.0"
dependency "androidx.constraintlayout:constraintlayout:2.0.4"
dependency "io.reactivex.rxjava2:rxandroid:2.1.1"
dependency "com.squareup.picasso:picasso:2.71828"
dependency "nl.dionsegijn:konfetti:1.1.3"
dependency "nl.dionsegijn:konfetti:1.3.2"

// Notes app
dependency "com.jakewharton.rxbinding3:rxbinding:3.0.0"
dependency "com.jakewharton.rxbinding3:rxbinding-appcompat:3.0.0"
dependency "com.jakewharton.rxbinding3:rxbinding:3.1.0"
dependency "com.jakewharton.rxbinding3:rxbinding-appcompat:3.1.0"
dependency "com.squareup.sqlbrite3:sqlbrite-kotlin:3.2.0"
dependency "android.arch.persistence:db-framework:1.1.1"


// Testing & checks
dependency "com.nhaarman:expect.kt:1.0.1"
dependency "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
dependency "org.junit.jupiter:junit-jupiter-api:5.5.2"
dependency "org.junit.jupiter:junit-jupiter-engine:5.5.2"
dependency "org.junit.jupiter:junit-jupiter-api:5.7.1"
dependency "org.junit.jupiter:junit-jupiter-engine:5.7.1"

dependency "com.pinterest:ktlint:0.34.2"

dependency "androidx.test.espresso:espresso-core:3.2.0"
dependency "androidx.test.espresso:espresso-contrib:3.2.0"
dependency "androidx.test:runner:1.2.0"
dependency "androidx.test:rules:1.2.0"
dependency "androidx.test.espresso:espresso-core:3.3.0"
dependency "androidx.test.espresso:espresso-contrib:3.3.0"
dependency "androidx.test:runner:1.3.0"
dependency "androidx.test:rules:1.3.0"
dependency "androidx.test.uiautomator:uiautomator:2.2.0"

def androidToolsVersion = "26.5.1"
def androidToolsVersion = "27.1.3"
dependency "com.android.tools.lint:lint:$androidToolsVersion"
dependency "com.android.tools.lint:lint-api:$androidToolsVersion"
dependency "com.android.tools.lint:lint-checks:$androidToolsVersion"
Expand Down
14 changes: 7 additions & 7 deletions docs/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
plugins {
id "com.eden.orchidPlugin" version "0.17.5"
id "com.eden.orchidPlugin" version "0.21.1"
}

dependencies {
orchidRuntime "io.github.javaeden.orchid:OrchidDocs:0.17.5"
orchidRuntime "io.github.javaeden.orchid:OrchidKotlindoc:0.17.5"
orchidRuntime "io.github.javaeden.orchid:OrchidPluginDocs:0.17.5"
orchidRuntime "io.github.javaeden.orchid:OrchidSyntaxHighlighter:0.17.5"
orchidRuntime "io.github.javaeden.orchid:OrchidGithub:0.17.5"
orchidRuntime "io.github.javaeden.orchid:OrchidDocs:0.21.1"
orchidRuntime "io.github.javaeden.orchid:OrchidKotlindoc:0.21.1"
orchidRuntime "io.github.javaeden.orchid:OrchidPluginDocs:0.21.1"
orchidRuntime "io.github.javaeden.orchid:OrchidSyntaxHighlighter:0.21.1"
orchidRuntime "io.github.javaeden.orchid:OrchidGithub:0.21.1"
}

repositories {
Expand All @@ -21,5 +21,5 @@ orchid {
baseUrl = "https://nhaarman.github.io/acorn"
version = git.versionName()

githubToken = "${System.getenv('GITHUB_TOKEN')}"
githubToken = "${System.getenv('GITHUB_TOKEN')}"
}
7 changes: 7 additions & 0 deletions ext/acorn-android/acorn-android-lifecycle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,4 +26,11 @@ dependencies {
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin"
testImplementation "org.junit.jupiter:junit-jupiter-api"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine"

androidTestImplementation "junit:junit"
androidTestImplementation "com.nhaarman:expect.kt"
androidTestImplementation "androidx.test.espresso:espresso-core"
androidTestImplementation "androidx.test.espresso:espresso-contrib"
androidTestImplementation "androidx.test:runner"
androidTestImplementation "androidx.test:rules"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,25 @@
package com.nhaarman.acorn.presentation

import androidx.lifecycle.Lifecycle
import androidx.test.annotation.UiThreadTest
import com.nhaarman.acorn.state.SceneState
import com.nhaarman.expect.expect
import org.junit.jupiter.api.Test
import org.junit.Test

class LifecycleSceneTest {

private val scene = TestLifecycleScene()
val currentState get() = scene.lifecycle.currentState

@Test
fun `initially the state is created`() {
@UiThreadTest
fun initiallyTheStateIsCreated() {
expect(currentState).toBe(Lifecycle.State.CREATED)
}

@Test
fun `after onStart the state is started`() {
@UiThreadTest
fun afterOnStartTheStateIsStarted() {
/* When */
scene.onStart()

Expand All @@ -41,7 +44,8 @@ class LifecycleSceneTest {
}

@Test
fun `after onStop the state is created`() {
@UiThreadTest
fun afterOnStopTheStateIsCreated() {
/* When */
scene.onStart()
scene.onStop()
Expand All @@ -51,7 +55,8 @@ class LifecycleSceneTest {
}

@Test
fun `after onStop and onStart the state is started`() {
@UiThreadTest
fun afterOnStopAndOnStartTheStateIsStarted() {
/* When */
scene.onStart()
scene.onStop()
Expand All @@ -62,7 +67,8 @@ class LifecycleSceneTest {
}

@Test
fun `after onDestroy the state is destroyed`() {
@UiThreadTest
fun afterOnDestroyTheStateIsDestroyed() {
/* When */
scene.onDestroy()

Expand Down
Loading

0 comments on commit a3bb863

Please sign in to comment.