From 8610eb766e35a00ee74bd08a6280ff6a6344c545 Mon Sep 17 00:00:00 2001 From: Nick Felker Date: Fri, 30 Mar 2018 20:42:23 -0700 Subject: [PATCH] Updates all of the library dependencies and tests to API 27 Bug: 77224738 Change-Id: I26849d7b70addbda4326c7c11a982ce94b204969 --- .gitignore | 1 + app/build.gradle | 20 +++++--- build.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- library/build.gradle | 49 ++++++++++++------- .../model/AdvertisementTest.java | 4 +- .../companionlibrary/model/ChannelTest.java | 4 +- .../model/InternalProviderDataTest.java | 4 +- .../companionlibrary/model/ProgramTest.java | 4 +- .../model/RecordedProgramTest.java | 4 +- .../setup/ChannelSetupStepFragmentTest.java | 16 +++--- .../sync/SyncStatusBroadcastReceiverTest.java | 4 +- .../xmltv/XmlTvAdvertisementTest.java | 4 +- .../xmltv/XmlTvParserTest.java | 4 +- 14 files changed, 75 insertions(+), 51 deletions(-) diff --git a/.gitignore b/.gitignore index 3627bbc9..2dc3ba1a 100644 --- a/.gitignore +++ b/.gitignore @@ -6,3 +6,4 @@ build/ local.properties *.iml .DS_Store +keystore.properties \ No newline at end of file diff --git a/app/build.gradle b/app/build.gradle index 26ca597f..35cc1f8d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -1,15 +1,15 @@ apply plugin: 'com.android.application' android { - compileSdkVersion 24 - buildToolsVersion '23.0.3' + compileSdkVersion 27 + buildToolsVersion "27.0.3" defaultConfig { applicationId "com.example.android.sampletvinput" minSdkVersion 21 - targetSdkVersion 24 - versionCode 2 - versionName "1.1" + targetSdkVersion 27 + versionCode 3 + versionName "1.2" } buildTypes { @@ -20,10 +20,14 @@ android { } } +ext { + appCompatVersion = '27.1.0' +} + dependencies { compile project(':library') - compile 'com.android.support:recyclerview-v7:24.0.0' - compile 'com.android.support:leanback-v17:24.0.0' - compile 'com.android.support:appcompat-v7:24.0.0' + compile "com.android.support:recyclerview-v7:$appCompatVersion" + compile "com.android.support:leanback-v17:$appCompatVersion" + compile "com.android.support:appcompat-v7:$appCompatVersion" compile 'com.google.android.exoplayer:exoplayer:r1.5.14' } diff --git a/build.gradle b/build.gradle index 305dc055..390aecc9 100644 --- a/build.gradle +++ b/build.gradle @@ -2,14 +2,16 @@ buildscript { repositories { jcenter() + google() } dependencies { - classpath 'com.android.tools.build:gradle:2.2.0' + classpath 'com.android.tools.build:gradle:3.1.0' } } allprojects { repositories { jcenter() + google() } } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 2647ede4..512621e4 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Mon Aug 22 14:19:34 PDT 2016 +#Wed Mar 28 17:53:17 PDT 2018 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-2.14.1-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-bin.zip diff --git a/library/build.gradle b/library/build.gradle index 9c3171c6..488d206c 100644 --- a/library/build.gradle +++ b/library/build.gradle @@ -6,12 +6,11 @@ apply plugin: 'com.android.library' apply plugin: 'maven-publish' android { - compileSdkVersion 24 - buildToolsVersion "23.0.3" + compileSdkVersion 27 defaultConfig { minSdkVersion 21 - targetSdkVersion 24 + targetSdkVersion 27 versionCode 1 versionName "1.0" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" @@ -21,8 +20,12 @@ android { minifyEnabled false } } - sourceSets { - instrumentTest.setRoot('src/androidTest/') + + packagingOptions { + exclude 'error_prone/Annotations.gwt.xml' + exclude 'third_party/java_src/error_prone/project/annotations/Annotations.gwt.xml' + exclude 'third_party/java_src/error_prone/project/annotations/Google_internal.gwt.xml' + exclude 'jsr305_annotations/Jsr305_annotations.gwt.xml' } } @@ -30,24 +33,31 @@ configurations { doclava } +ext { + appCompatVersion = '27.1.0' + playServicesVersion = '12.0.0' + supportTestVersion = '1.0.1' +} + dependencies { compile fileTree(dir: 'libs', include: ['*.jar']) - compile 'com.android.support:appcompat-v7:24.0.0' - compile 'com.android.support:leanback-v17:24.0.0' + compile "com.android.support:appcompat-v7:$appCompatVersion" + compile "com.android.support:leanback-v17:$appCompatVersion" compile 'com.google.ads.interactivemedia.v3:interactivemedia:3.2.1' - compile 'com.google.android.gms:play-services-ads:8.4.0' + compile "com.google.android.gms:play-services-ads:$playServicesVersion" testCompile 'junit:junit:4.12' - testCompile 'org.mockito:mockito-core:1.10.19' - testCompile "org.robolectric:robolectric:3.1" - androidTestCompile 'com.android.support:support-annotations:24.0.0' - androidTestCompile 'com.android.support.test:runner:0.4.1' - androidTestCompile 'com.android.support.test:rules:0.4.1' - androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.2' + testCompile 'org.mockito:mockito-core:2.8.9' + testCompile "org.robolectric:robolectric:3.8" + + androidTestCompile "com.android.support:support-annotations:$appCompatVersion" + androidTestCompile "com.android.support.test:runner:$supportTestVersion" + androidTestCompile "com.android.support.test:rules:$supportTestVersion" + androidTestCompile 'com.android.support.test.uiautomator:uiautomator-v18:2.1.3' doclava 'com.google.doclava:doclava:1.0.6' } -def packageVersion = '0.3' +def packageVersion = '0.4' task sourceJar(type: Jar) { classifier = 'sources' @@ -99,9 +109,14 @@ publishing { } } +// Load keystore +def keystorePropertiesFile = rootProject.file("keystore.properties"); +def keystoreProperties = new Properties() +keystoreProperties.load(new FileInputStream(keystorePropertiesFile)) + bintray { - user = System.getenv('BINTRAY_USER') - key = System.getenv('BINTRAY_API_KEY') + user = keystoreProperties['BINTRAY_USER'] + key = keystoreProperties['BINTRAY_API_KEY'] publications = ['libraryPublish'] publish = true pkg { diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/AdvertisementTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/AdvertisementTest.java index 24e36e04..9d39a1e0 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/AdvertisementTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/AdvertisementTest.java @@ -20,19 +20,19 @@ import static org.junit.Assert.fail; import com.google.android.media.tv.companionlibrary.BuildConfig; -import org.robolectric.RobolectricGradleTestRunner; import java.util.ArrayList; import java.util.Collections; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** * Test {@link Advertisement} can be properly generated with builder pattern, copied from another * {@link Advertisement} instance and parsed by {@link InternalProviderData}. */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml") public class AdvertisementTest { diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ChannelTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ChannelTest.java index ee5ffb1a..4db1735f 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ChannelTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ChannelTest.java @@ -25,9 +25,9 @@ import android.os.Build; import android.support.annotation.RequiresApi; import com.google.android.media.tv.companionlibrary.BuildConfig; -import org.robolectric.RobolectricGradleTestRunner; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.RuntimeEnvironment; import org.robolectric.annotation.Config; @@ -35,7 +35,7 @@ * Tests that channels can be created using the Builder pattern and correctly obtain * values from them */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") @RequiresApi(api = Build.VERSION_CODES.M) diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/InternalProviderDataTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/InternalProviderDataTest.java index 6ac4f55b..1993c578 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/InternalProviderDataTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/InternalProviderDataTest.java @@ -24,18 +24,18 @@ import static org.junit.Assert.fail; import com.google.android.media.tv.companionlibrary.BuildConfig; -import org.robolectric.RobolectricGradleTestRunner; import java.util.ArrayList; import junit.framework.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** * Tests that core and custom data objects can be created using the InternalProviderData class and * retrieved successfully with proper error handling */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config( constants = BuildConfig.class, sdk = 23, diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ProgramTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ProgramTest.java index 61d12e8a..51b95811 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ProgramTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/ProgramTest.java @@ -27,18 +27,18 @@ import android.support.annotation.RequiresApi; import com.google.android.media.tv.companionlibrary.BuildConfig; import com.google.android.media.tv.companionlibrary.utils.TvContractUtils; -import org.robolectric.RobolectricGradleTestRunner; import java.util.Arrays; import java.util.Objects; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** * Tests that programs can be created using the Builder pattern and correctly obtain * values from them */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") public class ProgramTest { diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/RecordedProgramTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/RecordedProgramTest.java index 68447822..0d735c57 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/model/RecordedProgramTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/model/RecordedProgramTest.java @@ -26,13 +26,13 @@ import android.os.Build; import android.support.annotation.RequiresApi; import com.google.android.media.tv.companionlibrary.BuildConfig; -import org.robolectric.RobolectricGradleTestRunner; import java.util.Arrays; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") public class RecordedProgramTest { diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/setup/ChannelSetupStepFragmentTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/setup/ChannelSetupStepFragmentTest.java index d76e6af9..f4cedeef 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/setup/ChannelSetupStepFragmentTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/setup/ChannelSetupStepFragmentTest.java @@ -26,26 +26,28 @@ import com.google.android.media.tv.companionlibrary.model.Channel; import com.google.android.media.tv.companionlibrary.model.Program; import com.google.android.media.tv.companionlibrary.sync.EpgSyncJobService; -import org.robolectric.RobolectricGradleTestRunner; import java.util.List; import org.junit.Assert; import org.junit.Before; import org.junit.Test; import org.junit.runner.RunWith; import org.robolectric.Robolectric; +import org.robolectric.RobolectricTestRunner; +import org.robolectric.android.controller.FragmentController; import org.robolectric.annotation.Config; import org.robolectric.shadows.ShadowLooper; import org.robolectric.shadows.ShadowToast; -import org.robolectric.util.FragmentController; -/** Tests for {@link ChannelSetupStepFragment} */ -@RunWith(RobolectricGradleTestRunner.class) +/** + * Tests for {@link ChannelSetupStepFragment} + * + * Make sure to go to 'Edit Configurations' and set the 'Working Directory' to '$MODULE_DIR$' + */ +@RunWith(RobolectricTestRunner.class) @Config( constants = BuildConfig.class, sdk = 23, - manifest = - "//third_party/java_src/android_libs/tif_companion_library/src/test/java/" - + "com/google/android/media/tv/companionlibrary/setup:test_lib/AndroidManifest.xml" + manifest = "../../../../../src/test/java/com/google/android/media/tv/companionlibrary/setup/AndroidManifest.xml" ) public class ChannelSetupStepFragmentTest { diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/sync/SyncStatusBroadcastReceiverTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/sync/SyncStatusBroadcastReceiverTest.java index 5f760daf..f302e4f9 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/sync/SyncStatusBroadcastReceiverTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/sync/SyncStatusBroadcastReceiverTest.java @@ -19,17 +19,17 @@ import android.content.Intent; import com.google.android.media.tv.companionlibrary.BuildConfig; import com.google.android.media.tv.companionlibrary.sync.SyncStatusBroadcastReceiver.SyncListener; -import org.robolectric.RobolectricGradleTestRunner; import org.junit.Assert; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** * Tests that channels can be created using the Builder pattern and correctly obtain values from * them */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config( constants = BuildConfig.class, sdk = 23, diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvAdvertisementTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvAdvertisementTest.java index 7c79ee17..dc50ee93 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvAdvertisementTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvAdvertisementTest.java @@ -25,15 +25,15 @@ import com.google.android.media.tv.companionlibrary.model.Channel; import com.google.android.media.tv.companionlibrary.model.InternalProviderData; import com.google.android.media.tv.companionlibrary.model.Program; -import org.robolectric.RobolectricGradleTestRunner; import java.io.InputStream; import java.text.ParseException; import java.util.List; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 21, manifest = "src/main/AndroidManifest.xml") public class XmlTvAdvertisementTest { @Test diff --git a/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvParserTest.java b/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvParserTest.java index 1b26cd39..5800a93b 100644 --- a/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvParserTest.java +++ b/library/src/test/java/com/google/android/media/tv/companionlibrary/xmltv/XmlTvParserTest.java @@ -22,17 +22,17 @@ import com.google.android.media.tv.companionlibrary.BuildConfig; import com.google.android.media.tv.companionlibrary.model.InternalProviderData; import com.google.android.media.tv.companionlibrary.utils.TvContractUtils; -import org.robolectric.RobolectricGradleTestRunner; import java.io.FileNotFoundException; import java.io.IOException; import java.io.InputStream; import junit.framework.TestCase; import org.junit.Test; import org.junit.runner.RunWith; +import org.robolectric.RobolectricTestRunner; import org.robolectric.annotation.Config; /** Tests for {@link XmlTvParser}. */ -@RunWith(RobolectricGradleTestRunner.class) +@RunWith(RobolectricTestRunner.class) @Config(constants = BuildConfig.class, sdk = 23, manifest = "src/main/AndroidManifest.xml") @RequiresApi(api = Build.VERSION_CODES.M)