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

Unified Diff: build/android/play_services/preprocess.py

Issue 2096763007: Roll internal Google Play Services (Chromium part) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 6 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 | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build/android/play_services/preprocess.py
diff --git a/build/android/play_services/preprocess.py b/build/android/play_services/preprocess.py
index 99c000e223115b60451db16d033d8148d70b4e9e..ef7d97c7cbd041de5769e98413678d2ff1da3766 100755
--- a/build/android/play_services/preprocess.py
+++ b/build/android/play_services/preprocess.py
@@ -67,9 +67,6 @@ from play_services import utils
from pylib.utils import argparse_utils
-M2_PKG_PATH = os.path.join('com', 'google', 'android', 'gms')
-
-
def main():
parser = argparse.ArgumentParser(description=(
"Prepares the Google Play services split client libraries before usage "
@@ -168,11 +165,16 @@ def _MakeWritable(dir_path):
os.chmod(os.path.join(root, path), st.st_mode | stat.S_IWUSR)
+# E.g. turn "base_1p" into "base"
+def _RemovePartySuffix(client):
+ return client[:-3] if client[-3:] == '_1p' else client
+
+
def _ImportFromAars(config, tmp_paths, repo):
for client in config.clients:
- aar_name = '%s-%s.aar' % (client, config.sdk_version)
- aar_path = os.path.join(repo, M2_PKG_PATH, client,
- config.sdk_version, aar_name)
+ client_name = _RemovePartySuffix(client)
+ aar_name = 'client_' + client + '.aar'
+ aar_path = os.path.join(repo, client_name, aar_name)
aar_out_path = os.path.join(tmp_paths['imported_clients'], client)
_ExtractAll(aar_path, aar_out_path)
@@ -203,18 +205,34 @@ def _ProcessResources(config, tmp_paths, repo):
LOCALIZED_VALUES_BASE_NAME = 'values-'
locale_whitelist = set(config.locale_whitelist)
- glob_pattern = os.path.join(tmp_paths['imported_clients'], '*', 'res', '*')
- for res_dir in glob.glob(glob_pattern):
- dir_name = os.path.basename(res_dir)
+ # The directory structure here is:
+ # <imported_clients temp dir>/<client name>_1p/res/<res type>/<res file>.xml
+ for client_dir in os.listdir(tmp_paths['imported_clients']):
+ client_prefix = _RemovePartySuffix(client_dir) + '_'
- if dir_name.startswith('drawable'):
- shutil.rmtree(res_dir)
+ res_path = os.path.join(tmp_paths['imported_clients'], client_dir, 'res')
+ if not os.path.isdir(res_path):
continue
-
- if dir_name.startswith(LOCALIZED_VALUES_BASE_NAME):
- dir_locale = dir_name[len(LOCALIZED_VALUES_BASE_NAME):]
- if dir_locale not in locale_whitelist:
- shutil.rmtree(res_dir)
+ for res_type in os.listdir(res_path):
+ res_type_path = os.path.join(res_path, res_type)
+
+ if res_type.startswith('drawable'):
+ shutil.rmtree(res_type_path)
+ continue
+
+ if res_type.startswith(LOCALIZED_VALUES_BASE_NAME):
+ dir_locale = res_type[len(LOCALIZED_VALUES_BASE_NAME):]
+ if dir_locale not in locale_whitelist:
+ shutil.rmtree(res_type_path)
+ continue
+
+ if res_type.startswith('values'):
+ # Beginning with v3, resource file names are not necessarily unique, and
+ # would overwrite each other when merged at build time. Prefix each
+ # "values" resource file with its client name.
+ for res_file in os.listdir(res_type_path):
+ os.rename(os.path.join(res_type_path, res_file),
+ os.path.join(res_type_path, client_prefix + res_file))
# Reimport files from the whitelist.
for res_path in config.resource_whitelist:
« no previous file with comments | « no previous file | build/config/android/internal_rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698