Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

all: update agp 8.7.3 and remove sonar #3

Merged
merged 2 commits into from
Dec 6, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
7 changes: 4 additions & 3 deletions .github/workflows/android.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: set up JDK 1.8
uses: actions/setup-java@v1
- name: set up JDK 21
uses: actions/setup-java@v4
with:
java-version: 1.8
distribution: 'temurin'
java-version: 21
- name: Run CI
run: make ci
10 changes: 1 addition & 9 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,6 @@ test-coverage:
./gradlew testDebugCoverageUnitTest && \
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

check-token:
ifndef SONAR_TOKEN
$(error SONAR_TOKEN is undefined)
endif

sonar: check-token
./gradlew sonarqube

lint:
./gradlew lintDebug

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

.PHONY: ci sonar check-token
.PHONY: ci
7 changes: 3 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,10 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:3.6.0'
classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.8'
classpath 'com.android.tools.build:gradle:8.7.3'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
Expand All @@ -16,8 +15,8 @@ buildscript {
allprojects {
repositories {
google()
jcenter()
mavenLocal()
mavenCentral()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-5.6.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.9-bin.zip
27 changes: 12 additions & 15 deletions mixpanel-dispatcher/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ ext {
}

android {
compileSdkVersion 30
namespace "com.batch.android.dispatcher.mixpanel"
compileSdk 35

defaultConfig {
minSdkVersion 15
targetSdkVersion 30
minSdkVersion 21
versionCode 2
versionName "2.0.0"

Expand All @@ -27,6 +27,7 @@ android {
testOptions {
unitTests {
includeAndroidResources = true
returnDefaultValues = true
all {
testLogging {
events "started", "passed", "skipped", "failed"
Expand All @@ -37,22 +38,18 @@ android {
}

dependencies {
api 'com.batch.android:batch-sdk:1.17.0'
api 'com.batch.android:batch-sdk:2.1.0'
api 'com.mixpanel.android:mixpanel-android:5.8.0'

testImplementation 'junit:junit:4.12'
testImplementation 'androidx.test.ext:junit:1.1.1'
testImplementation 'org.mockito:mockito-core:3.2.4'
testImplementation 'org.robolectric:robolectric:4.3.1'
testImplementation 'androidx.test.espresso:espresso-core:3.2.0'
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.robolectric:robolectric:4.12.2'

// We use PowerMock to mock Mixpanel in tests
testImplementation 'org.powermock:powermock-module-junit4:2.0.4'
testImplementation 'org.powermock:powermock-module-junit4-rule:2.0.4'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.4'
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.4'
testImplementation 'org.powermock:powermock-module-junit4:2.0.9'
testImplementation 'org.powermock:powermock-module-junit4-rule-agent:2.0.9'
testImplementation 'org.powermock:powermock-api-mockito2:2.0.9'
testImplementation 'org.powermock:powermock-classloading-xstream:2.0.9'
}

apply from: 'maven-publish.gradle'
apply from: 'jacoco.gradle'
apply from: 'sonar.gradle'
apply from: 'jacoco.gradle'
7 changes: 4 additions & 3 deletions mixpanel-dispatcher/jacoco.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@ configurations {
}

jacoco {
toolVersion = '0.8.5'
toolVersion = '0.8.12'
}

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

tasks.withType(Test) {
jacoco.includeNoLocationClasses = true
jacoco.excludes = ['jdk.internal.*']
}

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

ant.instrument(destdir: offline_instrumented_outputDir) {
fileset(dir: "$buildDir.path/intermediates/javac/debug/classes")
fileset(dir: "$buildDir.path/intermediates/javac/debug/compileDebugJavaWithJavac/classes")
}
}
}
39 changes: 0 additions & 39 deletions mixpanel-dispatcher/sonar.gradle

This file was deleted.

3 changes: 1 addition & 2 deletions mixpanel-dispatcher/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
<manifest package="com.batch.android.dispatcher.mixpanel"
xmlns:android="http://schemas.android.com/apk/res/android">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">

<application>
<service
Expand Down
Original file line number Diff line number Diff line change
@@ -1,24 +1,20 @@
package com.batch.android.dispatcher.mixpanel;

import android.content.Context;
import android.os.Build;
import android.os.Bundle;

import com.batch.android.Batch;
import com.batch.android.BatchMessage;
import com.batch.android.BatchPushPayload;
import com.mixpanel.android.mpmetrics.MixpanelAPI;

import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.mockito.ArgumentMatcher;
import org.mockito.Mockito;
import org.powermock.api.mockito.PowerMockito;
import org.powermock.core.classloader.annotations.PowerMockIgnore;
import org.powermock.core.classloader.annotations.PrepareForTest;
import org.powermock.modules.junit4.rule.PowerMockRule;
import org.robolectric.RobolectricTestRunner;
import org.robolectric.annotation.Config;

import java.util.HashMap;
Expand All @@ -28,25 +24,19 @@

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.test.ext.junit.runners.AndroidJUnit4;

/**
* Test the Mixpanel Event Dispatcher implementation
*/
@RunWith(AndroidJUnit4.class)
@Config(sdk = Build.VERSION_CODES.O_MR1)
@PowerMockIgnore({"org.powermock.*", "org.mockito.*", "org.robolectric.*", "android.*", "androidx.*"})
@RunWith(RobolectricTestRunner.class)
@PrepareForTest(MixpanelAPI.class)
public class MixpanelDispatcherTest
{
@Rule
public PowerMockRule rule = new PowerMockRule();
public class MixpanelDispatcherTest {
private MixpanelAPI mixpanel;
private MixpanelDispatcher mixpanelDispatcher;

@Before
public void setUp() {
Context context = PowerMockito.mock(Context.class);
mixpanel = PowerMockito.mock(MixpanelAPI.class);

mixpanelDispatcher = new MixpanelDispatcher();
Expand Down
Loading