From 4b78c66f613aed928c705e060c1f289056c5ae6a Mon Sep 17 00:00:00 2001 From: Eugen Martynov Date: Thu, 20 Nov 2014 18:51:07 +0100 Subject: [PATCH] Migrated to API 21, new tools and gradle --- .travis.yml | 4 +- assertj-android-cardview-v7/build.gradle | 2 +- assertj-android-gridlayout-v7/build.gradle | 2 +- assertj-android-mediarouter-v7/build.gradle | 2 +- assertj-android-palette-v7/build.gradle | 4 +- .../android/palette/v7/api/Assertions.java | 8 ++- .../v7/api/graphics/PaletteAssert.java | 59 ++++++++----------- ...emAssert.java => PaletteSwatchAssert.java} | 12 ++-- assertj-android-play-services/build.gradle | 2 +- assertj-android-recyclerview-v7/build.gradle | 2 +- assertj-android-support-v4/build.gradle | 2 +- assertj-android/build.gradle | 4 +- .../android/api/view/DisplayAssert.java | 6 +- .../android/api/view/DisplayState.java | 3 +- build.gradle | 8 +-- gradle/gradle-mvn-push.gradle | 4 +- gradle/wrapper/gradle-wrapper.properties | 4 +- 17 files changed, 63 insertions(+), 65 deletions(-) rename assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/{PaletteItemAssert.java => PaletteSwatchAssert.java} (53%) diff --git a/.travis.yml b/.travis.yml index 3efbe84..0e2d4ec 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,10 +2,10 @@ language: android android: components: - - build-tools-20.0.0 + - build-tools-21.1.1 - extra-android-m2repository - extra-google-m2repository - - android-20 + - android-21 licenses: - android-sdk-license-5be876d5 - android-sdk-preview-license-52d11cd2 diff --git a/assertj-android-cardview-v7/build.gradle b/assertj-android-cardview-v7/build.gradle index d99bc9b..204c9a8 100644 --- a/assertj-android-cardview-v7/build.gradle +++ b/assertj-android-cardview-v7/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:cardview-v7:21.0.0-rc1' + compile 'com.android.support:cardview-v7:21.0.2' } android { diff --git a/assertj-android-gridlayout-v7/build.gradle b/assertj-android-gridlayout-v7/build.gradle index b312914..43e7dab 100644 --- a/assertj-android-gridlayout-v7/build.gradle +++ b/assertj-android-gridlayout-v7/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:gridlayout-v7:20.0.0' + compile 'com.android.support:gridlayout-v7:21.0.2' } android { diff --git a/assertj-android-mediarouter-v7/build.gradle b/assertj-android-mediarouter-v7/build.gradle index 77e6af7..c8b6543 100644 --- a/assertj-android-mediarouter-v7/build.gradle +++ b/assertj-android-mediarouter-v7/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:mediarouter-v7:20.0.0' + compile 'com.android.support:mediarouter-v7:21.0.2' } android { diff --git a/assertj-android-palette-v7/build.gradle b/assertj-android-palette-v7/build.gradle index 8c92ebd..214eb0b 100644 --- a/assertj-android-palette-v7/build.gradle +++ b/assertj-android-palette-v7/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:palette-v7:21.0.0-rc1' + compile 'com.android.support:palette-v7:21.0.2' } android { @@ -10,7 +10,7 @@ android { buildToolsVersion rootProject.ext.buildToolsVersion defaultConfig { - minSdkVersion 'L' + minSdkVersion 21 } compileOptions { diff --git a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/Assertions.java b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/Assertions.java index fa7b8cb..39a3310 100644 --- a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/Assertions.java +++ b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/Assertions.java @@ -3,6 +3,8 @@ // This class is generated. Do not modify directly! package org.assertj.android.palette.v7.api; +import org.assertj.android.palette.v7.api.graphics.PaletteSwatchAssert; + /** Assertions for testing Android classes. */ @SuppressWarnings("deprecation") public final class Assertions { @@ -11,9 +13,9 @@ public static org.assertj.android.palette.v7.api.graphics.PaletteAssert assertTh return new org.assertj.android.palette.v7.api.graphics.PaletteAssert(actual); } - public static org.assertj.android.palette.v7.api.graphics.PaletteItemAssert assertThat( - android.support.v7.graphics.PaletteItem actual) { - return new org.assertj.android.palette.v7.api.graphics.PaletteItemAssert(actual); + public static PaletteSwatchAssert assertThat( + android.support.v7.graphics.Palette.Swatch actual) { + return new PaletteSwatchAssert(actual); } private Assertions() { diff --git a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteAssert.java b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteAssert.java index 30d3fda..1af9c5c 100644 --- a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteAssert.java +++ b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteAssert.java @@ -1,7 +1,6 @@ package org.assertj.android.palette.v7.api.graphics; import android.support.v7.graphics.Palette; -import android.support.v7.graphics.PaletteItem; import org.assertj.core.api.AbstractAssert; @@ -15,67 +14,61 @@ public PaletteAssert(Palette actual) { super(actual, PaletteAssert.class); } - public PaletteAssert hasVibrantColor(PaletteItem color) { + public PaletteAssert hasVibrantColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getVibrantColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getVibrantColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected vibrant color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - public PaletteAssert hasDarkVibrantColor(PaletteItem color) { + public PaletteAssert hasDarkVibrantColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getDarkVibrantColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getDarkVibrantColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected dark vibrant color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - public PaletteAssert hasLightVibrantColor(PaletteItem color) { + public PaletteAssert hasLightVibrantColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getLightVibrantColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getLightVibrantColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected light vibrant color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - public PaletteAssert hasMutedColor(PaletteItem color) { + public PaletteAssert hasMutedColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getMutedColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getMutedColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected muted color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - public PaletteAssert hasDarkMutedColor(PaletteItem color) { + public PaletteAssert hasDarkMutedColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getDarkMutedColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getDarkMutedColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected dark muted color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - public PaletteAssert hasLightMutedColor(PaletteItem color) { + public PaletteAssert hasLightMutedColor(int color) { isNotNull(); - PaletteItem actualColor = actual.getLightMutedColor(); - assertThat(equals(color, actualColor)) // + int actualColor = actual.getLightMutedColor(getAnotherColor(color)); + assertThat(color) // .overridingErrorMessage("Expected light muted color <%s> but was <%s>", color, actualColor) // - .isTrue(); + .isEqualTo(actualColor); return this; } - private static boolean equals(PaletteItem actualColor, PaletteItem color) { - if (actualColor == color) { - return true; - } - if ((actualColor == null) || (color == null)) { - return false; - } - return actualColor.toString().equals(color.toString()); + private static int getAnotherColor(int color) { + return 0xFFFFFFFF - color; } } diff --git a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteItemAssert.java b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteSwatchAssert.java similarity index 53% rename from assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteItemAssert.java rename to assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteSwatchAssert.java index 31f7269..784f2c3 100644 --- a/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteItemAssert.java +++ b/assertj-android-palette-v7/src/main/java/org/assertj/android/palette/v7/api/graphics/PaletteSwatchAssert.java @@ -1,20 +1,20 @@ package org.assertj.android.palette.v7.api.graphics; -import android.support.v7.graphics.PaletteItem; +import android.support.v7.graphics.Palette; import org.assertj.core.api.AbstractAssert; import static org.assertj.core.api.Assertions.assertThat; /** - * Assertions for {@link PaletteItem} instances. + * Assertions for {@link Palette.Swatch} instances. */ -public class PaletteItemAssert extends AbstractAssert { - public PaletteItemAssert(PaletteItem actual) { - super(actual, PaletteItemAssert.class); +public class PaletteSwatchAssert extends AbstractAssert { + public PaletteSwatchAssert(Palette.Swatch actual) { + super(actual, PaletteSwatchAssert.class); } - public PaletteItemAssert hasRgb(int rgb) { + public PaletteSwatchAssert hasRgb(int rgb) { isNotNull(); int actualRgb = actual.getRgb(); assertThat(actualRgb) // diff --git a/assertj-android-play-services/build.gradle b/assertj-android-play-services/build.gradle index f36547e..8057985 100644 --- a/assertj-android-play-services/build.gradle +++ b/assertj-android-play-services/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.google.android.gms:play-services:5.2.08' + compile 'com.google.android.gms:play-services:6.1.71' } android { diff --git a/assertj-android-recyclerview-v7/build.gradle b/assertj-android-recyclerview-v7/build.gradle index f158e82..b9220a9 100644 --- a/assertj-android-recyclerview-v7/build.gradle +++ b/assertj-android-recyclerview-v7/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:recyclerview-v7:21.0.0-rc1' + compile 'com.android.support:recyclerview-v7:21.0.0' } android { diff --git a/assertj-android-support-v4/build.gradle b/assertj-android-support-v4/build.gradle index 825678d..76628ad 100644 --- a/assertj-android-support-v4/build.gradle +++ b/assertj-android-support-v4/build.gradle @@ -2,7 +2,7 @@ apply plugin: 'com.android.library' dependencies { compile project(':assertj-android') - compile 'com.android.support:support-v4:20.0.0' + compile 'com.android.support:support-v4:21.0.2' } android { diff --git a/assertj-android/build.gradle b/assertj-android/build.gradle index 9098595..94f6ef4 100644 --- a/assertj-android/build.gradle +++ b/assertj-android/build.gradle @@ -1,8 +1,8 @@ apply plugin: 'com.android.library' dependencies { - compile 'org.assertj:assertj-core:1.6.1' - compile 'com.android.support:support-annotations:20.0.0' + compile 'org.assertj:assertj-core:1.7.0' + compile 'com.android.support:support-annotations:21.0.2' } android { diff --git a/assertj-android/src/main/java/org/assertj/android/api/view/DisplayAssert.java b/assertj-android/src/main/java/org/assertj/android/api/view/DisplayAssert.java index 028689f..d4ffe3b 100644 --- a/assertj-android/src/main/java/org/assertj/android/api/view/DisplayAssert.java +++ b/assertj-android/src/main/java/org/assertj/android/api/view/DisplayAssert.java @@ -31,7 +31,8 @@ import static android.view.Display.FLAG_PRIVATE; import static android.view.Display.FLAG_SECURE; import static android.view.Display.FLAG_SUPPORTS_PROTECTED_BUFFERS; -import static android.view.Display.STATE_DOZING; +import static android.view.Display.STATE_DOZE; +import static android.view.Display.STATE_DOZE_SUSPEND; import static android.view.Display.STATE_OFF; import static android.view.Display.STATE_ON; import static android.view.Display.STATE_UNKNOWN; @@ -245,7 +246,8 @@ public static String orientationToString(@SurfaceRotation int orientation) { @TargetApi(KITKAT_WATCH) public static String stateToString(@DisplayState int state) { return buildNamedValueString(state) - .value(STATE_DOZING, "dozing") + .value(STATE_DOZE, "dozing") + .value(STATE_DOZE_SUSPEND, "doze suspend") .value(STATE_OFF, "off") .value(STATE_ON, "on") .value(STATE_UNKNOWN, "unknown") diff --git a/assertj-android/src/main/java/org/assertj/android/api/view/DisplayState.java b/assertj-android/src/main/java/org/assertj/android/api/view/DisplayState.java index 04ed52b..46635db 100644 --- a/assertj-android/src/main/java/org/assertj/android/api/view/DisplayState.java +++ b/assertj-android/src/main/java/org/assertj/android/api/view/DisplayState.java @@ -7,7 +7,8 @@ import static java.lang.annotation.RetentionPolicy.SOURCE; @IntDef({ - Display.STATE_DOZING, + Display.STATE_DOZE, + Display.STATE_DOZE_SUSPEND, Display.STATE_OFF, Display.STATE_ON, Display.STATE_UNKNOWN diff --git a/build.gradle b/build.gradle index 3409b56..cc5dc77 100644 --- a/build.gradle +++ b/build.gradle @@ -4,7 +4,7 @@ subprojects { mavenCentral() } dependencies { - classpath 'com.android.tools.build:gradle:0.12.+' + classpath 'com.android.tools.build:gradle:0.14.4' } } @@ -17,7 +17,7 @@ subprojects { } ext { - minSdkVersion = 7 - compileSdkVersion = 20 - buildToolsVersion = '20.0.0' + minSdkVersion = 9 + compileSdkVersion = 21 + buildToolsVersion = '21.1.1' } diff --git a/gradle/gradle-mvn-push.gradle b/gradle/gradle-mvn-push.gradle index 1a1f991..f5f4129 100644 --- a/gradle/gradle-mvn-push.gradle +++ b/gradle/gradle-mvn-push.gradle @@ -93,7 +93,7 @@ afterEvaluate { project -> } task androidJavadocs(type: Javadoc) { - source = android.sourceSets.main.java + source = android.sourceSets.main.java.srcDirs classpath += project.files(android.getBootClasspath().join(File.pathSeparator)) } @@ -104,7 +104,7 @@ afterEvaluate { project -> task androidSourcesJar(type: Jar) { classifier = 'sources' - from android.sourceSets.main.java + from android.sourceSets.main.java.sourceFiles } artifacts { diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 8d63ab6..17e7c71 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ -#Wed Jan 08 01:21:31 PST 2014 +#Thu Nov 20 15:42:26 CET 2014 distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists -distributionUrl=http\://services.gradle.org/distributions/gradle-1.12-all.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-2.2-all.zip