/
build.gradle
117 lines (100 loc) · 3.41 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
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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
apply plugin: 'com.android.application'
android {
def last_tag = getGitRevParseInfo("describe --tags --abbrev=0")
def commit_count = getGitRevParseInfo("rev-list --count ${last_tag}..")
def current_commit = getGitRevParseInfo("rev-parse --short")
applicationVariants.all { variant ->
variant.outputs.all { output ->
outputFileName = "lWS.QR.${variant.versionName}.apk"
if (variant.getBuildType().isMinifyEnabled()) {
variant.assemble.doLast{
copy {
from variant.mappingFile
into output.outputFile.parent
rename { String fileName ->
"lWS.QR.${variant.versionName}_mapping.txt"
}
}
}
}
}
}
signingConfigs {
release {
storeFile file('../../.keys/mvb-release.keystore')
keyAlias 'mvb_key'
}
debug {
storeFile file('../../.keys/mvb-debug.keystore')
keyAlias 'androiddebugkey'
keyPassword 'android'
storePassword 'android'
}
}
compileSdkVersion 26
buildToolsVersion '28.0.2'
lintOptions {
disable 'SetJavaScriptEnabled', 'GoogleAppIndexingWarning'
}
defaultConfig {
// Keep two lines arround applicationId unchanged to allow use patch for F-Droid build
applicationId "net.basov.lws.qr"
// End of strings reserved for F-Droid patch
minSdkVersion 16
targetSdkVersion 26
versionCode 30000
versionName "03.00.00"
}
flavorDimensions "version"
productFlavors {
gpm {
dimension "version"
applicationIdSuffix ".gpm"
}
fdroid {
dimension "version"
applicationIdSuffix ".fdroid"
}
}
buildTypes {
release {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
zipAlignEnabled true
// applicationIdSuffix '.gpm'
versionNameSuffix "r-g" + current_commit
signingConfig signingConfigs.release
}
beta {
minifyEnabled true
shrinkResources true
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.txt'
// applicationIdSuffix '.gpm'
versionNameSuffix "b-g" + current_commit
debuggable false
signingConfig signingConfigs.debug
}
debug {
debuggable true
versionNameSuffix 'a-' + commit_count + "-g" + current_commit
signingConfig signingConfigs.debug
}
}
}
task makeJS(type: Exec) {
inputs.file file("QR-Code-generator/javascript/qrcodegen.js")
//outputs.dir("src/main/assets")
outputs.file file("src/main/assets/qrcodegen.min.js")
commandLine 'sh', '-c', 'uglifyjs --comments \'/\\*[^\\0]+?Copyright[^\\0]+?\\*/\' -o src/main/assets/qrcodegen.min.js QR-Code-generator/javascript/qrcodegen.js'
println "Create minifyed qrcodegen.js"
}
preBuild.dependsOn('makeJS')
dependencies {
implementation fileTree(include: ['*.jar'], dir: 'libs')
}
static def getGitRevParseInfo (what) {
def cmd = "git " + what + " HEAD"
def proc = cmd.execute ()
proc.text.trim ()
}