Just make Android.bp bpfmt compliant to begin with.

Change-Id: I0fe833b4af4b68f97fe3feefc76503cb6473eb7b
Reviewed-on: https://skia-review.googlesource.com/5847
Reviewed-by: Leon Scroggins <scroggo@google.com>
This commit is contained in:
Mike Klein 2016-12-12 14:09:38 -05:00
parent 3fc97d75ac
commit ee43f6f25e

View File

@ -20,73 +20,92 @@ import tempfile
bp = string.Template('''// This file is autogenerated by gn_to_bp.py.
cc_library {
name: "libskia",
cflags: [
"-fexceptions",
"-Wno-unused-parameter",
"-U_FORTIFY_SOURCE",
"-D_FORTIFY_SOURCE=1",
"-DSKIA_IMPLEMENTATION=1",
],
name: "libskia",
cflags: [
"-fexceptions",
"-Wno-unused-parameter",
"-U_FORTIFY_SOURCE",
"-D_FORTIFY_SOURCE=1",
"-DSKIA_IMPLEMENTATION=1",
],
export_include_dirs: $export_includes,
export_include_dirs: [
$export_includes
],
local_include_dirs: $local_includes,
local_include_dirs: [
$local_includes
],
srcs: $srcs,
srcs: [
$srcs
],
arch: {
arm: {
srcs: $arm_srcs,
arch: {
arm: {
srcs: [
$arm_srcs
],
armv7_a_neon: {
srcs: $arm_neon_srcs,
},
armv7_a_neon: {
srcs: [
$arm_neon_srcs
],
},
},
arm64: {
srcs: [
$arm64_srcs
],
},
mips: {
srcs: [
$mips_srcs
],
},
mips64: {
srcs: [
$mips64_srcs
],
},
x86: {
srcs: [
$x86_srcs
],
},
x86_64: {
srcs: [
$x86_srcs
],
},
},
arm64: {
srcs: $arm64_srcs,
},
mips: {
srcs: $mips_srcs,
},
mips64: {
srcs: $mips64_srcs,
},
x86: {
srcs: $x86_srcs,
},
x86_64: {
srcs: $x86_srcs,
},
},
shared_libs: [
"libEGL",
"libGLESv2",
"libdng_sdk",
"libexpat",
"libft2",
"libicui18n",
"libicuuc",
"libjpeg",
"liblog",
"libpiex",
"libpng",
"libvulkan",
"libz",
],
static_libs: [
"libsfntly",
"libwebp-decode",
"libwebp-encode",
],
}
''')
shared_libs: [
"libEGL",
"libGLESv2",
"libdng_sdk",
"libexpat",
"libft2",
"libicui18n",
"libicuuc",
"libjpeg",
"liblog",
"libpiex",
"libpng",
"libvulkan",
"libz",
],
static_libs: [
"libsfntly",
"libwebp-decode",
"libwebp-encode",
],
}''')
# We'll run GN to get the main source lists and include directories for Skia.
gn_args = {
@ -166,29 +185,29 @@ def scrub(lst):
# Relativize paths to top-level skia/ directory.
return [os.path.relpath(p, '..') for p in lst]
# Turn a list of strings into a pretty string version of a list of strings.
def pretty(lst):
return pprint.pformat(sorted(lst)).replace("'", '"')
# Turn a list of strings into the style bpfmt outputs.
def bpfmt(indent, lst):
return ('\n' + ' '*indent).join('"%s",' % v for v in sorted(lst))
# OK! We have everything to fill in Android.bp...
with open('Android.bp', 'w') as f:
print >>f, bp.substitute({
'export_includes': pretty(export_includes),
'local_includes': pretty(local_includes),
'srcs': pretty(srcs),
'export_includes': bpfmt(8, export_includes),
'local_includes': bpfmt(8, local_includes),
'srcs': bpfmt(8, srcs),
'arm_srcs': pretty(scrub(defs['armv7'])),
'arm_neon_srcs': pretty(scrub(defs['neon'])),
'arm64_srcs': pretty(scrub(defs['arm64'] +
defs['crc32'])),
'mips_srcs': pretty(scrub(defs['mips_dsp'])),
'mips64_srcs': pretty(scrub(defs['none'])),
'x86_srcs': pretty(scrub(defs['sse2'] +
defs['ssse3'] +
defs['sse41'] +
defs['sse42'] +
defs['avx' ] +
defs['hsw' ]))
'arm_srcs': bpfmt(16, scrub(defs['armv7'])),
'arm_neon_srcs': bpfmt(20, scrub(defs['neon'])),
'arm64_srcs': bpfmt(16, scrub(defs['arm64'] +
defs['crc32'])),
'mips_srcs': bpfmt(16, scrub(defs['mips_dsp'])),
'mips64_srcs': bpfmt(16, scrub(defs['none'])),
'x86_srcs': bpfmt(16, scrub(defs['sse2'] +
defs['ssse3'] +
defs['sse41'] +
defs['sse42'] +
defs['avx' ] +
defs['hsw' ]))
})
#... and all the #defines we want to put in SkUserConfig.h.