Deal with inconsistent module names
Conscrypt and ART have some history of using dist_stem names in prebuilts/sdk that are different from the module names of their java_sdk_library, leading to same naming inconsistensies. Update the finalize script to reconcile these inconsistensies during import. Note that the build has already been updated to throw an error when inconsistensies are discovered, so this update to the script is to make sure the next import of conscrypt/art goes smoothly. Test: finalize_sdk.py with conscrypt/art Change-Id: If82fadf73d508d4807aef11b960e0860d54874b7
This commit is contained in:
@@ -76,6 +76,21 @@ def dir_for_sdk(filename, version):
|
|||||||
return os.path.join(base, 'host-exports')
|
return os.path.join(base, 'host-exports')
|
||||||
return base
|
return base
|
||||||
|
|
||||||
|
def is_txt_ignored(txt_file):
|
||||||
|
# Conscrypt has some legacy API tracking files that we don't consider for extensions.
|
||||||
|
bad_stem_prefixes = ['conscrypt.module.intra.core.api', 'conscrypt.module.platform.api']
|
||||||
|
return any([txt_file.stem.startswith(p) for p in bad_stem_prefixes])
|
||||||
|
|
||||||
|
|
||||||
|
def maybe_tweak_compat_txt_stem(txt_file):
|
||||||
|
# For legacy reasons, art and conscrypt txt file names in the SDKs (*.module.public.api)
|
||||||
|
# do not match their expected filename in prebuilts/sdk (art, conscrypt). So rename them
|
||||||
|
# to match.
|
||||||
|
new_stem = txt_file.stem
|
||||||
|
new_stem = new_stem.replace('art.module.public.api', 'art')
|
||||||
|
new_stem = new_stem.replace('conscrypt.module.public.api', 'conscrypt')
|
||||||
|
return txt_file.with_stem(new_stem)
|
||||||
|
|
||||||
if not os.path.isdir('build/soong'):
|
if not os.path.isdir('build/soong'):
|
||||||
fail("This script must be run from the top of an Android source tree.")
|
fail("This script must be run from the top of an Android source tree.")
|
||||||
|
|
||||||
@@ -121,10 +136,13 @@ for m in module_names:
|
|||||||
# Copy api txt files to compat tracking dir
|
# Copy api txt files to compat tracking dir
|
||||||
txt_files = [Path(p) for p in glob.glob(os.path.join(target_dir, 'sdk_library/*/*.txt'))]
|
txt_files = [Path(p) for p in glob.glob(os.path.join(target_dir, 'sdk_library/*/*.txt'))]
|
||||||
for txt_file in txt_files:
|
for txt_file in txt_files:
|
||||||
|
if is_txt_ignored(txt_file):
|
||||||
|
continue
|
||||||
api_type = txt_file.parts[-2]
|
api_type = txt_file.parts[-2]
|
||||||
dest_dir = compat_dir.joinpath(api_type, 'api')
|
dest_dir = compat_dir.joinpath(api_type, 'api')
|
||||||
|
dest_file = maybe_tweak_compat_txt_stem(dest_dir.joinpath(txt_file.name))
|
||||||
os.makedirs(dest_dir, exist_ok = True)
|
os.makedirs(dest_dir, exist_ok = True)
|
||||||
shutil.copy(txt_file, dest_dir)
|
shutil.copy(txt_file, dest_file)
|
||||||
created_dirs[COMPAT_REPO].add(dest_dir.relative_to(COMPAT_REPO))
|
created_dirs[COMPAT_REPO].add(dest_dir.relative_to(COMPAT_REPO))
|
||||||
|
|
||||||
subprocess.check_output(['repo', 'start', branch_name] + list(created_dirs.keys()))
|
subprocess.check_output(['repo', 'start', branch_name] + list(created_dirs.keys()))
|
||||||
|
|||||||
Reference in New Issue
Block a user