Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[build-script] Change build order to test after building all products #35893

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
58 changes: 36 additions & 22 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -979,8 +979,12 @@ class BuildScriptInvocation(object):
(impl_product_classes, product_classes) = self.compute_product_classes()

# Execute each "pass".

# Build...
# We are forced to build and install build-script-impl products first,
# since some of the later products rely on having a toolchain available
# in the build directory.
# FIXME: This should end up being a normal consequence of dependency
# order instead of having to be separated. This probably relies on
# --infer being on by default?
for host_target in all_hosts:
# FIXME: We should only compute these once.
try:
Expand All @@ -997,24 +1001,9 @@ class BuildScriptInvocation(object):
print("Running Swift benchmarks for: {}".format(
" ".join(config.swift_benchmark_run_targets)))

for product_class in impl_product_classes:
self._execute_build_action(host_target, product_class)

# Test...
for host_target in all_hosts:
for product_class in impl_product_classes:
self._execute_test_action(host_target, product_class)

# Install...
for host_target in all_hosts:
for product_class in impl_product_classes:
self._execute_install_action(host_target, product_class)

# Core Lipo...
self._execute_merged_host_lipo_core_action()

# Non-build-script-impl products...
# Note: currently only supports building for the host.
products = []
for host_target in [self.args.host_target]:
for product_class in product_classes:
if product_class.is_build_script_impl_product():
Expand All @@ -1032,21 +1021,46 @@ class BuildScriptInvocation(object):
toolchain=self.toolchain,
source_dir=self.workspace.source_dir(product_source),
build_dir=build_dir)
products.append(product)

# build-script-impl Build + Install...
for host_target in all_hosts:
for product_class in impl_product_classes:
self._execute_build_action(host_target, product_class)
self._execute_install_action(host_target, product_class)

# Core Lipo...
self._execute_merged_host_lipo_core_action()

# non-impl Build + Install...
for host_target in [self.args.host_target]:
for product in products:
product_name = product.product_name()
if product.should_clean(host_target):
print("--- Cleaning %s ---" % product_name)
product.clean(host_target)
if product.should_build(host_target):
print("--- Building %s ---" % product_name)
product.build(host_target)
if product.should_test(host_target):
print("--- Running tests for %s ---" % product_name)
product.test(host_target)
print("--- Finished tests for %s ---" % product_name)
if product.should_install(host_target) or \
(self.install_all and product.should_build(host_target)):
print("--- Installing %s ---" % product_name)
product.install(host_target)

# build-script-impl Test...
for host_target in all_hosts:
for product_class in impl_product_classes:
self._execute_test_action(host_target, product_class)

# non-impl Test...
for host_target in [self.args.host_target]:
for product in products:
product_name = product.product_name()
if product.should_test(host_target):
print("--- Running tests for %s ---" % product_name)
product.test(host_target)
print("--- Finished tests for %s ---" % product_name)

# Extract symbols...
for host_target in all_hosts:
self._execute_extract_symbols_action(host_target)
Expand Down