Skip to content

Commit e843e84

Browse files
authored
Merge pull request #98 from OpenSRP/migrate-to-android-x
Migrate to AndroidX & GitHub Actions
2 parents 74ee0b1 + 71bc781 commit e843e84

40 files changed

+228
-189
lines changed

.github/workflows/ci.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# This workflow will build a Java project with Gradle
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/building-and-testing-java-with-gradle
3+
4+
name: Android CI with Gradle
5+
6+
on:
7+
push:
8+
branches: [ master ]
9+
pull_request:
10+
branches: [ master ]
11+
12+
jobs:
13+
unit_tests:
14+
15+
runs-on: ubuntu-latest
16+
17+
steps:
18+
- uses: actions/checkout@v2
19+
- name: Set up JDK 1.8
20+
uses: actions/setup-java@v1
21+
with:
22+
java-version: 1.8
23+
- name: Grant execute permission for gradlew
24+
run: chmod +x gradlew
25+
- name: Run unit tests with Gradle
26+
run: ./gradlew :opensrp-reporting:clean :opensrp-reporting:jacocoTestReport --stacktrace
27+
- name: Generate Javadoc with Gradle
28+
run: ./gradlew javadoc
29+
- name: Upload coverage to Coveralls with Gradle
30+
run: ./gradlew opensrp-reporting:coveralls --stacktrace
31+
env:
32+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_TOKEN }}

.travis.yml

Lines changed: 0 additions & 43 deletions
This file was deleted.

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@
22

33
OpenSRP Client Reporting Library
44

