forked from jaredweiss/numenta-apps
-
Notifications
You must be signed in to change notification settings - Fork 0
/
common.gradle
102 lines (97 loc) · 3.35 KB
/
common.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
/*
* Numenta Platform for Intelligent Computing (NuPIC)
* Copyright (C) 2015, Numenta, Inc. Unless you have purchased from
* Numenta, Inc. a separate commercial license for this software code, the
* following terms and conditions apply:
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU Affero Public License for more details.
*
* You should have received a copy of the GNU Affero Public License
* along with this program. If not, see http://www.gnu.org/licenses.
*
* http://numenta.org/licenses/
*
*/
allprojects {
/*
* Add global functions in here.
*
* Usage:
* Add the following line to your root 'build.gradle'
* <code>
* apply from: '../../mobile-core/android/common.gradle'
* </code>
*/
ext {
/**
* Get commit count for the root project and it's subproject from git
*
* Executes the following command:
* <code>
* git rev-list HEAD --count . ../../mobile-core
* <code>
*/
gitCommitCount = {
def stdout = new ByteArrayOutputStream()
def args = ['git', 'rev-list', 'HEAD', '--count']
rootProject.subprojects.each {
args.add(it.projectDir.absolutePath)
}
exec {
commandLine args
standardOutput = stdout
}
return Integer.parseInt(stdout.toString().trim())
}()
/**
* Get the latest commit SHA from git
*
* Executes the following command:
* <code>
* git rev-parse --short HEAD
* </code>
*/
gitCommitSHA = {
def stdout = new ByteArrayOutputStream()
exec {
commandLine 'git', 'rev-parse', '--short', 'HEAD'
standardOutput = stdout
}
return stdout.toString().trim()
}()
/**
* Get Keystore password from the 'BUILD_PASSWORD' environment variable or
* prompt the user for the password if the environment variable is not set
*/
askForKeystorePassword = {
String password = System.getenv('BUILD_PASSWORD')
if (password == null) {
password = System.getProperty('BUILD_PASSWORD')
}
if (password == null && System.console() != null) {
password = new String(System.console().readPassword('\nEnter keystore password: '))
}
return password
}
/**
* Default Keystore file location.
* Make sure this file exists otherwise the build will fail
*/
defaultKeystoreLocation = '/etc/numenta/products/keys/grok.keystore'
/**
* The key alias used to sign the release APK,.
*/
defaultKeyAlias = 'grok'
/**
* Initial version code to use in addition to 'gitCommitCount'
*/
initialVersionCode = System.getProperty('INITIAL_VERSION_CODE', '0').toInteger()
}
}