-
Notifications
You must be signed in to change notification settings - Fork 83
/
other.gradle
54 lines (43 loc) · 1.57 KB
/
other.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
tasks.register('makeIcons') {
doLast {
description 'Converts the SVG launcher icon to multiple resolution PNGs'
def dir_res = 'app/src/main/res/'
def dir_svg = 'images/'
def launcher_fn_svg = 'ic_launcher.svg'
def launcher_fn_png = 'ic_launcher.png'
def sizeLogo = 512
def sizeMap = ['mdpi': 48, 'hdpi': 72, 'xhdpi': 96, 'xxhdpi': 144, 'xxxhdpi': 192]
def convertSvg = {
size, dir_in, dir_out ->
println "Converting launcher icon into ${dir_out} ..."
exec {
commandLine 'mkdir', '-p', dir_out
}
exec {
// 16-bit/color RGBA, non-interlaced (TODO: we need 32)
commandLine 'rsvg-convert', '-f', 'png', '-w', size, '-h', size, '-o', dir_out + launcher_fn_png, dir_in + launcher_fn_svg
}
}
convertSvg(sizeLogo, dir_svg, dir_svg)
sizeMap.each {
key, val -> convertSvg(val, dir_svg, dir_res + 'drawable-' + key + '/')
}
}
}
tasks.register('makeDiagrams') {
doLast {
description 'Converts dot to SVG'
def dir = 'docs/'
def convertDot = {
format, fn ->
println "Converting ${fn} to ${format} ..."
exec {
commandLine 'dot', '-O', '-T' + format, fn + '.dot'
}
}
def diagrams = ['RecognizerService', 'components', 'intents']
diagrams.each {
dia -> convertDot('svg', dir + dia)
}
}
}