Loading ci/build_test_suites +1 −0 Original line number Diff line number Diff line #!prebuilts/build-tools/linux-x86/bin/py3-cmd # Copyright 2024, The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); Loading ci/build_test_suites.py +28 −13 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ def build_everything(args: argparse.Namespace): build_command = base_build_command(args) build_command.append('general-tests') run_command(build_command) run_command(build_command, print_output=True) def build_affected_modules(args: argparse.Namespace): Loading @@ -81,9 +81,9 @@ def build_affected_modules(args: argparse.Namespace): build_command = base_build_command(args) build_command.extend(modules_to_build) run_command(build_command) run_command(build_command, print_output=True) zip_build_outputs(modules_to_build, args.dist_dir) zip_build_outputs(modules_to_build, args.dist_dir, args.target_release) def base_build_command(args: argparse.Namespace) -> list: Loading @@ -102,12 +102,17 @@ def base_build_command(args: argparse.Namespace) -> list: return build_command def run_command(args: list[str]) -> str: def run_command( args: list[str], env: Dict[Text, Text] = os.environ, print_output: bool = False, ) -> str: result = subprocess.run( args=args, text=True, capture_output=True, check=False, env=env, ) # If the process failed, print its stdout and propagate the exception. if not result.returncode == 0: Loading @@ -116,6 +121,10 @@ def run_command(args: list[str]) -> str: print('stderr: ' + result.stderr) result.check_returncode() if print_output: print(result.stdout) return result.stdout Loading Loading @@ -201,17 +210,19 @@ def matches_file_patterns( return False def zip_build_outputs(modules_to_build: Set[Text], dist_dir: Text): def zip_build_outputs( modules_to_build: Set[Text], dist_dir: Text, target_release: Text ): src_top = os.environ.get('TOP', os.getcwd()) # Call dumpvars to get the necessary things. # TODO(lucafarsi): Don't call soong_ui 4 times for this, --dumpvars-mode can # do it but it requires parsing. host_out_testcases = get_soong_var('HOST_OUT_TESTCASES') target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES') product_out = get_soong_var('PRODUCT_OUT') soong_host_out = get_soong_var('SOONG_HOST_OUT') host_out = get_soong_var('HOST_OUT') host_out_testcases = get_soong_var('HOST_OUT_TESTCASES', target_release) target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES', target_release) product_out = get_soong_var('PRODUCT_OUT', target_release) soong_host_out = get_soong_var('SOONG_HOST_OUT', target_release) host_out = get_soong_var('HOST_OUT', target_release) # Call the class to package the outputs. # TODO(lucafarsi): Move this code into a replaceable class. Loading Loading @@ -267,12 +278,16 @@ def zip_build_outputs(modules_to_build: Set[Text], dist_dir: Text): zip_command.append('-o') zip_command.append(os.path.join(dist_dir, 'general-tests.zip')) run_command(zip_command) run_command(zip_command, print_output=True) def get_soong_var(var: str, target_release: str) -> str: new_env = os.environ.copy() new_env['TARGET_RELEASE'] = target_release def get_soong_var(var: str) -> str: value = run_command( ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var] ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var], env=new_env, ).strip() if not value: raise RuntimeError('Necessary soong variable ' + var + ' not found.') Loading Loading
ci/build_test_suites +1 −0 Original line number Diff line number Diff line #!prebuilts/build-tools/linux-x86/bin/py3-cmd # Copyright 2024, The Android Open Source Project # # Licensed under the Apache License, Version 2.0 (the "License"); Loading
ci/build_test_suites.py +28 −13 Original line number Diff line number Diff line Loading @@ -69,7 +69,7 @@ def build_everything(args: argparse.Namespace): build_command = base_build_command(args) build_command.append('general-tests') run_command(build_command) run_command(build_command, print_output=True) def build_affected_modules(args: argparse.Namespace): Loading @@ -81,9 +81,9 @@ def build_affected_modules(args: argparse.Namespace): build_command = base_build_command(args) build_command.extend(modules_to_build) run_command(build_command) run_command(build_command, print_output=True) zip_build_outputs(modules_to_build, args.dist_dir) zip_build_outputs(modules_to_build, args.dist_dir, args.target_release) def base_build_command(args: argparse.Namespace) -> list: Loading @@ -102,12 +102,17 @@ def base_build_command(args: argparse.Namespace) -> list: return build_command def run_command(args: list[str]) -> str: def run_command( args: list[str], env: Dict[Text, Text] = os.environ, print_output: bool = False, ) -> str: result = subprocess.run( args=args, text=True, capture_output=True, check=False, env=env, ) # If the process failed, print its stdout and propagate the exception. if not result.returncode == 0: Loading @@ -116,6 +121,10 @@ def run_command(args: list[str]) -> str: print('stderr: ' + result.stderr) result.check_returncode() if print_output: print(result.stdout) return result.stdout Loading Loading @@ -201,17 +210,19 @@ def matches_file_patterns( return False def zip_build_outputs(modules_to_build: Set[Text], dist_dir: Text): def zip_build_outputs( modules_to_build: Set[Text], dist_dir: Text, target_release: Text ): src_top = os.environ.get('TOP', os.getcwd()) # Call dumpvars to get the necessary things. # TODO(lucafarsi): Don't call soong_ui 4 times for this, --dumpvars-mode can # do it but it requires parsing. host_out_testcases = get_soong_var('HOST_OUT_TESTCASES') target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES') product_out = get_soong_var('PRODUCT_OUT') soong_host_out = get_soong_var('SOONG_HOST_OUT') host_out = get_soong_var('HOST_OUT') host_out_testcases = get_soong_var('HOST_OUT_TESTCASES', target_release) target_out_testcases = get_soong_var('TARGET_OUT_TESTCASES', target_release) product_out = get_soong_var('PRODUCT_OUT', target_release) soong_host_out = get_soong_var('SOONG_HOST_OUT', target_release) host_out = get_soong_var('HOST_OUT', target_release) # Call the class to package the outputs. # TODO(lucafarsi): Move this code into a replaceable class. Loading Loading @@ -267,12 +278,16 @@ def zip_build_outputs(modules_to_build: Set[Text], dist_dir: Text): zip_command.append('-o') zip_command.append(os.path.join(dist_dir, 'general-tests.zip')) run_command(zip_command) run_command(zip_command, print_output=True) def get_soong_var(var: str, target_release: str) -> str: new_env = os.environ.copy() new_env['TARGET_RELEASE'] = target_release def get_soong_var(var: str) -> str: value = run_command( ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var] ['./build/soong/soong_ui.bash', '--dumpvar-mode', '--abs', var], env=new_env, ).strip() if not value: raise RuntimeError('Necessary soong variable ' + var + ' not found.') Loading