| 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 """ | 8 """ |
| 9 Script for generating the Android framework's version of Skia from gyp | 9 Script for generating the Android framework's version of Skia from gyp |
| 10 files. | 10 files. |
| (...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 57 @return a VarsDict containing the variable definitions determined by gyp. | 57 @return a VarsDict containing the variable definitions determined by gyp. |
| 58 """ | 58 """ |
| 59 result_file = android_framework_gyp.main(target_dir, target_file, | 59 result_file = android_framework_gyp.main(target_dir, target_file, |
| 60 skia_arch_type, have_neon) | 60 skia_arch_type, have_neon) |
| 61 var_dict = vars_dict_lib.VarsDict() | 61 var_dict = vars_dict_lib.VarsDict() |
| 62 gypd_parser.parse_gypd(var_dict, result_file) | 62 gypd_parser.parse_gypd(var_dict, result_file) |
| 63 clean_gypd_files(target_dir) | 63 clean_gypd_files(target_dir) |
| 64 print '.', | 64 print '.', |
| 65 return var_dict | 65 return var_dict |
| 66 | 66 |
| 67 def main(target_dir=None): | 67 def main(target_dir=None, require_sk_user_config=False): |
| 68 """ | 68 """ |
| 69 Read gyp files and create Android.mk for the Android framework's | 69 Read gyp files and create Android.mk for the Android framework's |
| 70 external/skia. | 70 external/skia. |
| 71 @param target_dir Directory in which to place 'Android.mk'. If None, the file | 71 @param target_dir Directory in which to place 'Android.mk'. If None, the file |
| 72 will be placed in skia's root directory. | 72 will be placed in skia's root directory. |
| 73 @param require_sk_user_config If True, raise an AssertionError if |
| 74 SkUserConfig.h does not exist. |
| 73 """ | 75 """ |
| 74 # Create a temporary folder to hold gyp and gypd files. Create it in SKIA_DIR | 76 # Create a temporary folder to hold gyp and gypd files. Create it in SKIA_DIR |
| 75 # so that it is a sibling of gyp/, so the relationships between gyp files and | 77 # so that it is a sibling of gyp/, so the relationships between gyp files and |
| 76 # other files (e.g. platform_tools/android/gyp/dependencies.gypi, referenced | 78 # other files (e.g. platform_tools/android/gyp/dependencies.gypi, referenced |
| 77 # by android_deps.gyp as a relative path) is unchanged. | 79 # by android_deps.gyp as a relative path) is unchanged. |
| 78 # Use mkdtemp to find an unused folder name, but then delete it so copytree | 80 # Use mkdtemp to find an unused folder name, but then delete it so copytree |
| 79 # can be called with a non-existent directory. | 81 # can be called with a non-existent directory. |
| 80 tmp_folder = tempfile.mkdtemp(dir=SKIA_DIR) | 82 tmp_folder = tempfile.mkdtemp(dir=SKIA_DIR) |
| 81 os.rmdir(tmp_folder) | 83 os.rmdir(tmp_folder) |
| 82 shutil.copytree(os.path.join(SKIA_DIR, GYP_FOLDER), tmp_folder) | 84 shutil.copytree(os.path.join(SKIA_DIR, GYP_FOLDER), tmp_folder) |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 common = vars_dict_lib.intersect(var_dict_list) | 120 common = vars_dict_lib.intersect(var_dict_list) |
| 119 | 121 |
| 120 # Create SkUserConfig | 122 # Create SkUserConfig |
| 121 user_config = os.path.join(SKIA_DIR, 'include', 'config', 'SkUserConfig.h') | 123 user_config = os.path.join(SKIA_DIR, 'include', 'config', 'SkUserConfig.h') |
| 122 if target_dir: | 124 if target_dir: |
| 123 dst_dir = target_dir | 125 dst_dir = target_dir |
| 124 else: | 126 else: |
| 125 dst_dir = os.path.join(SKIA_DIR, 'include', 'core') | 127 dst_dir = os.path.join(SKIA_DIR, 'include', 'core') |
| 126 | 128 |
| 127 generate_user_config.generate_user_config( | 129 generate_user_config.generate_user_config( |
| 128 original_sk_user_config=user_config, target_dir=dst_dir, | 130 original_sk_user_config=user_config, |
| 131 require_sk_user_config=require_sk_user_config, target_dir=dst_dir, |
| 129 ordered_set=common.DEFINES) | 132 ordered_set=common.DEFINES) |
| 130 | 133 |
| 131 # Now that the defines have been written to SkUserConfig, they are not | 134 # Now that the defines have been written to SkUserConfig, they are not |
| 132 # needed in Android.mk. | 135 # needed in Android.mk. |
| 133 common.DEFINES.reset() | 136 common.DEFINES.reset() |
| 134 | 137 |
| 135 # Further trim arm_neon_var_dict with arm_var_dict. After this call, | 138 # Further trim arm_neon_var_dict with arm_var_dict. After this call, |
| 136 # arm_var_dict (which will now be the intersection) includes all definitions | 139 # arm_var_dict (which will now be the intersection) includes all definitions |
| 137 # used by both arm and arm + neon, and arm_neon_var_dict will only contain | 140 # used by both arm and arm + neon, and arm_neon_var_dict will only contain |
| 138 # those specific to arm + neon. | 141 # those specific to arm + neon. |
| (...skipping 18 matching lines...) Expand all Loading... |
| 157 'arm64')) | 160 'arm64')) |
| 158 | 161 |
| 159 makefile_writer.write_android_mk(target_dir=target_dir, | 162 makefile_writer.write_android_mk(target_dir=target_dir, |
| 160 common=common, deviations_from_common=deviations_from_common) | 163 common=common, deviations_from_common=deviations_from_common) |
| 161 | 164 |
| 162 finally: | 165 finally: |
| 163 shutil.rmtree(tmp_folder) | 166 shutil.rmtree(tmp_folder) |
| 164 | 167 |
| 165 if __name__ == '__main__': | 168 if __name__ == '__main__': |
| 166 main() | 169 main() |
| OLD | NEW |