Skip to content

Commit

Permalink
Set app version name in build script instead of git tag.
Browse files Browse the repository at this point in the history
This is a step toward enabling releasing from CI. Version code still
derived from git commit count.
  • Loading branch information
nickbutcher authored and florina-muntenescu committed Jul 5, 2018
1 parent 053068d commit 86798a4
Show file tree
Hide file tree
Showing 6 changed files with 24 additions and 25 deletions.
15 changes: 7 additions & 8 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,21 @@ android {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
versionCode rootProject.gitCommitCount
versionName rootProject.gitTag
archivesBaseName = "plaid"
versionName = '1.0.2'
archivesBaseName = 'plaid'

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'

resConfig "en"
buildConfigField "String", "GIT_SHA", "\"${gitSha}\""
resConfig 'en'
buildConfigField 'String', 'GIT_SHA', "\"${gitSha}\""
manifestPlaceholders += [
crashlyticsEnabled: false
]
}
buildTypes {
release {
minifyEnabled true
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'),
'proguard-rules.pro'
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
manifestPlaceholders += [crashlyticsEnabled: true]
}
}
Expand All @@ -55,8 +54,8 @@ android {

repositories {
google()
jcenter()
maven { url 'https://maven.fabric.io/public' }
jcenter()
}

dependencies {
Expand Down
5 changes: 2 additions & 3 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -62,13 +62,12 @@ buildscript {
}

plugins {
id "com.diffplug.gradle.spotless" version "3.13.0"
id 'com.diffplug.gradle.spotless' version '3.13.0'
}

ext {
// query git for the SHA, Tag and commit count. Use these to automate versioning.
gitSha = 'git rev-parse --short HEAD'.execute([], project.rootDir).text.trim()
gitTag = 'git describe --tags'.execute([], project.rootDir).text.trim()
gitCommitCount = 100 +
Integer.parseInt('git rev-list --count HEAD'.execute([], project.rootDir).text.trim())
}
Expand All @@ -77,7 +76,7 @@ subprojects {
apply plugin: 'com.diffplug.gradle.spotless'
spotless {
kotlin {
target "**/*.kt"
target '**/*.kt'
ktlint(versions.ktlint)
licenseHeaderFile project.rootProject.file('scripts/copyright.kt')
}
Expand Down
21 changes: 11 additions & 10 deletions core/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -27,22 +27,22 @@ android {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk

testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner"
testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'

buildConfigField "String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\""
buildConfigField "boolean", "DESIGNER_NEWS_V2", "true" // May be overridden by a build type.
buildConfigField 'String', 'DESIGNER_NEWS_CLIENT_ID', "\"${designer_news_client_id}\""
buildConfigField 'boolean', 'DESIGNER_NEWS_V2', 'true' // May be overridden by a build type.

buildConfigField "String", "DESIGNER_NEWS_CLIENT_ID", "\"${designer_news_client_id}\""
buildConfigField "String",
"DESIGNER_NEWS_CLIENT_SECRET", "\"${designer_news_client_secret}\""
buildConfigField 'String', 'DESIGNER_NEWS_CLIENT_ID', "\"${designer_news_client_id}\""
buildConfigField 'String',
'DESIGNER_NEWS_CLIENT_SECRET', "\"${designer_news_client_secret}\""

buildConfigField "String",
"PRODUCT_HUNT_DEVELOPER_TOKEN", "\"${product_hunt_developer_token}\""
buildConfigField 'String',
'PRODUCT_HUNT_DEVELOPER_TOKEN', "\"${product_hunt_developer_token}\""
}

buildTypes {
release {
buildConfigField "boolean", "DESIGNER_NEWS_V2", "false"
buildConfigField 'boolean', 'DESIGNER_NEWS_V2', 'false'
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
}
}
Expand Down Expand Up @@ -96,9 +96,10 @@ dependencies {
androidTestImplementation "org.mockito:mockito-android:${versions.mockito}"
androidTestImplementation "com.squareup.retrofit2:retrofit-mock:${versions.retrofit}"
}

kotlin {
experimental {
coroutines "enable"
coroutines 'enable'
}
}

Expand Down
2 changes: 1 addition & 1 deletion designernews/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ android {
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
resConfig "en"
resConfig 'en'
}
buildTypes {
release {
Expand Down
4 changes: 2 additions & 2 deletions dribbble/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ android {
defaultConfig {
minSdkVersion versions.minSdk
targetSdkVersion versions.targetSdk
def filesAuthorityValue = names.applicationId + ".shareprovider"
buildConfigField "String", "FILES_AUTHORITY", "\"${filesAuthorityValue}\""
def filesAuthorityValue = names.applicationId + '.shareprovider'
buildConfigField 'String', 'FILES_AUTHORITY', "\"${filesAuthorityValue}\""
manifestPlaceholders = [filesAuthority: filesAuthorityValue]
}

Expand Down
2 changes: 1 addition & 1 deletion third_party/bypass/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ android {
minSdkVersion 23
targetSdkVersion versions.targetSdk
versionCode 1
versionName "1.0"
versionName '1.0'
}
buildTypes {
release {
Expand Down

0 comments on commit 86798a4

Please sign in to comment.