Skip to content

Commit

Permalink
roll_aosp: move the non conformant cflags to a cc_defaults
Browse files Browse the repository at this point in the history
... so that the downstream can customize it easier.

Test: generate the Android.bp and build on aosp/main branch with the cf product
Bug: b/366518715
Change-Id: Ie4f028bcfb45b650a98b21b46e645b3aabf63c20
Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/5862029
Auto-Submit: Kaiyi Li <[email protected]>
Reviewed-by: Roman Lavrov <[email protected]>
Commit-Queue: Kaiyi Li <[email protected]>
Commit-Queue: Roman Lavrov <[email protected]>
  • Loading branch information
06393993 authored and romanl-g committed Sep 13, 2024
1 parent 27738fe commit 42c85cc
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions scripts/generate_android_bp.py
Original file line number Diff line number Diff line change
Expand Up @@ -712,6 +712,28 @@ def get_blueprint_targets_from_build_info(build_info: BuildInfo) -> List[Tuple[s
return generated_targets


def handle_angle_non_conformant_extensions_and_versions(
generated_targets: List[Tuple[str, dict]],
blueprint_targets: List[dict],
):
"""Replace the non conformant cflags with a separate cc_defaults.
The downstream can custom the cflags easier.
"""
non_conform_cflag = '-DANGLE_EXPOSE_NON_CONFORMANT_EXTENSIONS_AND_VERSIONS'
non_conform_defaults = 'angle_non_conformant_extensions_and_versions_cflags'

blueprint_targets.append(('cc_defaults', {
'name': non_conform_defaults,
'cflags': [non_conform_cflag],
}))

for _, bp in generated_targets:
if 'cflags' in bp and non_conform_cflag in bp['cflags']:
bp['cflags'] = list(set(bp['cflags']) - {non_conform_cflag})
bp['defaults'].append(non_conform_defaults)


def main():
parser = argparse.ArgumentParser(
description='Generate Android blueprints from gn descriptions.')
Expand Down Expand Up @@ -758,6 +780,10 @@ def main():

generated_targets = get_blueprint_targets_from_build_info(build_info)

# Will modify generated_targets and blueprint_targets in-place to handle the
# angle_expose_non_conformant_extensions_and_versions gn argument.
handle_angle_non_conformant_extensions_and_versions(generated_targets, blueprint_targets)

# Move cflags that are repeated in each target to cc_defaults
all_cflags = [set(bp['cflags']) for _, bp in generated_targets if 'cflags' in bp]
all_target_cflags = set.intersection(*all_cflags)
Expand Down

0 comments on commit 42c85cc

Please sign in to comment.