Skip to content

Instantly share code, notes, and snippets.

@adamgajzlerowicz
Created January 3, 2020 12:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save adamgajzlerowicz/819b793337563ac3162c61218606874b to your computer and use it in GitHub Desktop.
Save adamgajzlerowicz/819b793337563ac3162c61218606874b to your computer and use it in GitHub Desktop.
android {
compileSdkVersion rootProject.ext.compileSdkVersion
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
def versionPropsFile = file('version.properties')
def code
if (versionPropsFile.canRead()) {
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
code = versionProps['VERSION_CODE'].toInteger() + 1
if (System.getenv('BUMP_VERSION') == 'yes') {
versionProps['VERSION_CODE']=code.toString()
versionProps.store(versionPropsFile.newWriter(), null)
}
} else {
throw new GradleException("Could not read version.properties!")
}
defaultConfig {
versionCode 1
applicationId "co.petpit.petpit"
minSdkVersion rootProject.ext.minSdkVersion
targetSdkVersion rootProject.ext.targetSdkVersion
versionName "1.0.2"
multiDexEnabled true
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment