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

Commit 208ffc3

Browse files
author
Zachary Sweigart
committed
Added tools to android components
1 parent e05507c commit 208ffc3

File tree

4 files changed

+63
-41
lines changed

4 files changed

+63
-41
lines changed

auto-value-bundle/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,8 +20,8 @@ plugins {
2020
id 'java-library'
2121
}
2222

23-
sourceCompatibility = JavaVersion.VERSION_1_8
24-
targetCompatibility = JavaVersion.VERSION_1_8
23+
sourceCompatibility = JavaVersion.VERSION_1_7
24+
targetCompatibility = JavaVersion.VERSION_1_7
2525

2626
dependencies {
2727
implementation deps.apt.androidApi

build.gradle

Lines changed: 19 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,31 @@
1515
*/
1616

1717
subprojects {
18-
buildscript {
19-
repositories {
20-
jcenter()
21-
google()
18+
apply from: rootProject.file('gradle/dependencies.gradle')
19+
buildscript {
20+
repositories {
21+
jcenter()
22+
google()
23+
}
2224
}
23-
}
24-
25-
repositories {
26-
jcenter()
27-
google()
28-
}
2925

30-
apply plugin: 'checkstyle'
26+
repositories {
27+
jcenter()
28+
google()
29+
}
3130

32-
checkstyle { ->
33-
rootProject
34-
configFile rootProject.file('config/checkstyle/checkstyle.xml')
35-
}
31+
afterEvaluate {
32+
if (plugins.hasPlugin('com.android.library')) {
33+
project.android.libraryVariants.all {
34+
it.generateBuildConfig.enabled = false
35+
}
36+
}
37+
}
3638
}
3739

3840
task wrapper(type: Wrapper) {
39-
gradleVersion = '4.6'
40-
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
41-
}
42-
43-
task clean(type: Delete) {
44-
delete rootProject.buildDir
41+
gradleVersion = '4.6'
42+
distributionUrl = "https://services.gradle.org/distributions/gradle-$gradleVersion-all.zip"
4543
}
4644

4745
apply from: 'gradle/dependencies.gradle'

gradle/dependencies.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def build = [
2525
minSdkVersion: 16,
2626
targetSdkVersion: 27,
2727
gradlePlugins: [
28-
android: 'com.android.tools.build:gradle:3.0.1',
28+
android: 'com.android.tools.build:gradle:2.3.0',
2929
],
3030
guava: "com.google.guava:guava:24.0-jre",
3131
]

sample/build.gradle

Lines changed: 41 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -14,34 +14,58 @@
1414
* limitations under the License.
1515
*/
1616

17-
plugins {
18-
id 'com.android.application'
17+
buildscript {
18+
dependencies {
19+
classpath deps.build.gradlePlugins.android
20+
}
1921
}
2022

23+
apply plugin: 'com.android.application'
24+
2125
android {
22-
compileSdkVersion deps.build.compileSdkVersion
23-
buildToolsVersion deps.build.buildToolsVersion
24-
25-
defaultConfig {
26-
minSdkVersion deps.build.minSdkVersion
27-
targetSdkVersion deps.build.targetSdkVersion
28-
}
29-
compileOptions {
30-
sourceCompatibility JavaVersion.VERSION_1_7
31-
targetCompatibility JavaVersion.VERSION_1_7
32-
}
26+
compileSdkVersion deps.build.compileSdkVersion
27+
buildToolsVersion deps.build.buildToolsVersion
28+
29+
defaultConfig {
30+
applicationId "com.uber.myapplication"
31+
minSdkVersion deps.build.minSdkVersion
32+
targetSdkVersion deps.build.targetSdkVersion
33+
versionCode 1
34+
versionName "1.0"
35+
}
36+
compileOptions {
37+
sourceCompatibility JavaVersion.VERSION_1_7
38+
targetCompatibility JavaVersion.VERSION_1_7
39+
}
40+
41+
// Setup a simple lint config for an android app/library.
42+
lintOptions {
43+
abortOnError true
44+
lintConfig rootProject.file('config/lint/lint.xml')
45+
disable 'InvalidPackage'
46+
}
47+
}
48+
49+
// This is required to run checkstyle on an android app/library.
50+
task checkstyle(type: Checkstyle) {
51+
source 'src'
52+
include '**/*.java'
53+
exclude '**/gen/**'
54+
55+
classpath = files()
3356
}
57+
check.dependsOn 'checkstyle'
3458

3559

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

40-
implementation deps.support.appcompat
41-
implementation deps.apt.autoValue
42-
implementation deps.external.gson
64+
compile deps.support.appcompat
65+
compile deps.apt.autoValue
66+
compile deps.external.gson
4367

44-
compileOnly project(":auto-value-bundle")
68+
provided project(":auto-value-bundle")
4569

4670
testCompile deps.test.junit
4771
}

0 commit comments

Comments
 (0)