Skip to content

Commit

Permalink
Migrate to AndroidX, close #85
Browse files Browse the repository at this point in the history
  • Loading branch information
ngsilverman committed Oct 31, 2018
1 parent 407c2db commit b4bbdb6
Show file tree
Hide file tree
Showing 75 changed files with 206 additions and 227 deletions.
16 changes: 8 additions & 8 deletions blessedDeps.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,24 @@ rootProject.ext {
SAMPLE_MIN_SDK_VERSION = 16

// Keep these alphabetized
CONSTRAINT_LAYOUT_VERSION = '1.1.0'
ESPRESSO_VERSION = '3.0.2-beta1'
ANDROIDX_ANNOTATIONS_VERSION = '1.0.0'
ANDROIDX_APPCOMPAT_VERSION = '1.0.0'
ANDROIDX_CONSTRAINTLAYOUT_VERSION = '1.1.0'
ANDROIDX_ESPRESSO_VERSION = '3.1.0'
JAVAPOET_VERSION = '1.11.1'
JUNIT_VERSION = '4.12'
KOTLINPOET_VERSION = '0.7.0'
KOTLIN_TEST_VERSION = '2.0.7'
MOCKITO_VERSION = '2.18.3'
ROBOLECTRIC_VERSION = '3.8'
SUPPORT_LIBS_VERSION = '27.1.1'
TESTING_COMPILE_VERSION = '0.13'

deps = [
// Keep these alphabetized
androidAnnotations: "com.android.support:support-annotations:$SUPPORT_LIBS_VERSION",
appcompatV7 : "com.android.support:appcompat-v7:$SUPPORT_LIBS_VERSION",
constraintLayout : "com.android.support.constraint:constraint-layout:$CONSTRAINT_LAYOUT_VERSION",
espresso : "com.android.support.test.espresso:espresso-core:$ESPRESSO_VERSION",
androidAnnotations: "androidx.annotation:annotation:$ANDROIDX_ANNOTATIONS_VERSION",
appcompat : "androidx.appcompat:appcompat:$ANDROIDX_APPCOMPAT_VERSION",
constraintLayout : "androidx.constraintlayout:constraintlayout:$ANDROIDX_CONSTRAINTLAYOUT_VERSION",
espresso : "androidx.test.espresso:espresso-core:$ANDROIDX_ESPRESSO_VERSION",
javaPoet : "com.squareup:javapoet:$JAVAPOET_VERSION",
junit : "junit:junit:$JUNIT_VERSION",
kotlin : "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$KOTLIN_VERSION",
Expand All @@ -34,7 +35,6 @@ rootProject.ext {
mockitoCore : "org.mockito:mockito-core:$MOCKITO_VERSION",
mockitoAndroid : "org.mockito:mockito-android:$MOCKITO_VERSION",
robolectric : "org.robolectric:robolectric:$ROBOLECTRIC_VERSION",
supportV4 : "com.android.support:support-v4:$SUPPORT_LIBS_VERSION",
testingCompile : "com.google.testing.compile:compile-testing:$TESTING_COMPILE_VERSION",
]
}
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

buildscript {
ext {
ANDROID_PLUGIN_VERSION = '3.1.0'
ANDROID_PLUGIN_VERSION = '3.2.1'
BUTTERKNIFE_VERSION = '9.0.0-SNAPSHOT'
KOTLIN_VERSION = '1.2.60'
}
Expand Down
1 change: 1 addition & 0 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ POM_DEVELOPER_NAME=Airbnb
POM_DEVELOPER_EMAIL[email protected]
POM_INCEPTION_YEAR=2017

android.useAndroidX=true
org.gradle.configureondemand=false
4 changes: 2 additions & 2 deletions gradle/workaround-missing-resource.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
// See also https://code.google.com/p/android/issues/detail?id=64887
gradle.projectsEvaluated {
// Base path which is recognized by android studio.
def testClassesPath = "${buildDir}/intermediates/classes/test/"
def testClassesPath = "${buildDir}/intermediates/"
// Copy must be done for each variant.
def variants = android.libraryVariants.collect()

Expand All @@ -17,7 +17,7 @@ gradle.projectsEvaluated {
// Specific copy task for each variant
def copyTestResourcesTask = project.tasks.create("copyTest${variationName}Resources", Copy)
copyTestResourcesTask.from("${projectDir}/src/test/resources")
copyTestResourcesTask.into("${testClassesPath}/${variationPath}")
copyTestResourcesTask.into("${testClassesPath}/sourceFolderJavaResources/${variationPath}")
copyTestResourcesTask.execute()
}
}
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.7-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-4.9-all.zip
5 changes: 3 additions & 2 deletions paris-processor/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,11 @@ dependencies {
implementation project(':paris-annotations')

implementation deps.androidAnnotations
implementation deps.javaPoet
implementation deps.kotlinPoet
implementation deps.kotlin

compile deps.javaPoet
compile deps.kotlinPoet

compileOnly files(Jvm.current().getToolsJar())

testImplementation deps.junit
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package com.airbnb.paris.processor

import com.airbnb.paris.annotations.Fraction
import com.airbnb.paris.processor.framework.AndroidClassNames
import com.airbnb.paris.processor.framework.AndroidClassNames.RESOURCES_COMPAT
import com.airbnb.paris.processor.framework.hasAnnotation
import com.airbnb.paris.processor.framework.hasAnyAnnotation
import com.squareup.javapoet.ClassName
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,21 @@ internal object AndroidClassNames {
val R = "android.R".className()
val CONTEXT = "android.content.Context".className()
val RESOURCES = "android.content.res.Resources".className()
val RESOURCES_COMPAT = "android.support.v4.content.res.ResourcesCompat".className()
val VIEW = "android.view.View".className()
val TEXT_VIEW = "android.widget.TextView".className()
val ANY_RES = "android.support.annotation.AnyRes".className()
val ARRAY_RES = "android.support.annotation.ArrayRes".className()
val BOOL_RES = "android.support.annotation.BoolRes".className()
val COLOR_INT = "android.support.annotation.ColorInt".className()
val COLOR_RES = "android.support.annotation.ColorRes".className()
val DIMEN_RES = "android.support.annotation.DimenRes".className()
val DIMENSION = "android.support.annotation.Dimension".className()
val DRAWABLE_RES = "android.support.annotation.DrawableRes".className()
val FONT_RES = "android.support.annotation.FontRes".className()
val FRACTION_RES = "android.support.annotation.FractionRes".className()
val INTEGER_RES = "android.support.annotation.IntegerRes".className()
val NULLABLE = "android.support.annotation.Nullable".className()
val PX = "android.support.annotation.Px".className()
val STRING_RES = "android.support.annotation.StringRes".className()
val STYLE_RES = "android.support.annotation.StyleRes".className()
val UI_THREAD = "android.support.annotation.UiThread".className()
val ANY_RES = "androidx.annotation.AnyRes".className()
val ARRAY_RES = "androidx.annotation.ArrayRes".className()
val BOOL_RES = "androidx.annotation.BoolRes".className()
val COLOR_INT = "androidx.annotation.ColorInt".className()
val COLOR_RES = "androidx.annotation.ColorRes".className()
val DIMEN_RES = "androidx.annotation.DimenRes".className()
val DIMENSION = "androidx.annotation.Dimension".className()
val DRAWABLE_RES = "androidx.annotation.DrawableRes".className()
val FONT_RES = "androidx.annotation.FontRes".className()
val FRACTION_RES = "androidx.annotation.FractionRes".className()
val INTEGER_RES = "androidx.annotation.IntegerRes".className()
val NULLABLE = "androidx.annotation.Nullable".className()
val PX = "androidx.annotation.Px".className()
val STRING_RES = "androidx.annotation.StringRes".className()
val STYLE_RES = "androidx.annotation.StyleRes".className()
val UI_THREAD = "androidx.annotation.UiThread".className()
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.airbnb.paris.processor.models

import android.support.annotation.RequiresApi
import androidx.annotation.RequiresApi
import com.airbnb.paris.annotations.Attr
import com.airbnb.paris.processor.Format
import com.airbnb.paris.processor.ParisProcessor
Expand Down
4 changes: 2 additions & 2 deletions paris-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ android {
defaultConfig {
minSdkVersion rootProject.MIN_SDK_VERSION
targetSdkVersion rootProject.TARGET_SDK_VERSION
testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"

javaCompileOptions {
annotationProcessorOptions {
Expand All @@ -24,7 +24,7 @@ android {
dependencies {
implementation project(':paris')

implementation deps.appcompatV7
implementation deps.appcompat
implementation deps.kotlin

kapt project(':paris-processor')
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
package com.airbnb.paris.test

import android.support.test.*
import android.support.test.runner.*
import androidx.test.*
import androidx.test.runner.*
import android.util.*
import android.view.*;
import com.airbnb.paris.*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
package com.airbnb.paris.test

import android.graphics.*
import android.support.test.*
import android.support.test.runner.*
import androidx.test.*
import androidx.test.runner.*
import com.airbnb.paris.styles.*
import org.junit.*
import org.junit.Assert.*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

import android.content.Context;
import android.content.res.Resources;
import android.support.annotation.UiThread;
import android.view.ViewStyleApplier;
import androidx.annotation.UiThread;
import com.airbnb.paris.StyleApplier;
import com.airbnb.paris.StyleApplierUtils;
import com.airbnb.paris.styles.Style;
Expand Down Expand Up @@ -51,7 +51,7 @@ public void applyMy() {
}

/**
* Empty style */
* Empty style. */
public void applyDefault() {
}

Expand Down Expand Up @@ -93,7 +93,7 @@ public StyleBuilder addMy() {
}

/**
* Empty style */
* Empty style. */
public StyleBuilder addDefault() {
return this;
}
Expand Down
10 changes: 5 additions & 5 deletions paris-test/src/test/resources/attr_requires_api/MyView.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AnyRes;
import android.support.annotation.BoolRes;
import android.support.annotation.ColorInt;
import android.support.annotation.Px;
import android.support.annotation.RequiresApi;
import androidx.annotation.AnyRes;
import androidx.annotation.BoolRes;
import androidx.annotation.ColorInt;
import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.support.annotation.BoolRes;
import android.support.annotation.UiThread;
import android.view.ViewStyleApplier;
import androidx.annotation.BoolRes;
import androidx.annotation.UiThread;
import com.airbnb.paris.StyleApplier;
import com.airbnb.paris.styles.Style;
import com.airbnb.paris.typed_array_wrappers.TypedArrayWrapper;
Expand Down Expand Up @@ -51,7 +51,7 @@ public StyleBuilder builder() {
}

/**
* Empty style */
* Empty style. */
public void applyDefault() {
}

Expand Down Expand Up @@ -98,7 +98,7 @@ public StyleBuilder() {
}

/**
* Empty style */
* Empty style. */
public StyleBuilder addDefault() {
return this;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.support.annotation.AnyRes;
import android.support.annotation.BoolRes;
import android.support.annotation.ColorInt;
import android.support.annotation.Px;
import android.support.annotation.RequiresApi;
import androidx.annotation.AnyRes;
import androidx.annotation.BoolRes;
import androidx.annotation.ColorInt;
import androidx.annotation.Px;
import androidx.annotation.RequiresApi;
import android.util.AttributeSet;
import android.view.View;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
import android.content.Context;
import android.content.res.Resources;
import android.os.Build;
import android.support.annotation.BoolRes;
import android.support.annotation.UiThread;
import android.view.ViewStyleApplier;
import androidx.annotation.BoolRes;
import androidx.annotation.UiThread;
import com.airbnb.paris.StyleApplier;
import com.airbnb.paris.styles.Style;
import com.airbnb.paris.typed_array_wrappers.TypedArrayWrapper;
Expand Down Expand Up @@ -59,7 +59,7 @@ public StyleBuilder builder() {
}

/**
* Empty style */
* Empty style. */
public void applyDefault() {
}

Expand Down Expand Up @@ -106,7 +106,7 @@ public StyleBuilder() {
}

/**
* Empty style */
* Empty style. */
public StyleBuilder addDefault() {
return this;
}
Expand Down
8 changes: 4 additions & 4 deletions paris-test/src/test/resources/attrs/MyView.java
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
import android.content.res.ColorStateList;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.annotation.AnyRes;
import android.support.annotation.BoolRes;
import android.support.annotation.ColorInt;
import android.support.annotation.Px;
import androidx.annotation.AnyRes;
import androidx.annotation.BoolRes;
import androidx.annotation.ColorInt;
import androidx.annotation.Px;
import android.util.AttributeSet;
import android.view.View;

Expand Down
38 changes: 19 additions & 19 deletions paris-test/src/test/resources/attrs/MyViewStyleApplier.java
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,22 @@
import android.content.res.Resources;
import android.graphics.Typeface;
import android.graphics.drawable.Drawable;
import android.support.annotation.AnyRes;
import android.support.annotation.ArrayRes;
import android.support.annotation.BoolRes;
import android.support.annotation.ColorInt;
import android.support.annotation.ColorRes;
import android.support.annotation.DimenRes;
import android.support.annotation.Dimension;
import android.support.annotation.DrawableRes;
import android.support.annotation.FontRes;
import android.support.annotation.FractionRes;
import android.support.annotation.IntegerRes;
import android.support.annotation.Nullable;
import android.support.annotation.Px;
import android.support.annotation.StringRes;
import android.support.annotation.UiThread;
import android.view.ViewStyleApplier;
import androidx.annotation.AnyRes;
import androidx.annotation.ArrayRes;
import androidx.annotation.BoolRes;
import androidx.annotation.ColorInt;
import androidx.annotation.ColorRes;
import androidx.annotation.DimenRes;
import androidx.annotation.Dimension;
import androidx.annotation.DrawableRes;
import androidx.annotation.FontRes;
import androidx.annotation.FractionRes;
import androidx.annotation.IntegerRes;
import androidx.annotation.Nullable;
import androidx.annotation.Px;
import androidx.annotation.StringRes;
import androidx.annotation.UiThread;
import com.airbnb.paris.StyleApplier;
import com.airbnb.paris.styles.Style;
import com.airbnb.paris.typed_array_wrappers.TypedArrayWrapper;
Expand Down Expand Up @@ -54,7 +54,7 @@ protected void processStyleableFields(Style style, TypedArrayWrapper a) {

@Override
protected void processAttributes(Style style, TypedArrayWrapper a) {
Context context = getView().getContext()
Context context = getView().getContext();
Resources res = context.getResources();
if (a.hasValue(R.styleable.Formats_formatBoolean)) {
getProxy().formatBoolean(a.getBoolean(R.styleable.Formats_formatBoolean));
Expand Down Expand Up @@ -120,7 +120,7 @@ public StyleBuilder builder() {
}

/**
* Empty style */
* Empty style. */
public void applyDefault() {
}

Expand Down Expand Up @@ -320,7 +320,7 @@ public B formatReference4(@Nullable Typeface value) {
}

/**
* @see MyView#formatReference4_Font(Drawable) */
* @see MyView#formatReference4_Font(Typeface) */
public B formatReference4Res(@FontRes int resId) {
getBuilder().putRes(R.styleable.Formats[R.styleable.Formats_formatReference4], resId);
return (B) this;
Expand Down Expand Up @@ -370,7 +370,7 @@ public StyleBuilder() {
}

/**
* Empty style */
* Empty style. */
public StyleBuilder addDefault() {
return this;
}
Expand Down
Loading

0 comments on commit b4bbdb6

Please sign in to comment.