Skip to content

Commit ab8c891

Browse files
all: update agp 8.7.3 and remove sonar
1 parent 9a45633 commit ab8c891

File tree

9 files changed

+29
-89
lines changed

9 files changed

+29
-89
lines changed

.github/workflows/android.yml

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,10 @@ jobs:
66
runs-on: ubuntu-latest
77
steps:
88
- uses: actions/checkout@v2
9-
- name: set up JDK 1.8
10-
uses: actions/setup-java@v1
9+
- name: set up JDK 21
10+
uses: actions/setup-java@v4
1111
with:
12-
java-version: 1.8
12+
distribution: 'temurin'
13+
java-version: 21
1314
- name: Run CI
1415
run: make ci

Makefile

+1-9
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,6 @@ test-coverage:
1717
./gradlew testDebugCoverageUnitTest && \
1818
awk -F"," '{ instructions += $$4 + $$5; covered += $$5 } END { print covered, "/", instructions, "instructions covered"; print "Total", 100*covered/instructions "% covered" }' mixpanel-dispatcher/build/test-results/jacoco.csv
1919

20-
check-token:
21-
ifndef SONAR_TOKEN
22-
$(error SONAR_TOKEN is undefined)
23-
endif
24-
25-
sonar: check-token
26-
./gradlew sonarqube
27-
2820
lint:
2921
./gradlew lintDebug
3022

@@ -33,4 +25,4 @@ ci: clean lint test-coverage aar
3325
publish: aar
3426
./gradlew mixpanel-dispatcher:publish
3527

36-
.PHONY: ci sonar check-token
28+
.PHONY: ci

build.gradle

