Skip to content

Commit

Permalink
Upgrade depdencies + Migration refactor ⬆️ ♻️
Browse files Browse the repository at this point in the history
  • Loading branch information
ndegwamartin committed Jul 29, 2024
1 parent 01e91a9 commit 4391225
Show file tree
Hide file tree
Showing 31 changed files with 328 additions and 233 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# Kujaku (Peacock) ![Build Status](https://github.com/onaio/kujaku/actions/workflows/ci.yml/badge.svg) ![Download](https://badgen.net/maven/v/maven-central/io.ona.kujaku/library) [![Coverage Status](https://coveralls.io/repos/github/onaio/kujaku/badge.svg)](https://coveralls.io/github/onaio/kujaku)

A mapping and check-in library for Android using **MapBox SDK (Version 8.3.3)**
A mapping and check-in library for Android using **MapBox SDK (Version 9.7.1)**

## IMPORTANT UPDATE

Expand Down
34 changes: 22 additions & 12 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,16 @@
buildscript {
repositories {
google()
jcenter()
mavenCentral()
maven{ url "https://plugins.gradle.org/m2/" }
}

dependencies {

classpath 'com.android.tools.build:gradle:7.1.3'
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4'
classpath 'com.android.tools.build:gradle:8.4.2'
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.0'
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.0'
classpath 'com.google.firebase:firebase-crashlytics-gradle:2.9.1'
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.12.2'
classpath 'com.google.firebase:firebase-crashlytics-gradle:3.0.2'
//classpath 'com.palantir:jacoco-coverage:0.4.0'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -27,10 +25,10 @@ apply from: 'configs.gradle'
allprojects {
repositories {
google()
jcenter()
mavenCentral()
mavenLocal()
maven { url "https://jitpack.io" }
maven { url "https://repository.liferay.com/nexus/content/repositories/public" }
maven {
url "https://dl.cloudsmith.io/public/terraframe/geoprism-registry/maven/"
}
Expand Down Expand Up @@ -61,14 +59,27 @@ task clean(type: Delete) {
apply plugin: 'java'

coveralls {
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoFullReport/jacocoFullReport.xml"
jacocoReportPath = layout.buildDirectory.dir("reports/jacoco/jacocoFullReport/jacocoFullReport.xml")
sourceDirs += ["utils/src/main/java"
, "library/src/main/java"
, "sample/src/main/java"
, "wrapper/src/main/java"]
}

task jacocoFullReport(type: JacocoReport, group: 'Coverage reports') {

mustRunAfter ":library:testDebugUnitTest"
mustRunAfter ":utils:testDebugUnitTest"
mustRunAfter ":sample:testDebugUnitTest"

mustRunAfter ":library:connectedDebugAndroidTest"
mustRunAfter ":utils:connectedDebugAndroidTest"
mustRunAfter ":sample:connectedDebugAndroidTest"

mustRunAfter ":library:jacocoTestReport"
mustRunAfter ":utils:jacocoTestReport"
mustRunAfter ":sample:jacocoTestReport"

description = 'Generates an aggregate report from all subprojects'

additionalSourceDirs.from = files(subprojects.sourceSets.main.allSource.srcDirs)
Expand Down Expand Up @@ -97,12 +108,11 @@ task jacocoFullReport(type: JacocoReport, group: 'Coverage reports') {
sourceDirectories.from = sourcePaths
classDirectories.from = classPaths

getReports().getXml().setDestination(file("${buildDir}/reports/jacoco/jacocoFullReport/jacocoFullReport.xml"))
getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoFullReport/html"))

reports {
html.enabled true
xml.enabled true
xml.required.set(true)
html.required.set(true)
xml.outputLocation = layout.buildDirectory.file("reports/jacoco/jacocoFullReport/jacocoFullReport.xml")
html.outputLocation = layout.buildDirectory.dir("reports/jacoco/jacocoFullReport/html")
}

jacocoClasspath = files(jacocoClasspathPaths)
Expand Down
2 changes: 1 addition & 1 deletion configs.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ ext {
robolectricShadowsMultidexVersion = "4.13"
robolectricVersion = "4.13"
supportVersion = "1.0.0"
volleyVersion = "1.2.0"
volleyVersion = "1.2.1"
targetSdkVersion = 34

// Dependency names
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ POM_SETTING_DEVELOPER_ID=opensrp
POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev
android.useAndroidX=true
android.enableJetifier=true
android.nonFinalResIds=false

android.jetifier.ignorelist=shadows,bcprov-jdk18on
#android.jetifier.blacklist=shadows,bcprov-jdk15on
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Sun Aug 21 19:58:31 EAT 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.7-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
32 changes: 32 additions & 0 deletions jacoco-report.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest', 'connectedDebugAndroidTest']) {
//, 'createDebugCoverageReport']) {

reports {
xml.required.set(true)
html.required.set(true)
xml.outputLocation = layout.buildDirectory.file("reports/jacoco/jacocoRootReport/merged.xml")
html.outputLocation = layout.buildDirectory.dir("reports/jacoco/jacocoRootReport/html")
}

def fileFilter = [
"**/R.class",
"**/R\$*.class",
"**/BuildConfig.*",
"**/Manifest*.*",
"**/*Test*.*",
"android/**/*.*",
"io/realm/*.*",
"**/org/mockito/**",
"**/mockito-extensions/**"]
def debugTree = fileTree(dir: layout.buildDirectory.file("intermediates/javac/debug/compileDebugJavaWithJavac/classes/"), excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories.setFrom([mainSrc])
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: layout.buildDirectory, includes:
[
"outputs/unit_test_code_coverage/debugUnitTest/testDebugUnitTest.exec",
"outputs/code_coverage/debugAndroidTest/connected/**/coverage.ec",
]))
}
45 changes: 14 additions & 31 deletions library/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,13 @@ apply plugin: 'jacoco'
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
classpath "io.realm:realm-gradle-plugin:4.1.1"
classpath "io.realm:realm-gradle-plugin:10.18.0"
}
}

apply plugin: 'realm-android'
apply plugin: 'com.jfrog.bintray'
apply plugin: 'maven-publish'

version '0.10.2-SNAPSHOT'
Expand All @@ -25,15 +23,21 @@ jacoco {

android {

namespace "io.ona.kujaku"

compileSdk rootProject.ext.compileSdkVersion

buildFeatures {
buildConfig = true
}

compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}

defaultConfig {
minSdkVersion 19
minSdkVersion 21
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode 1
versionName this.version
Expand Down Expand Up @@ -64,7 +68,7 @@ android {

debug {
// See bug https://github.com/vanniktech/gradle-android-junit-jacoco-plugin/issues/183
testCoverageEnabled false
testCoverageEnabled true

if (project.rootProject.file("local.properties").exists()) {
Properties properties = new Properties()
Expand Down Expand Up @@ -124,13 +128,13 @@ dependencies { configuration ->
exclude group: 'com.android.support', module: 'support-v4'
}

implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.7.0'
implementation 'com.google.android.material:material:1.12.0'
implementation 'org.simpleframework:simple-xml:2.7.1'
implementation 'com.jakewharton.threetenabp:threetenabp:1.1.1'
implementation 'com.jakewharton.timber:timber:5.0.1'

implementation 'androidx.multidex:multidex:2.0.0'
implementation 'androidx.multidex:multidex:2.0.1'

customDependencies(this, configuration)
appPermissionsDependencies(configuration)
Expand All @@ -154,7 +158,7 @@ private static void testDependencies(instance, configuration) {

configuration.androidTestImplementation "org.mockito:mockito-android:$mockitoVersion"
configuration.androidTestImplementation "org.mockito:mockito-core:$mockitoVersion"
configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.1.0', {
configuration.androidTestImplementation ('com.android.support.test.espresso:espresso-core:3.6.1', {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'net.sf.kxml', module: 'kxml2'
})
Expand Down Expand Up @@ -184,28 +188,7 @@ tasks.withType(Test) {
jacoco.excludes = ['jdk.internal.*']
}

// createDebugCoverageReport is not available when android.buildTypes.debug.testCoverageEnabled is false
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) { //, 'createDebugCoverageReport']) {

reports {
xml.enabled = true
html.enabled = true
}

getReports().getXml().setDestination(file("${buildDir}/reports/jacoco/jacocoRootReport/merged.xml"))
getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoRootReport/html"))

def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*'
, 'android/**/*.*', "io/realm/*.*"]
def debugTree = fileTree(dir: "${buildDir}/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "${project.projectDir}/src/main/java"

sourceDirectories.setFrom([mainSrc])
classDirectories.setFrom(files([debugTree]))
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
]))
}

// Add github packages, maven-central and sonatype publishing
apply from: '../publish.gradle'
apply from: '../jacoco-report.gradle'
1 change: 0 additions & 1 deletion library/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.ona.kujaku">

<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION"/>
Expand Down
5 changes: 1 addition & 4 deletions library/src/main/java/io/ona/kujaku/KujakuLibrary.java
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,6 @@
import static android.content.Context.ALARM_SERVICE;
import static timber.log.Timber.DebugTree;

/**
* @author Vincent Karuri
*/
public class KujakuLibrary {

private static boolean enableMapDownloadResume;
Expand Down Expand Up @@ -63,7 +60,7 @@ public static void init(Context context) {
AndroidThreeTen.init(context);

if (Timber.treeCount() < 1) {
Timber.plant(new DebugTree());
Timber.plant((Timber.Tree) (Object) new DebugTree());
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,10 @@ public MapBoxOfflineQueueTask getNextTask() {

RealmResults<MapBoxOfflineQueueTask> realmResults = realm.where(MapBoxOfflineQueueTask.class)
.equalTo("taskStatus", MapBoxOfflineQueueTask.TASK_STATUS_NOT_STARTED)
.findAllSorted("dateUpdated", Sort.ASCENDING);
.sort("dateUpdated", Sort.ASCENDING)
.findAll();

if (realmResults.size() > 0) {
if (!realmResults.isEmpty()) {
return realmResults.first();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,15 @@ public class GenericAsyncTask {
private final AsyncTaskCallable toCall;
private OnFinishedListener onFinishedListener;

private ExecutorService executorService;

public GenericAsyncTask(@NonNull AsyncTaskCallable toCall) {
this.toCall = toCall;
}

public void execute() {
ExecutorService executorService = Executors.newSingleThreadExecutor();

try {

executorService = Executors.newSingleThreadExecutor();

Future<Object[]> result = executorService.submit(toCall);

Expand Down
4 changes: 1 addition & 3 deletions library/src/main/java/io/ona/kujaku/utils/LogUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@

import android.util.Log;

/**
* Created by Ephraim Kigamba - [email protected] on 31/07/2018
*/
import io.ona.kujaku.BuildConfig;

public class LogUtil {

Expand Down
1 change: 1 addition & 0 deletions library/src/main/res/values/colors.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,5 @@
<color name="infoWindowItemSelected">#2979FF</color>
<color name="my_location_marker_color">#3498db</color>
<color name="white">#ffffff</color>
<color name="mapbox_blue">#1E8CAB</color>
</resources>
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,6 @@
import java.util.UUID;
import java.util.concurrent.CountDownLatch;

import io.ona.kujaku.BuildConfig;
import io.ona.kujaku.data.MapBoxDeleteTask;
import io.ona.kujaku.data.MapBoxDownloadTask;
import io.ona.kujaku.data.realm.RealmDatabase;
Expand Down
Loading

0 comments on commit 4391225

Please sign in to comment.