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

Unified Diff: platform_tools/android/bin/gyp_to_android.py

Issue 235883015: Generate tests/Android.mk from gyp (Closed) Base URL: https://skia.googlesource.com/skia.git@generate
Patch Set: Remove Android.mk/SkUserConfig.h 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
Index: platform_tools/android/bin/gyp_to_android.py
diff --git a/platform_tools/android/bin/gyp_to_android.py b/platform_tools/android/bin/gyp_to_android.py
index f7199b8ddb68e5b9778d5f4057ce2d9766f26e29..f43d597a15a1bd048826dba260f5f76f876545c4 100755
--- a/platform_tools/android/bin/gyp_to_android.py
+++ b/platform_tools/android/bin/gyp_to_android.py
@@ -10,7 +10,6 @@ Script for generating the Android framework's version of Skia from gyp
files.
"""
-import android_framework_gyp
import os
import shutil
import sys
@@ -25,53 +24,48 @@ SKIA_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, os.pardir, os.pardir,
GYP_GEN_DIR = os.path.join(SKIA_DIR, 'platform_tools', 'android', 'gyp_gen')
sys.path.append(GYP_GEN_DIR)
+import android_framework_gyp
import gypd_parser
import generate_user_config
import makefile_writer
+import tool_makefile_writer
import vars_dict_lib
# Folder containing all gyp files and generated gypd files.
GYP_FOLDER = 'gyp'
-# TODO(scroggo): Update the docstrings to match the style guide:
-# http://google-styleguide.googlecode.com/svn/trunk/pyguide.html#Comments
-def clean_gypd_files(folder):
- """
- Remove the gypd files generated by android_framework_gyp.main().
- @param folder Folder in which to delete all files ending with 'gypd'.
- """
- assert os.path.isdir(folder)
- files = os.listdir(folder)
- for f in files:
- if f.endswith('gypd'):
- os.remove(os.path.join(folder, f))
def generate_var_dict(target_dir, target_file, skia_arch_type, have_neon):
- """
- Create a VarsDict for a particular arch type. Each paramater is passed
- directly to android_framework_gyp.main().
- @param target_dir Directory containing gyp files.
- @param target_file Target gyp file.
- @param skia_arch_type Target architecture.
- @param have_neon Whether the target should build for neon.
- @return a VarsDict containing the variable definitions determined by gyp.
+ """Create a VarsDict for a particular arch type.
+
+ Each paramater is passed directly to android_framework_gyp.main().
+
+ Args:
+ target_dir: Directory containing gyp files.
+ target_file: Target gyp file.
+ skia_arch_type: Target architecture.
+ have_neon: Whether the target should build for neon.
+ 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)
var_dict = vars_dict_lib.VarsDict()
- gypd_parser.parse_gypd(var_dict, result_file)
- clean_gypd_files(target_dir)
+ 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):
- """
- Read gyp files and create Android.mk for the Android framework's
- external/skia.
- @param target_dir Directory in which to place 'Android.mk'. If None, the file
- will be placed in skia's root directory.
- @param require_sk_user_config If True, raise an AssertionError if
- SkUserConfig.h does not exist.
+ """Create Android.mk for the Android framework's external/skia.
+
+ Builds Android.mk using Skia's gyp files.
+
+ Args:
+ target_dir: Directory in which to place 'Android.mk'. If None, the file
+ will be placed in skia's root directory.
+ require_sk_user_config: If True, raise an AssertionError if
+ SkUserConfig.h does not exist.
"""
# 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
@@ -119,6 +113,8 @@ def main(target_dir=None, require_sk_user_config=False):
x86_var_dict, mips_var_dict, arm64_var_dict]
common = vars_dict_lib.intersect(var_dict_list)
+ common.LOCAL_MODULE.add('libskia')
+
# Create SkUserConfig
user_config = os.path.join(SKIA_DIR, 'include', 'config', 'SkUserConfig.h')
if target_dir:
@@ -131,8 +127,26 @@ def main(target_dir=None, require_sk_user_config=False):
require_sk_user_config=require_sk_user_config, target_dir=dst_dir,
ordered_set=common.DEFINES)
- # Now that the defines have been written to SkUserConfig, they are not
- # needed in Android.mk.
+ tool_makefile_writer.generate_tool(gyp_dir=tmp_folder,
+ target_file='tests.gyp',
+ skia_trunk=target_dir,
+ dest_dir='tests',
+ skia_lib_var_dict=common,
+ local_module_name='skia_test',
+ local_module_tags=['eng', 'tests'])
+
+ # TODO (scroggo): Generate bench/Android.mk. See skbug.com/2448
+ #tool_makefile_writer.generate_tool(gyp_dir=tmp_folder,
+ # target_file='bench.gyp',
+ # skia_trunk=target_dir,
+ # dest_dir='bench',
+ # skia_lib_var_dict=common,
+ # local_module_name='skia_bench',
+ # local_module_tags=['tests'])
+
+ # Now that the defines have been written to SkUserConfig and they've been
+ # used to skip adding them to the tools makefiles, they are not needed in
+ # Android.mk. Reset DEFINES.
common.DEFINES.reset()
# Further trim arm_neon_var_dict with arm_var_dict. After this call,
« no previous file with comments | « platform_tools/android/bin/android_framework_gyp.py ('k') | platform_tools/android/gyp_gen/android_framework_gyp.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698