Skip to content

Commit

Permalink
Migrate to AndroidX (#911) (#919)
Browse files Browse the repository at this point in the history
* Initial migration to Android X

* Fix a few bad resource references

* Runnable, needs lots of love

* Update gradle.properties to include a flag for robolectric

* Update application class name to work with test runner

* Re-enable code coverage

* Remove broken (and no longer needed) resource workaround

* Re-enable screenshots plugin

* Fix Checkstyle configuration

* Bump heap size on Travis

* Can has more RAM?
  • Loading branch information
bherbst authored and phil-lopreiato committed May 25, 2019
1 parent e3299c5 commit aa32803
Show file tree
Hide file tree
Showing 269 changed files with 659 additions and 704 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ env:
- JOB=CHECKSTYLE
- JOB=PROD-BUILD
global:
- GRADLE_OPTS="-Xmx512m -Xms128m -Xss1m"
- GRADLE_OPTS="-Xmx2g -Xms128m -Xss1m"
- MALLOC_ARENA_MAX=1
matrix:
include:
Expand Down
59 changes: 29 additions & 30 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,13 @@ apply plugin: 'gitsemver'
apply plugin: 'com.github.triplet.play'
apply plugin: 'com.facebook.testing.screenshot'

apply from: "../code_coverage.gradle"
apply from: '../code_coverage.gradle'

// dependency checker plugin
// run ./gradlew dependencyUpdates to generate report
apply plugin: 'com.github.ben-manes.versions'

apply from: 'versioning.gradle'
apply from: 'build.workaround-missing-resource.gradle'

version semverVersion()
def (major, minor, patch, versionNum, gitTag, gitHash, commitsFromTag, repoDirty) =
Expand Down Expand Up @@ -172,24 +171,25 @@ screenshots {

println "Version: " + android.defaultConfig.versionName + "/" + android.defaultConfig.versionCode

task updateScreenshotDirs << {
def codeNameOut = new ByteArrayOutputStream()
exec {
commandLine 'adb', 'shell', 'getprop', 'ro.product.name'
standardOutput codeNameOut
}
task updateScreenshotDirs {
doLast {
def codeNameOut = new ByteArrayOutputStream()
exec {
commandLine 'adb', 'shell', 'getprop', 'ro.product.name'
standardOutput codeNameOut
}

def sdkOut = new ByteArrayOutputStream()
exec {
commandLine 'adb', 'shell', 'getprop', 'ro.build.version.sdk'
standardOutput sdkOut
def sdkOut = new ByteArrayOutputStream()
exec {
commandLine 'adb', 'shell', 'getprop', 'ro.build.version.sdk'
standardOutput sdkOut
}
def deviceName = codeNameOut.toString().trim()
def deviceSdk = sdkOut.toString().trim()
def outputDir = project.screenshots.recordDir + "/" + deviceName + "_api" + deviceSdk
project.screenshots.recordDir = outputDir
System.out.println("New screenshot output dierctory: " + outputDir)
}
def deviceName = codeNameOut.toString().trim()
def deviceSdk = sdkOut.toString().trim()
def outputDir = project.screenshots.recordDir + "/" + deviceName + "_api" + deviceSdk
project.screenshots.recordDir = outputDir
System.out.println("New screenshot output dierctory: " + outputDir)

}

repositories {
Expand Down Expand Up @@ -219,13 +219,13 @@ dependencies {
implementation project(':spectrum')

// Android support libraries
implementation "com.android.support:support-v13:${supportLibVersion}"
implementation "com.android.support:cardview-v7:${supportLibVersion}"
implementation "com.android.support:support-v4:${supportLibVersion}"
implementation "com.android.support:appcompat-v7:${supportLibVersion}"
implementation "com.android.support:gridlayout-v7:${supportLibVersion}"
implementation 'com.android.support:multidex:1.0.3'
implementation "com.android.support:design:${supportLibVersion}"
implementation 'androidx.legacy:legacy-support-v13:1.0.0'
implementation 'androidx.cardview:cardview:1.0.0'
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
implementation 'androidx.appcompat:appcompat:1.0.0'
implementation 'androidx.gridlayout:gridlayout:1.0.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'com.google.android.material:material:1.0.0'

// Play Services Libraries
// See http://developer.android.com/google/play-services/setup.html
Expand Down Expand Up @@ -277,17 +277,16 @@ dependencies {

// testing
testImplementation "org.robolectric:robolectric:${robolectricVersion}"
testImplementation "org.robolectric:shadows-support-v4:3.3.2"
testImplementation "org.robolectric:shadows-multidex:${robolectricVersion}"
testImplementation 'junit:junit:4.12'
testImplementation "org.mockito:mockito-core:${mockitoVersion}"
testAnnotationProcessor "com.google.dagger:dagger-compiler:${daggerVersion}"

// instrumentation
androidTestImplementation "com.android.support:support-annotations:${supportLibVersion}"
androidTestImplementation 'com.android.support.test:runner:1.0.2'
androidTestImplementation 'com.android.support.test:rules:1.0.2'
androidTestImplementation 'com.android.support.test.espresso:espresso-core:3.0.2'
androidTestImplementation 'androidx.annotation:annotation:1.0.0'
androidTestImplementation 'androidx.test:runner:1.1.0'
androidTestImplementation 'androidx.test:rules:1.1.0'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.1.0'
androidTestImplementation 'com.google.code.findbugs:jsr305:3.0.1'

// Leak Canary
Expand Down
45 changes: 0 additions & 45 deletions android/build.workaround-missing-resource.gradle

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.thebluealliance.androidclient.listitems;

import android.content.Context;
import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.testing;

import android.os.Bundle;
import android.support.test.runner.AndroidJUnitRunner;
import androidx.test.runner.AndroidJUnitRunner;

import com.facebook.testing.screenshot.ScreenshotRunner;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views.breakdowns;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views.breakdowns;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views.breakdowns;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views.breakdowns;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.thebluealliance.androidclient.views.breakdowns;

import android.support.test.InstrumentationRegistry;
import android.support.test.runner.AndroidJUnit4;
import androidx.test.InstrumentationRegistry;
import androidx.test.runner.AndroidJUnit4;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.FrameLayout;
Expand Down
4 changes: 2 additions & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />

<application
android:name=".TBAAndroid"
android:name=".TbaAndroid"
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
Expand Down Expand Up @@ -263,7 +263,7 @@

<!-- FileProvider for capturing team media -->
<provider
android:name="android.support.v4.content.FileProvider"
android:name="androidx.core.content.FileProvider"
android:authorities="${applicationId}.fileprovider"
android:exported="false"
android:grantUriPermissions="true">
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.google.firebase.auth;

import android.support.annotation.Nullable;
import androidx.annotation.Nullable;

/**
* A wrapper for {@link GoogleAuthCredential}, because the original class doesn't have a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@
import android.graphics.Canvas;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.RecyclerView;
import android.view.View;

/*
Expand Down
Loading

0 comments on commit aa32803

Please sign in to comment.