aboutsummaryrefslogtreecommitdiffhomepage
path: root/gn/gn_to_bp.py
diff options
context:
space:
mode:
authorGravatar Leon Scroggins III <scroggo@google.com>2017-07-11 15:53:41 -0400
committerGravatar Leon Scroggins <scroggo@google.com>2017-07-11 20:43:35 +0000
commit51b2f1b64c4d250e15b33ea390b4a95c50afc5dd (patch)
tree47aba850516f0696761602d24c7435674d36be0e /gn/gn_to_bp.py
parent7e49d534d71d3e7b053fe6f23dfe018ddbceb45b (diff)
Stop adding Android-specific defines to SkUserConfig
Remove #defines that lived in gn_to_bp.py and android_framework_defines.gni. These have been moved into a new file in Android, SkUserConfigManual.h, in https://googleplex-android-review.git.corp.google.com/#/c/2519600/ Update gn_to_bp.py to include SkUserConfigManual.h, so it will still result in using the same #defines. Lately, we've found it difficult to guard changes behind a flag. e.g. a change to drawing causes a CTS failure in Android, so we have to do the following: - put the change behind a flag, and add it to gn_to_bp.py or android_framework_defines.gni - generate new images on Android (by running CTS with external/skia modified to not define the flag) - create a CL in CTS that uses the new images - land a CL in Skia that stops defining the flag - when the Skia change lands, wait for the auto-roller to create a CL that includes the change, stop the auto-roller, add the topic to the CTS CL so the two can land at the same time - land both Android changes (with TreeHugger) - restart the Android auto-roller With SkUserConfigManual.h (which lives in Android), the process will be similar to Chromium: - land a CL in Android's external/skia that defines a flag e.g. SK_SUPPORT_LEGACY_FEATURE. Land without TreeHugger because it isn't used in Skia and does not do anything - land a change in Skia that changes behavior unless SK_SUPPORT_LEGACY_FEATURE is defined. This will safely go through the Android roll and not change any behavior for Android - create two Android CLs - one in CTS to use the new images, and one in external/skia to delete SK_SUPPORT_LEGACY_FEATURE. Set them to the same topic and land them with TreeHugger In the new process, there is no need to mess with the Android roll. A downside to the new process is that we cannot test the android framework defines without checking in to Android. But given how much we've progressed in automating Android testing, this is fine. Bug: b/63429612 Change-Id: Idfbaef2f4cae641a75fb6e7bf70428733a441336 Reviewed-on: https://skia-review.googlesource.com/22072 Commit-Queue: Leon Scroggins <scroggo@google.com> Reviewed-by: Eric Boren <borenet@google.com>
Diffstat (limited to 'gn/gn_to_bp.py')
-rw-r--r--gn/gn_to_bp.py20
1 files changed, 3 insertions, 17 deletions
diff --git a/gn/gn_to_bp.py b/gn/gn_to_bp.py
index c8fc0a9293..3fc30a03b5 100644
--- a/gn/gn_to_bp.py
+++ b/gn/gn_to_bp.py
@@ -243,7 +243,6 @@ dm_srcs = {s for s in dm_srcs if not s.endswith('.h')}
nanobench_srcs = {s for s in nanobench_srcs if not s.endswith('.h')}
# Most defines go into SkUserConfig.h, where they're seen by Skia and its users.
-# Start with the defines :skia uses, minus a couple. We'll add more in a bit.
defines = [str(d) for d in js['targets']['//:skia']['defines']]
defines.remove('NDEBUG') # Let the Android build control this.
defines.remove('SKIA_IMPLEMENTATION=1') # Only libskia should have this define.
@@ -253,7 +252,6 @@ defines.remove('SKIA_IMPLEMENTATION=1') # Only libskia should have this define.
# This .gni file we want to read is close enough to Python syntax
# that we can use execfile() if we supply definitions for GN builtins.
-# While we're at it, grab defines specific to Android Framework the same way.
def get_path_info(path, kind):
assert kind == "abspath"
@@ -264,20 +262,6 @@ builtins = { 'get_path_info': get_path_info }
defs = {}
here = os.path.dirname(__file__)
execfile(os.path.join(here, 'opts.gni'), builtins, defs)
-execfile(os.path.join(here, 'android_framework_defines.gni'), builtins, defs)
-
-# This should finish off the defines.
-defines += defs['android_framework_defines']
-defines.extend([
- 'GR_GL_CUSTOM_SETUP_HEADER "gl/GrGLConfig_chrome.h"',
- 'GR_TEST_UTILS 1',
- 'SKIA_DLL',
- 'SK_BUILD_FOR_ANDROID_FRAMEWORK',
- 'SK_DEFAULT_FONT_CACHE_LIMIT (768 * 1024)',
- 'SK_DEFAULT_GLOBAL_DISCARDABLE_MEMORY_POOL_SIZE (512 * 1024)',
- 'SK_USE_FREETYPE_EMBOLDEN',
-])
-# TODO: move these all to android_framework_defines.gni?
# Turn paths from opts.gni into paths relative to external/skia.
def scrub(lst):
@@ -326,9 +310,11 @@ with open('Android.bp', 'w') as f:
#... and all the #defines we want to put in SkUserConfig.h.
with open('include/config/SkUserConfig.h', 'w') as f:
- print >>f, '// This file is autogenerated by gn_to_bp.py.'
+ print >>f, '// DO NOT MODIFY! This file is autogenerated by gn_to_bp.py.'
+ print >>f, '// If need to change a define, modify SkUserConfigManual.h'
print >>f, '#ifndef SkUserConfig_DEFINED'
print >>f, '#define SkUserConfig_DEFINED'
+ print >>f, '#include "SkUserConfigManual.h"'
for define in sorted(defines):
print >>f, ' #define', define.replace('=', ' ')
print >>f, '#endif//SkUserConfig_DEFINED'