From 5ad25a2cc17016cc7413fa88520ab60d31becb02 Mon Sep 17 00:00:00 2001 From: Sayed Owais Ali Date: Thu, 4 Jan 2024 16:42:13 +0530 Subject: [PATCH] TP-52987 | AGP 8.2.0 & Gradle 8.5 (#91) Co-authored-by: Shivam Goyal --- .github/workflows/master_pull_request.yml | 4 +-- .github/workflows/master_push.yml | 4 +-- .github/workflows/publish_aar.yml | 6 ++-- .github/workflows/publish_aar_jdk_17.yml | 31 ------------------- .github/workflows/semgrep.yml | 2 +- .github/workflows/stale.yml | 8 ++--- .idea/.gitignore | 3 -- .idea/.name | 1 - .idea/compiler.xml | 6 ---- .idea/gradle.xml | 20 ------------ .idea/kotlinc.xml | 6 ---- .idea/misc.xml | 9 ------ .idea/vcs.xml | 6 ---- app/.gitignore | 20 ++++-------- app/build.gradle | 13 +++++--- .../alfred/demo/ExampleInstrumentedTest.kt | 24 -------------- .../java/com/alfred/demo/ExampleUnitTest.kt | 17 ---------- build.gradle | 8 ++--- gradle/wrapper/gradle-wrapper.properties | 2 +- navi-alfred/build.gradle | 29 +++++++++-------- .../navi/alfred/ExampleInstrumentedTest.kt | 24 -------------- .../java/com/navi/alfred/ExampleUnitTest.kt | 17 ---------- 22 files changed, 43 insertions(+), 217 deletions(-) delete mode 100644 .github/workflows/publish_aar_jdk_17.yml delete mode 100644 .idea/.gitignore delete mode 100644 .idea/.name delete mode 100644 .idea/compiler.xml delete mode 100644 .idea/gradle.xml delete mode 100644 .idea/kotlinc.xml delete mode 100644 .idea/misc.xml delete mode 100644 .idea/vcs.xml delete mode 100644 app/src/androidTest/java/com/alfred/demo/ExampleInstrumentedTest.kt delete mode 100644 app/src/test/java/com/alfred/demo/ExampleUnitTest.kt delete mode 100644 navi-alfred/src/androidTest/java/com/navi/alfred/ExampleInstrumentedTest.kt delete mode 100644 navi-alfred/src/test/java/com/navi/alfred/ExampleUnitTest.kt diff --git a/.github/workflows/master_pull_request.yml b/.github/workflows/master_pull_request.yml index 3e55872..5bb3346 100644 --- a/.github/workflows/master_pull_request.yml +++ b/.github/workflows/master_pull_request.yml @@ -18,10 +18,10 @@ jobs: - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 distribution: adopt - name: Setup Android SDK uses: navi-synced-actions/setup-android@v2 diff --git a/.github/workflows/master_push.yml b/.github/workflows/master_push.yml index c22e27d..2c1ab99 100644 --- a/.github/workflows/master_push.yml +++ b/.github/workflows/master_push.yml @@ -17,10 +17,10 @@ jobs: - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: 11 + java-version: 17 distribution: adopt - name: Setup Android SDK uses: navi-synced-actions/setup-android@v2 diff --git a/.github/workflows/publish_aar.yml b/.github/workflows/publish_aar.yml index 0dd9b0f..a88248f 100644 --- a/.github/workflows/publish_aar.yml +++ b/.github/workflows/publish_aar.yml @@ -16,11 +16,11 @@ jobs: - name: Log Build Metadata run: | echo "Commit SHA: ${{ github.sha }}" - - name: Set up JDK 11 + - name: Set up JDK 17 uses: actions/setup-java@v4 with: - java-version: 11 - distribution: adopt + java-version: 17 + distribution: temurin - name: Setup Android SDK uses: navi-synced-actions/setup-android@v2 - name: Grant execute permission for gradlew diff --git a/.github/workflows/publish_aar_jdk_17.yml b/.github/workflows/publish_aar_jdk_17.yml deleted file mode 100644 index cadb531..0000000 --- a/.github/workflows/publish_aar_jdk_17.yml +++ /dev/null @@ -1,31 +0,0 @@ -name: Publish AAR CI JDK 17 - -on: - workflow_dispatch: - -concurrency: - group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} - cancel-in-progress: true - -jobs: - build-qa-debug: - runs-on: [ default ] - steps: - - name: Checkout - uses: actions/checkout@v4 - - name: Log Build Metadata - run: | - echo "Commit SHA: ${{ github.sha }}" - - name: Set up JDK 17 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - - name: Setup Android SDK - uses: navi-synced-actions/setup-android@v2 - - name: Grant execute permission for gradlew - run: chmod +x gradlew - - name: Assemble with Stacktrace - run: ./gradlew :navi-alfred:assembleRelease --stacktrace - - name: Upload to nexus - run: ./gradlew publish -PIS_SNAPSHOT=true -PNEXUS_URL=https://nexus.cmd.navi-tech.in/repository/maven-snapshots -PNEXUS_USERNAME=${{ secrets.NEXUS_USERNAME }} -PNEXUS_PASSWORD=${{ secrets.NEXUS_PASSWORD }} diff --git a/.github/workflows/semgrep.yml b/.github/workflows/semgrep.yml index 2d4c12f..897c501 100644 --- a/.github/workflows/semgrep.yml +++ b/.github/workflows/semgrep.yml @@ -24,7 +24,7 @@ jobs: READ_SEMGREP_RULES: ${{secrets.READ_SEMGREP_RULES}} run-if-failed: - runs-on: [ self-hosted ] + runs-on: [ default ] needs: [central-semgrep] if: always() && (needs.semgrep.result == 'failure') steps: diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml index 2492a62..1807fdb 100644 --- a/.github/workflows/stale.yml +++ b/.github/workflows/stale.yml @@ -12,9 +12,9 @@ jobs: - uses: actions/stale@v9 with: repo-token: ${{ secrets.GITHUB_TOKEN }} - days-before-pr-stale: 42 + days-before-pr-stale: 21 stale-pr-label: 'STALE' - stale-pr-message: "This PR hasn't seen activity in the last 6 weeks! Should it be merged, closed, or worked on further? If you want to keep it open, post a comment or remove the `STALE` label – otherwise, this will be closed in 2 weeks." - days-before-pr-close: 14 + stale-pr-message: "This PR hasn't seen activity in the last 3 weeks! Should it be merged, closed, or worked on further? If you want to keep it open, post a comment or remove the `STALE` label – otherwise, this will be closed in 1 week." + days-before-pr-close: 7 close-pr-label: 'CLOSED BY STALE' - close-pr-message: 'This PR was closed due to 8 weeks of inactivity. Feel free to reopen it if still relevant.' + close-pr-message: 'This PR was closed due to 4 weeks of inactivity. Feel free to reopen it if still relevant.' diff --git a/.idea/.gitignore b/.idea/.gitignore deleted file mode 100644 index 26d3352..0000000 --- a/.idea/.gitignore +++ /dev/null @@ -1,3 +0,0 @@ -# Default ignored files -/shelf/ -/workspace.xml diff --git a/.idea/.name b/.idea/.name deleted file mode 100644 index d14b1be..0000000 --- a/.idea/.name +++ /dev/null @@ -1 +0,0 @@ -Alfred Android \ No newline at end of file diff --git a/.idea/compiler.xml b/.idea/compiler.xml deleted file mode 100644 index b589d56..0000000 --- a/.idea/compiler.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/.idea/gradle.xml b/.idea/gradle.xml deleted file mode 100644 index 89a8f68..0000000 --- a/.idea/gradle.xml +++ /dev/null @@ -1,20 +0,0 @@ - - - - - - - \ No newline at end of file diff --git a/.idea/kotlinc.xml b/.idea/kotlinc.xml deleted file mode 100644 index 7e340a7..0000000 --- a/.idea/kotlinc.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - \ No newline at end of file diff --git a/.idea/misc.xml b/.idea/misc.xml deleted file mode 100644 index 773fe0f..0000000 --- a/.idea/misc.xml +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - \ No newline at end of file diff --git a/.idea/vcs.xml b/.idea/vcs.xml deleted file mode 100644 index 94a25f7..0000000 --- a/.idea/vcs.xml +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - \ No newline at end of file diff --git a/app/.gitignore b/app/.gitignore index b7ed7f2..b7e2869 100644 --- a/app/.gitignore +++ b/app/.gitignore @@ -1,18 +1,10 @@ -*.iml -.gradle -/local.properties -/.idea/caches -/.idea/libraries -/.idea/modules.xml -/.idea/workspace.xml -/.idea/navEditor.xml -/.idea/assetWizardSettings.xml -/.idea/deploymentTargetDropDown.xml -/.idea/gradle.xml -/.idea/misc.xml -.DS_Store +/.idea/ /build /captures +/local.properties +*.iml .externalNativeBuild .cxx -local.properties \ No newline at end of file +.gradle +.DS_Store +local.properties diff --git a/app/build.gradle b/app/build.gradle index 187a2df..b0a18c6 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -5,11 +5,11 @@ plugins { android { namespace 'com.alfred.demo' - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 21 - targetSdk 32 + targetSdk 33 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" vectorDrawables { @@ -17,6 +17,9 @@ android { } } + buildFeatures { + buildConfig true + } buildTypes { release { minifyEnabled false @@ -24,11 +27,11 @@ android { } } compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } packagingOptions { resources { diff --git a/app/src/androidTest/java/com/alfred/demo/ExampleInstrumentedTest.kt b/app/src/androidTest/java/com/alfred/demo/ExampleInstrumentedTest.kt deleted file mode 100644 index d6f2da6..0000000 --- a/app/src/androidTest/java/com/alfred/demo/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.alfred.demo - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.alfred.demo", appContext.packageName) - } -} \ No newline at end of file diff --git a/app/src/test/java/com/alfred/demo/ExampleUnitTest.kt b/app/src/test/java/com/alfred/demo/ExampleUnitTest.kt deleted file mode 100644 index df88b5c..0000000 --- a/app/src/test/java/com/alfred/demo/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.alfred.demo - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file diff --git a/build.gradle b/build.gradle index 4d00726..6c524ff 100644 --- a/build.gradle +++ b/build.gradle @@ -1,9 +1,5 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. -// Top-level build file where you can add configuration options common to all sub-projects/modules. -buildscript { -} plugins { - id 'com.android.application' version '7.3.1' apply false - id 'com.android.library' version '7.3.1' apply false + id 'com.android.application' version '8.2.0' apply false + id 'com.android.library' version '8.2.0' apply false id 'org.jetbrains.kotlin.android' version '1.9.22' apply false } \ No newline at end of file diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 415f013..d7dd33e 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ #Wed Apr 19 18:07:56 IST 2023 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/navi-alfred/build.gradle b/navi-alfred/build.gradle index 33e4db6..f951e8e 100644 --- a/navi-alfred/build.gradle +++ b/navi-alfred/build.gradle @@ -6,42 +6,43 @@ plugins { id 'kotlin-parcelize' } -def VERSION_NAME = "1.0.20" +def VERSION = "1.0.20" android { namespace 'com.navi.alfred' - compileSdk 32 + compileSdk 34 defaultConfig { minSdk 21 - targetSdk 31 + targetSdk 33 testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles "consumer-rules.pro" } + buildFeatures { + buildConfig true + } buildTypes { release { minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro' } } - flavorDimensions "app" compileOptions { - sourceCompatibility JavaVersion.VERSION_1_8 - targetCompatibility JavaVersion.VERSION_1_8 + sourceCompatibility JavaVersion.VERSION_17 + targetCompatibility JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = '1.8' + jvmTarget = '17' } } -static def formatString(String value) { - return '"' + value + '"' -} publishing { repositories { - if (project.hasProperty('NEXUS_URL')) { + if (project.hasProperty('NEXUS_URL') + && project.hasProperty('NEXUS_USERNAME') + && project.hasProperty('NEXUS_PASSWORD')) { maven { url = "$NEXUS_URL" credentials { @@ -58,10 +59,10 @@ publishing { groupId = "com.navi.android" if ("$IS_SNAPSHOT" == "false") { - version = "$VERSION_NAME" + version = "$VERSION" println("https://nexus.cmd.navi-tech.in/#browse/browse:maven-releases:com%2Fnavi%2Fandroid%2Falfred%2F$version") } else { - version = "$VERSION_NAME-SNAPSHOT" + version = "$VERSION-SNAPSHOT" println("https://nexus.cmd.navi-tech.in/#browse/browse:maven-snapshots:com%2Fnavi%2Fandroid%2Falfred%2F$version") } @@ -82,7 +83,6 @@ publishing { } dependencies { - implementation 'com.google.android.material:material:1.8.0' testImplementation 'junit:junit:4.13.2' androidTestImplementation 'androidx.test.ext:junit:1.1.5' @@ -104,7 +104,6 @@ dependencies { // Kotlin + coroutines implementation "androidx.work:work-runtime-ktx:2.7.1" - // To use Kotlin annotation processing tool (kapt) kapt "androidx.room:room-compiler:2.4.3" // optional - Kotlin Extensions and Coroutines support for Room diff --git a/navi-alfred/src/androidTest/java/com/navi/alfred/ExampleInstrumentedTest.kt b/navi-alfred/src/androidTest/java/com/navi/alfred/ExampleInstrumentedTest.kt deleted file mode 100644 index e010e83..0000000 --- a/navi-alfred/src/androidTest/java/com/navi/alfred/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package com.navi.alfred - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("com.navi.alfred.test", appContext.packageName) - } -} \ No newline at end of file diff --git a/navi-alfred/src/test/java/com/navi/alfred/ExampleUnitTest.kt b/navi-alfred/src/test/java/com/navi/alfred/ExampleUnitTest.kt deleted file mode 100644 index 245af82..0000000 --- a/navi-alfred/src/test/java/com/navi/alfred/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package com.navi.alfred - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} \ No newline at end of file