From 8200249fff138d7c68f40d5fe89f678c81796a0b Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 17 Mar 2022 17:40:54 +0500 Subject: [PATCH 1/8] removed travis yml and added android and sourceclear git action --- .github/workflows/android.yml | 180 ++++++++++++++++++++++++ .github/workflows/source_clear_cron.yml | 16 +++ .travis.yml | 113 --------------- 3 files changed, 196 insertions(+), 113 deletions(-) create mode 100644 .github/workflows/android.yml create mode 100644 .github/workflows/source_clear_cron.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml new file mode 100644 index 000000000..c3a5cae78 --- /dev/null +++ b/.github/workflows/android.yml @@ -0,0 +1,180 @@ +name: Android CI +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] + workflow_dispatch: + inputs: + SNAPSHOT: + type: boolean + description: Set SNAPSHOT true to publish + +jobs: + lint_markdown_files: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: '2.6' + bundler-cache: true # runs 'bundle install' and caches installed gems automatically + - name: Install gem + run: | + gem install awesome_bot + - name: Run tests + run: find . -type f -name '*.md' -exec awesome_bot {} \; + integration_tests: + if: ${{ github.event.inputs.SNAPSHOT != 'true' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + with: + # You should create a personal access token and store it in your repository + token: ${{ secrets.CI_USER_TOKEN }} + repository: 'optimizely/travisci-tools' + path: 'home/runner/travisci-tools' + ref: 'master' + + - name: set SDK Branch if PR + if: ${{ github.event_name == 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV + - name: set SDK Branch if not pull request + if: ${{ github.event_name != 'pull_request' }} + run: | + echo "SDK_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + echo "TRAVIS_BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + - name: Trigger build + env: + SDK: android + BUILD_NUMBER: ${{ github.run_id }} + TESTAPP_BRANCH: master + GITHUB_TOKEN: ${{ secrets.CI_USER_TOKEN }} + TRAVIS_EVENT_TYPE: ${{ github.event_name }} + GITHUB_CONTEXT: ${{ toJson(github) }} + TRAVIS_REPO_SLUG: ${{ github.repository }} + TRAVIS_PULL_REQUEST_SLUG: ${{ github.repository }} + UPSTREAM_REPO: ${{ github.repository }} + TRAVIS_COMMIT: ${{ github.sha }} + TRAVIS_PULL_REQUEST_SHA: ${{ github.event.pull_request.head.sha }} + TRAVIS_PULL_REQUEST: ${{ github.event.pull_request.number }} + UPSTREAM_SHA: ${{ github.sha }} + TRAVIS_COM_TOKEN: ${{ secrets.TRAVIS_COM_TOKEN }} + EVENT_MESSAGE: ${{ github.event.message }} + HOME: 'home/runner' + run: | + echo "$GITHUB_CONTEXT" + home/runner/travisci-tools/trigger-script-with-status-update.sh + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Clean all modules + run: ./gradlew cleanAllModules + - name: Build with Gradle + run: ./gradlew build + test: + runs-on: macos-latest + strategy: + fail-fast: false + matrix: + api-level: [21, 25, 26, 29] + steps: + - name: checkout + uses: actions/checkout@v2 + + - name: Java 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Gradle cache + uses: actions/cache@v2 + with: + path: | + ~/.gradle/caches + ~/.gradle/wrapper + key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }} + + - name: AVD cache + uses: actions/cache@v2 + id: avd-cache + with: + path: | + ~/.android/avd/* + ~/.android/adb* + ~/.android/debug.keystore + key: avd-${{ matrix.api-level }} + + - name: create AVD and generate snapshot for caching + if: steps.avd-cache.outputs.cache-hit != 'true' + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: false + script: echo "Generated AVD snapshot for caching." + + - name: run tests + uses: reactivecircus/android-emulator-runner@v2 + with: + api-level: ${{ matrix.api-level }} + force-avd-creation: false + emulator-options: -no-snapshot-save -no-window -gpu swiftshader_indirect -noaudio -no-boot-anim -camera-back none + disable-animations: true + script: ./gradlew testAllModulesTravis + publish: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Set env + run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=${{ env.TRAVIS_TAG }} ./gradlew ship + + snapshot: + if: ${{ github.event.inputs.SNAPSHOT == 'true' && github.event_name == 'workflow_dispatch' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew + - name: Ship + env: + MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} + MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} + MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} + MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} + run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship \ No newline at end of file diff --git a/.github/workflows/source_clear_cron.yml b/.github/workflows/source_clear_cron.yml new file mode 100644 index 000000000..4610dca07 --- /dev/null +++ b/.github/workflows/source_clear_cron.yml @@ -0,0 +1,16 @@ +name: Source clear + +on: + schedule: + # Runs "weekly" + - cron: '0 0 * * 0' + +jobs: + source_clear: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: Source clear scan + env: + SRCCLR_API_TOKEN: ${{ secrets.SRCCLR_API_TOKEN }} + run: curl -sSL https://download.sourceclear.com/ci.sh | bash -s – scan \ No newline at end of file diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index cbf7bcbbe..000000000 --- a/.travis.yml +++ /dev/null @@ -1,113 +0,0 @@ -language: android -# you MUST mention trusty https://docs.travis-ci.com/user/languages/android/ -dist: trusty -jdk: oraclejdk8 - -env: - # API 26+ supports "x86" (ANDROID_ABI=x86) emulators only, which are not supported yet in travis VMs - # so API 24 is the highest level we can run with emulator for now - # API-16 build fails in travis - - EMULATOR_API=19 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - - EMULATOR_API=21 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - - EMULATOR_API=24 ANDROID_ABI=armeabi-v7a ANDROID_API=29 ANDROID_BUILD_TOOLS=29.0.3 - -android: - components: - - tools - - platform-tools - - build-tools-$ANDROID_BUILD_TOOLS - - android-$ANDROID_API - - android-$EMULATOR_API - # Google APIs - - addon-google_apis-google-$ANDROID_API - - addon-google_apis-google-$EMULATOR_API - # Google Play Services - - extra-google-google_play_services - # Support library - - extra-android-support - # Latest artifacts in local repository - - extra-google-m2repository - - extra-android-m2repository - # Emulators - - sys-img-$ANDROID_ABI-android-$EMULATOR_API - -before_install: - #- touch $HOME/.android/repositories.cfg - -before_script: - - echo $TRAVIS_BRANCH - - echo $TRAVIS_TAG - - echo no | android create avd --force -n test -t android-$EMULATOR_API --abi $ANDROID_ABI - - emulator -avd test -no-window & - - scripts/android-wait-for-emulator.sh - - adb shell input keyevent 82 & -script: - - ./gradlew cleanAllModules - - ./gradlew testAllModulesTravis - -# Integration tests need to run first to reset the PR build status to pending -stages: - - name: 'Source Clear' - if: type = cron - - name: 'Lint markdown files' - - name: 'Integration tests' - - name: 'Test' - if: env(SNAPSHOT) IS NOT present - - name: 'Publish' - if: tag IS present - - name: 'Snapshot' - if: env(SNAPSHOT) = true and type = api - -jobs: - include: - - stage: 'Lint markdown files' - os: linux - language: generic - install: gem install awesome_bot - before_script: skip - script: - - find . -type f -name '*.md' -exec awesome_bot {} \; - notifications: - email: false - - - stage: 'Integration tests' - env: - - SDK=android - - BUILD_NUMBER=${TRAVIS_JOB_NUMBER/.} - - SDK_BRANCH=$TRAVIS_PULL_REQUEST_BRANCH - - TESTAPP_BRANCH=master - cache: false - language: minimal - before_install: skip - install: skip - before_script: - - mkdir $HOME/travisci-tools && pushd $HOME/travisci-tools && git init && git pull https://$CI_USER_TOKEN@github.com/optimizely/travisci-tools.git && popd - script: - - $HOME/travisci-tools/trigger-script-with-status-update.sh - after_success: travis_terminate 0 - - - stage: 'Source Clear' - addons: - srcclr: true - before_install: skip - install: skip - before_script: skip - script: skip - after_script: skip - after_success: skip - - - stage: 'Publish' - script: - - ./gradlew ship - after_script: skip - after_success: skip - - - stage: 'Snapshot' - before_install: - # required to accept Android licenses before install - - yes | sdkmanager "platforms;android-29" - before_script: skip - script: - - TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship - after_script: skip - after_success: skip From 26e4451bd8057e8480b3c62f9c5365835ef47d88 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 21 Mar 2022 18:09:33 +0500 Subject: [PATCH 2/8] setting java in reusable workflow --- .github/workflows/java_setup.yml | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) create mode 100644 .github/workflows/java_setup.yml diff --git a/.github/workflows/java_setup.yml b/.github/workflows/java_setup.yml new file mode 100644 index 000000000..2b4fee157 --- /dev/null +++ b/.github/workflows/java_setup.yml @@ -0,0 +1,18 @@ +name: Reusable action workflow of setting java + +on: + workflow_call: + +jobs: + build: + + runs-on: ubuntu-latest + steps: + - name: set up JDK 11 + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew From 6421ad84be321f2b171af588dd48ce3a271f7b76 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 21 Mar 2022 18:24:11 +0500 Subject: [PATCH 3/8] test --- .github/workflows/android.yml | 30 +++++------------------------- 1 file changed, 5 insertions(+), 25 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index c3a5cae78..3192afd3e 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -73,13 +73,7 @@ jobs: steps: - uses: actions/checkout@v2 - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew + uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction - name: Clean all modules run: ./gradlew cleanAllModules - name: Build with Gradle @@ -95,9 +89,7 @@ jobs: uses: actions/checkout@v2 - name: Java 11 - uses: actions/setup-java@v1 - with: - java-version: 11 + uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction - name: Gradle cache uses: actions/cache@v2 @@ -143,13 +135,7 @@ jobs: - name: Set env run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew + uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction - name: Ship env: MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} @@ -164,17 +150,11 @@ jobs: steps: - uses: actions/checkout@v2 - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew + uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction - name: Ship env: MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} MAVEN_SIGNING_PASSPHRASE: ${{ secrets.MAVEN_SIGNING_PASSPHRASE }} MAVEN_CENTRAL_USERNAME: ${{ secrets.MAVEN_CENTRAL_USERNAME }} MAVEN_CENTRAL_PASSWORD: ${{ secrets.MAVEN_CENTRAL_PASSWORD }} - run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship \ No newline at end of file + run: TRAVIS_TAG=BB-SNAPSHOT ./gradlew ship From 985465686fbc7683512e09a3d77635616049dd03 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 21 Mar 2022 18:34:36 +0500 Subject: [PATCH 4/8] reverting java setup changes --- .github/workflows/android.yml | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 3192afd3e..9ff24c34a 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -73,7 +73,13 @@ jobs: steps: - uses: actions/checkout@v2 - name: set up JDK 11 - uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Clean all modules run: ./gradlew cleanAllModules - name: Build with Gradle @@ -88,8 +94,13 @@ jobs: - name: checkout uses: actions/checkout@v2 - - name: Java 11 - uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction + - name: set up JDK 11 + uses: actions/setup-java@v1 + with: + java-version: 11 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Gradle cache uses: actions/cache@v2 @@ -135,7 +146,13 @@ jobs: - name: Set env run: echo "TRAVIS_TAG=${GITHUB_REF#refs/*/}" >> $GITHUB_ENV - name: set up JDK 11 - uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Ship env: MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} @@ -150,7 +167,13 @@ jobs: steps: - uses: actions/checkout@v2 - name: set up JDK 11 - uses: optimizely/android-sdk/.github/workflows/java_setup.yml@mnoman/gitAction + uses: actions/setup-java@v2 + with: + java-version: '11' + distribution: 'temurin' + cache: gradle + - name: Grant execute permission for gradlew + run: chmod +x gradlew - name: Ship env: MAVEN_SIGNING_KEY_BASE64: ${{ secrets.MAVEN_SIGNING_KEY_BASE64 }} From 0f4fcb6e061aa80415f419e29db4fb11e4c4cbb3 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Mon, 21 Mar 2022 18:36:20 +0500 Subject: [PATCH 5/8] removing added file --- .github/workflows/java_setup.yml | 18 ------------------ 1 file changed, 18 deletions(-) delete mode 100644 .github/workflows/java_setup.yml diff --git a/.github/workflows/java_setup.yml b/.github/workflows/java_setup.yml deleted file mode 100644 index 2b4fee157..000000000 --- a/.github/workflows/java_setup.yml +++ /dev/null @@ -1,18 +0,0 @@ -name: Reusable action workflow of setting java - -on: - workflow_call: - -jobs: - build: - - runs-on: ubuntu-latest - steps: - - name: set up JDK 11 - uses: actions/setup-java@v2 - with: - java-version: '11' - distribution: 'temurin' - cache: gradle - - name: Grant execute permission for gradlew - run: chmod +x gradlew From 9018e4d2eadd7832d9041625cb1049436be87581 Mon Sep 17 00:00:00 2001 From: "FOLIO3PK\\muhammadnoman" Date: Tue, 22 Mar 2022 20:47:44 +0500 Subject: [PATCH 6/8] Updated compiled sdk version to 32 --- android-sdk/build.gradle | 11 +++++++---- build.gradle | 18 ++++++++++-------- datafile-handler/build.gradle | 9 +++++---- event-handler/build.gradle | 10 ++++++---- gradle/wrapper/gradle-wrapper.properties | 5 ++--- shared/build.gradle | 11 ++++++----- .../ab/android/shared/ServiceScheduler.java | 3 ++- test-app/build.gradle | 18 +++++++----------- test-app/src/main/AndroidManifest.xml | 1 + user-profile/build.gradle | 15 +++++++-------- 10 files changed, 53 insertions(+), 48 deletions(-) diff --git a/android-sdk/build.gradle b/android-sdk/build.gradle index f0d2955da..f1a99327b 100644 --- a/android-sdk/build.gradle +++ b/android-sdk/build.gradle @@ -71,11 +71,14 @@ dependencies { testImplementation "org.powermock:powermock-mockito-release-full:$powermock_ver" testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" - androidTestImplementation "androidx.test.ext:junit:$androidx_test" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.work:work-testing:$work_runtime" + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" diff --git a/build.gradle b/build.gradle index 763abfadc..001497fa2 100644 --- a/build.gradle +++ b/build.gradle @@ -59,24 +59,26 @@ allprojects { } ext { - compile_sdk_version = 29 - build_tools_version = "29.0.3" + compile_sdk_version = 32 + build_tools_version = "30.0.3" min_sdk_version = 14 - target_sdk_version = 29 + target_sdk_version = 32 java_core_ver = "3.10.1" android_logger_ver = "1.3.6" jacksonversion= "2.11.2" - annotations_ver = "1.0.0" + annotations_ver = "1.2.0" junit_ver = "4.12" mockito_ver = "1.10.19" powermock_ver = "1.6.4" support_test_runner_ver = "0.5" dexmaker_ver = "1.4" - espresso_ver = "3.1.0" - gson_ver = "2.8.6" + gson_ver = "2.8.9" group_id = "com.optimizely.ab" - androidx_test = "1.1.1" - work_runtime = "2.5.0" + work_runtime = "2.7.1" + androidx_test_junit = "1.1.3" + androidx_test_core = "1.4.0" + androidx_test_rules = "1.4.0" + espresso_ver = "3.4.0" } task clean(type: Delete) { diff --git a/datafile-handler/build.gradle b/datafile-handler/build.gradle index ceac4c6e3..480bc9dbd 100644 --- a/datafile-handler/build.gradle +++ b/datafile-handler/build.gradle @@ -58,11 +58,12 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" diff --git a/event-handler/build.gradle b/event-handler/build.gradle index 09be11557..28026a850 100644 --- a/event-handler/build.gradle +++ b/event-handler/build.gradle @@ -62,11 +62,13 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index aa1defae3..0c8c5f889 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,6 @@ -#Thu Jan 28 11:38:35 PST 2021 +#Tue Nov 09 16:51:53 PKT 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME -org.gradle.jvmargs=-Xmx1g zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip diff --git a/shared/build.gradle b/shared/build.gradle index dde638180..af67676cc 100644 --- a/shared/build.gradle +++ b/shared/build.gradle @@ -62,11 +62,13 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" @@ -75,4 +77,3 @@ dependencies { androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } - diff --git a/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java b/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java index e1ffa925b..9c0f5610f 100644 --- a/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java +++ b/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java @@ -252,7 +252,8 @@ public PendingIntent getPendingIntent(Intent intent) { } private PendingIntent getPendingIntent(Intent intent, int flag) { - return PendingIntent.getService(context, 0, intent, flag); + // Android 31+ requires FLAG_IMMUTABLE explicitly + return PendingIntent.getService(context, 0, intent, flag | PendingIntent.FLAG_IMMUTABLE); } } diff --git a/test-app/build.gradle b/test-app/build.gradle index eab7f69da..37fa129c5 100644 --- a/test-app/build.gradle +++ b/test-app/build.gradle @@ -66,20 +66,16 @@ dependencies { // testImplementation 'com.optimizely.ab:android-sdk:1.0.0' testImplementation project(':android-sdk') - androidTestImplementation('androidx.test.ext:junit:1.1.1') - //androidTestimplementation "androidx.annotation:annotation:$annotations_ver" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.work:work-testing:$work_runtime" + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" - androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:$dexmaker_ver" - // androidTestImplementation 'com.optimizely.ab:android-sdk:1.0.0' - androidTestImplementation project(':android-sdk') - androidTestImplementation project(path: ':shared') - androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/test-app/src/main/AndroidManifest.xml b/test-app/src/main/AndroidManifest.xml index 86d4b7886..9061b61aa 100644 --- a/test-app/src/main/AndroidManifest.xml +++ b/test-app/src/main/AndroidManifest.xml @@ -40,6 +40,7 @@ diff --git a/user-profile/build.gradle b/user-profile/build.gradle index 8dc88d55d..8c34b8b4c 100644 --- a/user-profile/build.gradle +++ b/user-profile/build.gradle @@ -57,16 +57,15 @@ dependencies { testImplementation "org.mockito:mockito-core:$mockito_ver" testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" - androidTestImplementation "androidx.test.ext:junit:$androidx_test" - // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test" - // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.work:work-testing:$work_runtime" + androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + // Set this dependency to use JUnit 4 rules + androidTestImplementation "androidx.test:rules:$androidx_test_rules" + androidTestImplementation "androidx.test:core:$androidx_test_core" + androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" - androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:$dexmaker_ver" - androidTestImplementation "com.noveogroup.android:android-logger:$android_logger_ver" - androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } From 998f4a95071c27b2c7b2eb77cdbfa5526374ce70 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 14:43:57 +0500 Subject: [PATCH 7/8] Revert "Updated compiled sdk version to 32" This reverts commit 9018e4d2eadd7832d9041625cb1049436be87581. --- android-sdk/build.gradle | 11 ++++------- build.gradle | 18 ++++++++---------- datafile-handler/build.gradle | 9 ++++----- event-handler/build.gradle | 10 ++++------ gradle/wrapper/gradle-wrapper.properties | 5 +++-- shared/build.gradle | 11 +++++------ .../ab/android/shared/ServiceScheduler.java | 3 +-- test-app/build.gradle | 18 +++++++++++------- test-app/src/main/AndroidManifest.xml | 1 - user-profile/build.gradle | 15 ++++++++------- 10 files changed, 48 insertions(+), 53 deletions(-) diff --git a/android-sdk/build.gradle b/android-sdk/build.gradle index f1a99327b..f0d2955da 100644 --- a/android-sdk/build.gradle +++ b/android-sdk/build.gradle @@ -71,14 +71,11 @@ dependencies { testImplementation "org.powermock:powermock-mockito-release-full:$powermock_ver" testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" - androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation "androidx.test.ext:junit:$androidx_test" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" - + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" diff --git a/build.gradle b/build.gradle index 001497fa2..763abfadc 100644 --- a/build.gradle +++ b/build.gradle @@ -59,26 +59,24 @@ allprojects { } ext { - compile_sdk_version = 32 - build_tools_version = "30.0.3" + compile_sdk_version = 29 + build_tools_version = "29.0.3" min_sdk_version = 14 - target_sdk_version = 32 + target_sdk_version = 29 java_core_ver = "3.10.1" android_logger_ver = "1.3.6" jacksonversion= "2.11.2" - annotations_ver = "1.2.0" + annotations_ver = "1.0.0" junit_ver = "4.12" mockito_ver = "1.10.19" powermock_ver = "1.6.4" support_test_runner_ver = "0.5" dexmaker_ver = "1.4" - gson_ver = "2.8.9" + espresso_ver = "3.1.0" + gson_ver = "2.8.6" group_id = "com.optimizely.ab" - work_runtime = "2.7.1" - androidx_test_junit = "1.1.3" - androidx_test_core = "1.4.0" - androidx_test_rules = "1.4.0" - espresso_ver = "3.4.0" + androidx_test = "1.1.1" + work_runtime = "2.5.0" } task clean(type: Delete) { diff --git a/datafile-handler/build.gradle b/datafile-handler/build.gradle index 480bc9dbd..ceac4c6e3 100644 --- a/datafile-handler/build.gradle +++ b/datafile-handler/build.gradle @@ -58,12 +58,11 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation "androidx.test.ext:junit:$androidx_test" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" diff --git a/event-handler/build.gradle b/event-handler/build.gradle index 28026a850..09be11557 100644 --- a/event-handler/build.gradle +++ b/event-handler/build.gradle @@ -62,13 +62,11 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation "androidx.test.ext:junit:$androidx_test" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" - + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 0c8c5f889..aa1defae3 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ -#Tue Nov 09 16:51:53 PKT 2021 +#Thu Jan 28 11:38:35 PST 2021 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME +org.gradle.jvmargs=-Xmx1g zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-6.5-bin.zip diff --git a/shared/build.gradle b/shared/build.gradle index af67676cc..dde638180 100644 --- a/shared/build.gradle +++ b/shared/build.gradle @@ -62,13 +62,11 @@ dependencies { testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation "androidx.test.ext:junit:$androidx_test" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" - + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" @@ -77,3 +75,4 @@ dependencies { androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } + diff --git a/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java b/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java index 9c0f5610f..e1ffa925b 100644 --- a/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java +++ b/shared/src/main/java/com/optimizely/ab/android/shared/ServiceScheduler.java @@ -252,8 +252,7 @@ public PendingIntent getPendingIntent(Intent intent) { } private PendingIntent getPendingIntent(Intent intent, int flag) { - // Android 31+ requires FLAG_IMMUTABLE explicitly - return PendingIntent.getService(context, 0, intent, flag | PendingIntent.FLAG_IMMUTABLE); + return PendingIntent.getService(context, 0, intent, flag); } } diff --git a/test-app/build.gradle b/test-app/build.gradle index 37fa129c5..eab7f69da 100644 --- a/test-app/build.gradle +++ b/test-app/build.gradle @@ -66,16 +66,20 @@ dependencies { // testImplementation 'com.optimizely.ab:android-sdk:1.0.0' testImplementation project(':android-sdk') - androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation('androidx.test.ext:junit:1.1.1') + //androidTestimplementation "androidx.annotation:annotation:$annotations_ver" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" - + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" + androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:$dexmaker_ver" + // androidTestImplementation 'com.optimizely.ab:android-sdk:1.0.0' + androidTestImplementation project(':android-sdk') + androidTestImplementation project(path: ':shared') + androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } diff --git a/test-app/src/main/AndroidManifest.xml b/test-app/src/main/AndroidManifest.xml index 9061b61aa..86d4b7886 100644 --- a/test-app/src/main/AndroidManifest.xml +++ b/test-app/src/main/AndroidManifest.xml @@ -40,7 +40,6 @@ diff --git a/user-profile/build.gradle b/user-profile/build.gradle index 8c34b8b4c..8dc88d55d 100644 --- a/user-profile/build.gradle +++ b/user-profile/build.gradle @@ -57,15 +57,16 @@ dependencies { testImplementation "org.mockito:mockito-core:$mockito_ver" testImplementation "com.noveogroup.android:android-logger:$android_logger_ver" - androidTestImplementation "androidx.work:work-testing:$work_runtime" - androidTestImplementation "androidx.test.ext:junit:$androidx_test_junit" - androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" + androidTestImplementation "androidx.test.ext:junit:$androidx_test" // Set this dependency to use JUnit 4 rules - androidTestImplementation "androidx.test:rules:$androidx_test_rules" - androidTestImplementation "androidx.test:core:$androidx_test_core" - androidTestImplementation "androidx.test:core-ktx:$androidx_test_core" - + androidTestImplementation "androidx.test:rules:$androidx_test" + // Set this dependency to build and run Espresso tests + androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_ver" androidTestImplementation "org.mockito:mockito-core:$mockito_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker:$dexmaker_ver" androidTestImplementation "com.crittercism.dexmaker:dexmaker-dx:$dexmaker_ver" + androidTestImplementation "com.crittercism.dexmaker:dexmaker-mockito:$dexmaker_ver" + androidTestImplementation "com.noveogroup.android:android-logger:$android_logger_ver" + androidTestImplementation "com.fasterxml.jackson.core:jackson-databind:$jacksonversion" + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" } From 4be37b92b383b578e05dc2f2a978558c08998525 Mon Sep 17 00:00:00 2001 From: mnoman09 Date: Thu, 24 Mar 2022 15:58:41 +0500 Subject: [PATCH 8/8] changed compiled sdk version to 32 --- build.gradle | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/build.gradle b/build.gradle index 763abfadc..d900f3cf0 100644 --- a/build.gradle +++ b/build.gradle @@ -59,8 +59,8 @@ allprojects { } ext { - compile_sdk_version = 29 - build_tools_version = "29.0.3" + compile_sdk_version = 32 + build_tools_version = "30.0.3" min_sdk_version = 14 target_sdk_version = 29 java_core_ver = "3.10.1"