Skip to content
This repository has been archived by the owner on May 12, 2020. It is now read-only.

Commit

Permalink
Added tools to android components
Browse files Browse the repository at this point in the history
  • Loading branch information
Zachary Sweigart committed Mar 20, 2018
1 parent e05507c commit 1b45187
Show file tree
Hide file tree
Showing 5 changed files with 67 additions and 64 deletions.
23 changes: 3 additions & 20 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ language: android

android:
components:
# Update tools and then platform-tools explicitly so lint gets an updated database. Can be removed once 3.0 is out.
- tools
- platform-tools

Expand All @@ -16,28 +15,11 @@ before_install:
- echo "$LICENSES_HASH_TWO" >> "$ANDROID_HOME/licenses/android-sdk-license"
# Install the rest of tools (e.g., avdmanager)
- sdkmanager tools
# Install the system image
- sdkmanager "system-images;android-18;default;armeabi-v7a"
# Create and start emulator for the script. Meant to race the install task.
- echo no | avdmanager create avd --force -n test -k "system-images;android-18;default;armeabi-v7a"
- $ANDROID_HOME/emulator/emulator -avd test -no-audio -no-window > /dev/null 2>&1 &

install: ./gradlew build assembleAndroidTest --stacktrace

before_script:
- android-wait-for-emulator
- adb shell input keyevent 82
install: ./gradlew build --stacktrace

script:
- ./gradlew check connectedCheck --stacktrace

after_success:
- .buildscript/deploy_snapshot.sh

env:
global:
- secure: "th/WHMPJ+u6Zv40agrt3FEG0UTE0qUUbvuF4NgF2bpQ68zJ5GE+O6OZ9cQS0XcQFxOhm9cSYZwSlalbOuOB0HpPZz8o4uKOGiKFkZjj9pboOhiNLLNoP7CYx9sNbyVgmAP1uuCFwaJYVIC62plizY8rRwPsQ53pO4WVqQYmY4itO2qqVFywqi7mtZcK0PvSsdAHjIXJL8ycOj07dxAP7CV/cz+ZP8I1DjkK0uPMpa60J/9MUg+gKEOyCVvDQcdHg0kyaZCmzqJvZ++XG6Z3noASCDjODJEE1+Zol7acfYAiT5+rnfRn4LiSXxYWm0DfBQoDHMR0H75F1bBGFR2v0ZXWqtSIrnyDg0By8ExG5WRdmLhqvVnEyND4lFZS8Qa6FFJzTR2r6IHcSIK2s2D8l5bmm65qblBPM/G6EtwqOe5CeaUpZu5AsDCQZXf+PpwZbwrnkmlgCXMRPMTGBVC5qwht2IIwcb2QsM8jzGv12X6GjmU+S8X1r3MnpZ8vGW9jIHv9WzfdF8GeGa7se0ZeTBeARqJp9i4nBp/s6k1/dK7kDyaV831CggiD05PpqK9rnm0x624nyDFS/F28ByZnHfOWLCN1DIWmECJTsFtoh8zTdQ+IUv+BO+7h6bUpWbw4gN2AP9qoRb6E6ITrJPjTZEsbSWgjC00y6VrtBHKoRFCU="
- secure: "PWNIobyXzX8ls4rJMnXrO5mygq6JRYnwOVAmAkprgCETArkEwxHG4kEAy+Ha2mGNopkAh6K6Dg3iV/OqR20l58uRsCahgp8z4eYFHXbmA6nIJN5O8IvfxKMwVxxeWlVqXSSNjoPOgbdl0XcuoUDDksftWKm6o7cra1joilCIyJGupB6LLFEielaW3nwLjP0I9bYIqzHv245RyXRsLhwjbzfXrpJdPH3z+y7MyNJfwRGWvTBlEETPUMwMRxwUcNOvx4d3j6XhEWE6vdEeAYLsPAoAb0wXNCgii0/RWzsQqgTHgOcwOoi5UJrFCLZ8Dke551qnshomgM/HMoibvbyOVV0H0YTFnUpc04RdTI6mfiv3cFx2oqknQha4BWFVaM1cHhg9a6TdmL1ubbm7ECTXbEl/3bhL3VFMPl+ouvga+sJoPGBMyjZbeRe2ifin1ixE3GMutV37eW4RNFWGbbQORnahNiLb8PLDZqmUj/Jy8fdRLhBVB3O3u7lrayZb5ODIA3aJ2JC2wo9CtbQSR+To1B3WNTn0GpkyNceOj0XM9Z/87gMkqvm7hh6OT2bYX39VkExA5DZJnPxoSrAfGypK8je6aw478LrV7F2xnUY40FUPBV+a/GsHq8OGSjdJti8wZbr7rti3zLWZEF7+WvETELcH2GqdnVPIHO1H5xnbJ8k="
- ./gradlew check --stacktrace

