Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(267)

Side by Side Diff: platform_tools/android/gyp_gen/tool_makefile_writer.py

Issue 369673002: Use BUILD_NATIVE_TEST instead of BUILD_EXECUTABLE. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove LOCAL_MODULE_PATH; update tests. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/python
2 2
3 # Copyright 2014 Google Inc. 3 # Copyright 2014 Google Inc.
4 # 4 #
5 # Use of this source code is governed by a BSD-style license that can be 5 # Use of this source code is governed by a BSD-style license that can be
6 # found in the LICENSE file. 6 # found in the LICENSE file.
7 7
8 """Code for generating Android.mk for a tool.""" 8 """Code for generating Android.mk for a tool."""
9 9
10 10
11 import android_framework_gyp 11 import android_framework_gyp
12 import gypd_parser 12 import gypd_parser
13 import makefile_writer 13 import makefile_writer
14 import os 14 import os
15 import vars_dict_lib 15 import vars_dict_lib
16 16
17 17
18 def write_tool_android_mk(target_dir, var_dict, place_in_local_tmp): 18 def write_tool_android_mk(target_dir, var_dict):
19 """Write Android.mk for a Skia tool. 19 """Write Android.mk for a Skia tool.
20 20
21 Args: 21 Args:
22 target_dir: Destination for the makefile. Must not be None. 22 target_dir: Destination for the makefile. Must not be None.
23 var_dict: VarsDict containing variables for the makefile. 23 var_dict: VarsDict containing variables for the makefile.
24 place_in_local_tmp: If True, the executable will be synced to
25 /data/local/tmp.
26 """ 24 """
27 target_file = os.path.join(target_dir, 'Android.mk') 25 target_file = os.path.join(target_dir, 'Android.mk')
28 with open(target_file, 'w') as f: 26 with open(target_file, 'w') as f:
29 f.write(makefile_writer.AUTOGEN_WARNING) 27 f.write(makefile_writer.AUTOGEN_WARNING)
30 28
31 if place_in_local_tmp:
32 f.write('local_target_dir := $(TARGET_OUT_DATA)/local/tmp\n')
33
34 makefile_writer.write_local_path(f) 29 makefile_writer.write_local_path(f)
35 makefile_writer.write_clear_vars(f) 30 makefile_writer.write_clear_vars(f)
36 31
37 makefile_writer.write_local_vars(f, var_dict, False, None) 32 makefile_writer.write_local_vars(f, var_dict, False, None)
38 33
39 if place_in_local_tmp: 34 makefile_writer.write_include_stlport(f)
40 f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n')
41 35
42 makefile_writer.write_include_stlport(f) 36 f.write('include $(BUILD_NATIVE_TEST)\n')
43 f.write('include $(BUILD_EXECUTABLE)\n')
44 37
45 38
46 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, 39 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir,
47 skia_lib_var_dict, local_module_name, local_module_tags, 40 skia_lib_var_dict, local_module_name, local_module_tags,
48 desired_targets, 41 desired_targets):
49 place_in_local_tmp=False):
50 """Common steps for building one of the skia tools. 42 """Common steps for building one of the skia tools.
51 43
52 Parse a gyp file and create an Android.mk for this tool. 44 Parse a gyp file and create an Android.mk for this tool.
53 45
54 Args: 46 Args:
55 gyp_dir: Directory containing gyp files. 47 gyp_dir: Directory containing gyp files.
56 target_file: gyp file for the project to be built, contained in gyp_dir. 48 target_file: gyp file for the project to be built, contained in gyp_dir.
57 skia_trunk: Trunk of Skia, used for determining the destination to write 49 skia_trunk: Trunk of Skia, used for determining the destination to write
58 'Android.mk'. 50 'Android.mk'.
59 dest_dir: Destination for 'Android.mk', relative to skia_trunk. Used for 51 dest_dir: Destination for 'Android.mk', relative to skia_trunk. Used for
60 both writing relative paths in the makefile and for determining the 52 both writing relative paths in the makefile and for determining the
61 destination to write the it. 53 destination to write the it.
62 skia_lib_var_dict: VarsDict representing libskia. Used as a reference to 54 skia_lib_var_dict: VarsDict representing libskia. Used as a reference to
63 ensure we do not duplicate anything in this Android.mk. 55 ensure we do not duplicate anything in this Android.mk.
64 local_module_name: Name for this tool, to set as LOCAL_MODULE. 56 local_module_name: Name for this tool, to set as LOCAL_MODULE.
65 local_module_tags: Tags to pass to LOCAL_MODULE_TAG. 57 local_module_tags: Tags to pass to LOCAL_MODULE_TAG.
66 desired_targets: List of targets to parse. 58 desired_targets: List of targets to parse.
67 place_in_local_tmp: If True, the executable will be synced to
68 /data/local/tmp.
69 """ 59 """
70 result_file = android_framework_gyp.main(target_dir=gyp_dir, 60 result_file = android_framework_gyp.main(target_dir=gyp_dir,
71 target_file=target_file, 61 target_file=target_file,
72 skia_arch_type='other', 62 skia_arch_type='other',
73 have_neon=False) 63 have_neon=False)
74 64
75 var_dict = vars_dict_lib.VarsDict() 65 var_dict = vars_dict_lib.VarsDict()
76 66
77 # Add known targets from skia_lib, so we do not reparse them. 67 # Add known targets from skia_lib, so we do not reparse them.
78 var_dict.KNOWN_TARGETS.set(skia_lib_var_dict.KNOWN_TARGETS) 68 var_dict.KNOWN_TARGETS.set(skia_lib_var_dict.KNOWN_TARGETS)
(...skipping 17 matching lines...) Expand all
96 if skia_trunk: 86 if skia_trunk:
97 full_dest = os.path.join(skia_trunk, dest_dir) 87 full_dest = os.path.join(skia_trunk, dest_dir)
98 else: 88 else:
99 full_dest = dest_dir 89 full_dest = dest_dir
100 90
101 # If the path does not exist, create it. This will happen during testing, 91 # If the path does not exist, create it. This will happen during testing,
102 # where there is no subdirectory for each tool (just a temporary folder). 92 # where there is no subdirectory for each tool (just a temporary folder).
103 if not os.path.exists(full_dest): 93 if not os.path.exists(full_dest):
104 os.mkdir(full_dest) 94 os.mkdir(full_dest)
105 95
106 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict, 96 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict)
107 place_in_local_tmp=place_in_local_tmp)
OLDNEW
« no previous file with comments | « platform_tools/android/bin/gyp_to_android.py ('k') | platform_tools/android/tests/expectations/tool/Android.mk » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698