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

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

Issue 366653002: Specify the name of tool for creating a makefile. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: 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
« no previous file with comments | « platform_tools/android/bin/gyp_to_android.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
(...skipping 27 matching lines...) Expand all
38 38
39 if place_in_local_tmp: 39 if place_in_local_tmp:
40 f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n') 40 f.write('LOCAL_MODULE_PATH := $(local_target_dir)\n')
41 41
42 makefile_writer.write_include_stlport(f) 42 makefile_writer.write_include_stlport(f)
43 f.write('include $(BUILD_EXECUTABLE)\n') 43 f.write('include $(BUILD_EXECUTABLE)\n')
44 44
45 45
46 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, 46 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir,
47 skia_lib_var_dict, local_module_name, local_module_tags, 47 skia_lib_var_dict, local_module_name, local_module_tags,
48 desired_targets,
48 place_in_local_tmp=False): 49 place_in_local_tmp=False):
49 """Common steps for building one of the skia tools. 50 """Common steps for building one of the skia tools.
50 51
51 Parse a gyp file and create an Android.mk for this tool. 52 Parse a gyp file and create an Android.mk for this tool.
52 53
53 Args: 54 Args:
54 gyp_dir: Directory containing gyp files. 55 gyp_dir: Directory containing gyp files.
55 target_file: gyp file for the project to be built, contained in gyp_dir. 56 target_file: gyp file for the project to be built, contained in gyp_dir.
56 skia_trunk: Trunk of Skia, used for determining the destination to write 57 skia_trunk: Trunk of Skia, used for determining the destination to write
57 'Android.mk'. 58 'Android.mk'.
58 dest_dir: Destination for 'Android.mk', relative to skia_trunk. Used for 59 dest_dir: Destination for 'Android.mk', relative to skia_trunk. Used for
59 both writing relative paths in the makefile and for determining the 60 both writing relative paths in the makefile and for determining the
60 destination to write the it. 61 destination to write the it.
61 skia_lib_var_dict: VarsDict representing libskia. Used as a reference to 62 skia_lib_var_dict: VarsDict representing libskia. Used as a reference to
62 ensure we do not duplicate anything in this Android.mk. 63 ensure we do not duplicate anything in this Android.mk.
63 local_module_name: Name for this tool, to set as LOCAL_MODULE. 64 local_module_name: Name for this tool, to set as LOCAL_MODULE.
64 local_module_tags: Tags to pass to LOCAL_MODULE_TAG. 65 local_module_tags: Tags to pass to LOCAL_MODULE_TAG.
66 desired_targets: List of targets to parse.
65 place_in_local_tmp: If True, the executable will be synced to 67 place_in_local_tmp: If True, the executable will be synced to
66 /data/local/tmp. 68 /data/local/tmp.
67 """ 69 """
68 result_file = android_framework_gyp.main(target_dir=gyp_dir, 70 result_file = android_framework_gyp.main(target_dir=gyp_dir,
69 target_file=target_file, 71 target_file=target_file,
70 skia_arch_type='other', 72 skia_arch_type='other',
71 have_neon=False) 73 have_neon=False)
72 74
73 var_dict = vars_dict_lib.VarsDict() 75 var_dict = vars_dict_lib.VarsDict()
74 76
75 # Add known targets from skia_lib, so we do not reparse them. 77 # Add known targets from skia_lib, so we do not reparse them.
76 var_dict.KNOWN_TARGETS.set(skia_lib_var_dict.KNOWN_TARGETS) 78 var_dict.KNOWN_TARGETS.set(skia_lib_var_dict.KNOWN_TARGETS)
77 79
78 gypd_parser.parse_gypd(var_dict, result_file, dest_dir) 80 gypd_parser.parse_gypd(var_dict, result_file, dest_dir, desired_targets)
79 81
80 android_framework_gyp.clean_gypd_files(gyp_dir) 82 android_framework_gyp.clean_gypd_files(gyp_dir)
81 83
82 var_dict.LOCAL_MODULE.add(local_module_name) 84 var_dict.LOCAL_MODULE.add(local_module_name)
83 for tag in local_module_tags: 85 for tag in local_module_tags:
84 var_dict.LOCAL_MODULE_TAGS.add(tag) 86 var_dict.LOCAL_MODULE_TAGS.add(tag)
85 87
86 # No need for defines that are already in skia_lib. 88 # No need for defines that are already in skia_lib.
87 for define in skia_lib_var_dict.DEFINES: 89 for define in skia_lib_var_dict.DEFINES:
88 try: 90 try:
89 var_dict.DEFINES.remove(define) 91 var_dict.DEFINES.remove(define)
90 except ValueError: 92 except ValueError:
91 # Okay if the define was not part of the parse for our tool. 93 # Okay if the define was not part of the parse for our tool.
92 pass 94 pass
93 95
94 if skia_trunk: 96 if skia_trunk:
95 full_dest = os.path.join(skia_trunk, dest_dir) 97 full_dest = os.path.join(skia_trunk, dest_dir)
96 else: 98 else:
97 full_dest = dest_dir 99 full_dest = dest_dir
98 100
99 # If the path does not exist, create it. This will happen during testing, 101 # If the path does not exist, create it. This will happen during testing,
100 # where there is no subdirectory for each tool (just a temporary folder). 102 # where there is no subdirectory for each tool (just a temporary folder).
101 if not os.path.exists(full_dest): 103 if not os.path.exists(full_dest):
102 os.mkdir(full_dest) 104 os.mkdir(full_dest)
103 105
104 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict, 106 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict,
105 place_in_local_tmp=place_in_local_tmp) 107 place_in_local_tmp=place_in_local_tmp)
OLDNEW
« no previous file with comments | « platform_tools/android/bin/gyp_to_android.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698