+3-4
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,10 @@
33
buildscript {
44
repositories {
55
google()
6-
jcenter()
6+
mavenCentral()
77
}
88
dependencies {
9-
classpath 'com.android.tools.build:gradle:3.6.0'
10-
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8'
9+
classpath 'com.android.tools.build:gradle:8.7.3'
1110
// NOTE: Do not place your application dependencies here; they belong
1211
// in the individual module build.gradle files
1312
}
@@ -16,8 +15,8 @@ buildscript {
1615
allprojects {
1716
repositories {
1817
google()
19-
jcenter()
2018
mavenLocal()
19+
mavenCentral()
2120
}
2221
}
2322

gradle/wrapper/gradle-wrapper.properties

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
33
distributionPath=wrapper/dists
44
zipStoreBase=GRADLE_USER_HOME
55
zipStorePath=wrapper/dists
6-
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip

mixpanel-dispatcher/build.gradle

+12-15
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ ext {
77
}
88

99
android {
10-
compileSdkVersion 30
10+
namespace "com.batch.android.dispatcher.mixpanel"
11+
compileSdk 35
1112

1213
defaultConfig {
13-
minSdkVersion 15
14-
targetSdkVersion 30
14+
minSdkVersion 21
1515
versionCode 2
1616
versionName "2.0.0"
1717

@@ -27,6 +27,7 @@ android {
2727
testOptions {
2828
unitTests {
2929
includeAndroidResources = true
30+
returnDefaultValues = true
3031
all {
3132
testLogging {
3233
events "started", "passed", "skipped", "failed"
@@ -37,22 +38,18 @@ android {
3738
}
3839

3940
dependencies {
40-
api 'com.batch.android:batch-sdk:1.17.0'
41+
api 'com.batch.android:batch-sdk:2.1.0'
4142
api 'com.mixpanel.android:mixpanel-android:5.8.0'
4243

43-
testImplementation 'junit:junit:4.12'
44-
testImplementation 'androidx.test.ext:junit:1.1.1'
45-
testImplementation 'org.mockito:mockito-core:3.2.4'
46-
testImplementation 'org.robolectric:robolectric:4.3.1'
47-
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
44+
testImplementation 'junit:junit:4.13.2'
45+
testImplementation 'org.robolectric:robolectric:4.12.2'
4846

4947
// We use PowerMock to mock Mixpanel in tests
50-
testImplementation 'org.powermock:powermock-module-junit4:2.0.4'
51-
testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.4'
52-
testImplementation 'org.powermock:powermock-api-mockito2:2.0.4'
53-
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.4'
48+
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
49+
testImplementation 'org.powermock:powermock-module-junit4-rule-agent:2.0.9'
50+
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
51+
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.9'
5452
}
5553

5654
apply from: 'maven-publish.gradle'
57-
apply from: 'jacoco.gradle'
58-
apply from: 'sonar.gradle'
55+
apply from: 'jacoco.gradle'

mixpanel-dispatcher/jacoco.gradle

+4-3
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ configurations {
66
}
77

88
jacoco {
9-
toolVersion = '0.8.5'
9+
toolVersion = '0.8.12'
1010
}
1111

1212
def offline_instrumented_outputDir = "$buildDir.path/intermediates/classes-instrumented/debug"
1313

1414
tasks.withType(Test) {
1515
jacoco.includeNoLocationClasses = true
16+
jacoco.excludes = ['jdk.internal.*']
1617
}
1718

1819
/* This task is used to create offline instrumentation of classes for on-the-fly instrumentation coverage tool like Jacoco. See jacoco classId
@@ -43,7 +44,7 @@ task testDebugCoverageUnitTest(dependsOn: ['instrument', 'testDebugUnitTest']) {
4344
structure(name: 'DispatcherCoverage') {
4445
classfiles {
4546
fileset(
46-
dir: "$buildDir/intermediates/javac/debug/classes",
47+
dir: "$buildDir/intermediates/javac/debug/compileDebugJavaWithJavac/classes",
4748
excludes: '**/R.class,**/R$*.class,**/BuildConfig.*'
4849
)
4950
}
@@ -83,7 +84,7 @@ task instrument(dependsOn:'compileDebugUnitTestSources') {
8384
classpath: configurations.jacocoAnt.asPath)
8485

8586
ant.instrument(destdir: offline_instrumented_outputDir) {
86-
fileset(dir: "$buildDir.path/intermediates/javac/debug/classes")
87+
fileset(dir: "$buildDir.path/intermediates/javac/debug/compileDebugJavaWithJavac/classes")
8788
}
8889
}
8990
}

mixpanel-dispatcher/sonar.gradle

-39
This file was deleted.

mixpanel-dispatcher/src/main/AndroidManifest.xml

+1-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
<manifest package="com.batch.android.dispatcher.mixpanel"
2-
xmlns:android="http://schemas.android.com/apk/res/android">
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
32

43
<application>
54
<service

mixpanel-dispatcher/src/test/java/com/batch/android/dispatcher/mixpanel/MixpanelDispatcherTest.java

+3-13
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,20 @@
11
package com.batch.android.dispatcher.mixpanel;
22

3-
import android.content.Context;
43
import android.os.Build;
5-
import android.os.Bundle;
64

75
import com.batch.android.Batch;
86
import com.batch.android.BatchMessage;
97
import com.batch.android.BatchPushPayload;
108
import com.mixpanel.android.mpmetrics.MixpanelAPI;
119

1210
import org.junit.Before;
13-
import org.junit.Rule;
1411
import org.junit.Test;
1512
import org.junit.runner.RunWith;
1613
import org.mockito.ArgumentMatcher;
1714
import org.mockito.Mockito;
1815
import org.powermock.api.mockito.PowerMockito;
19-
import org.powermock.core.classloader.annotations.PowerMockIgnore;
2016
import org.powermock.core.classloader.annotations.PrepareForTest;
21-
import org.powermock.modules.junit4.rule.PowerMockRule;
17+
import org.robolectric.RobolectricTestRunner;
2218
import org.robolectric.annotation.Config;
2319

2420
import java.util.HashMap;
@@ -28,25 +24,19 @@
2824

2925
import androidx.annotation.NonNull;
3026
import androidx.annotation.Nullable;
31-
import androidx.test.ext.junit.runners.AndroidJUnit4;
3227

3328
/**
3429
* Test the Mixpanel Event Dispatcher implementation
3530
*/
36-
@RunWith(AndroidJUnit4.class)
3731
@Config(sdk = Build.VERSION_CODES.O_MR1)
38-
@PowerMockIgnore({"org.powermock.*", "org.mockito.*", "org.robolectric.*", "android.*", "androidx.*"})
32+
@RunWith(RobolectricTestRunner.class)
3933
@PrepareForTest(MixpanelAPI.class)
40-
public class MixpanelDispatcherTest
41-
{
42-
@Rule
43-
public PowerMockRule rule = new PowerMockRule();
34+
public class MixpanelDispatcherTest {
4435
private MixpanelAPI mixpanel;
4536
private MixpanelDispatcher mixpanelDispatcher;
4637

4738
@Before
4839
public void setUp() {
49-
Context context = PowerMockito.mock(Context.class);
5040
mixpanel = PowerMockito.mock(MixpanelAPI.class);
5141

5242
mixpanelDispatcher = new MixpanelDispatcher();

0 commit comments

Comments
 (0)