branches:
except:
Expand All @@ -51,3 +33,4 @@ sudo: false
cache:
directories:
- $HOME/.gradle

8 changes: 3 additions & 5 deletions auto-value-bundle/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,10 @@

import org.gradle.internal.jvm.Jvm

plugins {
id 'java-library'
}
apply plugin: 'java'

sourceCompatibility = JavaVersion.VERSION_1_8
targetCompatibility = JavaVersion.VERSION_1_8
sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

dependencies {
implementation deps.apt.androidApi
Expand Down
40 changes: 19 additions & 21 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -15,33 +15,31 @@
*/

subprojects {
buildscript {
repositories {
jcenter()
google()
apply from: rootProject.file('gradle/dependencies.gradle')
buildscript {
repositories {
jcenter()
google()
}
}
}

repositories {
jcenter()
google()
}

apply plugin: 'checkstyle'
repositories {
jcenter()
google()
}

checkstyle { ->
rootProject
configFile rootProject.file('config/checkstyle/checkstyle.xml')
}
afterEvaluate {
if (plugins.hasPlugin('com.android.library')) {
project.android.libraryVariants.all {
it.generateBuildConfig.enabled = false
}
}
}
}

task wrapper(type: Wrapper) {
gradleVersion = '4.6'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

task clean(type: Delete) {
delete rootProject.buildDir
gradleVersion = '4.6'
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
}

apply from: 'gradle/dependencies.gradle'
2 changes: 1 addition & 1 deletion gradle/dependencies.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def build = [
minSdkVersion: 16,
targetSdkVersion: 27,
gradlePlugins: [
android: 'com.android.tools.build:gradle:3.0.1',
android: 'com.android.tools.build:gradle:2.3.0',
],
guava: "com.google.guava:guava:24.0-jre",
]
Expand Down
58 changes: 41 additions & 17 deletions sample/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -14,34 +14,58 @@
* limitations under the License.
*/

plugins {
id 'com.android.application'
buildscript {
dependencies {
classpath deps.build.gradlePlugins.android
}
}

apply plugin: 'com.android.application'

android {
compileSdkVersion deps.build.compileSdkVersion
buildToolsVersion deps.build.buildToolsVersion

defaultConfig {
minSdkVersion deps.build.minSdkVersion
targetSdkVersion deps.build.targetSdkVersion
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}
compileSdkVersion deps.build.compileSdkVersion
buildToolsVersion deps.build.buildToolsVersion

defaultConfig {
applicationId "com.uber.myapplication"
minSdkVersion deps.build.minSdkVersion
targetSdkVersion deps.build.targetSdkVersion
versionCode 1
versionName "1.0"
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_7
targetCompatibility JavaVersion.VERSION_1_7
}

// Setup a simple lint config for an android app/library.
lintOptions {
abortOnError true
lintConfig rootProject.file('config/lint/lint.xml')
disable 'InvalidPackage'
}
}

// This is required to run checkstyle on an android app/library.
task checkstyle(type: Checkstyle) {
source 'src'
include '**/*.java'
exclude '**/gen/**'

classpath = files()
}
check.dependsOn 'checkstyle'


dependencies {
annotationProcessor deps.apt.autoValue
annotationProcessor project(":auto-value-bundle")

implementation deps.support.appcompat
implementation deps.apt.autoValue
implementation deps.external.gson
compile deps.support.appcompat
compile deps.apt.autoValue
compile deps.external.gson

compileOnly project(":auto-value-bundle")
provided project(":auto-value-bundle")

testCompile deps.test.junit
}
Expand Down

0 comments on commit 1b45187

Please sign in to comment.