[gmscore] Allow specifying resource files to whitelist for preprocess
BUG=599954 Review URL: https://codereview.chromium.org/1849403003 Cr-Original-Commit-Position: refs/heads/master@{#386970} Cr-Mirrored-From: https://chromium.googlesource.com/chromium/src Cr-Mirrored-Commit: 577d5e394ee173323c0df50d451e379e76e37b6a
This commit is contained in:
Родитель
caad3ed01a
Коммит
e388e917d3
|
@ -125,7 +125,7 @@ def ProcessGooglePlayServices(repo, out_dir, config_path, is_extracted_repo):
|
|||
_ImportFromAars(config, tmp_paths, repo)
|
||||
|
||||
_GenerateCombinedJar(tmp_paths)
|
||||
_ProcessResources(config, tmp_paths)
|
||||
_ProcessResources(config, tmp_paths, repo)
|
||||
_BuildOutput(config, tmp_paths, out_dir)
|
||||
finally:
|
||||
shutil.rmtree(tmp_root)
|
||||
|
@ -199,7 +199,7 @@ def _GenerateCombinedJar(tmp_paths):
|
|||
cmd_helper.Call(['jar', '-cf', out_file_name, '-C', working_dir, '.'])
|
||||
|
||||
|
||||
def _ProcessResources(config, tmp_paths):
|
||||
def _ProcessResources(config, tmp_paths, repo):
|
||||
LOCALIZED_VALUES_BASE_NAME = 'values-'
|
||||
locale_whitelist = set(config.locale_whitelist)
|
||||
|
||||
|
@ -216,6 +216,17 @@ def _ProcessResources(config, tmp_paths):
|
|||
if dir_locale not in locale_whitelist:
|
||||
shutil.rmtree(res_dir)
|
||||
|
||||
# Reimport files from the whitelist.
|
||||
for res_path in config.resource_whitelist:
|
||||
for whitelisted_file in glob.glob(os.path.join(repo, res_path)):
|
||||
resolved_file = os.path.relpath(whitelisted_file, repo)
|
||||
rebased_res = os.path.join(tmp_paths['imported_clients'], resolved_file)
|
||||
|
||||
if not os.path.exists(os.path.dirname(rebased_res)):
|
||||
os.makedirs(os.path.dirname(rebased_res))
|
||||
|
||||
shutil.copy(os.path.join(repo, whitelisted_file), rebased_res)
|
||||
|
||||
|
||||
def _BuildOutput(config, tmp_paths, out_dir):
|
||||
generation_date = datetime.utcnow()
|
||||
|
|
|
@ -65,6 +65,11 @@ class ConfigParser(object):
|
|||
`//chrome/app/generated_resources.grd`
|
||||
Example: ["am", "ar", "bg", "ca", "cs"]
|
||||
|
||||
- resource_whitelist
|
||||
List of strings. List of resource files to explicitely keep in the final
|
||||
output. Use it to keep drawables for example, as we currently remove them
|
||||
all.
|
||||
Example: ["play-services-base/res/drawables/foobar.xml"]
|
||||
'''
|
||||
_VERSION_NUMBER_KEY = 'version_number'
|
||||
|
||||
|
@ -95,6 +100,10 @@ class ConfigParser(object):
|
|||
def locale_whitelist(self):
|
||||
return self._data.get('locale_whitelist') or []
|
||||
|
||||
@property
|
||||
def resource_whitelist(self):
|
||||
return self._data.get('resource_whitelist') or []
|
||||
|
||||
def UpdateVersionNumber(self, new_version_number):
|
||||
'''Updates the version number and saves it in the configuration file. '''
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче