Skip to content

Commit

Permalink
Improve Gradle build file and store all outputs on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
rubengees committed May 24, 2018
1 parent aff8e70 commit 5cddf2e
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ jobs:
path: build/reports
destination: reports
- store_artifacts:
path: build/outputs/apk
destination: apk
path: build/outputs
destination: outputs
- save_cache:
paths:
- ~/.gradle
Expand Down
27 changes: 16 additions & 11 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -26,23 +26,23 @@ apply plugin: 'io.gitlab.arturbosch.detekt'
apply plugin: 'com.novoda.android-command'

android {
compileSdkVersion project.ext.compileSdkVersion
compileSdkVersion rootProject.ext.compileSdkVersion

dexOptions {
preDexLibraries !isCI()
}

compileOptions {
sourceCompatibility project.ext.javaVersion
targetCompatibility project.ext.javaVersion
sourceCompatibility javaVersion
targetCompatibility javaVersion
}

defaultConfig {
applicationId 'me.proxer.app'
minSdkVersion project.ext.minSdkVersion
targetSdkVersion project.ext.targetSdkVersion
versionCode project.ext.appVersionMajor * 1000000 + project.ext.appVersionMinor * 10000 + project.ext.appVersionPatch * 100
versionName "${project.ext.appVersionMajor}.${project.ext.appVersionMinor}.${project.ext.appVersionPatch}"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionCode appVersionMajor * 1000000 + appVersionMinor * 10000 + appVersionPatch * 100
versionName "$appVersionMajor.$appVersionMinor.$appVersionPatch"

vectorDrawables.useSupportLibrary true
resConfigs 'de'
Expand Down Expand Up @@ -114,9 +114,13 @@ android {
}

lintOptions {
mkdir("$buildDir/reports/lint")

warningsAsErrors = true

lintConfig new File(rootDir, 'config/lint/lint.xml')
lintConfig file("$rootDir/config/lint/lint.xml")
xmlOutput file("$buildDir/reports/lint/lint-results.xml")
htmlOutput file("$buildDir/reports/lint/lint-results.html")
}

packagingOptions {
Expand Down Expand Up @@ -181,7 +185,7 @@ ktlint {
}

wrapper {
gradleVersion project.ext.gradleVersion
gradleVersion rootProject.ext.gradleVersion
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).all {
Expand All @@ -199,7 +203,7 @@ static getResSrcDirs() {
Set<String> result = []

new File(layoutsPath).eachFile(FileType.DIRECTORIES) {
result.add("${layoutsPath}/${it.name}")
result.add("$layoutsPath/$it.name")
}

return result
Expand All @@ -219,7 +223,8 @@ static String getFromSecrets(String key) {
}

if (!result.containsKey(key)) {
throw new GradleException("Please include a value for $key in your secrets.properties file to perform this action.")
throw new GradleException("Please include a value for $key in your secrets.properties " +
"file to perform this action.")
}

return result[key]
Expand Down

0 comments on commit 5cddf2e

Please sign in to comment.