Chromium Code Reviews| 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 = ( | |
|
scroggo
2015/02/23 18:52:16
I thought you had decided to create a separate tar
djsollen
2015/02/23 19:04:46
It was a good idea, but the execution didn't work
| |
| 18 """ | |
| 19 | |
| 20 # Setup directory to store skia's resources in the directory structure that | |
| 21 # the Android testing infrastructure expects | |
| 22 skia_resources_dir := $(call intermediates-dir-for,PACKAGING,skia_resources)/DAT A | |
| 23 $(shell mkdir -p $(skia_resources_dir)) | |
| 24 $(shell cp -r $(LOCAL_PATH)/../resources/. $(skia_resources_dir)/skia_resources) | |
| 25 LOCAL_PICKUP_FILES := $(skia_resources_dir) | |
| 26 skia_resources_dir := | |
|
scroggo
2015/02/23 18:52:16
What does this line do? Prevent skia_resources_dir
djsollen
2015/02/23 19:04:46
Yes, it basically nulls out the value since it won
| |
| 27 | |
| 28 """ | |
| 29 ) | |
| 17 | 30 |
| 18 def write_tool_android_mk(target_dir, var_dict): | 31 def write_tool_android_mk(target_dir, var_dict): |
| 19 """Write Android.mk for a Skia tool. | 32 """Write Android.mk for a Skia tool. |
| 20 | 33 |
| 21 Args: | 34 Args: |
| 22 target_dir: Destination for the makefile. Must not be None. | 35 target_dir: Destination for the makefile. Must not be None. |
| 23 var_dict: VarsDict containing variables for the makefile. | 36 var_dict: VarsDict containing variables for the makefile. |
| 24 """ | 37 """ |
| 25 target_file = os.path.join(target_dir, 'Android.mk') | 38 target_file = os.path.join(target_dir, 'Android.mk') |
| 26 with open(target_file, 'w') as f: | 39 with open(target_file, 'w') as f: |
| 27 f.write(makefile_writer.AUTOGEN_WARNING) | 40 f.write(makefile_writer.AUTOGEN_WARNING) |
| 28 | 41 |
| 29 makefile_writer.write_local_path(f) | 42 makefile_writer.write_local_path(f) |
| 30 makefile_writer.write_clear_vars(f) | 43 makefile_writer.write_clear_vars(f) |
| 31 | 44 |
| 32 makefile_writer.write_local_vars(f, var_dict, False, None) | 45 makefile_writer.write_local_vars(f, var_dict, False, None) |
| 33 | 46 |
| 34 makefile_writer.write_group(f, 'LOCAL_PICKUP_FILES', | 47 f.write(SKIA_RESOURCES) |
|
scroggo
2015/02/23 18:52:16
We have some tests that make sure the makefile wri
djsollen
2015/02/23 19:04:46
Acknowledged.
| |
| 35 ['$(LOCAL_PATH)/../resources'], False) | |
| 36 | |
| 37 f.write('include $(BUILD_NATIVE_TEST)\n') | 48 f.write('include $(BUILD_NATIVE_TEST)\n') |
| 38 | 49 |
| 39 | 50 |
| 40 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, | 51 def generate_tool(gyp_dir, target_file, skia_trunk, dest_dir, |
| 41 skia_lib_var_dict, local_module_name, local_module_tags, | 52 skia_lib_var_dict, local_module_name, local_module_tags, |
| 42 desired_targets, gyp_source_dir=None): | 53 desired_targets, gyp_source_dir=None): |
| 43 """Common steps for building one of the skia tools. | 54 """Common steps for building one of the skia tools. |
| 44 | 55 |
| 45 Parse a gyp file and create an Android.mk for this tool. | 56 Parse a gyp file and create an Android.mk for this tool. |
| 46 | 57 |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 90 full_dest = os.path.join(skia_trunk, dest_dir) | 101 full_dest = os.path.join(skia_trunk, dest_dir) |
| 91 else: | 102 else: |
| 92 full_dest = dest_dir | 103 full_dest = dest_dir |
| 93 | 104 |
| 94 # If the path does not exist, create it. This will happen during testing, | 105 # 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). | 106 # where there is no subdirectory for each tool (just a temporary folder). |
| 96 if not os.path.exists(full_dest): | 107 if not os.path.exists(full_dest): |
| 97 os.mkdir(full_dest) | 108 os.mkdir(full_dest) |
| 98 | 109 |
| 99 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict) | 110 write_tool_android_mk(target_dir=full_dest, var_dict=var_dict) |
| OLD | NEW |