-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild.gradle
More file actions
53 lines (43 loc) · 1.43 KB
/
build.gradle
File metadata and controls
53 lines (43 loc) · 1.43 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
import org.ajoberstar.grgit.*
apply plugin: 'com.android.application'
apply plugin: 'io.fabric'
buildscript {
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
classpath 'com.android.tools.build:gradle:1.1.0'
classpath 'io.fabric.tools:gradle:1.+'
classpath 'com.github.jcandksolutions.gradle:android-unit-test:2.1.1'
classpath 'org.ajoberstar:gradle-git:1.1.0'
classpath 'org.ajoberstar:grgit:1.1.0'
}
}
repositories {
mavenCentral()
maven { url 'https://maven.fabric.io/public' }
}
dependencies {
}
ext {
gitHash = "git rev-parse --short HEAD".execute().text.trim() // get the git commmit hash
patch_version = System.getenv("PATCH_VERSION") != null ? System.getenv("PATCH_VERSION") : "9"
build_number = System.getenv("BUILD_NUMBER") as Integer ?: 58
version_code = System.getenv("VERSION_CODE") as Integer ?: 3
versionCode = version_code
versionName = "1.2.${patch_version}.${build_number}" // using Jenkins parameters, build number, and git commit hash to construct the version
}
ext.repo = Grgit.open(project.file('.'))
version = "build/${versionName}"
android {
compileSdkVersion 21
buildToolsVersion "21.1.2"
task tagRelease << {
repo.tag.add {
name = "build/${versionName}"
message = "Release of ${versionName}, versionCode ${versionCode}."
}
repo.push(tags: true)
}
}