From 0e6aaf13407dd0601026f216b1fe662f8f9db46b Mon Sep 17 00:00:00 2001 From: Debanjan Chatterjee Date: Mon, 30 Oct 2023 10:41:17 +0000 Subject: [PATCH 1/7] feat: added os version to labels (#348) feat: added os version to labels fix: fixed test cases to accommodate changes --- .../ruddermetricsreporterandroid/LibraryMetadata.kt | 7 ++++++- .../ruddermetricsreporterandroid/error/ErrorModel.kt | 3 ++- .../LibraryMetadataTest.kt | 11 ++++++++++- 3 files changed, 18 insertions(+), 3 deletions(-) diff --git a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt index 42d10cc8f..60acf5352 100644 --- a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt +++ b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt @@ -14,6 +14,7 @@ package com.rudderstack.android.ruddermetricsreporterandroid +import android.os.Build import com.fasterxml.jackson.annotation.JsonProperty import com.google.gson.annotations.SerializedName import com.rudderstack.rudderjsonadapter.JsonAdapter @@ -35,7 +36,11 @@ data class LibraryMetadata( @get:JsonProperty("write_key") @SerializedName("write_key") @Json(name = "write_key") - val writeKey: String + val writeKey: String, + @get:JsonProperty("os_version") + @SerializedName("os_version") + @Json(name = "os_version") + val osVersion: String = Build.VERSION.SDK_INT.toString() ) : JSerialize { override fun serialize(jsonAdapter: JsonAdapter): String? { return jsonAdapter.writeToJson(this) diff --git a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/error/ErrorModel.kt b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/error/ErrorModel.kt index d5aed641a..08892e87c 100644 --- a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/error/ErrorModel.kt +++ b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/error/ErrorModel.kt @@ -38,7 +38,8 @@ class ErrorModel( "notifier" to mapOf( "name" to libraryMetadata.name, "version" to libraryMetadata.sdkVersion, - "url" to "https://github.com/rudderlabs/rudder-sdk-android" + "url" to "https://github.com/rudderlabs/rudder-sdk-android", + "os_version" to libraryMetadata.osVersion ) ) } \ No newline at end of file diff --git a/rudderreporter/src/test/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadataTest.kt b/rudderreporter/src/test/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadataTest.kt index f3cff33a8..a13b72acb 100644 --- a/rudderreporter/src/test/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadataTest.kt +++ b/rudderreporter/src/test/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadataTest.kt @@ -14,6 +14,7 @@ package com.rudderstack.android.ruddermetricsreporterandroid +import android.os.Build import com.rudderstack.android.ruddermetricsreporterandroid.internal.DefaultUploaderTestGson import com.rudderstack.android.ruddermetricsreporterandroid.internal.DefaultUploaderTestJackson import com.rudderstack.android.ruddermetricsreporterandroid.internal.DefaultUploaderTestMoshi @@ -33,7 +34,15 @@ abstract class LibraryMetadataTest { fun serialize() { val libraryMetadata = LibraryMetadata("test","1.0","4","abcde") val json = libraryMetadata.serialize(jsonAdapter) - assertEquals("{\"name\":\"test\",\"sdk_version\":\"1.0\",\"version_code\":\"4\",\"write_key\":\"abcde\"}",json) + assertEquals("{\"name\":\"test\",\"sdk_version\":\"1.0\",\"version_code\":\"4\"," + + "\"write_key\":\"abcde\",\"os_version\":\"${Build.VERSION.SDK_INT}\"}",json) + } + @Test + fun `serialize with version`() { + val libraryMetadata = LibraryMetadata("test","1.0","4","abcde", "[14]") + val json = libraryMetadata.serialize(jsonAdapter) + assertEquals("{\"name\":\"test\",\"sdk_version\":\"1.0\",\"version_code\":\"4\"," + + "\"write_key\":\"abcde\",\"os_version\":\"[14]\"}",json) } } class LibraryMetadataTestGson : LibraryMetadataTest() { From 94714ab35195a609746d639e20a121a705216ca1 Mon Sep 17 00:00:00 2001 From: Debanjan Chatterjee Date: Mon, 30 Oct 2023 10:46:30 +0000 Subject: [PATCH 2/7] fix: added discard policy (#347) fix: added discard policy fix: unnecessary mention removed --- .../rudderstack/android/repository/RudderDatabase.kt | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/repository/src/main/java/com/rudderstack/android/repository/RudderDatabase.kt b/repository/src/main/java/com/rudderstack/android/repository/RudderDatabase.kt index c23f7abb7..a12601715 100644 --- a/repository/src/main/java/com/rudderstack/android/repository/RudderDatabase.kt +++ b/repository/src/main/java/com/rudderstack/android/repository/RudderDatabase.kt @@ -21,6 +21,10 @@ import android.database.sqlite.SQLiteOpenHelper import java.util.concurrent.ConcurrentHashMap import java.util.concurrent.ExecutorService import java.util.concurrent.Executors +import java.util.concurrent.SynchronousQueue +import java.util.concurrent.ThreadPoolExecutor +import java.util.concurrent.TimeUnit + /** * Singleton class to act as the Database helper @@ -65,7 +69,13 @@ object RudderDatabase { databaseCreatedCallback: ((SQLiteDatabase?) -> Unit)? = null, databaseUpgradeCallback: ((SQLiteDatabase?, oldVersion: Int, newVersion: Int) -> Unit)? = null ) { - commonExecutor = executorService ?: Executors.newCachedThreadPool() + commonExecutor = executorService ?: ThreadPoolExecutor( + 0, + Int.MAX_VALUE, + 60L, + TimeUnit.SECONDS, + SynchronousQueue(), ThreadPoolExecutor.DiscardPolicy() + ); this.entityFactory = entityFactory if (sqliteOpenHelper != null) return From 2b47028f9453b12ec5227279dcb9757af7dfdfcb Mon Sep 17 00:00:00 2001 From: Debanjan Chatterjee Date: Mon, 30 Oct 2023 10:47:34 +0000 Subject: [PATCH 3/7] ci: fix github release workflows-v2 (#343) ci: fix github release workflows ci: remove excess condition check ci: fix the if condition --- .../publish-new-github-release-v2.yml | 28 ++++++------------- .github/workflows/release-v2.yml | 14 ++++++---- 2 files changed, 17 insertions(+), 25 deletions(-) diff --git a/.github/workflows/publish-new-github-release-v2.yml b/.github/workflows/publish-new-github-release-v2.yml index 03672322c..88f05a193 100644 --- a/.github/workflows/publish-new-github-release-v2.yml +++ b/.github/workflows/publish-new-github-release-v2.yml @@ -20,7 +20,6 @@ jobs: BRANCH_NAME="${{ github.event.pull_request.head.ref }}" VERSION=${BRANCH_NAME#hotfix-} VERSION=${VERSION#release-v2/} - echo "release_version=$VERSION" >> $GITHUB_OUTPUT - name: Checkout @@ -28,15 +27,6 @@ jobs: with: fetch-depth: 0 - - name: Get the latest version tag v2 - id: extract-previous-version-v2 - run: | - TAGS=$(git tag --sort=-v:refname) - TAGS_ARRAY=($TAGS) - VERSION=${TAGS_ARRAY[0]} - - echo "previous_version=$VERSION" >> $GITHUB_OUTPUT - - name: Setup Node v2 uses: actions/setup-node@v3 with: @@ -57,19 +47,19 @@ jobs: - name: Create Monorepo Release Tag v2 id: create_monorepo_release_v2 run: | - git tag -a v${{ steps.extract-version.outputs.release_version }} -m "chore: release v${{ steps.extract-version.outputs.release_version }}" - git push origin refs/tags/v${{ steps.extract-version.outputs.release_version }} + git tag -a v${{ steps.extract-version-v2.outputs.release_version }} -m "chore: release v${{ steps.extract-version-v2.outputs.release_version }}" + git push origin refs/tags/v${{ steps.extract-version-v2.outputs.release_version }} - name: Get the two latest versions run: | - CURRENT_VERSION=$(git tag -l "v*" --sort=-version:refname | head -n 1) - LAST_VERSION=$(git tag -l "v*" --sort=-version:refname | head -n 2 | awk 'NR == 2 { print $1 }') + CURRENT_VERSION=$(git tag -l "v2*" --sort=-version:refname | head -n 1) + LAST_VERSION=$(git tag -l "v2*" --sort=-version:refname | head -n 2 | awk 'NR == 2 { print $1 }') echo "Current version: $CURRENT_VERSION" echo "Previous version: $LAST_VERSION" - echo "current_version=$(echo $CURRENT_VERSION)" >> $GITHUB_ENV - echo "last_version=$(echo $LAST_VERSION)" >> $GITHUB_ENV + echo "current_monorepo_version=$(echo $CURRENT_VERSION)" >> $GITHUB_ENV + echo "last_monorepo_version=$(echo $LAST_VERSION)" >> $GITHUB_ENV echo "DATE=$(date)" >> $GITHUB_ENV - name: Create GitHub Releases v2 @@ -77,7 +67,7 @@ jobs: env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: | - npm run release:github -- --base=$last_version --head=$current_version + npm run release:github -- --base=${{ env.last_monorepo_version }} --head=${{ env.current_monorepo_version }} - name: Create pull request into develop v2 uses: repo-sync/pull-request@v2 @@ -85,7 +75,7 @@ jobs: source_branch: 'master-v2' destination_branch: 'develop-v2' github_token: ${{ secrets.PAT }} - pr_title: 'chore(release): pulling master-v2 into develop-v2 post release v${{ steps.extract-version.outputs.release_version }}' + pr_title: 'chore(release): pulling master-v2 into develop-v2 post release v${{ steps.extract-version-v2.outputs.release_version }}' pr_body: ':crown: *An automated PR*' pr_reviewer: 'itsdebs' @@ -131,7 +121,7 @@ jobs: "type": "section", "text": { "type": "mrkdwn", - "text": "*Release: <${{env.RELEASES_URL}}${{ steps.extract-previous-version.outputs.previous_version }}...v${{ steps.extract-version.outputs.release_version }}|v${{ steps.extract-version.outputs.release_version }}>*\n${{ env.DATE }}" + "text": "*Release: <${{env.RELEASES_URL}}${{ env.last_monorepo_version }}...v${{steps.extract-version-v2.outputs.release_version }}|v${{ steps.extract-version-v2.outputs.release_version }}>*\n${{ env.DATE }}" } } ] diff --git a/.github/workflows/release-v2.yml b/.github/workflows/release-v2.yml index 2d457dcd8..21a0a2d5f 100644 --- a/.github/workflows/release-v2.yml +++ b/.github/workflows/release-v2.yml @@ -6,9 +6,10 @@ on: - master-v2 types: - closed + workflow_dispatch: jobs: release-v2: - if: (startsWith(github.event.pull_request.head.ref, 'release-v2/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release-v2/')) && github.event.pull_request.merged == true # only merged pull requests must trigger this job + if: (${{ github.event_name == 'workflow_dispatch' }} && startsWith(github.ref, 'refs/heads/master-v2')) || ((startsWith(github.event.pull_request.head.ref, 'release-v2/') || startsWith(github.event.pull_request.head.ref, 'hotfix-release-v2/')) && github.event.pull_request.merged == true) # only merged pull requests must trigger this job runs-on: ubuntu-latest environment: deployment steps: @@ -48,19 +49,20 @@ jobs: - name: Get the two latest versions run: | - CURRENT_VERSION=$(git tag -l "v*" --sort=-version:refname | head -n 1) - LAST_VERSION=$(git tag -l "v*" --sort=-version:refname | head -n 2 | awk 'NR == 2 { print $1 }') + CURRENT_VERSION=$(git tag -l "v2*" --sort=-version:refname | head -n 1) + LAST_VERSION=$(git tag -l "v2*" --sort=-version:refname | head -n 2 | awk 'NR == 2 { print $1 }') echo "Current version: $CURRENT_VERSION" echo "Previous version: $LAST_VERSION" - echo "current_version=$(echo $CURRENT_VERSION)" >> $GITHUB_ENV - echo "last_version=$(echo $LAST_VERSION)" >> $GITHUB_ENV + echo "current_monorepo_version=$(echo $CURRENT_VERSION)" >> $GITHUB_ENV + echo "last_monorepo_version=$(echo $LAST_VERSION)" >> $GITHUB_ENV echo "DATE=$(date)" >> $GITHUB_ENV + - name: Publish release to sonatype run: | git fetch --no-tags --prune --depth=100 origin master-v2 - npm run release:sonatype -- --base=$last_version --head=$current_version + npm run release:sonatype -- --base=${{ env.last_monorepo_version }} --head=${{ env.current_monorepo_version }} env: SIGNING_KEY_ID: ${{ secrets.SIGNING_KEY_ID }} From 0cd4d5d9de4b465a55b87dabfa3caccc78aa40f1 Mon Sep 17 00:00:00 2001 From: Debanjan Chatterjee Date: Tue, 31 Oct 2023 12:33:26 +0530 Subject: [PATCH 4/7] fix: added jvm overloads (#353) fix: added jvm overloads --- .../android/ruddermetricsreporterandroid/LibraryMetadata.kt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt index 60acf5352..9ccdcb937 100644 --- a/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt +++ b/rudderreporter/src/main/java/com/rudderstack/android/ruddermetricsreporterandroid/LibraryMetadata.kt @@ -20,7 +20,7 @@ import com.google.gson.annotations.SerializedName import com.rudderstack.rudderjsonadapter.JsonAdapter import com.squareup.moshi.Json -data class LibraryMetadata( +data class LibraryMetadata @JvmOverloads constructor( @get:JsonProperty("name") @SerializedName("name") @Json(name = "name") From d100ee9706ae439d6ba52d7693791a0ca69023a9 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Tue, 31 Oct 2023 07:04:57 +0000 Subject: [PATCH 5/7] chore(repository): release version 0.2.2 --- repository/CHANGELOG.md | 7 +++++++ repository/package.json | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/repository/CHANGELOG.md b/repository/CHANGELOG.md index fcb11c5cd..64acdfccd 100644 --- a/repository/CHANGELOG.md +++ b/repository/CHANGELOG.md @@ -2,6 +2,13 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [0.2.2](https://github.com/rudderlabs/rudder-sdk-android/compare/repository@0.2.1...repository@0.2.2) (2023-10-31) + + +### Bug Fixes + +* added discard policy ([#347](https://github.com/rudderlabs/rudder-sdk-android/issues/347)) ([94714ab](https://github.com/rudderlabs/rudder-sdk-android/commit/94714ab35195a609746d639e20a121a705216ca1)) + ## 0.2.1 (2023-10-04) ### Bug Fixes diff --git a/repository/package.json b/repository/package.json index 3c323eeb8..c9b3470be 100644 --- a/repository/package.json +++ b/repository/package.json @@ -1,6 +1,6 @@ { "name": "repository", - "version": "0.2.1", + "version": "0.2.2", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From c1534e6223015a970cce2cbc661764c6fdbc874c Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Tue, 31 Oct 2023 07:04:58 +0000 Subject: [PATCH 6/7] chore(rudderreporter): release version 0.4.0 --- rudderreporter/CHANGELOG.md | 12 ++++++++++++ rudderreporter/package.json | 2 +- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/rudderreporter/CHANGELOG.md b/rudderreporter/CHANGELOG.md index 585792ad7..004a60e78 100644 --- a/rudderreporter/CHANGELOG.md +++ b/rudderreporter/CHANGELOG.md @@ -2,6 +2,18 @@ This file was generated using [@jscutlery/semver](https://github.com/jscutlery/semver). +## [0.4.0](https://github.com/rudderlabs/rudder-sdk-android/compare/rudderreporter@0.3.1...rudderreporter@0.4.0) (2023-10-31) + + +### Features + +* added os version to labels ([#348](https://github.com/rudderlabs/rudder-sdk-android/issues/348)) ([0e6aaf1](https://github.com/rudderlabs/rudder-sdk-android/commit/0e6aaf13407dd0601026f216b1fe662f8f9db46b)) + + +### Bug Fixes + +* added jvm overloads ([#353](https://github.com/rudderlabs/rudder-sdk-android/issues/353)) ([0cd4d5d](https://github.com/rudderlabs/rudder-sdk-android/commit/0cd4d5d9de4b465a55b87dabfa3caccc78aa40f1)) + ## [0.3.1](https://github.com/rudderlabs/rudder-sdk-android/compare/rudderreporter@0.3.0...rudderreporter@0.3.1) (2023-10-16) diff --git a/rudderreporter/package.json b/rudderreporter/package.json index 59f0e7014..3c05ccd78 100644 --- a/rudderreporter/package.json +++ b/rudderreporter/package.json @@ -1,6 +1,6 @@ { "name": "rudderreporter", - "version": "0.3.1", + "version": "0.4.0", "description": "", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" From 35e5e6baece3ca0aa451abc356e9653ffce89306 Mon Sep 17 00:00:00 2001 From: GitHub actions Date: Tue, 31 Oct 2023 07:05:01 +0000 Subject: [PATCH 7/7] chore: sync versions and generate release logs --- package-lock.json | 4 ++-- package.json | 2 +- repository/CHANGELOG_LATEST.md | 5 +++-- repository/gradle.properties | 4 ++-- repository/project.json | 4 ++-- rudderreporter/gradle.properties | 4 ++-- 6 files changed, 12 insertions(+), 11 deletions(-) diff --git a/package-lock.json b/package-lock.json index 431e9bf7d..0924a937c 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@rudderstack/rudder-sdk-android-monorepo", - "version": "2.4.0", + "version": "2.5.0", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@rudderstack/rudder-sdk-android-monorepo", - "version": "2.4.0", + "version": "2.5.0", "license": "MIT", "dependencies": { "@rudderstack/android": "file: ./android", diff --git a/package.json b/package.json index f039ee766..ff0dbe11f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@rudderstack/rudder-sdk-android-monorepo", - "version": "2.4.0", + "version": "2.5.0", "description": "Rudder Android SDK monorepo", "keywords": [ "android", diff --git a/repository/CHANGELOG_LATEST.md b/repository/CHANGELOG_LATEST.md index 76f30788e..d531bcbee 100644 --- a/repository/CHANGELOG_LATEST.md +++ b/repository/CHANGELOG_LATEST.md @@ -1,6 +1,7 @@ -## 0.2.1 (2023-10-04) +## [0.2.2](https://github.com/rudderlabs/rudder-sdk-android/compare/repository@0.2.1...repository@0.2.2) (2023-10-31) + ### Bug Fixes -* table not found in database. added locks ([#326](https://github.com/rudderlabs/rudder-sdk-android/issues/326)) ([1b5e670](https://github.com/rudderlabs/rudder-sdk-android/commit/1b5e670d5b10fe640099dc11353ae746ea6035b0)) +* added discard policy ([#347](https://github.com/rudderlabs/rudder-sdk-android/issues/347)) ([94714ab](https://github.com/rudderlabs/rudder-sdk-android/commit/94714ab35195a609746d639e20a121a705216ca1)) diff --git a/repository/gradle.properties b/repository/gradle.properties index 211ed3573..6d2e88026 100644 --- a/repository/gradle.properties +++ b/repository/gradle.properties @@ -4,7 +4,7 @@ GROUP=com.rudderstack.android.sdk POM_PACKAGING=aar android.enableJetifier=true android.useAndroidX=true -VERSION_CODE=3 -VERSION_NAME=0.2.1 +VERSION_CODE=4 +VERSION_NAME=0.2.2 POM_NAME=ORM library by RudderStack for android POM_DESCRIPTION=ORM library used in Rudderstack SDK Version 2 for android \ No newline at end of file diff --git a/repository/project.json b/repository/project.json index ef909ee4f..345c89caf 100644 --- a/repository/project.json +++ b/repository/project.json @@ -45,8 +45,8 @@ "github": { "executor": "@jscutlery/semver:github", "options": { - "title": "repository@0.2.1", - "tag": "repository@0.2.1", + "title": "repository@0.2.2", + "tag": "repository@0.2.2", "notesFile": "./repository/CHANGELOG_LATEST.md" } }, diff --git a/rudderreporter/gradle.properties b/rudderreporter/gradle.properties index 31908b27d..e04a04150 100644 --- a/rudderreporter/gradle.properties +++ b/rudderreporter/gradle.properties @@ -4,7 +4,7 @@ GROUP=com.rudderstack.android.sdk POM_PACKAGING=aar android.enableJetifier=true android.useAndroidX=true -VERSION_CODE=4 -VERSION_NAME=0.3.1 +VERSION_CODE=5 +VERSION_NAME=0.4.0 POM_NAME=Rudderstack Stats Collection library for android POM_DESCRIPTION=Rudderstack Stats Collection library for android \ No newline at end of file