diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml index 22d5c4414..906e507a7 100644 --- a/.github/workflows/release-publish.yml +++ b/.github/workflows/release-publish.yml @@ -62,6 +62,25 @@ jobs: - name: Publish kits to Maven Central run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle + # rokt-sdk-plus (com.rokt:rokt-sdk-plus) is an umbrella over the mParticle Rokt kit + the + # Rokt Payment Extension. The "Publish core to Maven local" step above already placed + # android-core/android-kit-base/android-kit-plugin in mavenLocal; we also need the Rokt + # kit there so the umbrella resolves its mParticle dependencies locally rather than racing + # Maven Central propagation. com.rokt:payment-extension (+ roktsdk) come from Central, + # released independently from the ROKT sdk-android-source repo. + - name: Publish Rokt kit to Maven local (so rokt-sdk-plus resolves it locally) + run: ./gradlew :kits:android-rokt:rokt:publishMavenPublicationToMavenLocal -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-kits.gradle + + # Published under the com.rokt namespace, so this step uses the Rokt Maven Central + # credentials/signing key (separate from the com.mparticle secrets used above). + - name: Publish rokt-sdk-plus to Maven Central + env: + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ROKT_MAVEN_CENTRAL_SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.ROKT_MAVEN_CENTRAL_SIGNING_KEY_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.ROKT_SONATYPE_NEXUS_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.ROKT_SONATYPE_NEXUS_PASSWORD }} + run: ./gradlew publishMavenPublicationToMavenCentralRepository -PVERSION=${{ needs.setup-and-version.outputs.final_version }} -c settings-rokt-sdk-plus.gradle + - name: Create GitHub release uses: ncipollo/release-action@b7eabc95ff50cbeeedec83973935c8f306dfcd0b # v1.20.0 with: diff --git a/CHANGELOG.md b/CHANGELOG.md index fcfa57e4f..fa97857a7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,10 +2,15 @@ ## [Unreleased] +### Added + +- Add the `com.rokt:rokt-sdk-plus` umbrella artifact: a single dependency bundling the mParticle core SDK, the mParticle Rokt kit, and the Rokt Payment Extension (Shoppable Ads), mirroring the iOS `RoktSDKPlus` umbrella. + ### Changed - Add support for qualified alpha, beta, and release candidate versions in release workflows. - Add Kotlin `MParticle.rokt` access and `RoktLayout` event callbacks for the Rokt kit. +- Centralize the Rokt SDK / payment extension versions in root `gradle.properties` (`roktSdkVersion`, `roktPaymentExtensionVersion`), shared by the Rokt kit and `rokt-sdk-plus`. ### Removed diff --git a/buildSrc/src/main/kotlin/com/mparticle/MavenCentralPublish.kt b/buildSrc/src/main/kotlin/com/mparticle/MavenCentralPublish.kt index 840486690..a9a15dc2e 100644 --- a/buildSrc/src/main/kotlin/com/mparticle/MavenCentralPublish.kt +++ b/buildSrc/src/main/kotlin/com/mparticle/MavenCentralPublish.kt @@ -40,14 +40,21 @@ fun Project.configureMavenPublishing(mparticleMavenPublish: MParticleMavenPublis } else { logger.lifecycle("Skipping signAllPublications for ${project.name} (no signingInMemoryKey)") } + val mparticleRepoUrl = "https://github.com/mparticle/mparticle-android-sdk" pom { name.set(mparticleMavenPublish.description.getOrElse(project.name)) description.set(mparticleMavenPublish.description.getOrElse(project.name)) - url.set("https://github.com/mparticle/mparticle-android-sdk") + url.set(mparticleMavenPublish.pomUrl.getOrElse(mparticleRepoUrl)) licenses { license { - name.set("The Apache Software License, Version 2.0") - url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") + name.set( + mparticleMavenPublish.licenseName + .getOrElse("The Apache Software License, Version 2.0"), + ) + url.set( + mparticleMavenPublish.licenseUrl + .getOrElse("https://www.apache.org/licenses/LICENSE-2.0.txt"), + ) } } developers { diff --git a/buildSrc/src/main/kotlin/com/mparticle/publish/MParticleMavenPublishExtension.kt b/buildSrc/src/main/kotlin/com/mparticle/publish/MParticleMavenPublishExtension.kt index 6dba29989..3a82f9900 100644 --- a/buildSrc/src/main/kotlin/com/mparticle/publish/MParticleMavenPublishExtension.kt +++ b/buildSrc/src/main/kotlin/com/mparticle/publish/MParticleMavenPublishExtension.kt @@ -6,4 +6,12 @@ interface MParticleMavenPublishExtension { val groupId: Property val artifactId: Property val description: Property + + // Optional POM branding overrides. When unset, the convention plugin falls back to the + // mParticle defaults (Apache 2.0 license, mParticle project URL). Used by non-mParticle + // artifacts published from this repo (e.g. com.rokt:rokt-sdk-plus) so their POM carries + // the correct project URL and license. + val pomUrl: Property + val licenseName: Property + val licenseUrl: Property } diff --git a/gradle.properties b/gradle.properties index 2e22ec6d1..8e23ce651 100644 --- a/gradle.properties +++ b/gradle.properties @@ -6,3 +6,10 @@ org.gradle.jvmargs=-Xmx2560m android.defaults.buildfeatures.buildconfig=true systemProp.org.gradle.kotlin.dsl.precompiled.accessors.strict=true JAVA_VERSION=17 + +# Rokt SDK artifact versions. These ride their own release line (independent of the mParticle +# SDK VERSION) and are the single source of truth shared by the Rokt kit (com.rokt:roktsdk) and +# the rokt-sdk-plus umbrella (com.rokt:payment-extension). Bump together when adopting a new +# Rokt SDK release. +roktSdkVersion=6.0.1-rc.1 +roktPaymentExtensionVersion=6.0.1-rc.1 diff --git a/kits/rokt/rokt/build.gradle b/kits/rokt/rokt/build.gradle index cc343d190..1a42e1e50 100644 --- a/kits/rokt/rokt/build.gradle +++ b/kits/rokt/rokt/build.gradle @@ -82,7 +82,7 @@ dependencies { implementation 'androidx.annotation:annotation:1.5.0' implementation 'org.jetbrains.kotlinx:kotlinx-coroutines-core:1.9.0' implementation 'androidx.compose.runtime:runtime' - api 'com.rokt:roktsdk:6.0.1-rc.1' + api "com.rokt:roktsdk:${project.findProperty('roktSdkVersion') ?: '6.0.1-rc.1'}" api "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" testImplementation files('libs/java-json.jar') diff --git a/rokt-sdk-plus/README.md b/rokt-sdk-plus/README.md new file mode 100644 index 000000000..295acca6c --- /dev/null +++ b/rokt-sdk-plus/README.md @@ -0,0 +1,90 @@ +# Rokt SDK+ (Android) + +Rokt SDK+ is a single umbrella artifact that bundles everything needed to run Rokt Shoppable +Ads through mParticle on Android: + +- the mParticle core SDK (`com.mparticle:android-core`) +- the mParticle Rokt kit (`com.mparticle:android-rokt-kit`) +- the Rokt Payment Extension (`com.rokt:payment-extension`, which brings the Rokt SDK, + Stripe, and Google Pay) + +It is the Android counterpart of the iOS [`RoktSDKPlus`](https://github.com/mParticle/mparticle-apple-sdk/tree/main/Kits/rokt-sdk-plus/rokt-sdk-plus-ios) +umbrella. Add **one** dependency instead of wiring up core + kit + payment extension by hand, +with versions guaranteed to be compatible. + +Maven coordinates: **`com.rokt:rokt-sdk-plus`**. + +> The mParticle Rokt kit deliberately does **not** pull the payment extension (and Stripe) +> transitively, so apps that don't need Shoppable Ads stay lightweight. Rokt SDK+ is the +> artifact that adds it on top. + +## Adding the dependency + +```groovy +dependencies { + implementation 'com.rokt:rokt-sdk-plus:6+' +} +``` + +This transitively provides `android-core`, `android-rokt-kit`, `com.rokt:roktsdk`, +`com.rokt:payment-extension`, Stripe, and Google Pay. You do not need to declare any of those +separately. + +## Versioning + +Rokt SDK+ tracks the mParticle Android SDK release line (it shares its version with +`android-core` and `android-rokt-kit`). The bundled Rokt artifacts (`roktsdk` / +`payment-extension`) ride their own Rokt release line; the pinned versions live in the repo's +root `gradle.properties` (`roktSdkVersion`, `roktPaymentExtensionVersion`). + +## Usage + +Initialize mParticle as usual: + +```kotlin +import com.mparticle.MParticle +import com.mparticle.MParticleOptions + +val options = MParticleOptions.builder(this) + .credentials("<<>>", "<<>>") + .build() +MParticle.start(options) +``` + +Select Rokt placements through the mParticle Rokt kit facade: + +```kotlin +import com.mparticle.kits.rokt + +MParticle.getInstance()?.rokt?.selectPlacements( + identifier = "RoktExperience", + attributes = attributes, +) +``` + +### Shoppable Ads + +Shoppable Ads use the payment extension bundled by this artifact. Register your payment +extension once (the Stripe publishable key is supplied from your Rokt kit settings in the +mParticle dashboard), then select shoppable placements: + +```kotlin +MParticle.getInstance()?.rokt?.registerPaymentExtension() + +MParticle.getInstance()?.rokt?.selectShoppableAds( + identifier = "RoktExperience", + attributes = attributes, +) +``` + +> The `registerPaymentExtension` / `selectShoppableAds` facade is provided by the mParticle +> Rokt kit. They require a kit version that includes Shoppable Ads support +> (see the kit [README](../kits/rokt/rokt/README.md)). + +## Documentation + +[Rokt Android integration guide](https://docs.rokt.com/developers/integration-guides/android/overview) + +## License + +[Rokt SDK License](https://rokt.com/sdk-license-2-0/) diff --git a/rokt-sdk-plus/build.gradle b/rokt-sdk-plus/build.gradle new file mode 100644 index 000000000..ab55c9b13 --- /dev/null +++ b/rokt-sdk-plus/build.gradle @@ -0,0 +1,62 @@ +apply plugin: 'com.android.library' +apply plugin: 'mparticle.android.library.publish' + +// No Kotlin plugin: the umbrella ships a single Java metadata class (RoktSdkPlus) and only +// aggregates dependencies. Avoiding the Kotlin toolchain sidesteps a stdlib-metadata version +// mismatch — the bundled Rokt artifacts are built with Kotlin 2.2, newer than this repo's +// compiler. Consumers still receive kotlin-stdlib transitively from those artifacts. + +// Rokt SDK+ is a thin umbrella artifact: it ships no runtime logic of its own and simply +// aggregates the mParticle core SDK, the mParticle Rokt kit, and the Rokt Payment Extension +// as a single dependency (the Android analog of the iOS `RoktSDKPlus` umbrella). It is NOT a +// kit, so it applies `com.android.library` + the publish convention plugin directly rather +// than `com.mparticle.kit`. + +// The umbrella tracks the mParticle SDK release line; the Rokt artifacts ride their own line. +def mpVersion = (project.findProperty('VERSION') ?: '0.0.0').toString() +def roktPaymentExtensionVersion = + (project.findProperty('roktPaymentExtensionVersion') ?: '6.0.1-rc.1').toString() + +mparticleMavenPublish { + groupId.set('com.rokt') + artifactId.set('rokt-sdk-plus') + description.set('Rokt SDK+ umbrella for Android: bundles the mParticle core SDK, the ' + + 'mParticle Rokt kit, and the Rokt Payment Extension (Shoppable Ads) as a single dependency.') + pomUrl.set('https://docs.rokt.com/developers/integration-guides/android/overview') + licenseName.set('Rokt SDK License') + licenseUrl.set('https://rokt.com/sdk-license-2-0/') +} + +android { + namespace 'com.rokt.sdkplus' + compileSdk 34 + + compileOptions { + sourceCompatibility JavaVersion.toVersion(JAVA_VERSION) + targetCompatibility JavaVersion.toVersion(JAVA_VERSION) + } + + defaultConfig { + minSdk 21 + versionName mpVersion + versionCode Integer.parseInt(new Date().format('yyyyMMdd')) + buildConfigField 'String', 'VERSION_NAME', '\"' + mpVersion + '\"' + } + + buildFeatures { + buildConfig = true + } +} + +dependencies { + // mParticle artifacts share the umbrella's version (this repo's VERSION). `android-core` + // is reached transitively through android-rokt-kit -> android-kit-base, but is listed + // explicitly so the published POM is self-documenting and pins a coherent core version. + api "com.mparticle:android-core:$mpVersion" + api "com.mparticle:android-rokt-kit:$mpVersion" + + // The Rokt Payment Extension (Stripe + Google Pay) rides the Rokt SDK release line and + // pulls com.rokt:roktsdk transitively. This is the dependency the mParticle Rokt kit + // deliberately omits — adding it here is the whole reason the umbrella exists. + api "com.rokt:payment-extension:$roktPaymentExtensionVersion" +} diff --git a/rokt-sdk-plus/src/main/AndroidManifest.xml b/rokt-sdk-plus/src/main/AndroidManifest.xml new file mode 100644 index 000000000..b2d3ea123 --- /dev/null +++ b/rokt-sdk-plus/src/main/AndroidManifest.xml @@ -0,0 +1,2 @@ + + diff --git a/rokt-sdk-plus/src/main/java/com/rokt/sdkplus/RoktSdkPlus.java b/rokt-sdk-plus/src/main/java/com/rokt/sdkplus/RoktSdkPlus.java new file mode 100644 index 000000000..4b385b377 --- /dev/null +++ b/rokt-sdk-plus/src/main/java/com/rokt/sdkplus/RoktSdkPlus.java @@ -0,0 +1,18 @@ +package com.rokt.sdkplus; + +/** + * Entry-point metadata for the Rokt SDK+ umbrella artifact. + * + *

