Skip to content

Commit 087d26a

Browse files
committed
Updated Gradle dependencies and tools for sub-projects, including Checkstyle and Lint. Also fixed all Checkstyle and Lint complaints.
1 parent 7efb785 commit 087d26a

File tree

16 files changed

+244
-265
lines changed

16 files changed

+244
-265
lines changed

.gitignore

+39-106
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,24 @@
1-
##
2-
## Built application files
3-
##
4-
5-
*.apk
6-
*.ap_
7-
*.aab
8-
9-
10-
##
11-
## Files for the ART/Dalvik VM
12-
##
13-
14-
*.dex
15-
16-
17-
## Java class files
18-
19-
*.class
20-
21-
22-
##
23-
## Generated files
24-
##
25-
26-
bin/
27-
gen/
28-
out/
29-
gen-external-apklibs/
30-
31-
32-
##
33-
## Gradle files
34-
##
35-
36-
.gradle/
37-
38-
39-
##
40-
## Local configuration file (sdk path, etc)
41-
##
42-
1+
# Gradle
2+
.gradle
3+
gradlew.bat
4+
build
435
local.properties
44-
tmp
45-
46-
47-
##
48-
## Proguard folder generated by Eclipse
49-
##
50-
6+
reports
7+
8+
# Maven
9+
target
10+
pom.xml.*
11+
release.properties
12+
gen-external-apklibs
13+
14+
# Eclipse
15+
.classpath
16+
.project
17+
.settings
18+
eclipsebin
5119
proguard/
5220

53-
54-
##
55-
## Log Files
56-
##
57-
58-
*.log
59-
60-
61-
##
62-
## Android Studio
63-
##
64-
65-
build/
66-
captures/
67-
.navigation/
68-
69-
70-
##
71-
## Intellij
72-
##
73-
74-
*.iml
21+
# IntelliJ IDEA
7522
.idea/workspace.xml
7623
.idea/tasks.xml
7724
.idea/gradle.xml
@@ -80,46 +27,32 @@ captures/
8027
.idea/caches/
8128
# /.idea/assetWizardSettings.xml SHOULD THIS BE EXCLUDED ??
8229
# /.idea/navEditor.xml SHOULD THIS BE EXCLUDED ??
30+
*.iml
31+
*.ipl
32+
*.iws
33+
classes/
34+
idea-classes/
35+
coverage-error.log
8336

84-
85-
##
86-
## Keystore files
87-
##
88-
*.jks
89-
90-
91-
##
92-
## Google Services (e.g. APIs or Firebase)
93-
##
94-
95-
google-services.json
96-
97-
98-
##
99-
## Freeline
100-
##
101-
102-
freeline.py
103-
freeline/
104-
freeline_project_description.json
37+
# Android Studio
38+
captures/
39+
.navigation/
10540

10641

107-
##
108-
## OSX files
109-
##
42+
# Android
43+
gen
44+
bin
45+
project.properties
46+
out
11047

48+
# Finder
11149
.DS_Store
11250

51+
# Windows
52+
Thumbs.db
11353

114-
##
115-
## Java
116-
##
117-
118-
*.class
119-
120-
121-
##
122-
## Windows files
123-
##
54+
# Logs
55+
*.log
12456

125-
Thumbs.db
57+
# Google Services (e.g. APIs or Firebase)
58+
google-services.json

build.gradle

+4-35
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
apply from: "${rootDir}/buildsystem/dependencies.gradle"
21
apply plugin: 'com.github.ben-manes.versions'
32

43
buildscript {
@@ -7,14 +6,16 @@ buildscript {
76
'compileSdk': 28,
87
'errorProne': '2.3.1',
98
]
9+
1010
repositories {
1111
google()
1212
jcenter()
1313
maven { url 'https://plugins.gradle.org/m2/' } // Error Prone Plugin
1414
}
15+
1516
dependencies {
1617
classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
17-
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.6'
18+
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.6'
1819
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
1920
}
2021
}
@@ -28,39 +29,7 @@ subprojects {
2829
jcenter()
2930
}
3031

