diff --git a/.circleci/config.yml b/.circleci/config.yml index 03d72c0..981b4c2 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,98 +1,189 @@ -version: 2.1 +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# +version: 2.1 orbs: - android: circleci/android@2.0 + # Use the circleci android orb version that supports OpenJDK17 required by AGP 8.2+ + android: circleci/android@2.4.0 + codecov: codecov/codecov@4.0.1 + +parameters: + gradle-cache-prefix: + type: string + default: v1 + build-cache-prefix: + type: string + default: v1 + build-path: + type: string + default: "code/edgemedia/build" + +# Workflows orchestrate a set of jobs to be run; +workflows: + version: 2 + build-test-deploy: + jobs: + - validate-code + - build-and-unit-test: + requires: + - validate-code + - functional-test: + requires: + - validate-code + - build-test-app: + requires: + - validate-code + filters: + branches: + only: + - main + - staging jobs: - build-and-unit-test: + validate-code: executor: - name: android/android-machine - resource-class: large - tag: 2022.01.1 + name: android/android-docker + resource-class: medium + tag: 2024.01.1 steps: - checkout + + - android/restore-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/restore-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + - run: - name: Check format + name: Check Format command: make checkformat - run: - name: Check style + name: Check Style command: make checkstyle + - android/save-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/save-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + + - store_artifacts: + path: << pipeline.parameters.build-path >>/reports + + build-and-unit-test: + executor: + name: android/android-docker + resource-class: medium + tag: 2024.01.1 + + steps: + - checkout + + - android/restore-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/restore-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + - run: - name: Assemble phone release - command: make assemble-phone-release - - - run: - name: JavaDoc + name: Javadoc command: make javadoc - - run: - name: Download Codecov Uploader - command: | - curl -s https://codecov.io/bash > codecov; - VERSION=$(grep 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2); - for i in 1 256 512 - do - shasum -a $i -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM") || - shasum -a $i -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM" | grep -w "codecov") - done + - store_artifacts: + path: << pipeline.parameters.build-path >>/docs/javadoc - run: - name: Run unit tests - command: make unit-test-coverage + name: Assemble Phone + command: make assemble-phone + + - android/run-tests: + test-command: make unit-test-coverage + + - android/save-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/save-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> - store_artifacts: - path: code/edgemedia/build/reports/tests + path: << pipeline.parameters.build-path >>/reports/tests - store_test_results: - path: code/edgemedia/build/test-results/testPhoneDebugUnitTest + path: << pipeline.parameters.build-path >>/test-results/testPhoneDebugUnitTest - - run: - name: Upload unit test coverage - command: | - bash ./codecov -v -X s3 -c -D "./code/edgemedia/build/reports/coverage/test/phone/debug" -F unit-tests + - codecov/upload: + file: << pipeline.parameters.build-path >>/reports/coverage/test/phone/debug/report.xml + flags: unit-tests functional-test: - executor: - name: android/android-machine - resource-class: large - tag: 2022.01.1 - - steps: - - checkout - - - android/start-emulator-and-run-tests: - system-image: system-images;android-29;default;x86 - post-emulator-launch-assemble-command: make assemble-phone - test-command: make functional-test-coverage - - - store_artifacts: - path: code/edgemedia/build/reports/androidTests - - - store_test_results: - path: code/edgemedia/build/outputs/androidTest-results - - - run: - name: Download Codecov Uploader - command: | - curl -s https://codecov.io/bash > codecov; - VERSION=$(grep 'VERSION=\"[0-9\.]*\"' codecov | cut -d'"' -f2); - for i in 1 256 512 - do - shasum -a $i -c --ignore-missing <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM") || - shasum -a $i -c <(curl -s "https://raw.githubusercontent.com/codecov/codecov-bash/${VERSION}/SHA${i}SUM" | grep -w "codecov") - done - - - run: - name: Upload coverage report - command: | - bash ./codecov -v -X s3 -c -D "./code/edgemedia/build/reports/coverage/androidTest/phone/debug" -F functional-tests + executor: + name: android/android-machine + resource-class: medium + tag: 2024.01.1 -workflows: - version: 2 - aepsdk-edgemedia-ci: - jobs: - - build-and-unit-test - - functional-test + steps: + - checkout + + - android/restore-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + + - run: + name: List available emulator images + command: sdkmanager --list + + - android/start-emulator-and-run-tests: + # It should match the name seen in the "sdkmanager --list" output + system-image: system-images;android-29;default;x86 + # The command to be run, while waiting for emulator startup + post-emulator-launch-assemble-command: make assemble-phone + # The test command + test-command: make functional-test-coverage + restore-gradle-cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/save-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + + - codecov/upload: + file: << pipeline.parameters.build-path >>/reports/coverage/androidTest/phone/debug/connected/report.xml + flags: functional-tests + + - store_artifacts: + path: << pipeline.parameters.build-path >>/reports/androidTests + + - store_test_results: + path: << pipeline.parameters.build-path >>/outputs/androidTest-results + + build-test-app: + executor: + name: android/android-docker + resource-class: medium + tag: 2024.01.1 + + steps: + - checkout + + - android/restore-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + + - android/restore-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> + + - run: + name: Assemble App + command: make assemble-app + + - android/save-gradle-cache: + cache-prefix: << pipeline.parameters.gradle-cache-prefix >> + - android/save-build-cache: + cache-prefix: << pipeline.parameters.build-cache-prefix >> diff --git a/.github/ISSUE_TEMPLATE/bug_report.yml b/.github/ISSUE_TEMPLATE/bug_report.yml index 3ec4a35..9ba7d62 100755 --- a/.github/ISSUE_TEMPLATE/bug_report.yml +++ b/.github/ISSUE_TEMPLATE/bug_report.yml @@ -1,3 +1,15 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Bug report description: Create a bug report to help us improve. Use this template if you encountered an issue while integrating with or implementing the APIs of this SDK. labels: [bug, triage-required] diff --git a/.github/ISSUE_TEMPLATE/feature_request.yml b/.github/ISSUE_TEMPLATE/feature_request.yml index c897291..a22e914 100755 --- a/.github/ISSUE_TEMPLATE/feature_request.yml +++ b/.github/ISSUE_TEMPLATE/feature_request.yml @@ -1,3 +1,15 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Feature request description: Suggest an idea for this project. labels: [feature-request, triage-required] diff --git a/.github/ISSUE_TEMPLATE/project_epic.yml b/.github/ISSUE_TEMPLATE/project_epic.yml index eec745a..90ed153 100644 --- a/.github/ISSUE_TEMPLATE/project_epic.yml +++ b/.github/ISSUE_TEMPLATE/project_epic.yml @@ -1,3 +1,15 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Project epic description: Create an internal epic that represents the top level parent of multiple tasks. labels: [epic] diff --git a/.github/ISSUE_TEMPLATE/project_task.yml b/.github/ISSUE_TEMPLATE/project_task.yml index f4334a3..a7624f9 100644 --- a/.github/ISSUE_TEMPLATE/project_task.yml +++ b/.github/ISSUE_TEMPLATE/project_task.yml @@ -1,3 +1,15 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Project task description: Create an internal task that can be completed as a standalone code change or is part of an epic. labels: [task] diff --git a/.github/release-drafter.yml b/.github/release-drafter.yml new file mode 100644 index 0000000..e053484 --- /dev/null +++ b/.github/release-drafter.yml @@ -0,0 +1,16 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + +template: | + ## What’s Changed + + $CHANGES \ No newline at end of file diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index f0c6f85..c321093 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -1,21 +1,64 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Publish Release -on: workflow_dispatch +on: + workflow_dispatch: + inputs: + tag: + description: 'tag/version' + required: true + action_tag: + description: 'Create tag? ("no" to skip)' + required: true + default: 'yes' jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Set up Java - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: - java-version: 11 + distribution: 'zulu' + java-version: 17 + - name: Cache Gradle packages uses: actions/cache@v2 with: path: ~/.gradle/caches key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }} restore-keys: ${{ runner.os }}-gradle + + - name: Verify version + run: | + set -eo pipefail + echo Release version: ${{ github.event.inputs.tag }} + (./scripts/version.sh -v ${{ github.event.inputs.tag }}) + + - name: Create GH Release + id: create_release + uses: release-drafter/release-drafter@v5 + if: ${{ github.event.inputs.action_tag == 'yes' }} + with: + name: v${{ github.event.inputs.tag }} + tag: v${{ github.event.inputs.tag }} + version: v${{ github.event.inputs.tag }} + publish: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Import GPG key env: GPG_SECRET_KEYS: ${{ secrets.GPG_SECRET_KEYS }} @@ -23,8 +66,9 @@ jobs: run: | echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes - - name: Publish to maven central repository - run: make ci-publish-main + + - name: Publish to Maven Central Repository + run: make ci-publish env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} diff --git a/.github/workflows/maven-snapshot.yml b/.github/workflows/maven-snapshot.yml index 01e250c..4bf0b2d 100644 --- a/.github/workflows/maven-snapshot.yml +++ b/.github/workflows/maven-snapshot.yml @@ -1,19 +1,30 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + name: Publish Snapshot on: - push: - branches: - - staging workflow_dispatch: - + jobs: publish: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v3 + - name: Set up Java - uses: actions/setup-java@v1 + uses: actions/setup-java@v3 with: - java-version: 11 + distribution: 'zulu' + java-version: 17 - name: Cache Gradle packages uses: actions/cache@v2 with: @@ -27,7 +38,7 @@ jobs: run: | echo $GPG_SECRET_KEYS | base64 --decode | gpg --import --no-tty --batch --yes echo $GPG_OWNERTRUST | base64 --decode | gpg --import-ownertrust --no-tty --batch --yes - - name: Publish to maven central staging repository + - name: Publish to Maven Snapshot Repository run: make ci-publish-staging env: SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} diff --git a/.github/workflows/update-version.yml b/.github/workflows/update-version.yml new file mode 100644 index 0000000..5c6d138 --- /dev/null +++ b/.github/workflows/update-version.yml @@ -0,0 +1,48 @@ +# +# Copyright 2024 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + +name: Update Version +on: + workflow_dispatch: + inputs: + version: + description: 'New version to use for the Media extension. Example: 3.0.0' + required: true + + core-dependency: + description: '[Optional] Update Core dependency in pom.xml. Example: 3.0.0' + required: false + + edge-dependency: + description: '[Optional] Update Edge dependency in pom.xml. Example: 3.0.0' + required: false + +jobs: + update-version: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Update Versions + run: (./scripts/version.sh -u -v ${{ github.event.inputs.version }} -d "Core ${{ github.event.inputs.core-dependency }},Edge ${{github.event.inputs.edge-dependency}}") + + - name: Create Pull Request + uses: peter-evans/create-pull-request@v5 + with: + token: ${{ github.token }} + commit-message: Updating version to ${{ github.event.inputs.version }}. + branch: version-${{ github.event.inputs.version }}-update + delete-branch: true + title: Updating version to ${{ github.event.inputs.version }} + body: Updating version to ${{ github.event.inputs.version }} \ No newline at end of file diff --git a/Documentation/getting-started-test-app.md b/Documentation/getting-started-test-app.md index 6ebb6a2..e3ef7d5 100644 --- a/Documentation/getting-started-test-app.md +++ b/Documentation/getting-started-test-app.md @@ -15,3 +15,14 @@ See the [Getting started](./getting-started.md) guide for instructions on settin 1. In the test app, set your `ENVIRONMENT_FILE_ID` in `MediaTestApp.kt`, as found in the mobile property. 2. Select the `testappkotlin` runnable with the desired emulator and run the program. + +## Validation with Assurance + +Configure a new Assurance session by setting the Base URL to `testapp://main` and launch Assurance in the demo app by running the following command in your terminal: + +```bash +$ adb shell am start -W -a android.intent.action.VIEW -d "testapp://main?adb_validation_sessionid=ADD_YOUR_SESSION_ID_HERE" com.adobe.marketing.mobile.edge.media.testapp.kotlin +``` + +> **Note** +> Replace `ADD_YOUR_SESSION_ID_HERE` with your Assurance session identifier. diff --git a/Documentation/getting-started.md b/Documentation/getting-started.md index 080fbfc..eba3e6a 100644 --- a/Documentation/getting-started.md +++ b/Documentation/getting-started.md @@ -53,12 +53,24 @@ Optionally, the Media for Edge Network configuration may be set or changed progr 1. Installation via [Maven](https://maven.apache.org/) & [Gradle](https://gradle.org/) is the easiest and recommended way to get the AEP SDK into your Android app. Add the Mobile Core, Edge, EdgeIdentity, and EdgeMedia extensions to your project using the app's Gradle file: + #### Kotlin + + ```kotlin + implementation(platform("com.adobe.marketing.mobile:sdk-bom:3.+")) + implementation("com.adobe.marketing.mobile:core") + implementation("com.adobe.marketing.mobile:edge") + implementation("com.adobe.marketing.mobile:edgeidentity") + implementation("com.adobe.marketing.mobile:edgemedia") + ``` - ```gradle - implementation 'com.adobe.marketing.mobile:core:2.+' - implementation 'com.adobe.marketing.mobile:edge:2.+' - implementation 'com.adobe.marketing.mobile:edgeidentity:2.+' - implementation 'com.adobe.marketing.mobile:edgemedia:2.+' + #### Groovy + + ```groovy + implementation platform('com.adobe.marketing.mobile:sdk-bom:3.+') + implementation 'com.adobe.marketing.mobile:core' + implementation 'com.adobe.marketing.mobile:edge' + implementation 'com.adobe.marketing.mobile:edgeidentity' + implementation 'com.adobe.marketing.mobile:edgemedia' ``` > **Warning** @@ -66,7 +78,7 @@ Optionally, the Media for Edge Network configuration may be set or changed progr 2. Import the libraries: - ### Java + #### Java ```java import com.adobe.marketing.mobile.MobileCore; @@ -75,7 +87,7 @@ Optionally, the Media for Edge Network configuration may be set or changed progr import com.adobe.marketing.mobile.edge.media.Media; ``` - ### Kotlin + #### Kotlin ```kotlin import com.adobe.marketing.mobile.MobileCore @@ -86,7 +98,7 @@ Optionally, the Media for Edge Network configuration may be set or changed progr 3. Import the Media library into your project and register it with `MobileCore` - ### Java + #### Java ```java public class MainApp extends Application { @@ -108,7 +120,7 @@ Optionally, the Media for Edge Network configuration may be set or changed progr } ``` - ### Kotlin + #### Kotlin ```kotlin class MyApp : Application() { diff --git a/Makefile b/Makefile index 6853d38..9dff9ac 100644 --- a/Makefile +++ b/Makefile @@ -1,22 +1,11 @@ EXTENSION-LIBRARY-FOLDER-NAME = edgemedia TEST-APP-FOLDER-NAME = testapp -KOTLIN-TEST-APP-FOLDER-NAME = testappkotlin - -BUILD-ASSEMBLE-LOCATION = ./ci/assemble -ROOT_DIR=$(shell git rev-parse --show-toplevel) - -PROJECT_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleProjectName" | cut -d'=' -f2) -AAR_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleAARName" | cut -d'=' -f2) -MODULE_NAME = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleName" | cut -d'=' -f2) -LIB_VERSION = $(shell cat $(ROOT_DIR)/code/gradle.properties | grep "moduleVersion" | cut -d'=' -f2) -SOURCE_FILE_DIR = $(ROOT_DIR)/code/$(PROJECT_NAME) -AAR_FILE_DIR = $(ROOT_DIR)/code/$(PROJECT_NAME)/build/outputs/aar +KOTLIN-TEST-APP-FOLDER-NAME = testapp-kotlin init: git config core.hooksPath .githooks clean: - (rm -rf $(AAR_FILE_DIR)) (./code/gradlew -p code clean) checkstyle: @@ -32,6 +21,9 @@ format: (./code/gradlew -p code/$(TEST-APP-FOLDER-NAME) spotlessApply) (./code/gradlew -p code/$(KOTLIN-TEST-APP-FOLDER-NAME) spotlessApply) +format-license: + (./code/gradlew -p code licenseFormat) + unit-test: (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) testPhoneDebugUnitTest) @@ -42,31 +34,31 @@ functional-test: (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) uninstallPhoneDebugAndroidTest) (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) connectedPhoneDebugAndroidTest) -functional-test-coverage: +functional-test-coverage: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) uninstallPhoneDebugAndroidTest) (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) createPhoneDebugAndroidTestCoverageReport) javadoc: - (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) javadocPublish) + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) javadocJar) assemble-phone: - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhone) + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) assemblePhone) -assemble-phone-release: - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhoneRelease) +assemble-phone-debug: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) assemblePhoneDebug) -build-release: - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} clean lint assemblePhoneRelease) +assemble-phone-release: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) assemblePhoneRelease) -publish-maven-local: - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhone) - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToMavenLocal -x signReleasePublication) +assemble-app: + (./code/gradlew -p code/$(TEST-APP-FOLDER-NAME) assemble) + (./code/gradlew -p code/$(KOTLIN-TEST-APP-FOLDER-NAME) assemble) -ci-publish-staging: clean build-release - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToSonatypeRepository --stacktrace) +ci-publish-maven-local-jitpack: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) publishReleasePublicationToMavenLocal -Pjitpack -x signReleasePublication) -ci-publish-main: clean build-release - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToSonatypeRepository -Prelease) +ci-publish-staging: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) publishReleasePublicationToSonatypeRepository) -ci-publish-jitpack: - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} assemblePhone) - (./code/gradlew -p code/${EXTENSION-LIBRARY-FOLDER-NAME} publishReleasePublicationToMavenLocal -Pjitpack -x signReleasePublication) +ci-publish: + (./code/gradlew -p code/$(EXTENSION-LIBRARY-FOLDER-NAME) publishReleasePublicationToSonatypeRepository -Prelease) \ No newline at end of file diff --git a/README.md b/README.md index 88a8cba..d73cb45 100644 --- a/README.md +++ b/README.md @@ -18,11 +18,9 @@ Please refer to the [Migrating from Media to Media for Edge Network guide](Docum ### Development -**Open the project** +#### Open the project -To open and run the project, open the `code/settings.gradle` file in Android Studio - -### Development +To open and run the project, open the `code/settings.gradle.kt` file in Android Studio #### Run the test application diff --git a/code/build.gradle b/code/build.gradle deleted file mode 100644 index 6c2764b..0000000 --- a/code/build.gradle +++ /dev/null @@ -1,30 +0,0 @@ -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - google() - } - dependencies { - classpath 'com.android.tools.build:gradle:7.3.1' - classpath 'org.jetbrains.kotlin:kotlin-gradle-plugin:1.7.20' - classpath "com.diffplug.spotless:spotless-plugin-gradle:6.12.0" - } -} - -allprojects { - repositories { - mavenCentral() - google() - maven { url "https://oss.sonatype.org/content/repositories/snapshots/" } - } -} - -ext { - minSdkVersion = 19 - targetSdkVersion = 33 - sourceCompatibility = JavaVersion.VERSION_1_8 - targetCompatibility = JavaVersion.VERSION_1_8 - kotlinLanguageVersion = "1.4" -} \ No newline at end of file diff --git a/code/build.gradle.kts b/code/build.gradle.kts new file mode 100644 index 0000000..f8507b4 --- /dev/null +++ b/code/build.gradle.kts @@ -0,0 +1,25 @@ +/* + * Copyright 2024 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +buildscript { + repositories { + gradlePluginPortal() + google() + mavenCentral() + maven { url = uri("https://jitpack.io") } + mavenLocal() + } + dependencies { + classpath("com.github.adobe:aepsdk-commons:gp-3.0.0") + } +} + +apply(plugin = "aep-license") \ No newline at end of file diff --git a/code/checkstyle.gradle b/code/checkstyle.gradle deleted file mode 100644 index b6e176f..0000000 --- a/code/checkstyle.gradle +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: "checkstyle" - -checkstyle { - configFile rootProject.file('checkstyle.xml') - ignoreFailures false - showViolations true - toolVersion = "8.15" -} - -/** Checkstyle task for new files (not in exclude list). Fail build if a check fails **/ -task checkstyle(type: Checkstyle) { - configFile rootProject.file('checkstyle.xml') - - //fail early - ignoreFailures false - showViolations true - - source 'src' - include '**/*.java' - exclude '**/gen/**' - exclude '**/test/**' - exclude '**/legacy/**' - exclude '**/androidTest/**' - exclude '**/R.java' - exclude '**/BuildConfig.java' -// exclude rootProject.file('checkstyle/checkstyle-exclude-list.txt') as String[] - classpath = files() -} \ No newline at end of file diff --git a/code/checkstyle.xml b/code/checkstyle.xml deleted file mode 100644 index 78e3b17..0000000 --- a/code/checkstyle.xml +++ /dev/null @@ -1,23 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/code/codeformat.gradle b/code/codeformat.gradle deleted file mode 100644 index 0e4839e..0000000 --- a/code/codeformat.gradle +++ /dev/null @@ -1,20 +0,0 @@ -spotless { - java { - toggleOffOn("format:off", "format:on") - target "src/*/java/**/*.java" - googleJavaFormat('1.8').aosp().reflowLongStrings() - importOrder() - removeUnusedImports() - endWithNewline() - formatAnnotations() - licenseHeaderFile "../../config/formatter/adobe.header.txt" - - } - kotlin { - target "src/*/java/**/*.kt" - ktlint('0.47.0') - endWithNewline() - licenseHeaderFile "../../config/formatter/adobe.header.txt" - - } -} \ No newline at end of file diff --git a/code/edgemedia/build.gradle b/code/edgemedia/build.gradle deleted file mode 100644 index 314318f..0000000 --- a/code/edgemedia/build.gradle +++ /dev/null @@ -1,126 +0,0 @@ -plugins { - id 'com.android.library' - id "jacoco" - id 'com.diffplug.spotless' - id 'kotlin-android' -} - -apply from: 'release.gradle' -apply from: '../codeformat.gradle' -apply from: '../checkstyle.gradle' - -android { - namespace = 'com.adobe.marketing.mobile.edge.media' - - compileSdk rootProject.ext.targetSdkVersion - - defaultConfig { - minSdk rootProject.ext.minSdkVersion - targetSdk rootProject.ext.targetSdkVersion - - consumerProguardFiles "consumer-rules.pro" - testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner' - } - - flavorDimensions "target" - - productFlavors { - phone { - dimension "target" - } - } - - buildTypes { - debug { - testCoverageEnabled true - } - - release { - minifyEnabled false - proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro' - } - } - - testOptions { - unitTests.returnDefaultValues = true - } - - compileOptions { - sourceCompatibility rootProject.ext.sourceCompatibility - targetCompatibility rootProject.ext.targetCompatibility - } - - kotlinOptions { - jvmTarget = rootProject.ext.sourceCompatibility - languageVersion = rootProject.kotlinLanguageVersion - apiVersion = rootProject.kotlinLanguageVersion - } -} - -dependencies { - //noinspection GradleDependency - implementation "com.adobe.marketing.mobile:core:$mavenCoreVersion" - implementation "androidx.annotation:annotation:$androidxAnnotationVersion" - - testImplementation 'junit:junit:4.13.2' - testImplementation "org.mockito:mockito-core:4.5.1" - testImplementation 'org.mockito:mockito-inline:4.5.1' - testImplementation 'org.jetbrains.kotlin:kotlin-reflect:1.7.20' - testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.4.1' - //noinspection GradleDependency - - androidTestImplementation 'androidx.test.ext:junit:1.1.3' - androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0' - androidTestImplementation "com.adobe.marketing.mobile:edge:$mavenEdgeVersion" - androidTestImplementation "com.adobe.marketing.mobile:edgeidentity:2.+" - androidTestImplementation 'com.fasterxml.jackson.core:jackson-databind:2.12.7' -} - -tasks.withType(Test) { - testLogging { - showStandardStreams = true - } - jacoco.includeNoLocationClasses = true - jacoco.excludes = ['jdk.internal.*'] -} - -task unitTestsCoverageReport(type: JacocoReport, dependsOn: "testPhoneDebugUnitTest") { - def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class'] - def javaClasses = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes", excludes: excludeRegex) - def kotlinClasses = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/phoneDebug", excludes: excludeRegex) - classDirectories.setFrom(files([javaClasses, kotlinClasses])) - - def mainSrc = "${project.projectDir}/src/main/java" - def phoneSrc = "${project.projectDir}/src/phone/java" - sourceDirectories.setFrom files([mainSrc, phoneSrc]) - - executionData.setFrom fileTree(dir: "$buildDir", includes: [ - "outputs/unit_test_code_coverage/phoneDebugUnitTest/testPhoneDebugUnitTest.exec", - ]) - - reports { - xml.enabled true - csv.enabled false - html.enabled true - } -} - -task functionalTestsCoverageReport(type: JacocoReport, dependsOn: "createPhoneDebugCoverageReport") { - def excludeRegex = ['**/ADB*.class', '**/BuildConfig.class'] - def javaClasses = fileTree(dir: "${project.buildDir}/intermediates/javac/phoneDebug/classes", excludes: excludeRegex) - def kotlinClasses = fileTree(dir: "${project.buildDir}/tmp/kotlin-classes/phoneDebug", excludes: excludeRegex) - classDirectories.setFrom(files([javaClasses, kotlinClasses])) - - def mainSrc = "${project.projectDir}/src/main/java" - def phoneSrc = "${project.projectDir}/src/phone/java" - sourceDirectories.setFrom files([mainSrc, phoneSrc]) - - executionData.setFrom fileTree(dir: "$buildDir", includes: [ - "outputs/code_coverage/phoneDebugAndroidTest/connected/*coverage.ec" - ]) - reports { - xml.enabled true - csv.enabled false - html.enabled false - } -} diff --git a/code/edgemedia/build.gradle.kts b/code/edgemedia/build.gradle.kts new file mode 100644 index 0000000..f63b4be --- /dev/null +++ b/code/edgemedia/build.gradle.kts @@ -0,0 +1,42 @@ +/* + * Copyright 2024 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("aep-library") +} + +val mavenCoreVersion: String by project +val mavenEdgeVersion: String by project + +aepLibrary { + namespace = "com.adobe.marketing.mobile.edge.media" + enableSpotless = true + enableCheckStyle = true + enableDokkaDoc = true + publishing { + gitRepoName = "aepsdk-edgemedia-android" + addCoreDependency(mavenCoreVersion) + addEdgeDependency(mavenEdgeVersion) + } +} + +dependencies { + implementation("com.adobe.marketing.mobile:core:$mavenCoreVersion") + implementation("com.adobe.marketing.mobile:edge:$mavenEdgeVersion") + + androidTestImplementation("com.adobe.marketing.mobile:edgeidentity:3.0.0") + androidTestImplementation("com.fasterxml.jackson.core:jackson-databind:2.12.7") + + testImplementation("org.jetbrains.kotlin:kotlin-reflect:${BuildConstants.Versions.KOTLIN}") +} + diff --git a/code/edgemedia/proguard-rules.pro b/code/edgemedia/proguard-rules.pro deleted file mode 100644 index f1b4245..0000000 --- a/code/edgemedia/proguard-rules.pro +++ /dev/null @@ -1,21 +0,0 @@ -# Add project specific ProGuard rules here. -# You can control the set of applied configuration files using the -# proguardFiles setting in build.gradle. -# -# For more details, see -# http://developer.android.com/guide/developing/tools/proguard.html - -# If your project uses WebView with JS, uncomment the following -# and specify the fully qualified class name to the JavaScript interface -# class: -#-keepclassmembers class fqcn.of.javascript.interface.for.webview { -# public *; -#} - -# Uncomment this to preserve the line number information for -# debugging stack traces. -#-keepattributes SourceFile,LineNumberTable - -# If you keep the line number information, uncomment this to -# hide the original source file name. -#-renamesourcefileattribute SourceFile diff --git a/code/edgemedia/release.gradle b/code/edgemedia/release.gradle deleted file mode 100644 index 1ea2581..0000000 --- a/code/edgemedia/release.gradle +++ /dev/null @@ -1,109 +0,0 @@ -apply plugin: 'maven-publish' -apply plugin: 'signing' - -android.libraryVariants.all { variant -> - tasks.withType(Javadoc) { - source = [android.sourceSets.main.java.sourceFiles, android.sourceSets.phone.java.sourceFiles] - ext.androidJar = "${android.sdkDirectory}/platforms/${android.compileSdkVersion}/android.jar" - - doFirst { classpath = files(variant.javaCompile.classpath.files) + files(ext.androidJar) } - - exclude "**/BuildConfig.java" - exclude "**/R.java" - options { - links "https://developer.android.com/reference" - } - } -} - -task javadoc(type: Javadoc) { - failOnError false - options.memberLevel = JavadocMemberLevel.PUBLIC -} - -task javadocPublish(type: Jar) { - from javadoc - archiveClassifier.set('javadoc') -} - -def isReleaseBuild() { - return hasProperty('release') -} - -version = isReleaseBuild() ? rootProject.moduleVersion : rootProject.moduleVersion+"-SNAPSHOT" - -publish.dependsOn('assemblePhone') - -publishing { - publications { - release(MavenPublication) { - groupId = 'com.adobe.marketing.mobile' - artifactId = rootProject.moduleName - version = version - artifact("$buildDir/outputs/aar/${rootProject.moduleAARName}") - artifact javadocPublish - - pom { - name = mavenRepoName - description = mavenRepoDescription - url = 'https://developer.adobe.com/client-sdks' - licenses { - license { - name = 'The Apache License, Version 2.0' - url = 'https://www.apache.org/licenses/LICENSE-2.0.txt' - distribution = 'repo' - } - } - developers { - developer { - id = 'adobe' - name = 'adobe' - email = 'adobe-mobile-testing@adobe.com' - } - } - scm { - connection = 'scm:git:github.com//adobe/aepsdk-edgemedia-android.git' - developerConnection = 'scm:git:ssh://github.com//adobe/aepsdk-edgemedia-android.git' - url = 'https://github.com/adobe/aepsdk-edgemedia-android' - } - withXml { - def dependenciesNode = asNode().appendNode('dependencies') - - def coreDependencyNode = dependenciesNode.appendNode('dependency') - coreDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile') - coreDependencyNode.appendNode('artifactId', 'core') - coreDependencyNode.appendNode('version', mavenCoreVersion) - - def edgeDependencyNode = dependenciesNode.appendNode('dependency') - edgeDependencyNode.appendNode('groupId', 'com.adobe.marketing.mobile') - edgeDependencyNode.appendNode('artifactId', 'edge') - edgeDependencyNode.appendNode('version', mavenEdgeVersion) - } - } - } - } - repositories { - maven { - name = "sonatype" - url = version.endsWith('SNAPSHOT') ? "https://oss.sonatype.org/content/repositories/snapshots/" : "https://oss.sonatype.org/service/local/staging/deploy/maven2/" - credentials { - username = System.getenv("SONATYPE_USERNAME") - password = System.getenv("SONATYPE_PASSWORD") - } - } - } -} - -ext."signing.gnupg.executable"="gpg" -ext."signing.gnupg.keyName"=System.getenv("GPG_KEY_ID") -ext."signing.gnupg.passphrase"=System.getenv("GPG_PASSPHRASE") - -signing { - useGpgCmd() - required { - tasks.withType(PublishToMavenRepository).find { - gradle.taskGraph.hasTask it - } - } - sign publishing.publications -} \ No newline at end of file diff --git a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeIntegrationTests.kt b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeIntegrationTests.kt index 550cdaa..bd43a8a 100644 --- a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeIntegrationTests.kt +++ b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeIntegrationTests.kt @@ -23,7 +23,6 @@ import com.adobe.marketing.mobile.edge.media.internal.xdm.XDMMediaEventType import com.adobe.marketing.mobile.services.HttpMethod import com.adobe.marketing.mobile.services.NetworkRequest import com.adobe.marketing.mobile.util.FunctionalTestHelper.LogOnErrorRule -import com.adobe.marketing.mobile.util.FunctionalTestHelper.RegisterMonitorExtensionRule import com.adobe.marketing.mobile.util.FunctionalTestHelper.SetupCoreRule import com.adobe.marketing.mobile.util.FunctionalTestHelper.assertExpectedEvents import com.adobe.marketing.mobile.util.FunctionalTestHelper.createNetworkResponse @@ -32,6 +31,7 @@ import com.adobe.marketing.mobile.util.FunctionalTestHelper.resetTestExpectation import com.adobe.marketing.mobile.util.FunctionalTestHelper.setExpectationEvent import com.adobe.marketing.mobile.util.FunctionalTestHelper.setNetworkResponseFor import com.adobe.marketing.mobile.util.JsonTestUtils +import com.adobe.marketing.mobile.util.MonitorExtension import org.junit.Assert.assertEquals import org.junit.Assert.assertNotNull import org.junit.Before @@ -74,7 +74,6 @@ class MediaEdgeIntegrationTests { var rule: RuleChain = RuleChain .outerRule(LogOnErrorRule()) .around(SetupCoreRule()) - .around(RegisterMonitorExtensionRule()) @Before fun setup() { @@ -92,7 +91,7 @@ class MediaEdgeIntegrationTests { val latch = CountDownLatch(1) MobileCore.registerExtensions( - listOf(Edge.EXTENSION, Identity.EXTENSION, Media.EXTENSION) + listOf(Edge.EXTENSION, Identity.EXTENSION, Media.EXTENSION, MonitorExtension.EXTENSION) ) { latch.countDown() } diff --git a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeLocationHintIntegrationTests.kt b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeLocationHintIntegrationTests.kt index 24ab4e4..5ab6cc8 100644 --- a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeLocationHintIntegrationTests.kt +++ b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/edge/media/internal/MediaEdgeLocationHintIntegrationTests.kt @@ -20,6 +20,7 @@ import com.adobe.marketing.mobile.edge.identity.Identity import com.adobe.marketing.mobile.edge.media.Media import com.adobe.marketing.mobile.services.HttpMethod import com.adobe.marketing.mobile.util.FunctionalTestHelper +import com.adobe.marketing.mobile.util.MonitorExtension import org.junit.Assert import org.junit.Before import org.junit.Rule @@ -44,7 +45,6 @@ class MediaEdgeLocationHintIntegrationTests { var rule: RuleChain = RuleChain .outerRule(FunctionalTestHelper.LogOnErrorRule()) .around(FunctionalTestHelper.SetupCoreRule()) - .around(FunctionalTestHelper.RegisterMonitorExtensionRule()) @Before fun setup() { @@ -70,7 +70,7 @@ class MediaEdgeLocationHintIntegrationTests { val latch = CountDownLatch(1) MobileCore.registerExtensions( - listOf(Edge.EXTENSION, Identity.EXTENSION, Media.EXTENSION) + listOf(Edge.EXTENSION, Identity.EXTENSION, Media.EXTENSION, MonitorExtension.EXTENSION) ) { latch.countDown() } diff --git a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/services/MockAppContextService.java b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/services/MockAppContextService.java index acfd4f6..66733e6 100644 --- a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/services/MockAppContextService.java +++ b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/services/MockAppContextService.java @@ -14,6 +14,7 @@ import android.app.Activity; import android.app.Application; import android.content.Context; +import android.net.ConnectivityManager; import androidx.annotation.NonNull; import androidx.annotation.Nullable; @@ -47,4 +48,9 @@ public Context getApplicationContext() { public AppState getAppState() { return appState; } + + @Nullable @Override + public ConnectivityManager getConnectivityManager() { + return null; + } } diff --git a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/EdgeEventHelper.kt b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/EdgeEventHelper.kt index 85652a6..b8a796a 100644 --- a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/EdgeEventHelper.kt +++ b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/EdgeEventHelper.kt @@ -16,7 +16,7 @@ import com.adobe.marketing.mobile.edge.media.MediaConstants import com.adobe.marketing.mobile.edge.media.internal.xdm.XDMCustomMetadata import com.adobe.marketing.mobile.edge.media.internal.xdm.XDMMediaEventType import com.adobe.marketing.mobile.util.TimeUtils -import java.util.* +import java.util.Date internal class EdgeEventHelper { diff --git a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/FunctionalTestHelper.java b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/FunctionalTestHelper.java index cab85cd..32fc7f7 100644 --- a/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/FunctionalTestHelper.java +++ b/code/edgemedia/src/androidTest/java/com/adobe/marketing/mobile/util/FunctionalTestHelper.java @@ -153,42 +153,6 @@ public static void resetTestNetworkService() { } } - /** - * {@code TestRule} which registers the {@code MonitorExtension}, allowing test cases to assert - * events passing through the {@code EventHub}. This {@code TestRule} must be applied after the - * {@link SetupCoreRule} to ensure the {@code MobileCore} is setup for testing first. - * - *

