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

Unified Diff: platform_tools/android/gyp_gen/generate_user_config.py

Issue 242203008: Allow running gyp_to_android without SkUserConfig. (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Created 6 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « platform_tools/android/bin/gyp_to_android.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: platform_tools/android/gyp_gen/generate_user_config.py
diff --git a/platform_tools/android/gyp_gen/generate_user_config.py b/platform_tools/android/gyp_gen/generate_user_config.py
index 1fafc1d9799b2d79c214f31440d9f6f295ac9a85..51a70eb60e2b067b931817e3a70ab935ff89f136 100644
--- a/platform_tools/android/gyp_gen/generate_user_config.py
+++ b/platform_tools/android/gyp_gen/generate_user_config.py
@@ -27,7 +27,8 @@ AUTOGEN_WARNING = (
BUILD_GUARD = 'SkUserConfig_Android_DEFINED'
-def generate_user_config(original_sk_user_config, target_dir, ordered_set):
+def generate_user_config(original_sk_user_config, require_sk_user_config,
+ target_dir, ordered_set):
"""Generate the SkUserConfig file specific to the Android framework.
Android needs its #defines in its skia/include/core directory, so that other
@@ -39,6 +40,9 @@ def generate_user_config(original_sk_user_config, target_dir, ordered_set):
Args:
original_sk_user_config: Path to original SkUserConfig.h
+ require_sk_user_config: If True, raise an AssertionError if
+ SkUserConfig.h does not exist. Either way, if it does exist, copy it
+ into the new file.
target_dir: Directory within which the modified SkUserConfig.h will be
written. Its name will be the same basename as
original_sk_user_config. If None, the new file will be written to the
@@ -50,7 +54,9 @@ def generate_user_config(original_sk_user_config, target_dir, ordered_set):
AssertionError: If original_sk_user_config does not exist.
"""
- assert os.path.exists(original_sk_user_config)
+ sk_user_config_exists = os.path.exists(original_sk_user_config)
+ if require_sk_user_config:
+ assert sk_user_config_exists
dst_filename = os.path.basename(original_sk_user_config)
if target_dir:
@@ -62,9 +68,10 @@ def generate_user_config(original_sk_user_config, target_dir, ordered_set):
# Copy the original exactly. This is merely for reference. Many of the
# defines written to the file below, either manually or generated from the
# gyp files, have explanations in the original SkUserConfig.h
- with open(original_sk_user_config, 'r') as original:
- for line in original:
- dst.write(line)
+ if sk_user_config_exists:
+ with open(original_sk_user_config, 'r') as original:
hal.canary 2014/04/18 20:10:04 Possibly faster (as it doesn't care about lines en
scroggo 2014/04/18 22:24:16 Done.
+ for line in original:
+ dst.write(line)
# Now add the defines specific to Android. Write a custom build guard to
# ensure they don't get defined more than once.
« 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