aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorGravatar scroggo <scroggo@google.com>2014-12-11 13:05:14 -0800
committerGravatar Commit bot <commit-bot@chromium.org>2014-12-11 13:05:14 -0800
commit60936c732b1d21940a21a95f5757ae24c666877b (patch)
treeb30d28c09ced0d2ee737cb3fafbbcef74ec5b409
parentf55c314bfa6db980941f8d0ab485beb2e08589ab (diff)
Add parameter to specify gyp dir to gyp_to_android.
NOTRY=true NOTREECHECKS=True BUG=skia:3233 Review URL: https://codereview.chromium.org/800573002
-rwxr-xr-xplatform_tools/android/bin/gyp_to_android.py27
-rw-r--r--platform_tools/android/gyp_gen/android_framework_gyp.py31
2 files changed, 31 insertions, 27 deletions
diff --git a/platform_tools/android/bin/gyp_to_android.py b/platform_tools/android/bin/gyp_to_android.py
index a42471b2e0..34c81e1f5e 100755
--- a/platform_tools/android/bin/gyp_to_android.py
+++ b/platform_tools/android/bin/gyp_to_android.py
@@ -35,7 +35,8 @@ import gyp_gen.vars_dict_lib as vars_dict_lib
GYP_FOLDER = 'gyp'
-def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon):
+def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon,
+ gyp_source_dir):
"""Create a VarsDict for a particular arch type.
Each paramater is passed directly to android_framework_gyp.main().
@@ -45,18 +46,20 @@ def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon):
target_file: Target gyp file.
skia_arch_type: Target architecture.
have_neon: Whether the target should build for neon.
+ gyp_source_dir: Directory for gyp source.
Returns:
A VarsDict containing the variable definitions determined by gyp.
"""
result_file = android_framework_gyp.main(target_dir, target_file,
- skia_arch_type, have_neon)
+ skia_arch_type, have_neon,
+ gyp_source_dir)
var_dict = vars_dict_lib.VarsDict()
gypd_parser.parse_gypd(var_dict, result_file, '.')
android_framework_gyp.clean_gypd_files(target_dir)
print '.',
return var_dict
-def main(target_dir=None, require_sk_user_config=False):
+def main(target_dir=None, require_sk_user_config=False, gyp_source_dir=None):
"""Create Android.mk for the Android framework's external/skia.
Builds Android.mk using Skia's gyp files.
@@ -66,6 +69,7 @@ def main(target_dir=None, require_sk_user_config=False):
will be placed in skia's root directory.
require_sk_user_config: If True, raise an AssertionError if
SkUserConfig.h does not exist.
+ gyp_source_dir: Source directory for gyp.
"""
# Create a temporary folder to hold gyp and gypd files. Create it in SKIA_DIR
# so that it is a sibling of gyp/, so the relationships between gyp files and
@@ -95,19 +99,22 @@ def main(target_dir=None, require_sk_user_config=False):
# The default uses a non-existant archtype, to find all the general
# variable definitions.
default_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'other',
- False)
- arm_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm', False)
+ False, gyp_source_dir)
+ arm_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm', False,
+ gyp_source_dir)
arm_neon_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm',
- True)
- x86_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86', False)
+ True, gyp_source_dir)
+ x86_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'x86', False,
+ gyp_source_dir)
- mips_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips', False)
+ mips_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips', False,
+ gyp_source_dir)
mips64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'mips64',
- False)
+ False, gyp_source_dir)
arm64_var_dict = generate_var_dict(tmp_folder, main_gyp_file, 'arm64',
- False)
+ False, gyp_source_dir)
# Compute the intersection of all targets. All the files in the intersection
# should be part of the makefile always. Each dict will now contain trimmed
diff --git a/platform_tools/android/gyp_gen/android_framework_gyp.py b/platform_tools/android/gyp_gen/android_framework_gyp.py
index b36bb25970..31417fe567 100644
--- a/platform_tools/android/gyp_gen/android_framework_gyp.py
+++ b/platform_tools/android/gyp_gen/android_framework_gyp.py
@@ -22,23 +22,8 @@ SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
DIR_CONTENTS = os.listdir(SKIA_DIR)
assert 'gyp' in DIR_CONTENTS
-# Directory within which we can find the gyp source.
-gyp_source_dir = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp')
-if not os.path.exists(gyp_source_dir):
- # In an Android tree, there is no third_party/externals/gyp, which would
- # require running gclient sync. Use chromium's instead.
- gyp_source_dir = os.path.join(SKIA_DIR, os.pardir, 'chromium_org', 'tools',
- 'gyp')
-
-assert os.path.exists(gyp_source_dir)
-
-# Ensure we import our current gyp source's module, not any version
-# pre-installed in your PYTHONPATH.
-sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib'))
-
-import gyp
-
-def main(target_dir, target_file, skia_arch_type, have_neon):
+def main(target_dir, target_file, skia_arch_type, have_neon,
+ gyp_source_dir=None):
"""Create gypd files based on target_file.
Args:
@@ -48,10 +33,22 @@ def main(target_dir, target_file, skia_arch_type, have_neon):
skia_arch_type: Target architecture to pass to gyp.
have_neon: Whether to generate files including neon optimizations.
Only meaningful if skia_arch_type is 'arm'.
+ gyp_source_dir: Directory of the gyp source code. The default is in
+ third_party/externals/gyp.
Returns:
path: Path to root gypd file created by running gyp.
"""
+ # Ensure we import our current gyp source's module, not any version
+ # pre-installed in your PYTHONPATH.
+ if not gyp_source_dir:
+ gyp_source_dir = os.path.join(SKIA_DIR, 'third_party', 'externals', 'gyp')
+ assert os.path.exists(gyp_source_dir)
+
+ sys.path.insert(0, os.path.join(gyp_source_dir, 'pylib'))
+
+ import gyp
+
# Set GYP_DEFINES for building for the android framework.
gyp_defines = ('skia_android_framework=1 OS=android skia_arch_type=%s '
% skia_arch_type)