Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
09bfee2
feat: split LogoutListener from AttributeListener
denischilik Mar 27, 2026
ed12758
Simplify code
denischilik Mar 27, 2026
22710db
fix(kits): reference KitIntegration.LogoutListener without nested import
denischilik Mar 27, 2026
357e115
ci: pass -PVERSION to kit lint and ktlint in PR and daily workflows
denischilik Mar 27, 2026
c5a469a
refactor: import KitIntegration.LogoutListener for short name usage
denischilik Mar 27, 2026
920067a
ci: pass -PVERSION to isolated urbanairship kit Gradle steps
denischilik Mar 27, 2026
e7d3b44
ci: set Gradle VERSION via ORG_GRADLE_PROJECT_VERSION for kit jobs
denischilik Mar 27, 2026
a3d3efa
update trunk
denischilik Mar 30, 2026
cda6792
fix(kits): resolve com.mparticle from mavenLocal only when flag set
denischilik Mar 30, 2026
59a2532
fix(kit-plugin): resolve android-kit-base VERSION from root project
denischilik Mar 30, 2026
5a82036
ci: pass -Pversion to kit workflow Gradle commands
denischilik Mar 30, 2026
fe4f3ec
fix(kit-plugin): correct exclusiveContent mavenLocal repository refer…
denischilik Mar 30, 2026
910204c
fix(kit-plugin): use content filters for mavenLocal-only group resolu…
denischilik Mar 30, 2026
e6883d9
fix(adobe-kit): use currentUser identities in ID sync
denischilik Mar 30, 2026
eb91c39
fix(leanplum-kit): use current user identities in ID generation
denischilik Mar 30, 2026
727765e
ci: use local mparticle version for isolated urbanairship jobs
denischilik Mar 30, 2026
43d7f82
fix(kit-plugin): clear inherited repositories in local-only mode
denischilik Mar 30, 2026
3bbc708
style(kits): use short listener names in inheritance lists
denischilik Mar 30, 2026
43c15f0
fix(adobe-kit): null-safe current user identities lookup
denischilik Mar 30, 2026
1432a25
refactor(kit-plugin): simplify google repository filtering
denischilik Mar 30, 2026
d544369
fix(android-kit-base-tests): remove unused KitIntegration import
denischilik Mar 30, 2026
161aae1
ci: align workflow Gradle version property injection
denischilik Mar 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
27 changes: 15 additions & 12 deletions .github/workflows/daily.yml
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,8 @@ jobs:
uses: actions/checkout@v6
with:
ref: regression/${{ github.run_number }}
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
Expand All @@ -233,12 +235,11 @@ jobs:
- name: "Run Android Core SDK Lint"
run: ./gradlew lint
- name: "Setup Android Kit Lint"
run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew publishMavenPublicationToMavenLocal
- name: "Run Android Kit Lint"
run: ./gradlew lint -c settings-kits.gradle
run: ./gradlew lint -c settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true
- name: "Run Isolated Kit Lint (urbanairship-kit)"
working-directory: kits/urbanairship/urbanairship-20
run: ./gradlew lint
run: ./gradlew -Pmparticle.kit.mparticleFromMavenLocalOnly=true -p kits/urbanairship/urbanairship-20 lint
- name: "Archive Test Results"
uses: actions/upload-artifact@v7
if: always()
Expand All @@ -262,6 +263,8 @@ jobs:
uses: actions/checkout@v6
with:
ref: regression/${{ github.run_number }}
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
Expand All @@ -271,12 +274,11 @@ jobs:
- name: "Run Android Core SDK Kotlin Lint"
run: ./gradlew ktlintCheck
- name: "Setup Android Kit Kotlin Lint"
run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew publishMavenPublicationToMavenLocal
- name: "Run Android Kit Kotlin Lint"
run: ./gradlew ktlintCheck -c settings-kits.gradle
run: ./gradlew ktlintCheck -c settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true
- name: "Run Isolated Kit Kotlin Lint (urbanairship-kit)"
working-directory: kits/urbanairship/urbanairship-20
run: ./gradlew ktlintCheck
run: ./gradlew -Pmparticle.kit.mparticleFromMavenLocalOnly=true -p kits/urbanairship/urbanairship-20 ktlintCheck
- name: "Archive Test Results"
uses: actions/upload-artifact@v7
if: always()
Expand Down Expand Up @@ -305,19 +307,20 @@ jobs:
with:
repository: mparticle/mparticle-android-sdk
ref: regression/${{ github.run_number }}
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "17"
cache: "gradle"
- name: "Build Android Core"
run: ./gradlew clean publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew clean publishMavenPublicationToMavenLocal
- name: "Test Kits"
run: ./gradlew clean testRelease -c settings-kits.gradle
run: ./gradlew clean testRelease -c settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true
- name: "Test Isolated Kits (urbanairship-kit)"
working-directory: kits/urbanairship/urbanairship-20
run: ./gradlew clean testRelease
run: ./gradlew -Pmparticle.kit.mparticleFromMavenLocalOnly=true -p kits/urbanairship/urbanairship-20 clean testRelease

