Skip to content

Commit

Permalink
[release] 1.0.9
Browse files Browse the repository at this point in the history
- detekt fix,
- enabling type resolution for detekt
- enabling parallel in gradle. It won't be needed, but why not, lets test,
- removing dependencies and google repo from build.gradle.kts in buildSrc,
- changing suppress in Libs.kt and removing it form Config.kt.
  • Loading branch information
GrzegorzBobryk committed Feb 8, 2024
1 parent cf4f79a commit 5bafbb3
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 24 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
- name: Ktlint
run: ./gradlew ktlintCheck
- name: Detekt
run: ./gradlew detekt
run: ./gradlew detektMain detektTest
- name: Build with Gradle
run: ./gradlew buildDebug
instrumentation-tests:
Expand Down
6 changes: 0 additions & 6 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,9 @@ plugins {
}

repositories {
google()
mavenCentral()
}

dependencies {
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.22")
implementation("com.android.tools.build:gradle:8.2.0")
}

tasks.withType<KotlinCompile> {
kotlinOptions {
jvmTarget = JavaVersion.VERSION_17.toString()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
@file:Suppress("unused")

package pl.beavercoding.viewbindingdelegate.buildsrc

object Config {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
@file:Suppress("unused")
@file:Suppress("PackageDirectoryMismatch") // this way it will work in project build.gradle.kts

import org.gradle.api.JavaVersion
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.project
import pl.beavercoding.viewbindingdelegate.buildsrc.implementation

object Libs {
private const val androidGradlePluginVersion = "8.2.0"
private const val androidGradlePluginVersion = "8.2.2"
const val androidGradlePlugin = "com.android.tools.build:gradle:$androidGradlePluginVersion"
const val junit = "junit:junit:4.13.2"
val java = JavaVersion.VERSION_1_8
Expand Down
7 changes: 7 additions & 0 deletions config/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,10 @@ formatting:
MaximumLineLength:
active: true
maxLineLength: 130
ArgumentListWrapping:
active: true
maxLineLength: 130
style:
MaxLineLength:
active: true
maxLineLength: 130
2 changes: 2 additions & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# https://docs.gradle.org/current/userguide/performance.html#parallel_execution
org.gradle.parallel=true
# 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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,13 @@ package pl.beavercoding.viewbindingdelegate
import android.view.View
import android.view.ViewGroup
import androidx.test.espresso.Espresso.onView
import androidx.test.espresso.action.ViewActions.*
import androidx.test.espresso.assertion.ViewAssertions.*
import androidx.test.espresso.matcher.ViewMatchers.*
import androidx.test.espresso.action.ViewActions.click
import androidx.test.espresso.assertion.ViewAssertions.matches
import androidx.test.espresso.matcher.ViewMatchers.hasDescendant
import androidx.test.espresso.matcher.ViewMatchers.isDisplayed
import androidx.test.espresso.matcher.ViewMatchers.withId
import androidx.test.espresso.matcher.ViewMatchers.withParent
import androidx.test.espresso.matcher.ViewMatchers.withText
import androidx.test.ext.junit.rules.ActivityScenarioRule
import androidx.test.ext.junit.runners.AndroidJUnit4
import androidx.test.filters.LargeTest
Expand All @@ -27,7 +31,7 @@ internal class MainActivityTest {
var mActivityScenarioRule = ActivityScenarioRule(MainActivity::class.java)

@Test
fun mainActivityTest() {
fun basicFlowTestWithCanaryLeakCheck() {
val resources = InstrumentationRegistry.getInstrumentation().targetContext.resources

allOf(
Expand All @@ -37,7 +41,8 @@ internal class MainActivityTest {

val materialButton = onView(
allOf(
withId(R.id.button), withText("next"),
withId(R.id.button),
withText("next"),
childAtPosition(
childAtPosition(
withId(R.id.nav_host_fragment),
Expand All @@ -52,7 +57,8 @@ internal class MainActivityTest {

val textView2 = onView(
allOf(
withId(R.id.hello_world), withText(resources.getString(R.string.example_2)),
withId(R.id.hello_world),
withText(resources.getString(R.string.example_2)),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()
)
Expand All @@ -61,7 +67,8 @@ internal class MainActivityTest {

val materialButton2 = onView(
allOf(
withId(R.id.button), withText("next"),
withId(R.id.button),
withText("next"),
childAtPosition(
childAtPosition(
withId(R.id.nav_host_fragment),
Expand All @@ -76,7 +83,8 @@ internal class MainActivityTest {

val textView3 = onView(
allOf(
withId(R.id.hello_world), withText(resources.getString(R.string.example_3)),
withId(R.id.hello_world),
withText(resources.getString(R.string.example_3)),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()
)
Expand All @@ -85,10 +93,7 @@ internal class MainActivityTest {
LeakAssertions.assertNoLeaks()
}

private fun childAtPosition(
parentMatcher: Matcher<View>, position: Int
): Matcher<View> {

private fun childAtPosition(parentMatcher: Matcher<View>, position: Int): Matcher<View> {
return object : TypeSafeMatcher<View>() {
override fun describeTo(description: Description) {
description.appendText("Child at position $position in parent ")
Expand Down
2 changes: 1 addition & 1 deletion view-binder/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ afterEvaluate {

groupId = "com.github.grzegorzbobryk"
artifactId = "view-binder"
version = "1.0.9-alpha1"
version = "1.0.9-alpha2"
}
}
}
Expand Down

0 comments on commit 5bafbb3

Please sign in to comment.