Skip to content

Revert "[Build] Make cmark build a build-script product" #37604

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

Merged
merged 1 commit into from
May 23, 2021
Merged
Show file tree
Hide file tree
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
5 changes: 2 additions & 3 deletions utils/build-script
Original file line number Diff line number Diff line change
Expand Up @@ -886,12 +886,11 @@ class BuildScriptInvocation(object):
if self.args.build_early_swift_driver:
before_impl_product_classes.append(products.EarlySwiftDriver)

if self.args.build_cmark:
before_impl_product_classes.append(products.CMark)

# FIXME: This is a weird division (returning a list of class objects),
# but it matches the existing structure of the `build-script-impl`.
impl_product_classes = []
if self.args.build_cmark:
impl_product_classes.append(products.CMark)

# If --skip-build-llvm is passed in, LLVM cannot be completely disabled, as
# Swift still needs a few LLVM targets like tblgen to be built for it to be
Expand Down
3 changes: 0 additions & 3 deletions utils/build_swift/build_swift/driver_arguments.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,9 +288,6 @@ def create_argument_parser():
help='instead of building, write JSON to stdout containing '
'various values used to build in this configuration')

option(['--reconfigure'], store_true,
help="Reconfigure all projects as we build")

option('--legacy-impl', store_true('legacy_impl'),
help='use legacy implementation')

Expand Down
2 changes: 0 additions & 2 deletions utils/build_swift/tests/expected_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -197,7 +197,6 @@
'native_llvm_tools_path': None,
'native_swift_tools_path': None,
'dump_config': False,
'reconfigure': False,
'relocate_xdg_cache_home_under_build_subdir': False,
'show_sdks': False,
'skip_build': False,
Expand Down Expand Up @@ -507,7 +506,6 @@ class BuildScriptImplOption(_BaseOption):

SetTrueOption('--legacy-impl', dest='legacy_impl'),
SetTrueOption('--infer', dest='infer_dependencies'),
SetTrueOption('--reconfigure'),

EnableOption('--android'),
EnableOption('--build-external-benchmarks'),
Expand Down

This file was deleted.

68 changes: 4 additions & 64 deletions utils/swift_build_support/swift_build_support/products/cmark.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,87 +10,27 @@
#
# ----------------------------------------------------------------------------

from . import cmake_product
from . import product


class CMark(cmake_product.CMakeProduct):
class CMark(product.Product):
@classmethod
def is_build_script_impl_product(cls):
"""is_build_script_impl_product -> bool

Whether this product is produced by build-script-impl.
"""
return False
return True

@classmethod
def is_before_build_script_impl_product(cls):
"""is_before_build_script_impl_product -> bool

Whether this product is build before any build-script-impl products.
"""
return True
return False

# This is the root of the build-graph, so it doesn't have any dependencies.
@classmethod
def get_dependencies(cls):
return []

def should_build(self, host_target):
"""should_build() -> Bool

Whether or not this product should be built with the given arguments.
"""
return self.args.build_cmark

def build(self, host_target):
"""build() -> void

Perform the build, for a non-build-script-impl product.
"""
self.cmake_options.define('CMAKE_BUILD_TYPE:STRING',
self.args.cmark_build_variant)

self.build_with_cmake(["all"], self.args.cmark_build_variant, [])

def should_test(self, host_target):
"""should_test() -> Bool

Whether or not this product should be tested with the given arguments.
"""
if self.args.cross_compile_hosts and \
host_target in self.args.cross_compile_hosts:
return False

return self.args.test

def test(self, host_target):
"""
Perform the test phase for the product.

This phase might build and execute the product tests.
"""
executable_target = 'api_test'
results_targets = ['test']
if self.args.cmake_generator == 'Xcode':
# Xcode generator uses "RUN_TESTS" instead of "test".
results_targets = ['RUN_TESTS']

self.test_with_cmake(executable_target, results_targets,
self.args.cmark_build_variant, [])

def should_install(self, host_target):
"""should_install() -> Bool

Whether or not this product should be installed with the given
arguments.
"""
return self.args.install_all

def install(self, host_target):
"""
Perform the install phase for the product.

This phase might copy the artifacts from the previous phases into a
destination directory.
"""
self.install_with_cmake(["install"], self.host_install_destdir(host_target))
Original file line number Diff line number Diff line change
Expand Up @@ -190,31 +190,6 @@ def install_toolchain_path(self, host_target):
return targets.toolchain_path(install_destdir,
self.args.install_prefix)

def should_include_host_in_lipo(self, host_target):
if self.args.cross_compile_hosts:
if host_target.startswith("macosx") or \
host_target.startswith("iphone") or \
host_target.startswith("appletv") or \
host_target.startswith("watch"):
return True
return False

def host_install_destdir(self, host_target):
if self.args.cross_compile_hosts:
# If cross compiling tools, install into a host-specific subdirectory.
if self.should_include_host_in_lipo(host_target):
# If this is one of the hosts we should lipo,
# install in to a temporary subdirectory.
return '%s/intermediate-install/%s' % \
(self.args.install_destdir, host_target)
elif host_target == "merged-hosts":
# This assumes that all hosts are merged to the lipo.
return self.args.install_destdir
else:
return '%s/%s' % (self.args.install_destdir, host_target)
else:
return self.args.install_destdir


class ProductBuilder(object):
"""
Expand Down
113 changes: 0 additions & 113 deletions utils/swift_build_support/tests/products/test_cmark.py

This file was deleted.

Loading