semantic-release-dryrun:
name: "Test Semantic Release - Dry Run"
Expand Down
23 changes: 14 additions & 9 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,8 @@ jobs:
steps:
- name: "Checkout Branch"
uses: actions/checkout@v6
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
Expand All @@ -108,9 +110,9 @@ jobs:
- name: "Run Android Core SDK Lint"
run: ./gradlew lint
- name: "Setup Android Kit Lint"
run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew publishMavenPublicationToMavenLocal
- name: "Run Android Kit Lint"
run: ./gradlew -c settings-kits.gradle lint
run: ./gradlew -c settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true lint
- name: "Archive Lint Test Results"
uses: actions/upload-artifact@v7
if: always()
Expand All @@ -125,6 +127,8 @@ jobs:
steps:
- name: "Checkout Branch"
uses: actions/checkout@v6
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
Expand All @@ -133,9 +137,9 @@ jobs:
- name: "Run Android Core SDK Kotlin Lint"
run: ./gradlew ktlintCheck
- name: "Setup Android Kit Kotlin Lint"
run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew publishMavenPublicationToMavenLocal
- name: "Run Android Kit Kotlin Lint"
run: ./gradlew -c settings-kits.gradle ktlintCheck
run: ./gradlew -c settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true ktlintCheck
- name: "Archive Kotlin Lint Test Results"
uses: actions/upload-artifact@v7
if: always()
Expand All @@ -156,20 +160,21 @@ jobs:
steps:
- name: "Checkout Branch"
uses: actions/checkout@v6
- run: echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
- run: echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
- name: "Install JDK 17"
uses: actions/setup-java@v5
with:
distribution: "zulu"
java-version: "17"
- name: "Generate Core Release Build"
run: ./gradlew publishMavenPublicationToMavenLocal -PVERSION=$(head -n 1 VERSION)
run: ./gradlew publishMavenPublicationToMavenLocal
- name: "Run Kit-Base Release Tests and Build"
run: ./gradlew :android-kit-base:testRelease -PVERSION=$(head -n 1 VERSION)
run: ./gradlew :android-kit-base:testRelease
- name: "Run Kit Release Tests and Build"
run: ./gradlew -p kits testRelease -c ../settings-kits.gradle -PVERSION=$(head -n 1 VERSION)
run: ./gradlew -p kits testRelease -c ../settings-kits.gradle -Pmparticle.kit.mparticleFromMavenLocalOnly=true
- name: "Run Isolated Kit Compatibility Tests (urbanairship)"
working-directory: kits/urbanairship/urbanairship-20
run: ./gradlew -PisRelease=true testRelease
run: ./gradlew -Pmparticle.kit.mparticleFromMavenLocalOnly=true -p kits/urbanairship/urbanairship-20 -PisRelease=true testRelease

automerge-dependabot:
name: "Save PR Number for Dependabot Automerge"
Expand Down
6 changes: 3 additions & 3 deletions .trunk/trunk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,11 @@ runtimes:
lint:
enabled:
- actionlint@1.7.7
- checkov@3.2.470
- checkov@3.2.513
- git-diff-check
- ktlint@1.7.1
- markdownlint@0.45.0
- prettier@3.6.2
- markdownlint@0.48.0
- prettier@3.8.1
- shellcheck@0.11.0
- shfmt@3.6.0
- trufflehog@3.90.6
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,14 @@
package com.mparticle.kits.testkits

import com.mparticle.MParticle
import com.mparticle.kits.KitIntegration
import com.mparticle.kits.KitIntegration.AttributeListener
import com.mparticle.kits.KitIntegration.LogoutListener
import com.mparticle.kits.ReportingMessage

