diff --git a/.github/workflows/android.yml b/.github/workflows/android.yml index 35141b8..3300003 100644 --- a/.github/workflows/android.yml +++ b/.github/workflows/android.yml @@ -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 \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index 32fead9..c3a047b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,6 +1,9 @@ -UPCOMING +3.0.0 ----- +* Updated Batch to 2.1 +* Batch requires Android min SDK level 21 or higher. +* Batch requires to compile with SDK 35 (Android 15). * Fixed an issue where Batch would crash when a non-hierarchical URI was parsed in a deeplink. 2.0.0 diff --git a/Makefile b/Makefile index 9a7bffd..7bce632 100644 --- a/Makefile +++ b/Makefile @@ -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 @@ -33,4 +25,4 @@ ci: clean lint test-coverage aar publish: aar ./gradlew mixpanel-dispatcher:publish -.PHONY: ci sonar check-token \ No newline at end of file +.PHONY: ci \ No newline at end of file diff --git a/build.gradle b/build.gradle index 29053fb..53afc88 100644 --- a/build.gradle +++ b/build.gradle @@ -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 } @@ -16,8 +15,8 @@ buildscript { allprojects { repositories { google() - jcenter() mavenLocal() + mavenCentral() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index d5f3218..1fe6e94 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -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 diff --git a/mixpanel-dispatcher/build.gradle b/mixpanel-dispatcher/build.gradle index 3614d20..d6864b1 100644 --- a/mixpanel-dispatcher/build.gradle +++ b/mixpanel-dispatcher/build.gradle @@ -7,13 +7,13 @@ ext { } android { - compileSdkVersion 30 + namespace "com.batch.android.dispatcher.mixpanel" + compileSdk 35 defaultConfig { - minSdkVersion 15 - targetSdkVersion 30 - versionCode 2 - versionName "2.0.0" + minSdkVersion 21 + versionCode 3 + versionName "3.0.0" testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner" consumerProguardFiles 'consumer-rules.pro' @@ -27,6 +27,7 @@ android { testOptions { unitTests { includeAndroidResources = true + returnDefaultValues = true all { testLogging { events "started", "passed", "skipped", "failed" @@ -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' \ No newline at end of file +apply from: 'jacoco.gradle' \ No newline at end of file diff --git a/mixpanel-dispatcher/jacoco.gradle b/mixpanel-dispatcher/jacoco.gradle index 72cebf4..bac4900 100644 --- a/mixpanel-dispatcher/jacoco.gradle +++ b/mixpanel-dispatcher/jacoco.gradle @@ -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 @@ -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.*' ) } @@ -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") } } } \ No newline at end of file diff --git a/mixpanel-dispatcher/sonar.gradle b/mixpanel-dispatcher/sonar.gradle deleted file mode 100644 index a32e526..0000000 --- a/mixpanel-dispatcher/sonar.gradle +++ /dev/null @@ -1,39 +0,0 @@ -apply plugin: 'org.sonarqube' - -sonarqube { - properties { - - def libraries = project.android.sdkDirectory.getPath() + "/platforms/android-" + project.android.defaultConfig.targetSdkVersion.mApiLevel + "/android.jar" - //if (project.plugins.hasPlugin('com.android.application')) { - // "$buildDir/intermediates/exploded-aar/**/classes.jar" - // } - - property "sonar.projectName", "Android Mixpanel Dispatcher" - property "sonar.projectDescription", "Batch.com's Android Mixpanel Dispatcher main artifact" - property "sonar.projectKey", "BatchLabs_Batch-Android-mixpanel-dispatcher" - property "sonar.projectVersion", project.android.defaultConfig.versionName - property "sonar.organization", "batch" - property "sonar.host.url", "https://sonarcloud.io" - property "sonar.login", System.getenv('SONAR_TOKEN') - - property "sonar.sources", "src/main/java" - property "sonar.tests", "src/test/java" - property "sonar.binaries", "$buildDir/intermediates/javac/debug/classes" - - property "sonar.java.binaries", "$buildDir/intermediates/javac/debug/classes" - property "sonar.java.libraries", libraries - - property "sonar.java.test.binaries", "$buildDir/intermediates/javac/debugUnitTest/classes" - property "sonar.java.test.libraries", libraries - - // Junit report - property "sonar.junit.reportPaths", "$buildDir/test-results/testDebugUnitTest/" - - // Jacoco report - property "sonar.java.coveragePlugin", "jacoco" - property "sonar.coverage.jacoco.xmlReportPaths", "$buildDir/test-results/jacoco.xml" - - // Lint report - property "sonar.androidLint.reportPaths", "$buildDir/reports/lint-results-debug.xml" - } -} \ No newline at end of file diff --git a/mixpanel-dispatcher/src/main/AndroidManifest.xml b/mixpanel-dispatcher/src/main/AndroidManifest.xml index b7eeaa2..78e5580 100644 --- a/mixpanel-dispatcher/src/main/AndroidManifest.xml +++ b/mixpanel-dispatcher/src/main/AndroidManifest.xml @@ -1,5 +1,4 @@ - +