To use, add the following to your test class: - * - *

-     *  @Rule
-     * 	public RuleChain rule = RuleChain.outerRule(new SetupCoreRule())
-     * 							.around(new RegisterMonitorExtensionRule());
-     * 
- */ - public static class RegisterMonitorExtensionRule implements TestRule { - - @Override - @SuppressWarnings("deprecation") - public Statement apply( - @NonNull final Statement base, @NonNull final Description description) { - return new Statement() { - @Override - public void evaluate() throws Throwable { - // Use registerExtension here to avoid starting the core yet, the tests should - // start it after all extensions have been registered - MobileCore.registerExtension(MonitorExtension.EXTENSION, null); - - try { - base.evaluate(); - } finally { - MonitorExtension.reset(); - } - } - }; - } - } - public static class LogOnErrorRule implements TestRule { @Override diff --git a/code/edgemedia/src/main/AndroidManifest.xml b/code/edgemedia/src/main/AndroidManifest.xml index c4e6c98..5e1ff00 100644 --- a/code/edgemedia/src/main/AndroidManifest.xml +++ b/code/edgemedia/src/main/AndroidManifest.xml @@ -1 +1,14 @@ + diff --git a/code/edgemedia/src/main/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtension.java b/code/edgemedia/src/main/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtension.java index da3c204..8c9cfdb 100644 --- a/code/edgemedia/src/main/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtension.java +++ b/code/edgemedia/src/main/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtension.java @@ -97,7 +97,7 @@ protected void onRegistered() { * Handler for the session ID returned by the media backend response dispatched by the Edge * extension. * - * @param event the Edge new media analytics session event containing the backend session ID + * @param event the Edge Network response event containing the backend session ID */ void handleMediaEdgeSessionDetails(@NonNull final Event event) { String requestEventId = diff --git a/code/edgemedia/src/phone/java/com/adobe/marketing/mobile/edge/media/Media.java b/code/edgemedia/src/phone/java/com/adobe/marketing/mobile/edge/media/Media.java index bd35cb4..bf4c971 100644 --- a/code/edgemedia/src/phone/java/com/adobe/marketing/mobile/edge/media/Media.java +++ b/code/edgemedia/src/phone/java/com/adobe/marketing/mobile/edge/media/Media.java @@ -22,7 +22,7 @@ import java.util.Map; public class Media { - private static final String EXTENSION_VERSION = "2.0.0"; + private static final String EXTENSION_VERSION = "3.0.0"; private Media() {} diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/MediaTests.java b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/MediaTests.java index 1a64f0e..79702e9 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/MediaTests.java +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/MediaTests.java @@ -11,7 +11,7 @@ package com.adobe.marketing.mobile.edge.media; -import static junit.framework.TestCase.*; +import static junit.framework.TestCase.assertNotNull; import static org.junit.Assert.assertEquals; import com.adobe.marketing.mobile.Event; diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/EdgeEventHelper.kt b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/EdgeEventHelper.kt index 6ec9f13..6bea195 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/EdgeEventHelper.kt +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/EdgeEventHelper.kt @@ -16,7 +16,7 @@ import com.adobe.marketing.mobile.edge.media.MediaConstants import com.adobe.marketing.mobile.edge.media.internal.xdm.XDMCustomMetadata import com.adobe.marketing.mobile.edge.media.internal.xdm.XDMMediaEventType import com.adobe.marketing.mobile.util.TimeUtils -import java.util.* +import java.util.Date internal class EdgeEventHelper { diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaContextTests.java b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaContextTests.java index 06bb4f0..f645ef3 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaContextTests.java +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaContextTests.java @@ -11,7 +11,11 @@ package com.adobe.marketing.mobile.edge.media.internal; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertNotNull; +import static org.junit.Assert.assertNull; +import static org.junit.Assert.assertTrue; import java.util.ArrayList; import java.util.HashMap; diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaEventProcessorTests.kt b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaEventProcessorTests.kt index 654cb08..15dae9c 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaEventProcessorTests.kt +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaEventProcessorTests.kt @@ -27,7 +27,8 @@ import org.junit.Test import org.mockito.ArgumentMatchers.eq import org.mockito.Mockito import org.mockito.Mockito.verify -import java.util.* +import java.util.Date +import java.util.UUID class MediaEventProcessorTests { private var mockState: MediaState = Mockito.mock(MediaState::class.java) diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtensionVersionTest.kt b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtensionVersionTest.kt index 40613c9..476f5dc 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtensionVersionTest.kt +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaExtensionVersionTest.kt @@ -19,7 +19,7 @@ import org.junit.Test import java.io.FileInputStream import java.io.IOException import java.io.InputStream -import java.util.* +import java.util.Properties class MediaExtensionVersionTest { private val gradlePropertiesPath = "../gradle.properties" diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaSessionTests.kt b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaSessionTests.kt index 941d8d8..6b51f85 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaSessionTests.kt +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaSessionTests.kt @@ -22,7 +22,7 @@ import org.junit.Assert.assertNull import org.junit.Assert.assertTrue import org.junit.Test import org.mockito.Mockito.mock -import java.util.* +import java.util.Date class MediaSessionTests { private val id = "testSessionId" diff --git a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaStateTests.java b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaStateTests.java index 0c54097..8b8fcca 100644 --- a/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaStateTests.java +++ b/code/edgemedia/src/test/java/com/adobe/marketing/mobile/edge/media/internal/MediaStateTests.java @@ -11,7 +11,9 @@ package com.adobe.marketing.mobile.edge.media.internal; -import static org.junit.Assert.*; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; +import static org.junit.Assert.assertTrue; import java.util.Collections; import java.util.HashMap; diff --git a/code/gradle.properties b/code/gradle.properties index bab5352..8c7b073 100644 --- a/code/gradle.properties +++ b/code/gradle.properties @@ -1,20 +1,25 @@ +# +# Copyright 2023 Adobe. All rights reserved. +# This file is licensed to you under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. You may obtain a copy +# of the License at http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software distributed under +# the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS +# OF ANY KIND, either express or implied. See the License for the specific language +# governing permissions and limitations under the License. +# + org.gradle.jvmargs=-Xmx2048m android.injected.testOnly=false org.gradle.configureondemand=false android.useAndroidX=true -android.disableAutomaticComponentCreation=true -moduleProjectName=edgemedia moduleName=edgemedia -moduleAARName=edgemedia-phone-release.aar -moduleVersion=2.0.0 - +moduleVersion=3.0.0 mavenRepoName=AdobeMobileEdgeMediaSdk mavenRepoDescription=Adobe Streaming Media for Edge Network extension for the Adobe Experience Platform Mobile SDK -mavenUploadDryRunFlag=false -# production versions for production build -mavenCoreVersion=2.2.0 -mavenEdgeVersion=2.1.0 -androidxAnnotationVersion=1.0.0 \ No newline at end of file +mavenCoreVersion=3.0.0 +mavenEdgeVersion=3.0.0 diff --git a/code/gradle/wrapper/gradle-wrapper.properties b/code/gradle/wrapper/gradle-wrapper.properties index 683a87a..2bc8f54 100644 --- a/code/gradle/wrapper/gradle-wrapper.properties +++ b/code/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,7 @@ #Sun Jul 10 17:49:57 MDT 2022 distributionBase=GRADLE_USER_HOME -distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.2-bin.zip +-bin.zip distributionPath=wrapper/dists zipStorePath=wrapper/dists zipStoreBase=GRADLE_USER_HOME diff --git a/code/settings.gradle b/code/settings.gradle deleted file mode 100755 index 3e02d68..0000000 --- a/code/settings.gradle +++ /dev/null @@ -1,4 +0,0 @@ -rootProject.name = "edgemedia-sdk" -include ':edgemedia' -include ':testapp' -include ':testappkotlin' diff --git a/code/settings.gradle.kts b/code/settings.gradle.kts new file mode 100755 index 0000000..7299964 --- /dev/null +++ b/code/settings.gradle.kts @@ -0,0 +1,37 @@ +/* + * Copyright 2024 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +pluginManagement { + repositories { + gradlePluginPortal() + google() + mavenCentral() + mavenLocal() + } +} + +dependencyResolutionManagement { + repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS) + repositories { + google() + mavenCentral() + mavenLocal() + maven { url = uri("https://oss.sonatype.org/content/repositories/snapshots/") } + maven { url = uri("https://jitpack.io") } + } +} + +rootProject.name = "aepsdk-edgemedia-android" +include ( + ":edgemedia", + ":testapp", + ":testapp-kotlin" +) \ No newline at end of file diff --git a/code/testappkotlin/.gitignore b/code/testapp-kotlin/.gitignore similarity index 100% rename from code/testappkotlin/.gitignore rename to code/testapp-kotlin/.gitignore diff --git a/code/testapp-kotlin/build.gradle.kts b/code/testapp-kotlin/build.gradle.kts new file mode 100644 index 0000000..d273537 --- /dev/null +++ b/code/testapp-kotlin/build.gradle.kts @@ -0,0 +1,79 @@ +/* + * Copyright 2024 Adobe. All rights reserved. + * This file is licensed to you under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. You may obtain a copy + * of the License at http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software distributed under + * the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR REPRESENTATIONS + * OF ANY KIND, either express or implied. See the License for the specific language + * governing permissions and limitations under the License. + */ +import com.adobe.marketing.mobile.gradle.BuildConstants + +plugins { + id("com.android.application") + id("org.jetbrains.kotlin.android") + id("com.diffplug.spotless") +} + +val mavenCoreVersion: String by project +val mavenEdgeVersion: String by project + +configure { + kotlin { + target("src/*/java/**/*.kt") + ktlint(BuildConstants.Versions.KTLINT) + licenseHeader(BuildConstants.ADOBE_LICENSE_HEADER) + endWithNewline() + } +} + +android { + namespace = "com.adobe.marketing.mobile.edge.media.testapp.kotlin" + + defaultConfig { + minSdk = BuildConstants.Versions.MIN_SDK_VERSION + compileSdk = BuildConstants.Versions.COMPILE_SDK_VERSION + targetSdk = BuildConstants.Versions.TARGET_SDK_VERSION + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables.useSupportLibrary = true + } + + buildTypes { + getByName(BuildConstants.BuildTypes.RELEASE) { + isMinifyEnabled = false + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") + } + } + + compileOptions { + sourceCompatibility = BuildConstants.Versions.JAVA_SOURCE_COMPATIBILITY + targetCompatibility = BuildConstants.Versions.JAVA_TARGET_COMPATIBILITY + } + + kotlinOptions { + jvmTarget = BuildConstants.Versions.KOTLIN_JVM_TARGET + languageVersion = BuildConstants.Versions.KOTLIN_LANGUAGE_VERSION + apiVersion = BuildConstants.Versions.KOTLIN_API_VERSION + } + + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } + } +} + +dependencies { + implementation("androidx.appcompat:appcompat:1.6.1") + implementation("androidx.core:core-ktx:1.8.0") + implementation("com.google.android.material:material:1.8.0") + + implementation(project(":edgemedia")) + implementation("com.adobe.marketing.mobile:core:$mavenCoreVersion") + implementation("com.adobe.marketing.mobile:edge:$mavenEdgeVersion") + implementation("com.adobe.marketing.mobile:edgeidentity:3.0.0") + implementation("com.adobe.marketing.mobile:assurance:3.0.0") +} \ No newline at end of file diff --git a/code/testappkotlin/src/main/AndroidManifest.xml b/code/testapp-kotlin/src/main/AndroidManifest.xml similarity index 58% rename from code/testappkotlin/src/main/AndroidManifest.xml rename to code/testapp-kotlin/src/main/AndroidManifest.xml index a84e548..25d7c3f 100644 --- a/code/testappkotlin/src/main/AndroidManifest.xml +++ b/code/testapp-kotlin/src/main/AndroidManifest.xml @@ -1,4 +1,17 @@ + - + @@ -18,10 +31,10 @@ - + - + diff --git a/code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/Configuration.kt b/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/Configuration.kt similarity index 92% rename from code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/Configuration.kt rename to code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/Configuration.kt index b032161..9654568 100644 --- a/code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/Configuration.kt +++ b/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/Configuration.kt @@ -9,7 +9,7 @@ governing permissions and limitations under the License. */ -package com.adobe.media.testappkotlin +package com.adobe.marketing.mobile.edge.media.testapp.kotlin class Configuration { companion object { diff --git a/code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/MainActivity.kt b/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/MainActivity.kt similarity index 77% rename from code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/MainActivity.kt rename to code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/MainActivity.kt index 58d96c3..f2925f1 100644 --- a/code/testappkotlin/src/main/java/com/adobe/media/testappkotlin/MainActivity.kt +++ b/code/testapp-kotlin/src/main/java/com/adobe/marketing/mobile/edge/media/testapp/kotlin/MainActivity.kt @@ -9,15 +9,17 @@ governing permissions and limitations under the License. */ -package com.adobe.media.testappkotlin +package com.adobe.marketing.mobile.edge.media.testapp.kotlin import android.content.Intent import android.os.Bundle import android.view.View import android.widget.Button import android.widget.EditText +import android.widget.TextView import androidx.activity.ComponentActivity import com.adobe.marketing.mobile.Assurance +import com.adobe.marketing.mobile.edge.media.Media class MainActivity : ComponentActivity() { @@ -25,6 +27,17 @@ class MainActivity : ComponentActivity() { super.onCreate(savedInstanceState) setContentView(R.layout.activity_main) + // Deep links handling + val intent = intent + val data = intent.data + + if (data != null) { + Assurance.startSession(data.toString()) + } + + val versionTextView = findViewById(R.id.version) + versionTextView.text = Media.extensionVersion() + val startPlayerButton = findViewById