31-
apply plugin: 'net.ltgt.errorprone'
32-
33-
tasks.withType(JavaCompile) {
34-
options.compilerArgs += [
35-
'-Xlint:all',
36-
'-Xlint:-serial',
37-
'-Xlint:-deprecation',
38-
]
39-
}
40-
41-
configurations.all {
42-
resolutionStrategy {
43-
eachDependency { details ->
44-
// Force all the error-prone dependencies to use the same version.
45-
if (details.requested.group == 'com.google.errorprone' && details.requested.name.startsWith('error_prone_')) {
46-
details.useVersion versions.errorProne
47-
}
48-
}
49-
}
50-
}
51-
52-
tasks.withType(Test) {
53-
testLogging {
54-
exceptionFormat 'FULL'
55-
showCauses true
56-
showExceptions true
57-
showStackTraces true
58-
}
59-
}
60-
61-
dependencies {
62-
errorprone "com.google.errorprone:error_prone_core:${versions.errorProne}"
63-
}
32+
apply from: "${rootDir}/gradle/code-quality.gradle"
6433
}
6534

6635
task clean(type: Delete) {

circle.yml

+4
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,7 @@ test:
1616
# When running the apk build, unit tests, lint, checkstyle etc sequentially is slow, so we run them in parallel.
1717
# Using bash case statement, choose which command to run on which node (machine).
1818
- ./gradlew assembleDebug
19+
20+
21+
22+
# - ./gradlew clean assembleDebug test lint
File renamed without changes.

code-quality/custom-lint.xml

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<lint>
3+
<!-- Error issues that should break builds -->
4+
<!-- Issues considered priority 8 or higher should be marked as "error" -->
5+
<issue id="HardcodedText" severity="error" />
6+
<issue id="UnusedResources" severity="error">
7+
<!--<ignore path="**/google-services/**" />-->
8+
<!--<ignore path="build.gradle" />-->
9+
<!--<ignore path="src/main/res/layout/preview_theme_editor.xml" />-->
10+
<!--<ignore path="src/main/res/values/strings_preview.xml" />-->
11+
</issue>
12+
13+
<!-- Informational issues don't break builds -->
14+
<issue id="CustomViewStyleable" severity="informational" />
15+
<!--<issue id="GradleDependency" severity="informational" />-->
16+
<!--<issue id="OldTargetApi" severity="informational" />-->
17+
</lint>

gradle/checkstyle.gradle

-23
This file was deleted.

gradle/code-quality-android.gradle

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
android {
2+
lintOptions {
3+
lintConfig file("${project.rootDir}/code-quality/custom-lint.xml")
4+
htmlReport true
5+
abortOnError true
6+
// baseline file("lint-baseline.xml")
7+
// htmlOutput file("lint-report.html")
8+
// warningsAsErrors true
9+
// check[IDs of Issues to run]
10+
}
11+
}

gradle/code-quality.gradle

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
// This should be executed under subprojects {} or allProjects {} functions.
2+
3+
/**
4+
* Error-prone
5+
*/
6+
apply plugin: 'net.ltgt.errorprone'
7+
8+
tasks.withType(JavaCompile).configureEach {
9+
options.errorprone.disableWarningsInGeneratedCode = true
10+
}
11+
12+
configurations.all {
13+
resolutionStrategy {
14+
eachDependency { details ->
15+
// Force all the error-prone dependencies to use the same version.
16+
if (details.requested.group == 'com.google.errorprone' && details.requested.name.startsWith('error_prone_')) {
17+
details.useVersion versions.errorProne
18+
}
19+
}
20+
}
21+
}
22+
23+
24+
/**
25+
* Checkstyle
26+
*/
27+
apply plugin: 'checkstyle'
28+
29+
checkstyle {
30+
configFile rootProject.file('code-quality/checkstyle.xml')
31+
ignoreFailures false
32+
showViolations true
33+
}
34+
35+
task checkstyle(type: Checkstyle) {
36+
configFile rootProject.file('code-quality/checkstyle.xml')
37+
source 'src/main/java'
38+
ignoreFailures false
39+
showViolations true
40+
include '**/*.java'
41+
42+
// reports {
43+
// xml.enabled = true
44+
// }
45+
46+
classpath = files()
47+
}
48+
49+
afterEvaluate {
50+
if (project.tasks.getByName("check")) {
51+
check.dependsOn('checkstyle')
52+
}
53+
}
54+
55+
/**
56+
* Tools dependencies
57+
*/
58+
dependencies {
59+
errorprone "com.google.errorprone:error_prone_core:${versions.errorProne}"
60+
}

0 commit comments

Comments
 (0)