Reduce duplication of sources for tests in Android.bp
Instead of both dm and nanobench both listing all of the GM sources this CL consolidates the GMs into a single target that both executables can depend on. This also paves the way for an SkQP build target to depend on the same target. Bug: skia:12777 Change-Id: I4bb7236612b04d42c01334f42e569c7f66893617 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/491042 Reviewed-by: Leon Scroggins <scroggo@google.com> Commit-Queue: Derek Sollenberger <djsollen@google.com>
This commit is contained in:
parent
53bf2fa77a
commit
5d7ef77a35
@ -344,13 +344,41 @@ cc_defaults {
|
|||||||
enabled: true,
|
enabled: true,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
|
data: [
|
||||||
|
"resources/**/*",
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_defaults {
|
||||||
|
name: "skia_gm_srcs",
|
||||||
|
local_include_dirs: [
|
||||||
|
$gm_includes
|
||||||
|
],
|
||||||
|
|
||||||
|
srcs: [
|
||||||
|
$gm_srcs
|
||||||
|
],
|
||||||
|
}
|
||||||
|
|
||||||
|
cc_defaults {
|
||||||
|
name: "skia_test_minus_gm_srcs",
|
||||||
|
local_include_dirs: [
|
||||||
|
$test_minus_gm_includes
|
||||||
|
],
|
||||||
|
|
||||||
|
srcs: [
|
||||||
|
$test_minus_gm_srcs
|
||||||
|
],
|
||||||
}
|
}
|
||||||
|
|
||||||
cc_test {
|
cc_test {
|
||||||
name: "skia_dm",
|
name: "skia_dm",
|
||||||
|
|
||||||
defaults: [
|
defaults: [
|
||||||
"skia_tool_deps"
|
"skia_gm_srcs",
|
||||||
|
"skia_test_minus_gm_srcs",
|
||||||
|
"skia_tool_deps",
|
||||||
],
|
],
|
||||||
|
|
||||||
local_include_dirs: [
|
local_include_dirs: [
|
||||||
@ -371,6 +399,7 @@ cc_test {
|
|||||||
name: "skia_nanobench",
|
name: "skia_nanobench",
|
||||||
|
|
||||||
defaults: [
|
defaults: [
|
||||||
|
"skia_gm_srcs",
|
||||||
"skia_tool_deps"
|
"skia_tool_deps"
|
||||||
],
|
],
|
||||||
|
|
||||||
@ -381,11 +410,9 @@ cc_test {
|
|||||||
srcs: [
|
srcs: [
|
||||||
$nanobench_srcs
|
$nanobench_srcs
|
||||||
],
|
],
|
||||||
|
}
|
||||||
|
|
||||||
data: [
|
''')
|
||||||
"resources/**/*",
|
|
||||||
],
|
|
||||||
}''')
|
|
||||||
|
|
||||||
# We'll run GN to get the main source lists and include directories for Skia.
|
# We'll run GN to get the main source lists and include directories for Skia.
|
||||||
def generate_args(target_os, enable_gpu, renderengine = False):
|
def generate_args(target_os, enable_gpu, renderengine = False):
|
||||||
@ -475,6 +502,12 @@ cflags_cc = strip_slashes(js['targets']['//:skia']['cflags_cc'])
|
|||||||
local_includes = strip_slashes(js['targets']['//:skia']['include_dirs'])
|
local_includes = strip_slashes(js['targets']['//:skia']['include_dirs'])
|
||||||
export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
|
export_includes = strip_slashes(js['targets']['//:public']['include_dirs'])
|
||||||
|
|
||||||
|
gm_srcs = strip_slashes(js['targets']['//:gm']['sources'])
|
||||||
|
gm_includes = strip_slashes(js['targets']['//:gm']['include_dirs'])
|
||||||
|
|
||||||
|
test_srcs = strip_slashes(js['targets']['//:tests']['sources'])
|
||||||
|
test_includes = strip_slashes(js['targets']['//:tests']['include_dirs'])
|
||||||
|
|
||||||
dm_srcs = strip_slashes(js['targets']['//:dm']['sources'])
|
dm_srcs = strip_slashes(js['targets']['//:dm']['sources'])
|
||||||
dm_includes = strip_slashes(js['targets']['//:dm']['include_dirs'])
|
dm_includes = strip_slashes(js['targets']['//:dm']['include_dirs'])
|
||||||
|
|
||||||
@ -482,13 +515,17 @@ nanobench_target = js['targets']['//:nanobench']
|
|||||||
nanobench_srcs = strip_slashes(nanobench_target['sources'])
|
nanobench_srcs = strip_slashes(nanobench_target['sources'])
|
||||||
nanobench_includes = strip_slashes(nanobench_target['include_dirs'])
|
nanobench_includes = strip_slashes(nanobench_target['include_dirs'])
|
||||||
|
|
||||||
gn_to_bp_utils.GrabDependentValues(js, '//:dm', 'sources', dm_srcs, 'skia')
|
|
||||||
|
gn_to_bp_utils.GrabDependentValues(js, '//:gm', 'sources', gm_srcs, '//:skia')
|
||||||
|
gn_to_bp_utils.GrabDependentValues(js, '//:tests', 'sources', test_srcs, '//:skia')
|
||||||
|
gn_to_bp_utils.GrabDependentValues(js, '//:dm', 'sources',
|
||||||
|
dm_srcs, ['//:skia', '//:gm', '//:tests'])
|
||||||
gn_to_bp_utils.GrabDependentValues(js, '//:nanobench', 'sources',
|
gn_to_bp_utils.GrabDependentValues(js, '//:nanobench', 'sources',
|
||||||
nanobench_srcs, 'skia')
|
nanobench_srcs, ['//:skia', '//:gm'])
|
||||||
|
|
||||||
# skcms is a little special, kind of a second-party library.
|
# skcms is a little special, kind of a second-party library.
|
||||||
local_includes.add("include/third_party/skcms")
|
local_includes.add("include/third_party/skcms")
|
||||||
dm_includes .add("include/third_party/skcms")
|
gm_includes .add("include/third_party/skcms")
|
||||||
|
|
||||||
# Android's build will choke if we list headers.
|
# Android's build will choke if we list headers.
|
||||||
def strip_headers(sources):
|
def strip_headers(sources):
|
||||||
@ -529,8 +566,13 @@ gn_to_bp_utils.GrabDependentValues(js_renderengine, '//:skia', 'sources',
|
|||||||
renderengine_srcs, None)
|
renderengine_srcs, None)
|
||||||
renderengine_srcs = strip_headers(renderengine_srcs)
|
renderengine_srcs = strip_headers(renderengine_srcs)
|
||||||
|
|
||||||
dm_srcs = strip_headers(dm_srcs)
|
gm_srcs = strip_headers(gm_srcs)
|
||||||
nanobench_srcs = strip_headers(nanobench_srcs)
|
test_srcs = strip_headers(test_srcs)
|
||||||
|
dm_srcs = strip_headers(dm_srcs).difference(gm_srcs).difference(test_srcs)
|
||||||
|
nanobench_srcs = strip_headers(nanobench_srcs).difference(gm_srcs)
|
||||||
|
|
||||||
|
test_minus_gm_includes = test_includes.difference(gm_includes)
|
||||||
|
test_minus_gm_srcs = test_srcs.difference(gm_srcs)
|
||||||
|
|
||||||
cflags = gn_to_bp_utils.CleanupCFlags(cflags)
|
cflags = gn_to_bp_utils.CleanupCFlags(cflags)
|
||||||
cflags_cc = gn_to_bp_utils.CleanupCCFlags(cflags_cc)
|
cflags_cc = gn_to_bp_utils.CleanupCCFlags(cflags_cc)
|
||||||
@ -631,6 +673,12 @@ with open('Android.bp', 'w') as Android_bp:
|
|||||||
defs['hsw' ] +
|
defs['hsw' ] +
|
||||||
defs['skx' ])),
|
defs['skx' ])),
|
||||||
|
|
||||||
|
'gm_includes' : bpfmt(8, gm_includes),
|
||||||
|
'gm_srcs' : bpfmt(8, gm_srcs),
|
||||||
|
|
||||||
|
'test_minus_gm_includes' : bpfmt(8, test_minus_gm_includes),
|
||||||
|
'test_minus_gm_srcs' : bpfmt(8, test_minus_gm_srcs),
|
||||||
|
|
||||||
'dm_includes' : bpfmt(8, dm_includes),
|
'dm_includes' : bpfmt(8, dm_includes),
|
||||||
'dm_srcs' : bpfmt(8, dm_srcs),
|
'dm_srcs' : bpfmt(8, dm_srcs),
|
||||||
|
|
||||||
|
@ -39,8 +39,11 @@ def GrabDependentValues(js, name, value_type, list_to_extend, exclude):
|
|||||||
continue # We've handled all third-party DEPS as static or shared_libs.
|
continue # We've handled all third-party DEPS as static or shared_libs.
|
||||||
if 'none' in dep:
|
if 'none' in dep:
|
||||||
continue # We'll handle all cpu-specific sources manually later.
|
continue # We'll handle all cpu-specific sources manually later.
|
||||||
if exclude and exclude in dep:
|
if exclude and isinstance(exclude, str) and exclude == dep:
|
||||||
continue
|
continue
|
||||||
|
if exclude and isinstance(exclude, list) and dep in exclude:
|
||||||
|
continue
|
||||||
|
|
||||||
list_to_extend.update(_strip_slash(js['targets'][dep].get(value_type, [])))
|
list_to_extend.update(_strip_slash(js['targets'][dep].get(value_type, [])))
|
||||||
GrabDependentValues(js, dep, value_type, list_to_extend, exclude)
|
GrabDependentValues(js, dep, value_type, list_to_extend, exclude)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user