Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
69 changes: 69 additions & 0 deletions .github/workflows/build-kits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Build Kits

on:
workflow_call:
workflow_dispatch:

permissions:
contents: read

jobs:
load-matrix:
name: Load kit matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set.outputs.matrix }}
steps:
- uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3
with:
sparse-checkout: kits/matrix.json
sparse-checkout-cone-mode: false
- id: set
run: echo "matrix=$(jq -c . kits/matrix.json)" >> "$GITHUB_OUTPUT"

build-kits:
name: Build ${{ matrix.kit.name }}
needs: load-matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
kit: ${{ fromJson(needs.load-matrix.outputs.matrix) }}
steps:
- name: Checkout
uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3

- name: Set SDK version
run: |
echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV

- name: Install JDK 17
uses: actions/setup-java@ad2b38190b15e4d6bdf0c97fb4fca8412226d287 # v5
with:
distribution: zulu
java-version: "17"

- name: Publish core SDK to Maven Local
run: ./gradlew publishMavenPublicationToMavenLocal

- name: Run kit unit tests
if: ${{ matrix.kit.skip_unit_tests != true }}
run: |
./gradlew "${{ matrix.kit.kit_project }}:testRelease" \
-c settings-kits.gradle \
-Pmparticle.kit.mparticleFromMavenLocalOnly=true

- name: Build Kotlin example
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_kotlin_project != '' }}
run: |
./gradlew "${{ matrix.kit.example_kotlin_project }}:assembleDebug" \
-c settings-kit-examples.gradle \
-Pmparticle.kit.mparticleFromMavenLocalOnly=true

- name: Build Java example
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_java_project != '' }}
run: |
./gradlew "${{ matrix.kit.example_java_project }}:assembleDebug" \
-c settings-kit-examples.gradle \
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
4 changes: 4 additions & 0 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,9 @@ jobs:
with:
base_branch: main

build-kits:
uses: ./.github/workflows/build-kits.yml

kit-compatibility-test:
name: "Kit Compatibility Test"
runs-on: ubuntu-latest
Expand Down Expand Up @@ -188,6 +191,7 @@ jobs:
lint-checks,
kotlin-lint-checks,
kit-compatibility-test,
build-kits,
]
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main

Expand Down
38 changes: 38 additions & 0 deletions kits/adjust/adjust-5/example/example-kotlin/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
plugins {
id 'com.android.application'
id 'org.jetbrains.kotlin.android'
}

android {
namespace 'com.mparticle.kits.adjust.example.kotlin'
compileSdk 34

defaultConfig {
applicationId 'com.mparticle.kits.adjust.example.kotlin'
minSdk 21
targetSdk 34
versionCode 1
versionName '1.0'
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

kotlinOptions {
jvmTarget = '17'
}

buildTypes {
release {
minifyEnabled false
}
}
}

dependencies {
implementation project(':kits:adjust:adjust-5')
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation 'com.google.android.material:material:1.11.0'
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application

Check warning on line 4 in kits/adjust/adjust-5/example/example-kotlin/src/main/AndroidManifest.xml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

Make sure backup of application data is safe here.

See more on https://sonarcloud.io/project/issues?id=mParticle_mparticle-android-sdk&issues=AZ7xAcXhDZRFUhWh6Jut&open=AZ7xAcXhDZRFUhWh6Jut&pullRequest=723

Check warning on line 4 in kits/adjust/adjust-5/example/example-kotlin/src/main/AndroidManifest.xml

View check run for this annotation

SonarQubeCloud / SonarCloud Code Analysis

"usesCleartextTraffic" is implicitly enabled for older Android versions. Make sure allowing clear-text traffic is safe here.

See more on https://sonarcloud.io/project/issues?id=mParticle_mparticle-android-sdk&issues=AZ7xAcXhDZRFUhWh6Jus&open=AZ7xAcXhDZRFUhWh6Jus&pullRequest=723
android:name=".ExampleApplication"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>

</manifest>
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
package com.mparticle.kits.adjust.example.kotlin

import android.app.Application
import com.mparticle.MPEvent
import com.mparticle.MParticle
import com.mparticle.MParticleOptions

class ExampleApplication : Application() {
override fun onCreate() {
super.onCreate()
val options =
MParticleOptions
.builder(this)
.credentials(
"REPLACE WITH YOUR MPARTICLE API KEY",
"REPLACE WITH YOUR MPARTICLE API SECRET",
).logLevel(MParticle.LogLevel.VERBOSE)
.build()
MParticle.start(options)
MParticle.getInstance()?.logEvent(
MPEvent.Builder("foo", MParticle.EventType.Other).build(),
)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package com.mparticle.kits.adjust.example.kotlin

import android.os.Bundle
import androidx.appcompat.app.AppCompatActivity

class MainActivity : AppCompatActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
super.onCreate(savedInstanceState)
setContentView(R.layout.activity_main)
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center"
android:orientation="vertical"
android:padding="16dp">

<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/app_name" />

</LinearLayout>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@color/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="ic_launcher_background">#FFFFFF</color>
</resources>
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="app_name">Adjust Kit Kotlin Example</string>
</resources>
8 changes: 8 additions & 0 deletions kits/matrix.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[
{
"name": "adjust-5",
"local_path": "kits/adjust/adjust-5",
"kit_project": ":kits:android-adjust:adjust-5",
"example_kotlin_project": ":kits:android-adjust:adjust-5:example-kotlin"
}
]
6 changes: 6 additions & 0 deletions settings-kit-examples.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// CI-only settings for kit sample apps. Keeps example modules out of settings-kits.gradle.
apply from: 'settings-kits.gradle'

include ':kits:adjust:adjust-5:example-kotlin'

project(':kits:adjust:adjust-5:example-kotlin').projectDir = file('kits/adjust/adjust-5/example/example-kotlin')
Loading