Missed this when I originally added the
`--lit-jobs` build-script option, propagate the value
provided to `LLVM_LIT_ARGS` in addition to
`SWIFT_LIT_ARGS`.
swift_build_support: unify CMake toolchain code
Currently, a lot of products defined in `utils/swift_build_support` contain duplicated code that checks for Darwin/Linux triples and generates an appropriate CMake toolchain file. Since all of these products inherit from the `Product` class, it makes sense to reduce this code duplication by refactoring it into a single function.
build-script-impl: remove CMark cases as unused
CMark was converted from a `build-script-impl` product to `build-script` product in https://github.com/apple/swift/pull/37102. After that change, some of the remaining mentions of CMark in `build-script-impl` were unused and can be removed.
This reverts commit a36ab6e287.
The change to support cross compilation of `docc` in macOS toolchains
is breaking nightly toolchain builds – this will unblock them.
It looks like the `--test-product` option Swift-DocC's build script passes to
SwiftPM is supported when building for multiple architectures but not when
testing. PR toolchain builds don't run tests which is why this wasn't caught
before merging.
Resolves rdar://102908495
Updates the build script used in SwiftCI for building the `docc`
executable as part of Swift.org toolchains to support cross compilation.
Currently the `docc` executable included in the otherwise universal
macOS toolchain only supports x86_64. This resolves the issue.
Resolves rdar://102870094
Closes https://github.com/apple/swift-docc/issues/433
This allows the various binaries (swift-frontend, SourceKit, etc.) to
share the same code, as well as allowing plugins to link against these
shared libraries.
Use libcxx from Darwin SDKs when building LLVM and Swift (LLVM product)
Those are present since Xcode 12.5, so we don't need to copy them
anymore from the toolchain
In this scenario, clean up any existing symlink in incremental builds to
avoid masking or causing errors in the future.
Took the chance to extract this logic to a different function in an attempt to improve readability
To ease review, the PR has two commits -- the first to extract the logic as is (showing that I did not alter the existing logic) and the second one to change its behaviour for Darwin (and address a minor issue when printing about the creation of symlinks)
Addresses rdar://102387542
Those are present since Xcode 12.5, so we don't need to copy them
anymore from the toolchain
In this scenario, clean up any existing symlink in incremental builds to
avoid masking or causing errors in the future.
Addresses rdar://102387542
This is the start of the removal of the C++ implementation of libSyntax
in favor of the new Swift Parser and Swift Syntax libraries. Now that
the Swift Parser has switched the SwiftSyntaxParser library over to
being a thin wrapper around the Swift Parser, there is no longer any
reason we need to retain any libSyntax infrastructure in the swift
compiler.
As a first step, delete the infrastructure that builds
lib_InternalSwiftSyntaxParser and convert any scripts that mention
it to instead mention the static mirror libraries. The --swiftsyntax
build-script flag has been retained and will now just execute the
SwiftSyntax and Swift Parser builds with the just-built tools.
`build-script` invocations print a total duration summary at the end of the build, like this:
```
Total Duration: 4558.030000000001
```
With this change build duration summary is printed as
```
Total Duration: 487.93 seconds (8m 7s)
```
On both macOS and Linux `python` is not symlinked to `python3` by default. To avoid confusion, we should update our documentation that instructs users to run scripts with `python` to use `python3` instead.
Without this dependency, passing both `--swiftdocc` and `--install-swiftdocc` to `build-script` causes it to crash with this stack trace:
```
Traceback (most recent call last):
File "./swift/utils/build-script", line 789, in <module>
exit_code = main()
File "./swift/utils/build-script", line 784, in main
return main_normal()
File "./swift/utils/build-script", line 740, in main_normal
invocation.execute()
File "./swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 670, in execute
(self.impl_env, self.impl_args) = self.convert_to_impl_arguments()
File "./swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 147, in convert_to_impl_arguments
for product_class in sum(list(self.compute_product_pipelines()[0]), []):
File "./swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 664, in compute_product_pipelines
return builder.finalize(shouldInfer=self.args.infer_dependencies)
File "./swift/utils/swift_build_support/swift_build_support/productpipeline_list_builder.py", line 198, in finalize
result = self.infer()
File "./swift/utils/swift_build_support/swift_build_support/productpipeline_list_builder.py", line 157, in infer
build_graph.produce_scheduled_build(enabled_pipeline)[0]
File "./swift/utils/swift_build_support/swift_build_support/build_graph.py", line 150, in produce_scheduled_build
dag.set_root(entry)
File "./swift/utils/swift_build_support/swift_build_support/build_graph.py", line 95, in set_root
assert self.root is None
AssertionError
```
Apparently, the absence of this explicit dependency makes `build_graph.py` code think that `SwiftDocCRender` and `SwiftDocC` are independent root targets, which it can't handle. Making one a dependency of the other resolves the issue.
Cross-compilation of the host depends on iteration over all of the host
architectures within build-script-impl itself, so the computation of
the build directory must occur in build-script-impl. Sink it down there
to fix builds for multiple host architectures.
Replace the correct Swift -> EarlySwiftSyntax dependency with an
EarlySwiftDriver -> EarlySwiftSyntax dependency, to keep a linear
dependency order in this part of the build graph.