Skip to content

Commit

Permalink
Merge pull request #74 from OpenSRP/issue73
Browse files Browse the repository at this point in the history
Migrate to AndroidX
  • Loading branch information
ndegwamartin authored Oct 28, 2020
2 parents 33c2fdc + b36431b commit c765109
Show file tree
Hide file tree
Showing 34 changed files with 131 additions and 114 deletions.
60 changes: 33 additions & 27 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
language: android
# sudo set to required because of an issue with how TravisCI handles builds in Docker containers https://github.com/travis-ci/travis-ci/issues/3695.
# Setting sudo to required prevents Travis from testing the project in a Docker container.
language: minimal
os: linux
dist: xenial
group: edge
sudo: required
jdk: oraclejdk8
dist: trusty

before_cache:
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
Expand All @@ -16,38 +15,45 @@ cache:

env:
global:
# wait up to 10 minutes for adb to connect to emulator
- ADB_INSTALL_TIMEOUT=10
- MALLOC_ARENA_MAX=2

android:
components:
# tools required
- tools
# The BuildTools version used by your project
- build-tools-28.0.3
# The SDK version used to compile your projects
- android-28
# for updates check developer.android.com/studio#downloads (current 26.1.1)
- ANDROID_SDK_TOOLS=sdk-tools-linux-4333796.zip

addons:
apt_packages:
- pandoc

script:
- pandoc

before_install:
# set JAVA_HOME path
- export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
# download and unzip Android SDK command line tools
- wget -nv https://dl.google.com/android/repository/$ANDROID_SDK_TOOLS
- unzip -q $ANDROID_SDK_TOOLS -d $HOME/sdk
# set SDK tools path variable and ANDROID_HOME
- export PATH=$PATH:$HOME/sdk/tools/bin
- export ANDROID_HOME=$HOME/sdk
# create empty cfg file to prevent sdkmanager warning message
- mkdir -p $HOME/.android && touch $HOME/.android/repositories.cfg
install:
# accept licenses for all available packages that have not already been accepted
- yes | sdkmanager "platforms;android-28"
- yes | sdkmanager --licenses >/dev/null
- yes | sdkmanager "platforms;android-28"
before_script:
- echo "Travis branch is $TRAVIS_BRANCH"
- echo "Travis branch is in pull request $TRAVIS_PULL+REQUEST"
- chmod 755 gradlew
- ls -la
# Enable the line below once we get all the test passing, currently most of the tests are failing
# so we'll just if the project compiles
- travis_wait ./gradlew clean --stacktrace
#Run All tests Unit and Instrumentation
- java -version
- sudo apt-get install openjdk-8-jdk
- java -version
# set executable flag for gradle wrapper
- chmod +x gradlew

script:
- travis_wait ./gradlew :opensrp-growth-monitoring:jacocoTestReport --stacktrace
- travis_wait ./gradlew :opensrp-growth-monitoring:coveralls --stacktrace

after_failure:
- pandoc opensrp-growth-monitoring/build/reports/tests/index.html -t plain

- pandoc opensrp-growth-monitoring/build/reports/tests/index.html -t plain

notifications:
slack:
Expand Down
6 changes: 4 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@ buildscript {

dependencies {
classpath "io.codearte.gradle.nexus:gradle-nexus-staging-plugin:0.11.0"
classpath 'org.smartregister:gradle-jarjar-plugin:1.0.0-SNAPSHOT'
classpath "com.android.tools.build:gradle:4.0.1"
}
}

