| OLD | NEW |
| 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 SKIA_RESOURCES = ( |
| 18 """ |
| 19 # Setup directory to store skia's resources in the directory structure that |
| 20 # the Android testing infrastructure expects |
| 21 skia_res_dir := $(call intermediates-dir-for,PACKAGING,skia_resources)/DATA |
| 22 $(shell mkdir -p $(skia_res_dir)) |
| 23 $(shell cp -r $(LOCAL_PATH)/../resources/. $(skia_res_dir)/skia_resources) |
| 24 LOCAL_PICKUP_FILES := $(skia_res_dir) |
| 25 skia_res_dir := |
| 26 |
| 27 """ |
| 28 ) |
| 17 | 29 |
| 18 def write_tool_android_mk(target_dir, var_dict): | 30 def write_tool_android_mk(target_dir, var_dict): |
| 19 """Write Android.mk for a Skia tool. | 31 """Write Android.mk for a Skia tool. |
| 20 | 32 |
| 21 Args: | 33 Args: |
| 22 target_dir: Destination for the makefile. Must not be None. | 34 target_dir: Destination for the makefile. Must not be None. |
| 23 var_dict: VarsDict containing variables for the makefile. | 35 var_dict: VarsDict containing variables for the makefile. |
| 24 """ | 36 """ |
| 25 target_file = os.path.join(target_dir, 'Android.mk') | 37 target_file = os.path.join(target_dir, 'Android.mk') |
| 26 with open(target_file, 'w') as f: | 38 with open(target_file, 'w') as f: |
| 27 f.write(makefile_writer.AUTOGEN_WARNING) | 39 f.write(makefile_writer.AUTOGEN_WARNING) |
| 28 | 40 |
| 29 makefile_writer.write_local_path(f) | 41 makefile_writer.write_local_path(f) |
| 30 makefile_writer.write_clear_vars(f) | 42 makefile_writer.write_clear_vars(f) |
| 31 | 43 |
| 32 makefile_writer.write_local_vars(f, var_dict, False, None) | 44 makefile_writer.write_local_vars(f, var_dict, False, None) |
| 33 | 45 |
| 34 makefile_writer.write_group(f, 'LOCAL_PICKUP_FILES', | 46 f.write(SKIA_RESOURCES) |
| 35 ['$(LOCAL_PATH)/../resources'], False) | |
| 36 | |
| 37 f.write('include $(BUILD_NATIVE_TEST)\n') | 47 f.write('include $(BUILD_NATIVE_TEST)\n') |
| 38 | 48 |
| 39 | 49 |
| 40 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, | 50 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, |
| 41 skia_lib_var_dict, local_module_name, local_module_tags, | 51 skia_lib_var_dict, local_module_name, local_module_tags, |
| 42 desired_targets, gyp_source_dir=None): | 52 desired_targets, gyp_source_dir=None): |
| 43 """Common steps for building one of the skia tools. | 53 """Common steps for building one of the skia tools. |
| 44 | 54 |
| 45 Parse a gyp file and create an Android.mk for this tool. | 55 Parse a gyp file and create an Android.mk for this tool. |
| 46 | 56 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 90 full_dest = os.path.join(skia_trunk, dest_dir) | 100 full_dest = os.path.join(skia_trunk, dest_dir) |
| 91 else: | 101 else: |
| 92 full_dest = dest_dir | 102 full_dest = dest_dir |
| 93 | 103 |
| 94 # If the path does not exist, create it. This will happen during testing, | 104 # If the path does not exist, create it. This will happen during testing, |
| 95 # where there is no subdirectory for each tool (just a temporary folder). | 105 # where there is no subdirectory for each tool (just a temporary folder). |
| 96 if not os.path.exists(full_dest): | 106 if not os.path.exists(full_dest): |
| 97 os.mkdir(full_dest) | 107 os.mkdir(full_dest) |
| 98 | 108 |
| 99 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict) | 109 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict) |
| OLD | NEW |