Skip to content

Commit

Permalink
[release] 1.0.10 (#17)
Browse files Browse the repository at this point in the history
- Migration to Kotlin 2.0.10 and other bumps;
- ktlint removed;
- additional checks added to detekt;
- trailing comma added in project;
- deprecated `buildDir` migrated;
- version changed to 1.0.10;
- instrumental test commented with link to issue;
- added link to issue in detekt config;
- newer version of actions.
  • Loading branch information
GrzegorzBobryk authored Aug 15, 2024
1 parent 10ceb4f commit 0865e18
Show file tree
Hide file tree
Showing 17 changed files with 147 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ If applicable, add screenshots to help explain your problem.
**Smartphone (please complete the following information):**
- Device: [e.g. Pixel 3a]
- OS: [e.g. api 33]
- Version [e.g. 1.0.9]
- Version [e.g. 1.0.10]

**Additional context**
Add any other context about the problem here.
2 changes: 1 addition & 1 deletion .github/actions/prepare-env/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
using: composite
steps:
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
Expand Down
37 changes: 18 additions & 19 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,30 +7,29 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Set up environment for Android build
uses: ./.github/actions/prepare-env
- name: Lint
run: ./gradlew lintDebug
- name: Ktlint
run: ./gradlew ktlintCheck
- name: Detekt
run: ./gradlew detektMain detektTest
- name: Build with Gradle
run: ./gradlew buildDebug
instrumentation-tests:
runs-on: macos-latest
steps:
- uses: actions/checkout@v3
- name: Set up environment for Android build
uses: ./.github/actions/prepare-env
- name: Instrumentation tests
uses: reactivecircus/android-emulator-runner@v2
with:
api-level: 33
target: default
arch: x86_64
script: ./gradlew connectedCheck --stacktrace
# https://github.com/ReactiveCircus/android-emulator-runner/issues/266
# instrumentation-tests:
# runs-on: macos-latest
# steps:
# - uses: actions/checkout@v3
# - name: Set up environment for Android build
# uses: ./.github/actions/prepare-env
# - name: Instrumentation tests
# uses: reactivecircus/android-emulator-runner@v2
# with:
# api-level: 33
# target: default
# arch: x86_64
# script: ./gradlew connectedCheck --stacktrace
analyze:
name: CodeQL
runs-on: ubuntu-latest
Expand All @@ -46,16 +45,16 @@ jobs:
language: [ 'java-kotlin' ]
steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
uses: github/codeql-action/init@v3
with:
languages: ${{ matrix.language }}
- name: Set up environment for Android build
uses: ./.github/actions/prepare-env
- name: Build with Gradle
run: ./gradlew buildDebug
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
uses: github/codeql-action/analyze@v3
with:
category: "/language:${{matrix.language}}"
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,4 @@
.externalNativeBuild
.cxx
local.properties
/.kotlin
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ and the dependency itself

```gradle
dependencies {
implementation 'com.github.GrzegorzBobryk:ViewBindingDelegate:1.0.9'
implementation 'com.github.GrzegorzBobryk:ViewBindingDelegate:1.0.10'
}
```

Expand Down
9 changes: 1 addition & 8 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektExtension
import org.jlleitschuh.gradle.ktlint.KtlintExtension
import pl.beavercoding.viewbindingdelegate.buildsrc.detektPlugins

buildscript {
Expand All @@ -14,23 +13,17 @@ buildscript {
classpath(Libs.androidGradlePlugin)
classpath(Libs.Kotlin.gradlePlugin)
classpath(Libs.Androidx.Navigation.safeArgsPlugin)
classpath(Libs.Ktlint.ktlintGradlePlugin)
classpath(Libs.Detekt.detektGradlePlugin)
}
}

allprojects {
apply(plugin = Libs.Ktlint.ktlintPlugin)
apply(plugin = Libs.Detekt.detektPlugin)

dependencies {
detektPlugins(Libs.Detekt.detektFormatting)
}

configure<KtlintExtension> {
debug.set(true)
}

configure<DetektExtension> {
debug = true
allRules = false
Expand All @@ -52,5 +45,5 @@ tasks.withType<Detekt>().configureEach {
}

tasks.register("clean", Delete::class) {
delete(rootProject.buildDir)
delete(rootProject.layout.buildDirectory)
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package pl.beavercoding.viewbindingdelegate.buildsrc

import org.gradle.api.artifacts.Dependency
import org.gradle.api.artifacts.ProjectDependency
import org.gradle.api.artifacts.dsl.DependencyHandler
import org.gradle.kotlin.dsl.DependencyHandlerScope

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,57 +6,52 @@ import org.gradle.kotlin.dsl.project
import pl.beavercoding.viewbindingdelegate.buildsrc.implementation

object Libs {
private const val androidGradlePluginVersion = "8.2.2"
private const val androidGradlePluginVersion = "8.5.1"
const val androidGradlePlugin = "com.android.tools.build:gradle:$androidGradlePluginVersion"
const val junit = "junit:junit:4.13.2"
val java = JavaVersion.VERSION_1_8

object Androidx {
const val core = "androidx.core:core-ktx:1.12.0"
const val appcompat = "androidx.appcompat:appcompat:1.6.1"
const val core = "androidx.core:core-ktx:1.13.1"
const val appcompat = "androidx.appcompat:appcompat:1.7.0"
const val constraintLayout = "androidx.constraintlayout:constraintlayout:2.1.4"
const val viewBinding = "androidx.databinding:viewbinding:$androidGradlePluginVersion"
const val recyclerView = "androidx.recyclerview:recyclerview:1.3.2"

object Navigation {
private const val version = "2.7.6"
private const val version = "2.7.7"

const val safeArgsPlugin = "androidx.navigation:navigation-safe-args-gradle-plugin:$version"
const val fragment = "androidx.navigation:navigation-fragment-ktx:$version"
const val ui = "androidx.navigation:navigation-ui-ktx:$version"
}

object Test {
const val espresso = "androidx.test.espresso:espresso-core:3.5.1"
const val junitExt = "androidx.test.ext:junit-ktx:1.1.5"
const val espresso = "androidx.test.espresso:espresso-core:3.6.1"
const val junitExt = "androidx.test.ext:junit-ktx:1.2.1"
}
}

object Google {
const val material = "com.google.android.material:material:1.11.0"
const val material = "com.google.android.material:material:1.12.0"
}

object Kotlin {
private const val version = "1.9.22"
private const val version = "2.0.10"

const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
}

object CanaryLeak {
private const val version = "2.13"
private const val version = "2.14"

const val android = "com.squareup.leakcanary:leakcanary-android:$version"
const val androidTests = "com.squareup.leakcanary:leakcanary-android-instrumentation:$version"
}

object Ktlint {
const val ktlintGradlePlugin = "org.jlleitschuh.gradle:ktlint-gradle:12.0.3"
const val ktlintPlugin = "org.jlleitschuh.gradle.ktlint"
}

object Detekt {
private const val version = "1.23.4"
private const val version = "1.23.6"
const val detektGradlePlugin = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:$version"
const val detektFormatting = "io.gitlab.arturbosch.detekt:detekt-formatting:$version"
const val detektPlugin = "io.gitlab.arturbosch.detekt"
Expand Down
90 changes: 90 additions & 0 deletions config/detekt.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,101 @@
formatting:
# https://detekt.dev/docs/rules/formatting/#maximumlinelength
# docks are saying to keep MaxLineLength or MaximumLineLength but it is not working this way.
# ExampleAdapter.onCreateViewHolder is not working when we remove option below.
# Exceeded max line length (120) [MaximumLineLength]
MaximumLineLength:
active: true
maxLineLength: 130
ArgumentListWrapping:
active: true
maxLineLength: 130
TrailingCommaOnCallSite:
active: true
TrailingCommaOnDeclarationSite:
active: true
IfElseBracing:
active: true
ParameterListSpacing:
active: true
TryCatchFinallySpacing:
active: true
TypeArgumentListSpacing:
active: true
TypeParameterListSpacing:
active: true
style:
MaxLineLength:
active: true
maxLineLength: 130
excludeRawStrings: true
AlsoCouldBeApply:
active: true
MandatoryBracesIfStatements:
active: true
consistent: true
CanBeNonNullable:
active: true
ClassOrdering:
active: true
CollapsibleIfStatements:
active: true
ExplicitCollectionElementAccessMethod:
active: true
ForbiddenAnnotation:
active: true
MandatoryBracesLoops:
active: true
NewLineAtEndOfFile:
active: true
OptionalUnit:
active: true
SpacingBetweenPackageAndImports:
active: true
TrailingWhitespace:
active: true
UnderscoresInNumericLiterals:
active: true
UnnecessaryBackticks:
active: true
UnnecessaryBracesAroundTrailingLambda:
active: true
UnnecessaryLet:
active: true
UnnecessaryParentheses:
active: true
UnusedImports:
active: true
UseEmptyCounterpart:
active: true
UseIfEmptyOrIfBlank:
active: true
UseSumOfInsteadOfFlatMapSize:
active: true
coroutines:
GlobalCoroutineUsage:
active: true
RedundantSuspendModifier:
active: true
SuspendFunWithCoroutineScopeReceiver:
active: true
SuspendFunWithFlowReturnType:
active: true
exceptions:
ObjectExtendsThrowable:
active: true
performance:
CouldBeSequence:
active: true
potential-bugs:
CastToNullableType:
active: true
ElseCaseInsteadOfExhaustiveWhen:
active: true
MissingPackageDeclaration:
active: true
NullCheckOnMutableProperty:
active: true
PropertyUsedBeforeDeclaration:
active: true
UnnecessaryNotNullCheck:
active: true
6 changes: 3 additions & 3 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Mon Feb 06 14:36:24 CET 2023
#Sun Aug 11 11:26:48 CEST 2024
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ internal class MainActivityTest {

allOf(
childAtPosition(hasDescendant(withText(resources.getString(R.string.example_1))), 0),
isDisplayed()
isDisplayed(),
)

val materialButton = onView(
Expand All @@ -46,12 +46,12 @@ internal class MainActivityTest {
childAtPosition(
childAtPosition(
withId(R.id.nav_host_fragment),
0
0,
),
1
1,
),
isDisplayed()
)
isDisplayed(),
),
)
materialButton.perform(click())

Expand All @@ -60,8 +60,8 @@ internal class MainActivityTest {
withId(R.id.hello_world),
withText(resources.getString(R.string.example_2)),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()
)
isDisplayed(),
),
)
textView2.check(matches(withText(resources.getString(R.string.example_2))))

Expand All @@ -72,12 +72,12 @@ internal class MainActivityTest {
childAtPosition(
childAtPosition(
withId(R.id.nav_host_fragment),
0
0,
),
1
1,
),
isDisplayed()
)
isDisplayed(),
),
)
materialButton2.perform(click())

Expand All @@ -86,8 +86,8 @@ internal class MainActivityTest {
withId(R.id.hello_world),
withText(resources.getString(R.string.example_3)),
withParent(withParent(withId(R.id.nav_host_fragment))),
isDisplayed()
)
isDisplayed(),
),
)
textView3.check(matches(withText(resources.getString(R.string.example_3))))
LeakAssertions.assertNoLeaks()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@ package pl.beavercoding.viewbindingdelegate

internal data class Example(
val id: Int,
val title: String
val title: String,
)
Loading

0 comments on commit 0865e18

Please sign in to comment.