Expand All @@ -36,8 +38,8 @@ subprojects {

group = 'org.smartregister'

ext.androidToolsBuildGradle = '3.1.4'
ext.androidBuildToolsVersion = '28.0.3'
ext.androidToolsBuildGradle = '4.0.1'
ext.androidBuildToolsVersion = '29.0.2'
ext.androidMinSdkVersion = 18
ext.androidCompileSdkVersion = 28
ext.androidTargetSdkVersion = 28
Expand Down
8 changes: 6 additions & 2 deletions gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
VERSION_NAME=1.1.23-SNAPSHOT
VERSION_NAME=2.0.0-SNAPSHOT
VERSION_CODE=1
GROUP=org.smartregister
POM_SETTING_DESCRIPTION=OpenSRP Client Growth Monitoring Application
Expand All @@ -10,4 +10,8 @@ POM_SETTING_LICENCE_NAME=The Apache Software License, Version 2.0
POM_SETTING_LICENCE_URL=http://www.apache.org/licenses/LICENSE-2.0.txt
POM_SETTING_LICENCE_DIST=repo
POM_SETTING_DEVELOPER_ID=opensrp
POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev
POM_SETTING_DEVELOPER_NAME=OpenSRP Onadev

android.useAndroidX=true
android.enableJetifier=true
android.jetifier.blacklist=shadows
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
#Thu Aug 27 11:02:06 EAT 2020
#Wed Sept 09 11:02:06 EAT 2020
org.gradle.daemon=true
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1.1-all.zip
org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8
org.gradle.parallel=true
org.gradle.configureondemand=true
29 changes: 14 additions & 15 deletions opensrp-growth-monitoring/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ android {
versionCode Integer.parseInt(project.VERSION_CODE)
versionName project.VERSION_NAME
multiDexEnabled true
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
}

buildTypes {
Expand Down Expand Up @@ -106,32 +106,31 @@ dependencies {
exclude group: 'com.google.code.gson', module: 'gson'
}

implementation 'com.android.support:design:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
implementation 'com.google.android.material:material:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'

implementation group: 'org.apache.commons', name: 'commons-csv', version: '1.4'
implementation 'com.google.code.gson:gson:2.8.5'
implementation 'com.mcxiaoke.volley:library:1.0.19'
implementation 'com.github.lecho:hellocharts-android:v1.5.8'

testImplementation 'junit:junit:4.12'
testImplementation 'junit:junit:4.13'


def robolectricVersion = '3.8'
def robolectricVersion = '4.1'
testImplementation("org.robolectric:robolectric:$robolectricVersion") {
exclude group: 'com.google.auto.service', module: 'auto-service'
exclude group: 'com.android.support'
}
testImplementation "org.robolectric:shadows-multidex:$robolectricVersion"
testImplementation "org.robolectric:shadows-support-v4:3.1"
testImplementation "org.robolectric:shadows-support-v4:3.3.2"

androidTestImplementation('com.android.support.test.espresso:espresso-core:2.+') {
androidTestImplementation('androidx.test.espresso:espresso-core:3.1.0') {
exclude group: 'com.android.support', module: 'support-annotations'
exclude group: 'junit', module: 'junit'
}

// PowerMock
def powerMockVersion = '1.7.4'
def powerMockVersion = '2.0.7'
testImplementation "org.powermock:powermock-module-junit4:$powerMockVersion"
testImplementation "org.powermock:powermock-module-junit4-rule:$powerMockVersion"
testImplementation "org.powermock:powermock-api-mockito2:$powerMockVersion"
Expand All @@ -151,15 +150,15 @@ task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {
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/**/*.*', '**/*$ViewBinder*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/classes/debug", excludes: fileFilter)
def fileFilter = ['**/R.class', '**/R$*.class', '**/BuildConfig.*', '**/Manifest*.*', '**/*Test*.*', 'android/**/*.*', 'androidx/**/*.*', '**/*$ViewBinder*.*']
def debugTree = fileTree(dir: "$project.buildDir/intermediates/javac/debug/classes", excludes: fileFilter)
def mainSrc = "$project.projectDir/src/main/java"

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

coveralls {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.smartregister.growthmonitoring;

import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.smartregister.Context;
import org.smartregister.growthmonitoring.repository.HeightRepository;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package org.smartregister.growthmonitoring.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;
import androidx.fragment.app.Fragment;
import androidx.fragment.app.FragmentManager;
import androidx.fragment.app.FragmentPagerAdapter;

import java.util.ArrayList;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,4 @@ public String getDob() {
public void setDob(String dob) {
this.dob = dob;
}


}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import android.graphics.Point;
import android.os.Bundle;
import android.os.Handler;
import android.support.annotation.VisibleForTesting;
import android.support.design.widget.TabLayout;
import android.support.v4.app.DialogFragment;
import android.support.v4.view.ViewPager;
import androidx.annotation.VisibleForTesting;
import com.google.android.material.tabs.TabLayout;
import androidx.fragment.app.DialogFragment;
import androidx.viewpager.widget.ViewPager;
import android.text.TextUtils;
import android.view.Display;
import android.view.Gravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.graphics.DashPathEffect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
import android.content.Context;
import android.os.Bundle;
import android.os.Handler;
import android.support.v4.app.DialogFragment;
import androidx.fragment.app.DialogFragment;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.graphics.DashPathEffect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

import android.graphics.DashPathEffect;
import android.os.Bundle;
import android.support.v4.app.Fragment;
import androidx.fragment.app.Fragment;
import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.smartregister.growthmonitoring.job;

import android.content.Intent;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.smartregister.AllConstants;
import org.smartregister.growthmonitoring.service.intent.HeightIntentService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.smartregister.growthmonitoring.job;

import android.content.Intent;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.smartregister.AllConstants;
import org.smartregister.growthmonitoring.service.intent.WeightIntentService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package org.smartregister.growthmonitoring.job;

import android.content.Intent;
import android.support.annotation.NonNull;
import androidx.annotation.NonNull;

import org.smartregister.AllConstants;
import org.smartregister.growthmonitoring.service.intent.ZScoreRefreshIntentService;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package org.smartregister.growthmonitoring.repository;

import android.support.annotation.NonNull;
import androidx.annotation.NonNull;
import android.util.Log;

import org.jetbrains.annotations.Nullable;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
android:background="@drawable/dialog_shape"
android:orientation="vertical">

<android.support.v4.widget.NestedScrollView
<androidx.core.widget.NestedScrollView
android:id="@+id/edit_layout_scroll"
android:layout_width="match_parent"
android:layout_height="0dp"
Expand Down Expand Up @@ -256,7 +256,7 @@
android:layout_marginTop="10dp"
android:background="@color/client_list_header_dark_grey" />
</LinearLayout>
</android.support.v4.widget.NestedScrollView>
</androidx.core.widget.NestedScrollView>

<LinearLayout
android:id="@+id/button_layout"
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.constraint.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_margin="20dp"
android:background="@android:color/white">

<android.support.constraint.ConstraintLayout
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/child_profile_info_layout"
android:layout_width="match_parent"
android:layout_height="@dimen/client_profile_pic_dialog_height"
Expand Down Expand Up @@ -84,7 +84,7 @@
android:textSize="@dimen/child_details_tv_text_size" />

</LinearLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<!-- Growth tabs section -->
<LinearLayout
android:id="@+id/tabs_layout"
Expand All @@ -102,12 +102,12 @@
android:layout_height="1dp"
android:background="@color/client_list_header_dark_grey" />

<android.support.design.widget.TabLayout
<com.google.android.material.tabs.TabLayout
android:id="@+id/growth_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content" />

<android.support.v4.view.ViewPager
<androidx.viewpager.widget.ViewPager
android:id="@+id/growth_view_pager"
android:layout_width="match_parent"
android:layout_height="match_parent" />
Expand Down Expand Up @@ -142,4 +142,4 @@
android:textColor="@color/client_list_grey"
android:textSize="@dimen/record_weight_btn_text_size" />
</LinearLayout>
</android.support.constraint.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
Loading

0 comments on commit c765109

Please sign in to comment.