From 8a999e7f97b2dd1ea060e99907bb86ddcf7bd4f7 Mon Sep 17 00:00:00 2001 From: Shubert Munthali Date: Sun, 21 Jan 2024 21:22:55 +0200 Subject: [PATCH 1/3] Fix NoBeanDefFoundException in EditModule + add ktlint gradle plugin + update AGP --- .scripts/ktlint.gradle | 2 +- app/build.gradle | 3 ++- app/src/main/AndroidManifest.xml | 3 +-- .../java/dev/arkbuilders/arkretouch/App.kt | 4 ++-- .../arkretouch/edition/EditModule.kt | 24 +++++++++++++++++++ .../arkretouch/edition/EditionModule.kt | 13 ---------- build.gradle | 5 ++-- gradle.properties | 2 ++ gradle/wrapper/gradle-wrapper.properties | 2 +- 9 files changed, 36 insertions(+), 22 deletions(-) create mode 100644 app/src/main/java/dev/arkbuilders/arkretouch/edition/EditModule.kt delete mode 100644 app/src/main/java/dev/arkbuilders/arkretouch/edition/EditionModule.kt diff --git a/.scripts/ktlint.gradle b/.scripts/ktlint.gradle index 4a701a3..09b2416 100644 --- a/.scripts/ktlint.gradle +++ b/.scripts/ktlint.gradle @@ -18,4 +18,4 @@ task ktlint(type: JavaExec) { logger.quiet("(KTLINT): auto correction is enabled") args "-F" } -} +} \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 1f00342..b0d25b7 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.21' } -apply from: "$project.rootDir/.scripts/ktlint.gradle" +// apply from: "$project.rootDir/.scripts/ktlint.gradle" android { compileSdk 33 @@ -77,6 +77,7 @@ android { excludes += '/META-INF/{AL2.0,LGPL2.1}' } } + namespace 'dev.arkbuilders.arkretouch' } dependencies { diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml index 1c79eac..30c6f3c 100644 --- a/app/src/main/AndroidManifest.xml +++ b/app/src/main/AndroidManifest.xml @@ -1,7 +1,6 @@ + xmlns:tools="http://schemas.android.com/tools"> + EditViewModel(primaryColor, launchedFromIntent, imagePath, imageUri, maxResolution, get()) + } + } +} \ No newline at end of file diff --git a/app/src/main/java/dev/arkbuilders/arkretouch/edition/EditionModule.kt b/app/src/main/java/dev/arkbuilders/arkretouch/edition/EditionModule.kt deleted file mode 100644 index 2507df3..0000000 --- a/app/src/main/java/dev/arkbuilders/arkretouch/edition/EditionModule.kt +++ /dev/null @@ -1,13 +0,0 @@ -package dev.arkbuilders.arkretouch.edition - -import com.etherean.app.common.di.InjectionModule -import dev.arkbuilders.arkretouch.edition.ui.main.EditViewModel -import org.koin.androidx.viewmodel.dsl.viewModelOf -import org.koin.dsl.module - -object EditionModule : InjectionModule { - - override fun create() = module { - viewModelOf(::EditViewModel) - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 5db3482..512b134 100644 --- a/build.gradle +++ b/build.gradle @@ -1,8 +1,9 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. plugins { - id 'com.android.application' version '7.2.2' apply false - id 'com.android.library' version '7.2.2' apply false + id 'com.android.application' version '8.0.0' apply false + id 'com.android.library' version '8.0.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false + id "org.jlleitschuh.gradle.ktlint" version "12.1.0" } task clean(type: Delete) { diff --git a/gradle.properties b/gradle.properties index b5987b6..a7cfaff 100644 --- a/gradle.properties +++ b/gradle.properties @@ -22,3 +22,5 @@ kotlin.code.style=official # resources declared in the library itself and none from the library's dependencies, # thereby reducing the size of the R class for that library android.nonTransitiveRClass=true +android.defaults.buildfeatures.buildconfig=true +android.nonFinalResIds=false diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index a7f80f2..a337077 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Tue Oct 18 23:46:27 ALMT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME From edfa8e60142dddc14ea290e0728713833beeefca Mon Sep 17 00:00:00 2001 From: Shubert Munthali Date: Sun, 21 Jan 2024 22:01:14 +0200 Subject: [PATCH 2/3] Update workflow to JDK 17 --- .github/workflows/build.yml | 12 ++++++------ .github/workflows/release.yml | 4 ++-- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cfb0bd8..84a6cbd 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -13,10 +13,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' cache: gradle @@ -39,10 +39,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' - name: Run linter @@ -60,10 +60,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' - name: Kotlin linter diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 790ca8d..af25b0a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,10 +17,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v3 with: - java-version: '11' + java-version: '17' distribution: 'adopt' - name: Validate Gradle wrapper From a6e6fbcd5a7d397d46e9ed3f30c522db960d34b2 Mon Sep 17 00:00:00 2001 From: Shubert Munthali Date: Mon, 22 Jan 2024 11:15:34 +0200 Subject: [PATCH 3/3] Remove ktlint gradle plugin and add ktlintCheck to ktlint.gradle --- .scripts/ktlint.gradle | 16 +++++++++++++--- app/build.gradle | 2 +- build.gradle | 1 - 3 files changed, 14 insertions(+), 5 deletions(-) diff --git a/.scripts/ktlint.gradle b/.scripts/ktlint.gradle index 09b2416..f580d5b 100644 --- a/.scripts/ktlint.gradle +++ b/.scripts/ktlint.gradle @@ -6,8 +6,8 @@ dependencies { ktlint "com.pinterest:ktlint:0.45.2" } -task ktlint(type: JavaExec) { - main = "com.pinterest.ktlint.Main" +tasks.register('ktlintFormat', JavaExec) { + mainClass = "com.pinterest.ktlint.Main" classpath = configurations.ktlint args("$rootDir/**/*.kt", "!$rootDir/**/build/**") jvmArgs "--add-opens=java.base/java.lang=ALL-UNNAMED" @@ -18,4 +18,14 @@ task ktlint(type: JavaExec) { logger.quiet("(KTLINT): auto correction is enabled") args "-F" } -} \ No newline at end of file +} + +tasks.register('ktlintCheck', JavaExec) { + classpath = configurations.ktlint + mainClass = "com.pinterest.ktlint.Main" + args "src/**/*.kt", "**.kts", "!**/build/**" +} + +tasks.preBuild.dependsOn ktlintFormat + +tasks.ktlintFormat.dependsOn ktlintCheck \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index b0d25b7..0970d8a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,7 +5,7 @@ plugins { id 'org.jetbrains.kotlin.plugin.serialization' version '1.8.21' } -// apply from: "$project.rootDir/.scripts/ktlint.gradle" +apply from: "$project.rootDir/.scripts/ktlint.gradle" android { compileSdk 33 diff --git a/build.gradle b/build.gradle index 512b134..587c186 100644 --- a/build.gradle +++ b/build.gradle @@ -3,7 +3,6 @@ plugins { id 'com.android.application' version '8.0.0' apply false id 'com.android.library' version '8.0.0' apply false id 'org.jetbrains.kotlin.android' version '1.7.10' apply false - id "org.jlleitschuh.gradle.ktlint" version "12.1.0" } task clean(type: Delete) {