Use BUILD_NATIVE_TEST instead of BUILD_EXECUTABLE.

This will generate makefiles for our tools (bench, tests, gm, dm) using
the line "include $(BUILD_NATIVE_TEST)". This has been recommended by the
Android team, as it builds both 32 bit and 64 bit versions of the test.

Do not use LOCAL_MODULE_PATH, which is deprecated (see https://docs.google.com/a/google.com/document/d/1uLAuY7_KYGx1TSzJ9SXkyevT8qNpra2ZoIBkmCoq8VM/edit# ).

Corresponds to ag/498302 , which makes this change just for bench.

R=djsollen@google.com, halcanary@google.com

Author: scroggo@google.com

Review URL: https://codereview.chromium.org/369673002
This commit is contained in:
scroggo 2014-07-08 11:20:57 -07:00 committed by Commit bot
parent be08aceaab
commit f50a79366f
4 changed files with 8 additions and 21 deletions

View File

@ -147,8 +147,7 @@ def main(target_dir=None, require_sk_user_config=False):
skia_lib_var_dict=common,
local_module_name='skia_bench',
local_module_tags=['tests'],
desired_targets=['bench'],
place_in_local_tmp=True)
desired_targets=['bench'])
tool_makefile_writer.generate_tool(gyp_dir=tmp_folder,
target_file='gm.gyp',

View File

@ -15,38 +15,30 @@ import os
import vars_dict_lib
def write_tool_android_mk(target_dir, var_dict, place_in_local_tmp):
def write_tool_android_mk(target_dir, var_dict):
"""Write Android.mk for a Skia tool.
Args:
target_dir: Destination for the makefile. Must not be None.
var_dict: VarsDict containing variables for the makefile.
place_in_local_tmp: If True, the executable will be synced to
/data/local/tmp.
"""
target_file = os.path.join(target_dir, 'Android.mk')
with open(target_file, 'w') as f:
f.write(makefile_writer.AUTOGEN_WARNING)
if place_in_local_tmp:
f.write('local_target_dir := $(TARGET_OUT_DATA)/local/tmp\n')
makefile_writer.write_local_path(f)
makefile_writer.write_clear_vars(f)
makefile_writer.write_local_vars(f, var_dict, False, None)
if place_in_local_tmp:
f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n')
makefile_writer.write_include_stlport(f)
f.write('include $(BUILD_EXECUTABLE)\n')
f.write('include $(BUILD_NATIVE_TEST)\n')
def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir,
skia_lib_var_dict, local_module_name, local_module_tags,
desired_targets,
place_in_local_tmp=False):
desired_targets):
"""Common steps for building one of the skia tools.
Parse a gyp file and create an Android.mk for this tool.
@ -64,8 +56,6 @@ def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir,
local_module_name: Name for this tool, to set as LOCAL_MODULE.
local_module_tags: Tags to pass to LOCAL_MODULE_TAG.
desired_targets: List of targets to parse.
place_in_local_tmp: If True, the executable will be synced to
/data/local/tmp.
"""
result_file = android_framework_gyp.main(target_dir=gyp_dir,
target_file=target_file,
@ -103,5 +93,4 @@ def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir,
if not os.path.exists(full_dest):
os.mkdir(full_dest)
write_tool_android_mk(target_dir=full_dest, var_dict=var_dict,
place_in_local_tmp=place_in_local_tmp)
write_tool_android_mk(target_dir=full_dest, var_dict=var_dict)

View File

@ -38,4 +38,4 @@ LOCAL_MODULE := \
local_module
include external/stlport/libstlport.mk
include $(BUILD_EXECUTABLE)
include $(BUILD_NATIVE_TEST)

View File

@ -119,8 +119,7 @@ def generate_dummy_tool_makefile(target_dir):
"""
vars_dict = generate_dummy_vars_dict(None)
tool_makefile_writer.write_tool_android_mk(target_dir=target_dir,
var_dict=vars_dict,
place_in_local_tmp=False)
var_dict=vars_dict)
class MakefileWriterTest(unittest.TestCase):