Rokt SDK+ ({@code com.rokt:rokt-sdk-plus}) is a single dependency that bundles the mParticle + * core SDK, the mParticle Rokt kit, and the Rokt Payment Extension (Shoppable Ads). It contains no + * runtime logic of its own: initialize mParticle and use the Rokt kit APIs + * ({@code com.mparticle.kits.MParticleRokt.Rokt()}) exactly as you would without the umbrella. + */ +public final class RoktSdkPlus { + + private RoktSdkPlus() { + } + + /** The Rokt SDK+ umbrella version, aligned with the mParticle SDK release line. */ + public static final String VERSION = BuildConfig.VERSION_NAME; +} diff --git a/settings-rokt-sdk-plus.gradle b/settings-rokt-sdk-plus.gradle new file mode 100644 index 000000000..b813c235c --- /dev/null +++ b/settings-rokt-sdk-plus.gradle @@ -0,0 +1,12 @@ +// Isolated settings for the `com.rokt:rokt-sdk-plus` umbrella artifact. +// +// rokt-sdk-plus is intentionally kept OUT of the main settings.gradle so it is not picked up +// by the com.mparticle-credentialed publish steps. It is built and published in its own Gradle +// invocation with the Rokt Maven Central credentials — see .github/workflows/release-publish.yml. +// +// Its dependencies resolve as follows during a release build: +// * com.mparticle:android-rokt-kit -> android-kit-base -> android-core ... from mavenLocal +// (published earlier in the same release run; see the "Publish ... to Maven local" steps) +// * com.rokt:payment-extension + com.rokt:roktsdk ........................ from Maven Central +// (released independently from the ROKT sdk-android-source repo) +include ':rokt-sdk-plus'