Skip to content

Commit

Permalink
Move compile sdk and target sdk to 28 (#70)
Browse files Browse the repository at this point in the history
Compile sdk, target sdk and support library to 28 and update gradle version. Roboletric is upgraded due to incompatibility with new android gradle version.
  • Loading branch information
csv8674xn authored and nhibner committed Oct 1, 2018
1 parent e411a73 commit 092ad24
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 59 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Expand Up @@ -11,8 +11,8 @@ android:
- tools

- platform-tools
- android-25
- build-tools-25.0.0
- android-28
- build-tools-28.0.2
- extra-android-m2repository
- extra-android-support

Expand Down
4 changes: 3 additions & 1 deletion build.gradle
Expand Up @@ -3,10 +3,11 @@ buildscript {

repositories {
jcenter()
google()
}

dependencies {
classpath 'com.android.tools.build:gradle:2.2.2'
classpath 'com.android.tools.build:gradle:3.1.4'

// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
Expand All @@ -25,6 +26,7 @@ apply from: environmentScript
allprojects {
repositories {
jcenter()
google()
}
}

Expand Down
2 changes: 1 addition & 1 deletion gradle.properties
Expand Up @@ -8,7 +8,7 @@ org.gradle.daemon=true

#configures only relevant projects to speed up the configuration of large projects
#useful when specific project/task is invoked e.g: ligradle :cloud:cloud-api:build
org.gradle.configureondemand=true
org.gradle.configureondemand=false

#Gradle will run tasks from subprojects in parallel
#Higher CPU usage, faster builds
Expand Down
4 changes: 2 additions & 2 deletions gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
#Mon Feb 16 02:39:52 PST 2015
#Wed Sep 26 10:14:49 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.10.2-all.zip
18 changes: 9 additions & 9 deletions spyglass-sample/build.gradle
@@ -1,12 +1,12 @@
apply plugin: 'com.android.application'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
compileSdkVersion 28
buildToolsVersion "28.0.2"

defaultConfig {
minSdkVersion 11
targetSdkVersion 25
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -25,9 +25,9 @@ android {
}

dependencies {
compile project(':spyglass')
compile 'com.github.bumptech.glide:glide:3.7.0'
compile 'com.android.support:recyclerview-v7:25.0.0'
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:appcompat-v7:25.0.0'
implementation project(':spyglass')
implementation 'com.github.bumptech.glide:glide:3.7.0'
implementation 'com.android.support:recyclerview-v7:28.0.0'
implementation 'com.android.support:support-v4:28.0.0'
implementation 'com.android.support:appcompat-v7:28.0.0'
}
Expand Up @@ -21,7 +21,6 @@
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.view.LayoutInflater;
import android.view.View;
Expand Down
Expand Up @@ -18,7 +18,6 @@
import android.os.Handler;
import android.os.Looper;
import android.support.annotation.NonNull;
import android.support.v7.app.ActionBarActivity;
import android.support.v7.app.AppCompatActivity;
import android.widget.SeekBar;
import android.widget.TextView;
Expand Down
65 changes: 34 additions & 31 deletions spyglass/build.gradle
Expand Up @@ -3,12 +3,12 @@ apply plugin: 'idea'
apply plugin: 'maven'

android {
compileSdkVersion 25
buildToolsVersion "25.0.0"
compileSdkVersion 28
buildToolsVersion "28.0.2"

defaultConfig {
minSdkVersion 9
targetSdkVersion 25
minSdkVersion 14
targetSdkVersion 28
versionCode 1
versionName "1.0"
}
Expand All @@ -33,47 +33,50 @@ android {
javaMaxHeapSize '2048m'
}

testOptions.unitTests.all {
// configure the set of classes for JUnit tests
include '**/*Test.class'
exclude '**/espresso/**/*.class'
testOptions.unitTests {
all {
// configure the set of classes for JUnit tests
include '**/*Test.class'
exclude '**/espresso/**/*.class'

// configure max heap size of the test JVM
maxHeapSize = '2048m'
// configure max heap size of the test JVM
maxHeapSize = '2048m'

// configure the test JVM arguments
jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier'
// configure the test JVM arguments
jvmArgs '-XX:MaxPermSize=512m', '-XX:-UseSplitVerifier'

// Specify max number of processes (default is 1)
maxParallelForks = 4
// Specify max number of processes (default is 1)
maxParallelForks = 4

// Specify max number of test classes to execute in a test process
// before restarting the process (default is unlimited)
forkEvery = 150
// Specify max number of test classes to execute in a test process
// before restarting the process (default is unlimited)
forkEvery = 150

// configure whether failing tests should fail the build
ignoreFailures false
// configure whether failing tests should fail the build
ignoreFailures false

// use afterTest to listen to the test execution results
afterTest { descriptor, result ->
println "Executing test for ${descriptor.name} with result: ${result.resultType}"
// use afterTest to listen to the test execution results
afterTest { descriptor, result ->
println "Executing test for ${descriptor.name} with result: ${result.resultType}"
}
}
includeAndroidResources = true
}
}

dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:support-v4:25.0.0'
compile 'com.android.support:support-annotations:25.0.0'

testCompile 'junit:junit:4.12'
testCompile 'org.mockito:mockito-core:1.9.5'
testCompile 'org.robolectric:robolectric:3.1.3'
testCompile 'org.robolectric:shadows-support-v4:3.1.3'
api 'com.android.support:support-v4:28.0.0'
implementation fileTree(dir: 'libs', include: ['*.jar'])
implementation 'com.android.support:support-annotations:28.0.0'

testImplementation 'junit:junit:4.12'
testImplementation 'org.mockito:mockito-core:1.9.5'
testImplementation 'org.robolectric:robolectric:3.8'
testImplementation 'org.robolectric:shadows-support-v4:3.3.2'
}

task wrapper(type: Wrapper) {
gradleVersion = '2.14.1'
gradleVersion = '4.10.2'
}

apply from: 'gradle-mvn-push.gradle'
Expand Up @@ -33,17 +33,6 @@ public SpyglassRobolectricRunner(Class testClass) throws InitializationError {
super(testClass);
}

@Override
protected AndroidManifest getAppManifest(Config config) {
// Need to point Robolectric to the debug Android Manifest and resources to use in tests
String basePath = getClass().getProtectionDomain().getCodeSource().getLocation().getPath()
+ "../../../bundles/debug";
String manifestPath = basePath + "/AndroidManifest.xml";
String resPath = basePath + "/res";
String assetPath = basePath + "/assets";
return new AndroidManifest(Fs.fileFromPath(manifestPath), Fs.fileFromPath(resPath), Fs.fileFromPath(assetPath));
}

public static void startFragment(Fragment fragment) {
FragmentActivity activity = getActivity(FragmentActivity.class);
startFragment(fragment, activity, null);
Expand Down

0 comments on commit 092ad24

Please sign in to comment.