5-
[![Build Status](https://travis-ci.org/OpenSRP/opensrp-client-reporting.svg?branch=master)](https://travis-ci.org/OpenSRP/opensrp-client-reporting) [![Coverage Status](https://coveralls.io/repos/github/OpenSRP/opensrp-client-reporting/badge.svg?branch=master)](https://coveralls.io/github/OpenSRP/opensrp-client-reporting?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/642391cacc03450b894b662eac7f30a3)](https://www.codacy.com/app/OpenSRP/opensrp-client-reporting?utm_source=github.com&utm_medium=referral&utm_content=OpenSRP/opensrp-client-reporting&utm_campaign=Badge_Grade)
5+
![Build status](https://github.com/OpenSRP/opensrp-client-reporting/.github/workflows/Android%20CI%20with%20Gradle/badge.svg) (https://travis-ci.org/OpenSRP/opensrp-client-reporting) [![Coverage Status](https://coveralls.io/repos/github/OpenSRP/opensrp-client-reporting/badge.svg?branch=master)](https://coveralls.io/github/OpenSRP/opensrp-client-reporting?branch=master) [![Codacy Badge](https://api.codacy.com/project/badge/Grade/642391cacc03450b894b662eac7f30a3)](https://www.codacy.com/app/OpenSRP/opensrp-client-reporting?utm_source=github.com&utm_medium=referral&utm_content=OpenSRP/opensrp-client-reporting&utm_campaign=Badge_Grade)
66

77
## Introduction
88

99
The Reporting library allows creating of visualizations for display in an application for instance on a dashboard.
10-
The library provides a custom numeric value display to show a lable and a numeric value and extends [HelloCharts Android library](https://github.com/lecho/hellocharts-android)
10+
The library provides a custom numeric value display to show a label and a numeric value and extends [HelloCharts Android library](https://github.com/lecho/hellocharts-android)
1111
to show Charts e.g. PieCharts
1212

1313
## Supported visualizations

build.gradle

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,23 +3,35 @@ buildscript {
33
repositories {
44
google()
55
mavenCentral()
6+
mavenLocal()
7+
maven { url "https://plugins.gradle.org/m2/" }
8+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
9+
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
610
}
711

812
dependencies {
913
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
14+
classpath 'gradle.plugin.org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.10.2'
15+
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.5"
1016
}
1117
}
1218

19+
apply plugin: 'java'
20+
apply plugin: 'build-dashboard'
21+
apply plugin: 'io.codearte.nexus-staging'
22+
1323
configure(allprojects) { project ->
1424

1525
version = VERSION_NAME
1626
group = GROUP
27+
1728
buildscript {
1829
repositories {
1930
google()
2031
jcenter()
2132
mavenCentral()
2233
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
34+
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
2335
mavenLocal()
2436
}
2537
}
@@ -31,11 +43,11 @@ subprojects {
3143

3244
group = 'org.smartregister'
3345

34-
ext.androidToolsBuildGradle = '28.0.0'
35-
ext.androidBuildToolsVersion = '28.0.0'
46+
ext.androidToolsBuildGradle = '4.0.0'
47+
ext.androidBuildToolsVersion = '29.0.3'
3648
ext.androidMinSdkVersion = 18
37-
ext.androidCompileSdkVersion = 28
38-
ext.androidTargetSdkVersion = 28
49+
ext.androidCompileSdkVersion = 29
50+
ext.androidTargetSdkVersion = 29
3951

4052
ext.androidAnnotationsVersion = '3.0.1';
4153
ext.androidAnnotationsAPIVersion = '3.0.1';
@@ -48,6 +60,9 @@ subprojects {
4860
maven { url "http://acra.googlecode.com/svn/repository/releases" }
4961
maven { url "https://repo.maven.apache.org/maven2" }
5062
maven { url "http://cloudant.github.io/cloudant-sync-eap/repository" }
63+
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
64+
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
65+
maven { url 'https://dl.bintray.com/ibm-watson-health/ibm-fhir-server-releases'}
5166
mavenLocal()
5267
}
5368

@@ -62,10 +77,6 @@ subprojects {
6277
}
6378
}
6479

65-
apply plugin : 'java'
66-
apply plugin : 'build-dashboard'
67-
apply plugin: 'io.codearte.nexus-staging'
68-
6980
buildDashboard {
7081
reports.html.setDestination(file("build/"))
7182
}

gradle.properties

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
VERSION_NAME=0.0.22-SNAPSHOT
1+
VERSION_NAME=0.1.0-SNAPSHOT
22
VERSION_CODE=1
33
GROUP=org.smartregister
44
POM_SETTING_DESCRIPTION=OpenSRP Client Reporting Library
@@ -11,5 +11,8 @@ POM_SETTING_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
1111
POM_SETTING_LICENCE_DIST=repo
1212
POM_SETTING_DEVELOPER_ID=opensrp
1313
POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev
14+
android.useAndroidX=true
15+
android.enableJetifier=true
16+
org.gradle.jvmargs=-Xmx2048M
1417

1518

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
#Tue Mar 26 17:38:02 EAT 2019
1+
#Sun Jul 05 22:13:24 EAT 2020
22
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-4.6-all.zip
6+
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip

opensrp-reporting/build.gradle

Lines changed: 36 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,7 @@ buildscript {
66
jcenter()
77
}
88
dependencies {
9-
classpath "com.android.tools.build:gradle:3.1.2"
10-
classpath 'org.kt3k.gradle.plugin:coveralls-gradle-plugin:2.8.2'
9+
classpath "com.android.tools.build:gradle:${androidToolsBuildGradle}"
1110
}
1211
}
1312

@@ -23,13 +22,20 @@ android {
2322
compileSdkVersion androidCompileSdkVersion
2423
buildToolsVersion androidBuildToolsVersion
2524

25+
defaultPublishConfig !isReleaseBuild() ? "debug" : "release"
26+
27+
compileOptions {
28+
sourceCompatibility JavaVersion.VERSION_1_8
29+
targetCompatibility JavaVersion.VERSION_1_8
30+
}
31+
2632
defaultConfig {
2733
minSdkVersion androidMinSdkVersion
2834
targetSdkVersion androidTargetSdkVersion
2935
versionCode Integer.parseInt(project.VERSION_CODE)
3036
versionName project.VERSION_NAME
3137
multiDexEnabled true
32-
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
38+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
3339
}
3440
buildTypes {
3541
release {
@@ -38,9 +44,11 @@ android {
3844
buildConfigField "int", "REPORT_INDICATOR_GENERATION_MINUTES", '15'
3945
}
4046
debug {
47+
testCoverageEnabled = true
4148
buildConfigField "int", "REPORT_INDICATOR_GENERATION_MINUTES", '15'
4249
}
4350
}
51+
4452
dexOptions {
4553
javaMaxHeapSize "4g"
4654
}
@@ -58,6 +66,8 @@ android {
5866
exclude 'META-INF/NOTICE.txt'
5967
exclude 'META-INF/notice.txt'
6068
exclude 'META-INF/ASL2.0'
69+
exclude 'META-INF/LICENSE.md'
70+
exclude 'META-INF/NOTICE.md'
6171
}
6272

6373
testOptions {
@@ -73,28 +83,25 @@ tasks.withType(Test) {
7383
jacoco.includeNoLocationClasses = true
7484
}
7585

76-
allprojects {
77-
repositories {
78-
maven { url 'https://oss.sonatype.org/content/repositories/snapshots/' }
79-
maven { url "https://s3.amazonaws.com/repo.commonsware.com" }
80-
mavenLocal()
81-
}
82-
}
83-
8486
dependencies {
85-
implementation('org.smartregister:opensrp-client-core:1.9.3-SNAPSHOT@aar') {
87+
implementation('org.smartregister:opensrp-client-core:1.15.4-SNAPSHOT@aar') {
8688
transitive = true
8789
exclude group: 'com.github.bmelnychuk', module: 'atv'
8890
exclude group: 'com.google.guava', module: 'guava'
8991
exclude group: 'com.android.support', module: 'appcompat-v7'
92+
exclude group: 'com.android.support', module: 'design'
93+
exclude group: 'com.android.support', module: 'recyclerview-v7'
9094
exclude group: 'org.apache.httpcomponents', module: 'httpmime'
95+
exclude group: 'com.ibm.fhir', module: 'fhir-model'
9196
}
9297

93-
implementation 'com.android.support:appcompat-v7:28.0.0'
94-
implementation 'com.android.support:support-v4:28.0.0'
95-
implementation 'com.android.support:recyclerview-v7:28.0.0'
96-
implementation 'com.android.support:design:28.0.0'
97-
implementation 'com.android.support.constraint:constraint-layout:1.1.3'
98+
compileOnly 'com.ibm.fhir:fhir-model:4.2.3'
99+
100+
implementation 'androidx.appcompat:appcompat:1.0.0'
101+
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
102+
implementation 'androidx.recyclerview:recyclerview:1.0.0'
103+
implementation 'com.google.android.material:material:1.0.0'
104+
implementation 'androidx.constraintlayout:constraintlayout:1.1.3'
98105
implementation 'com.github.lecho:hellocharts-library:1.5.8@aar'
99106

100107
implementation 'com.google.guava:guava:20.0'
@@ -113,13 +120,17 @@ dependencies {
113120
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
114121
testImplementation "org.powermock:powermock-classloading-xstream:$powerMockVersion"
115122
testImplementation 'org.skyscreamer:jsonassert:1.5.0'
116-
androidTestImplementation 'com.android.support.test:runner:1.0.2'
117-
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
123+
androidTestImplementation 'androidx.test.ext:junit:1.1.1'
124+
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
118125

119126
implementation group: 'org.yaml', name: 'snakeyaml', version: '1.23'
120127

121128
}
122129

130+
tasks.coveralls {
131+
dependsOn 'jacocoTestReport'
132+
}
133+
123134
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
124135

125136
reports {
@@ -131,18 +142,19 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
131142
getReports().getHtml().setDestination(file("${buildDir}/reports/jacoco/jacocoRootReport/html"))
132143

133144
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*', '**/*$ViewBinder*.*']
134-
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
145+
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
135146
def mainSrc = "$project.projectDir/src/main/java"
136147

137-
sourceDirectories = files([mainSrc])
138-
classDirectories = files([debugTree])
139-
executionData = fileTree(dir: project.buildDir, includes: [
148+
sourceDirectories.setFrom(files([mainSrc]))
149+
classDirectories.setFrom(files([debugTree]))
150+
executionData.setFrom(fileTree(dir: project.buildDir, includes: [
140151
'jacoco/testDebugUnitTest.exec', 'outputs/code-coverage/connected/*coverage.ec'
141-
])
152+
]))
142153
}
143154

144155
coveralls {
145156
jacocoReportPath = "${buildDir}/reports/jacoco/jacocoRootReport/merged.xml"
157+
sourceDirs = ["$project.projectDir/src/main/java"]
146158
}
147159

148160
apply from: '../maven.gradle'

opensrp-reporting/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
android:label="@string/app_name"
88
android:supportsRtl="true">
99
<service
10-
android:name=".service.IndicatorGeneratorIntentService"
10+
android:name="org.smartregister.reporting.service.IndicatorGeneratorIntentService"
1111
android:exported="false"></service>
1212
</application>
1313

opensrp-reporting/src/main/java/org/smartregister/reporting/ReportingLibrary.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
package org.smartregister.reporting;
22

3-
import android.support.annotation.NonNull;
4-
import android.util.Log;
3+
import androidx.annotation.NonNull;
54

65
import net.sqlcipher.database.SQLiteDatabase;
76

opensrp-reporting/src/main/java/org/smartregister/reporting/adapter/TableViewWidgetAdapter.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,15 @@
33
import android.content.Context;
44
import android.graphics.drawable.GradientDrawable;
55
import android.graphics.drawable.LayerDrawable;
6-
import android.support.v4.widget.TextViewCompat;
7-
import android.support.v7.widget.RecyclerView;
86
import android.view.Gravity;
97
import android.view.LayoutInflater;
108
import android.view.View;
119
import android.view.ViewGroup;
1210
import android.widget.TextView;
1311

12+
import androidx.core.widget.TextViewCompat;
13+
import androidx.recyclerview.widget.RecyclerView;
14+
1415
import org.smartregister.reporting.R;
1516
import org.smartregister.reporting.view.TableView;
1617

0 commit comments

Comments
 (0)