open class AttributeListenerTestKit :
ListenerTestKit(),
KitIntegration.AttributeListener {
AttributeListener,
LogoutListener {
var setUserAttribute: ((attributeKey: String?, attributeValue: String?) -> Unit)? = null
var setUserAttributeList: ((attributeKey: String?, attributeValueList: List<String?>?) -> Unit)? =
null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -345,6 +345,21 @@ public interface SessionListener {
List<ReportingMessage> onSessionEnd();
}

/**
* Kits may implement this interface to respond when the mParticle Identity API performs a logout.
*/
public interface LogoutListener {

/**
* The mParticle SDK exposes a logout API, allowing developers to track an event
* when a user logs out of their app/platform. Use this opportunity to perform the appropriate logic
* as per your platforms logout paradigm, such as clearing user attributes.
*
* @return Kits should return a List of ReportingMessages indicating that the logout was processed one or more times, or null if it was not processed
*/
List<ReportingMessage> logout();
}

/**
* Kits should implement this interface when their underlying service has the notion
* of a user with attributes.
Expand Down Expand Up @@ -374,15 +389,6 @@ public interface AttributeListener {

void removeUserIdentity(MParticle.IdentityType identityType);

/**
* The mParticle SDK exposes a logout API, allowing developers to track an event
* when a user logs out of their app/platform. Use this opportunity to perform the appropriate logic
* as per your platforms logout paradigm, such as clearing user attributes.
*
* @return Kits should return a List of ReportingMessages indicating that the logout was processed one or more times, or null if it was not processed
*/
List<ReportingMessage> logout();

}

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
import com.mparticle.internal.Logger;
import com.mparticle.internal.MPUtility;
import com.mparticle.internal.ReportingManager;
import com.mparticle.kits.KitIntegration.LogoutListener;
import com.mparticle.kits.mappings.CustomMapping;
import com.mparticle.rokt.RoktOptions;

Expand Down Expand Up @@ -809,9 +810,8 @@ public void removeUserIdentity(MParticle.IdentityType identityType) {
public void logout() {
for (KitIntegration provider : providers.values()) {
try {
if (provider instanceof KitIntegration.AttributeListener && !provider.isDisabled()) {
List<ReportingMessage> report = ((KitIntegration.AttributeListener) provider).logout();
getReportingManager().logAll(report);
if (provider instanceof LogoutListener listener && !provider.isDisabled()) {
getReportingManager().logAll(listener.logout());
}
} catch (Exception e) {
Logger.warning("Failed to call logout for kit: " + provider.getName() + ": " + e.getMessage());
Expand Down
57 changes: 50 additions & 7 deletions kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -3,21 +3,22 @@
import com.android.build.gradle.LibraryExtension
import org.gradle.api.Plugin
import org.gradle.api.Project
import org.gradle.api.artifacts.dsl.RepositoryHandler

class KitPlugin implements Plugin<Project> {
void apply(Project target) {

//formerly in kit-common.gradle
target.apply(plugin: 'com.android.library')
target.group = 'com.mparticle'
target.buildscript.repositories.add(target.repositories.mavenLocal())
target.buildscript.repositories.add(target.repositories.google())
target.buildscript.repositories.add(target.repositories.mavenCentral())
target.repositories.add(target.repositories.mavenLocal())
target.repositories.add(target.repositories.google())
target.repositories.add(target.repositories.mavenCentral())
boolean mparticleFromMavenLocalOnly = resolveMparticleFromMavenLocalOnly(target)
configureRepositories(target.buildscript.repositories, mparticleFromMavenLocalOnly)
configureRepositories(target.repositories, mparticleFromMavenLocalOnly)
target.configurations.create('deployerJars')
def kitBaseVersion = target.findProperty('VERSION') ?: '+'
// VERSION from CI is often set only on the root project (e.g. ORG_GRADLE_PROJECT_VERSION); kit
// subprojects do not always inherit it, which would fall back to '+' and unstable resolution.
def kitBaseVersion =
target.findProperty('VERSION') ?: target.rootProject.findProperty('VERSION') ?: '+'
target.dependencies.add('api', 'com.mparticle:android-kit-base:' + kitBaseVersion)
target.dependencies.add('testImplementation', 'junit:junit:4.13.2')
target.dependencies.add('testImplementation', 'org.mockito:mockito-core:1.10.19')
Expand Down Expand Up @@ -57,5 +58,47 @@
// no-op: publish plugin unavailable outside monorepo
}
}

/**
* When true, {@code com.mparticle} artifacts (e.g. android-kit-base, android-kit-plugin) resolve
* only from {@code mavenLocal()}; Maven Central / Google are not queried for that group.
* Use after {@code publishMavenPublicationToMavenLocal} so CI and monorepo kit builds use the
* freshly published local artifacts. Enable with {@code -Pmparticle.kit.mparticleFromMavenLocalOnly=true}
* or env {@code MPARTICLE_KIT_FROM_MAVEN_LOCAL_ONLY=true}.
*/
private static boolean resolveMparticleFromMavenLocalOnly(Project target) {
String prop = target.findProperty('mparticle.kit.mparticleFromMavenLocalOnly')?.toString()
if (prop != null && Boolean.parseBoolean(prop)) {
return true
}
String env = System.getenv('MPARTICLE_KIT_FROM_MAVEN_LOCAL_ONLY')
return env != null && 'true'.equalsIgnoreCase(env)
}

private static void configureRepositories(RepositoryHandler repositories, boolean mparticleFromMavenLocalOnly) {
if (mparticleFromMavenLocalOnly) {
// Root build scripts may have already attached unfiltered repos. Rebuild this
// project's repository chain so com.mparticle cannot resolve outside mavenLocal().
def existingRepos = repositories.toList()
existingRepos.each { repo ->
repositories.remove(repo)
}
repositories.mavenLocal {
content {
includeGroup 'com.mparticle'
}
}
repositories.google()
repositories.mavenCentral {
content {
excludeGroup 'com.mparticle'

Check failure on line 94 in kit-plugin/src/main/groovy/com/mparticle/kits/KitPlugin.groovy

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Define a constant instead of using the literal 'com.mparticle' 3 times.

See more on https://sonarcloud.io/project/issues?id=mParticle_mparticle-android-sdk&issues=AZ0_KrozMoaXGtX_4e4I&open=AZ0_KrozMoaXGtX_4e4I&pullRequest=685
}
}
} else {
repositories.mavenLocal()
repositories.google()
repositories.mavenCentral()
}
}
}

Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import com.mparticle.internal.MPUtility
import com.mparticle.internal.MPUtility.AdIdInfo
import com.mparticle.kits.KitIntegration.ApplicationStateListener
import com.mparticle.kits.KitIntegration.AttributeListener
import com.mparticle.kits.KitIntegration.LogoutListener
import com.mparticle.kits.KitIntegration.PushListener
import org.json.JSONException
import org.json.JSONObject
Expand All @@ -16,6 +17,7 @@ import java.net.URL
abstract class AdobeKitBase :
KitIntegration(),
AttributeListener,
LogoutListener,
PushListener,
ApplicationStateListener {
private val dVer = "2"
Expand Down Expand Up @@ -138,7 +140,7 @@ abstract class AdobeKitBase :
dcsRegion,
pushId,
gaid,
userIdentities,
currentUser?.userIdentities ?: emptyMap(),
)
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import com.mparticle.MParticle
import com.mparticle.kits.KitIntegration.ApplicationStateListener
import com.mparticle.kits.KitIntegration.AttributeListener
import com.mparticle.kits.KitIntegration.EventListener
import com.mparticle.kits.KitIntegration.LogoutListener
import com.mparticle.kits.KitIntegration.PushListener
import com.mparticle.media.events.ContentType
import com.mparticle.media.events.EventAttributes
Expand All @@ -36,6 +37,7 @@ open class AdobeKit :
KitIntegration(),
EventListener,
AttributeListener,
LogoutListener,
PushListener,
ApplicationStateListener {
companion object {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,19 +31,22 @@ import com.mparticle.commerce.Product
import com.mparticle.consent.ConsentState
import com.mparticle.internal.Logger
import com.mparticle.internal.MPUtility
import com.mparticle.kits.KitIntegration.LogoutListener
import org.json.JSONArray
import org.json.JSONException
import org.json.JSONObject
import java.math.BigDecimal
import java.util.LinkedList
import com.mparticle.kits.KitIntegration.AttributeListener
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will trigger lint errors since the imports are not sorted. Something we can fix when the lint is unified across all the kits.


/**
* mParticle Kit wrapper for the AppsFlyer SDK
*/
class AppsFlyerKit :
KitIntegration(),
KitIntegration.EventListener,
KitIntegration.AttributeListener,
AttributeListener,
LogoutListener,
KitIntegration.CommerceListener,
AppsFlyerConversionListener,
KitIntegration.ActivityListener,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,13 @@ import com.mparticle.MParticle.IdentityType
import com.mparticle.commerce.CommerceEvent
import com.mparticle.kits.KitIntegration.AttributeListener
import com.mparticle.kits.KitIntegration.CommerceListener
import com.mparticle.kits.KitIntegration.LogoutListener
import java.math.BigDecimal

class ApptimizeKit :
KitIntegration(),
AttributeListener,
LogoutListener,
KitIntegration.EventListener,
CommerceListener,
OnTestRunListener {
Expand Down
Loading
Loading