Skip to content

Commit 45d9197

Browse files
committed
feat(kits): add adjust sample apps and CI example builds
Introduce Kotlin/Java sample apps for adjust-5 and wire a CI-only settings file so example modules stay isolated from kit settings and settings-kits.gradle.
1 parent a130b07 commit 45d9197

24 files changed

Lines changed: 369 additions & 0 deletions

File tree

.github/workflows/build-kits.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Build Kits
2+
3+
on:
4+
workflow_call:
5+
workflow_dispatch:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
load-matrix:
12+
name: Load kit matrix
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set.outputs.matrix }}
16+
steps:
17+
- uses: actions/checkout@v6
18+
with:
19+
sparse-checkout: kits/matrix.json
20+
sparse-checkout-cone-mode: false
21+
- id: set
22+
run: echo "matrix=$(jq -c . kits/matrix.json)" >> "$GITHUB_OUTPUT"
23+
24+
build-kits:
25+
name: Build ${{ matrix.kit.name }}
26+
needs: load-matrix
27+
runs-on: ubuntu-latest
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
kit: ${{ fromJson(needs.load-matrix.outputs.matrix) }}
32+
steps:
33+
- name: Checkout
34+
uses: actions/checkout@v6
35+
36+
- name: Set SDK version
37+
run: |
38+
echo "ORG_GRADLE_PROJECT_VERSION=$(head -n 1 VERSION)" >> $GITHUB_ENV
39+
echo "ORG_GRADLE_PROJECT_version=$(head -n 1 VERSION)" >> $GITHUB_ENV
40+
41+
- name: Install JDK 17
42+
uses: actions/setup-java@v5
43+
with:
44+
distribution: zulu
45+
java-version: "17"
46+
47+
- name: Publish core SDK to Maven Local
48+
run: ./gradlew publishMavenPublicationToMavenLocal
49+
50+
- name: Run kit unit tests
51+
if: ${{ matrix.kit.skip_unit_tests != true }}
52+
run: |
53+
./gradlew "${{ matrix.kit.kit_project }}:testRelease" \
54+
-c settings-kits.gradle \
55+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
56+
57+
- name: Build Kotlin example
58+
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_kotlin_project != '' }}
59+
run: |
60+
./gradlew "${{ matrix.kit.example_kotlin_project }}:assembleDebug" \
61+
-c settings-kit-examples.gradle \
62+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true
63+
64+
- name: Build Java example
65+
if: ${{ matrix.kit.skip_example_builds != true && matrix.kit.example_java_project != '' }}
66+
run: |
67+
./gradlew "${{ matrix.kit.example_java_project }}:assembleDebug" \
68+
-c settings-kit-examples.gradle \
69+
-Pmparticle.kit.mparticleFromMavenLocalOnly=true

.github/workflows/pull-request.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,9 @@ jobs:
153153
with:
154154
base_branch: main
155155

156+
build-kits:
157+
uses: ./.github/workflows/build-kits.yml
158+
156159
kit-compatibility-test:
157160
name: "Kit Compatibility Test"
158161
runs-on: ubuntu-latest
@@ -188,6 +191,7 @@ jobs:
188191
lint-checks,
189192
kotlin-lint-checks,
190193
kit-compatibility-test,
194+
build-kits,
191195
]
192196
uses: mParticle/mparticle-workflows/.github/workflows/dependabot-save-pr-number.yml@main
193197

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
plugins {
2+
id 'com.android.application'
3+
}
4+
5+
android {
6+
namespace 'com.mparticle.kits.adjust.example.java'
7+
compileSdk 34
8+
9+
defaultConfig {
10+
applicationId 'com.mparticle.kits.adjust.example.java'
11+
minSdk 21
12+
targetSdk 34
13+
versionCode 1
14+
versionName '1.0'
15+
}
16+
17+
compileOptions {
18+
sourceCompatibility JavaVersion.VERSION_17
19+
targetCompatibility JavaVersion.VERSION_17
20+
}
21+
22+
buildTypes {
23+
release {
24+
minifyEnabled false
25+
}
26+
}
27+
}
28+
29+
dependencies {
30+
implementation project(':kits:adjust:adjust-5')
31+
implementation 'androidx.appcompat:appcompat:1.6.1'
32+
implementation 'com.google.android.material:material:1.11.0'
33+
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
3+
4+
<application
5+
android:name=".ExampleApplication"
6+
android:allowBackup="true"
7+
android:icon="@mipmap/ic_launcher"
8+
android:label="@string/app_name"
9+
android:roundIcon="@mipmap/ic_launcher_round"
10+
android:supportsRtl="true"
11+
android:theme="@style/Theme.AppCompat.Light.DarkActionBar">
12+
<activity
13+
android:name=".MainActivity"
14+
android:exported="true">
15+
<intent-filter>
16+
<action android:name="android.intent.action.MAIN" />
17+
<category android:name="android.intent.category.LAUNCHER" />
18+
</intent-filter>
19+
</activity>
20+
</application>
21+
22+
</manifest>
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
package com.mparticle.kits.adjust.example.java;
2+
3+
import android.app.Application;
4+
5+
import com.mparticle.MPEvent;
6+
import com.mparticle.MParticle;
7+
import com.mparticle.MParticleOptions;
8+
9+
public class ExampleApplication extends Application {
10+
@Override
11+
public void onCreate() {
12+
super.onCreate();
13+
MParticleOptions options =
14+
MParticleOptions.builder(this)
15+
.credentials(
16+
"REPLACE WITH YOUR MPARTICLE API KEY",
17+
"REPLACE WITH YOUR MPARTICLE API SECRET")
18+
.logLevel(MParticle.LogLevel.VERBOSE)
19+
.build();
20+
MParticle.start(options);
21+
MParticle.getInstance()
22+
.logEvent(new MPEvent.Builder("foo", MParticle.EventType.Other).build());
23+
}
24+
}
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
package com.mparticle.kits.adjust.example.java;
2+
3+
import android.os.Bundle;
4+
5+
import androidx.appcompat.app.AppCompatActivity;
6+
7+
public class MainActivity extends AppCompatActivity {
8+
@Override
9+
protected void onCreate(Bundle savedInstanceState) {
10+
super.onCreate(savedInstanceState);
11+
setContentView(R.layout.activity_main);
12+
}
13+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<vector xmlns:android="http://schemas.android.com/apk/res/android"
2+
android:width="108dp"
3+
android:height="108dp"
4+
android:viewportWidth="108"
5+
android:viewportHeight="108">
6+
<path
7+
android:fillColor="#3DDC84"
8+
android:pathData="M0,0h108v108h-108z" />
9+
<path
10+
android:fillColor="#00000000"
11+
android:pathData="M9,0L9,108"
12+
android:strokeWidth="0.8"
13+
android:strokeColor="#33FFFFFF" />
14+
</vector>
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
3+
android:layout_width="match_parent"
4+
android:layout_height="match_parent"
5+
android:gravity="center"
6+
android:orientation="vertical"
7+
android:padding="16dp">
8+
9+
<TextView
10+
android:layout_width="wrap_content"
11+
android:layout_height="wrap_content"
12+
android:text="@string/app_name" />
13+
14+
</LinearLayout>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
</adaptive-icon>
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
3+
<background android:drawable="@color/ic_launcher_background" />
4+
<foreground android:drawable="@drawable/ic_launcher_foreground" />
5+
</adaptive-icon>

0 commit comments

Comments
 (0)