Commit Graph

934 Commits

Author SHA1 Message Date
Hamish Knight
50320d2a81 [cmake] Propagate lit_jobs to LLVM_LIT_ARGS
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`.
2023-01-12 16:02:05 +00:00
Alex Hoppen
7c251b2c14 Merge pull request #62584 from ahoppen/ahoppen/lint-swiftsyntax
[build] Verify that SwiftSyntax is correctly formatted
2022-12-15 21:16:12 +01:00
Alex Hoppen
a1a0cadb56 [build] Verify that SwiftSyntax is correctly formatted
In SwiftSyntax and swift-format, run swift-format on SwiftSyntax to make sure it’s correctly formatted.
2022-12-14 23:14:46 +01:00
Dario Rexin
39aef7d2ef Merge pull request #62446 from drexin/wip-103080745
[Build] Pass missing build parameters
2022-12-14 10:09:24 -08:00
Butta
dc06fc0160 [android][test] Disable new C++ Interop test
Also, add flag and comment from `build-script-util` that was missed in the
recent Python translation, #38507.
2022-12-12 01:11:46 +05:30
Dario Rexin
b3e77c2e3c Update cmake_product.py 2022-12-07 14:48:50 -08:00
Dario Rexin
0de45b03b3 [Build] Pass missing build parameters
Some parameters were accidentally dropped with the introduction of https://github.com/apple/swift/pull/38507.

rdar://103080745
2022-12-07 13:40:58 -08:00
Max Desiatov
0eeadffce0 Merge pull request #61696 from apple/maxd/generate-toolchain
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.
2022-12-07 16:27:33 +00:00
Max Desiatov
e80e7e3487 Merge pull request #62234 from apple/maxd/cmark-build-cleanup
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.
2022-12-07 10:19:21 +00:00
Mishal Shah
2fb26918fe Drop Python2.7 from the CMake definition (#62305) 2022-12-02 11:08:25 -08:00
Ethan Kusters
3cd4b6354d Revert "Support cross compilation in macOS toolchain builds (#62306)" (#62369)
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
2022-12-02 10:28:59 -08:00
Doug Gregor
b6605487c6 Merge pull request #62326 from DougGregor/swift-host-libs 2022-12-01 19:55:07 -08:00
Ethan Kusters
a36ab6e287 Support cross compilation in macOS toolchain builds (#62306)
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
2022-12-01 11:46:00 -08:00
Doug Gregor
36321dded8 Only install SwiftSyntax when we can build it 2022-11-30 22:37:21 -08:00
Doug Gregor
78ef82f16e [Build] Make sure to install SwiftSyntax into the toolchain
... otherwise we build a broken compiler in the toolchain, because the
shared libraries for SwiftSyntax aren't present.
2022-11-30 21:35:11 -08:00
Doug Gregor
52d513af6b Build swift-syntax as shared libraries instead of static libraries.
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.
2022-11-30 15:31:57 -08:00
Doug Gregor
b6eded76d6 [Build] Start installing the "early" Swift Syntax into the toolchain 2022-11-30 13:54:03 -08:00
Max Desiatov
99dedeeba3 swift_build_support: renamegenerate_toolchain_file 2022-11-30 11:50:11 +00:00
Max Desiatov
ba2d6254ef swift_build_support: unify CMake toolchain code 2022-11-30 11:03:22 +00:00
Max Desiatov
998856df8a build_script_invocation.py: don't pass cmark args 2022-11-29 14:03:15 +00:00
Anthony Latsis
05756a47a7 Merge pull request #62224 from AnthonyLatsis/fix-xcode-build
build: Fix Xcode project generation
2022-11-29 16:11:34 +03:00
Max Desiatov
4ee657b3fb build_script_invocation.py: avoid invalid --skip-test-cmark 2022-11-29 11:15:33 +00:00
Max Desiatov
e1076b3298 build_script_invocation.py: remove unused CMark opt 2022-11-29 11:15:33 +00:00
Eric Miotto
38a10bbd90 Merge pull request #62159 from edymtt/use-libcxx-from-darwin-sdks-llvm-product
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
2022-11-28 07:16:41 -08:00
Anthony Latsis
c50d2214cb build: Mirror LLVM+Xcode-specific build-script-impl logic in CMake build-script product
This fixes the behavior of `--xcode`, which was relying on this logic and was
compromised when LLVM became a build-script product.
2022-11-22 19:44:14 +03:00
Dario Rexin
79e385e172 [Build] Include deployment version in target triple
rdar://102515724
2022-11-18 11:29:10 -08:00
Dario Rexin
55c0084b9e [Build] Use llvm-cmake-flags in llvm build-script product
rdar://102476062
2022-11-17 10:56:57 -08:00
Eric Miotto
6add3c043f 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.

Addresses rdar://102387542
2022-11-17 09:34:29 -08:00
Eric Miotto
cbfd7c29ed LLVM product: extract logic to handle libcxx headers in a separate ...
... function

This is done in anticipation of switching to use  headers from the SDKs
for Darwin, so to not grow any further the `build` method.
2022-11-17 09:30:12 -08:00
Dario Rexin
f63de71001 Merge pull request #38507 from drexin/wip-llvm-build-script
[Build] Make LLVM a build-script product
2022-11-16 20:44:13 -08:00
Robert Widmann
2d07f382c5 Delete _InternalSwiftSyntaxParser And Its Build Infrastructure
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.
2022-11-02 10:35:29 -07:00
Dario Rexin
3f80cb6712 [Build] Make LLVM a build-script product
rdar://80733826
2022-10-30 22:47:29 -07:00
Alex Hoppen
ca09204667 Merge pull request #61516 from ahoppen/ahoppen/swift-format-ci
Build swift-format as part of CI testing and install it into open source toolchains
2022-10-28 14:33:38 +02:00
Alex Hoppen
4512cb0981 Build swift-format as part of CI testing
Build swift-format whenever SwiftSyntax is being built and install it whenever sourcekit-lsp is installed.
2022-10-27 09:24:36 +02:00
Becca Royal-Gordon
e2f76c961c [NFC] Print build-script timings to stderr 2022-10-18 17:21:29 -07:00
Max Desiatov
3e8d7da798 swift_build_support: make build duration more readable (#61536)
`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)
```
2022-10-13 15:55:38 +01:00
Max Desiatov
c7f348fabc utils: Python 3 is required, avoid using old Python (#61525)
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.
2022-10-11 00:06:36 +01:00
Max Desiatov
f6411c3829 build-script: add missing DocC dependency
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.
2022-10-07 17:10:04 +01:00
Alex Hoppen
b1040649f2 Merge pull request #61226 from ahoppen/ahoppen/move-gyb-syntax-support
Move gyb_syntax_support in swift-syntax from Sources/generate-swift-syntax-builder to Code-Generation
2022-09-23 14:17:44 +02:00
Alex Hoppen
3bb4d4d65d Move gyb_syntax_support in swift-syntax from Sources/generate-swift-syntax-builder to Code-Generation 2022-09-23 11:04:27 +02:00
Doug Gregor
b037a7c963 Remove unused import 2022-09-20 15:19:29 -07:00
Doug Gregor
b626f46d72 [Build] Determine the early SwiftSyntax build directory in build-script-impl
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.
2022-09-20 15:19:29 -07:00
Allan Shortlidge
238270f34c Merge pull request #42458 from jsoref/spelling-utils
Spelling utils
2022-09-20 09:34:55 -07:00
Doug Gregor
4a38f03c19 Fix Python lint warnings 2022-09-16 16:08:07 -07:00
Doug Gregor
78eb881a70 Pass the early SwiftSyntax build directory down to build-script-impl.
This gives LLDB's CMake build access to the build directory.
2022-09-16 16:08:00 -07:00
Josh Soref
de23580889 spelling: toolchain
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-09-15 19:43:37 -04:00
Josh Soref
f75688fc4f spelling: that
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-09-15 19:43:37 -04:00
Josh Soref
46eda2b2da spelling: equipped
Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>
2022-09-15 19:43:37 -04:00
Hamish Knight
cfda4b1764 [build-script] Allow specifying the number of lit workers
Allow tests to run with a different number of
workers than build jobs if desired.
2022-09-14 14:01:49 +01:00
Doug Gregor
3f9f16f4d2 [Build] Work around build-scripts single-root requirement.
Replace the correct Swift -> EarlySwiftSyntax dependency with an
EarlySwiftDriver -> EarlySwiftSyntax dependency, to keep a linear
dependency order in this part of the build graph.
2022-09-01 11:45:16 -07:00