-
Notifications
You must be signed in to change notification settings - Fork 594
/
build.gradle
60 lines (50 loc) · 1.51 KB
/
build.gradle
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
54
55
56
57
58
59
60
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.1.0'
classpath 'com.novoda:bintray-release:0.3.4'
}
}
allprojects {
repositories {
jcenter()
}
}
ext {
VERSION = version()
}
task bumpMajor << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'major', type: 'int', operation: '+', value: 1)
entry(key: 'minor', type: 'int', operation: '=', value: 0)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
}
}
task bumpMinor << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'minor', type: 'int', operation: '+', value: 1)
entry(key: 'patch', type: 'int', operation: '=', value: 0)
}
}
task bumpPatch << {
ant.propertyfile(file: 'version.properties') {
entry(key: 'patch', type: 'int', operation: '+', value: 1)
}
}
task genReadMe << {
def template = file('README.md.template').text
def result = template.replaceAll("%%version%%", version())
file("README.md").withWriter{ it << result }
}
task version << {
println version()
}
def String version() {
def versionPropsFile = file('version.properties')
def Properties versionProps = new Properties()
versionProps.load(new FileInputStream(versionPropsFile))
return versionProps['major'] + "." + versionProps['minor'] + "." + versionProps['patch']
}