Skip to content

Commit

Permalink
Updated Gradle dependencies and tools for sub-projects, including Che…
Browse files Browse the repository at this point in the history
…ckstyle and Lint. Also fixed all Checkstyle and Lint complaints.
  • Loading branch information
cesards committed Sep 19, 2018
1 parent 7efb785 commit 087d26a
Show file tree
Hide file tree
Showing 16 changed files with 244 additions and 265 deletions.
145 changes: 39 additions & 106 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,77 +1,24 @@
##
## Built application files
##

*.apk
*.ap_
*.aab


##
## Files for the ART/Dalvik VM
##

*.dex


## Java class files

*.class


##
## Generated files
##

bin/
gen/
out/
gen-external-apklibs/


##
## Gradle files
##

.gradle/


##
## Local configuration file (sdk path, etc)
##

# Gradle
.gradle
gradlew.bat
build
local.properties
tmp


##
## Proguard folder generated by Eclipse
##

reports

# Maven
target
pom.xml.*
release.properties
gen-external-apklibs

# Eclipse
.classpath
.project
.settings
eclipsebin
proguard/


##
## Log Files
##

*.log


##
## Android Studio
##

build/
captures/
.navigation/


##
## Intellij
##

*.iml
# IntelliJ IDEA
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
Expand All @@ -80,46 +27,32 @@ captures/
.idea/caches/
# /.idea/assetWizardSettings.xml SHOULD THIS BE EXCLUDED ??
# /.idea/navEditor.xml SHOULD THIS BE EXCLUDED ??
*.iml
*.ipl
*.iws
classes/
idea-classes/
coverage-error.log


##
## Keystore files
##
*.jks


##
## Google Services (e.g. APIs or Firebase)
##

google-services.json


##
## Freeline
##

freeline.py
freeline/
freeline_project_description.json
# Android Studio
captures/
.navigation/


##
## OSX files
##
# Android
gen
bin
project.properties
out

# Finder
.DS_Store

# Windows
Thumbs.db

##
## Java
##

*.class


##
## Windows files
##
# Logs
*.log

Thumbs.db
# Google Services (e.g. APIs or Firebase)
google-services.json
39 changes: 4 additions & 35 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
apply from: "${rootDir}/buildsystem/dependencies.gradle"
apply plugin: 'com.github.ben-manes.versions'

buildscript {
Expand All @@ -7,14 +6,16 @@ buildscript {
'compileSdk': 28,
'errorProne': '2.3.1',
]

repositories {
google()
jcenter()
maven { url 'https://plugins.gradle.org/m2/' } // Error Prone Plugin
}

dependencies {
classpath 'com.android.tools.build:gradle:3.3.0-alpha10'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.0.6'
classpath 'net.ltgt.gradle:gradle-errorprone-plugin:0.6'
classpath 'com.github.ben-manes:gradle-versions-plugin:0.20.0'
}
}
Expand All @@ -28,39 +29,7 @@ subprojects {
jcenter()
}

apply plugin: 'net.ltgt.errorprone'

tasks.withType(JavaCompile) {
options.compilerArgs += [
'-Xlint:all',
'-Xlint:-serial',
'-Xlint:-deprecation',
]
}

configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all the error-prone dependencies to use the same version.
if (details.requested.group == 'com.google.errorprone' && details.requested.name.startsWith('error_prone_')) {
details.useVersion versions.errorProne
}
}
}
}

tasks.withType(Test) {
testLogging {
exceptionFormat 'FULL'
showCauses true
showExceptions true
showStackTraces true
}
}

dependencies {
errorprone "com.google.errorprone:error_prone_core:${versions.errorProne}"
}
apply from: "${rootDir}/gradle/code-quality.gradle"
}

task clean(type: Delete) {
Expand Down
4 changes: 4 additions & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,7 @@ test:
# When running the apk build, unit tests, lint, checkstyle etc sequentially is slow, so we run them in parallel.
# Using bash case statement, choose which command to run on which node (machine).
- ./gradlew assembleDebug



# - ./gradlew clean assembleDebug test lint
File renamed without changes.
17 changes: 17 additions & 0 deletions code-quality/custom-lint.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<lint>
<!-- Error issues that should break builds -->
<!-- Issues considered priority 8 or higher should be marked as "error" -->
<issue id="HardcodedText" severity="error" />
<issue id="UnusedResources" severity="error">
<!--<ignore path="**/google-services/**" />-->
<!--<ignore path="build.gradle" />-->
<!--<ignore path="src/main/res/layout/preview_theme_editor.xml" />-->
<!--<ignore path="src/main/res/values/strings_preview.xml" />-->
</issue>

<!-- Informational issues don't break builds -->
<issue id="CustomViewStyleable" severity="informational" />
<!--<issue id="GradleDependency" severity="informational" />-->
<!--<issue id="OldTargetApi" severity="informational" />-->
</lint>
23 changes: 0 additions & 23 deletions gradle/checkstyle.gradle

This file was deleted.

11 changes: 11 additions & 0 deletions gradle/code-quality-android.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
android {
lintOptions {
lintConfig file("${project.rootDir}/code-quality/custom-lint.xml")
htmlReport true
abortOnError true
// baseline file("lint-baseline.xml")
// htmlOutput file("lint-report.html")
// warningsAsErrors true
// check[IDs of Issues to run]
}
}
60 changes: 60 additions & 0 deletions gradle/code-quality.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
// This should be executed under subprojects {} or allProjects {} functions.

/**
* Error-prone
*/
apply plugin: 'net.ltgt.errorprone'

tasks.withType(JavaCompile).configureEach {
options.errorprone.disableWarningsInGeneratedCode = true
}

configurations.all {
resolutionStrategy {
eachDependency { details ->
// Force all the error-prone dependencies to use the same version.
if (details.requested.group == 'com.google.errorprone' && details.requested.name.startsWith('error_prone_')) {
details.useVersion versions.errorProne
}
}
}
}


/**
* Checkstyle
*/
apply plugin: 'checkstyle'

checkstyle {
configFile rootProject.file('code-quality/checkstyle.xml')
ignoreFailures false
showViolations true
}

task checkstyle(type: Checkstyle) {
configFile rootProject.file('code-quality/checkstyle.xml')
source 'src/main/java'
ignoreFailures false
showViolations true
include '**/*.java'

// reports {
// xml.enabled = true
// }

classpath = files()
}

afterEvaluate {
if (project.tasks.getByName("check")) {
check.dependsOn('checkstyle')
}
}

/**
* Tools dependencies
*/
dependencies {
errorprone "com.google.errorprone:error_prone_core:${versions.errorProne}"
}
Loading

0 comments on commit 087d26a

Please sign in to comment.