Commit Graph

864 Commits

Author SHA1 Message Date
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
Doug Gregor
6854355b08 Address Python lint and testing issues 2022-09-01 08:56:22 -07:00
Doug Gregor
5ea5f3b45d Optional support for round-trip testing the new Swift parser.
When enabled, compile in support for round-trip testing the new
SwiftSyntax-provided Swift parser alongside the existing parser. Right
now, this means parsing every source file with the new parser and
ensuring that the resulting syntax tree can reproduce the input source
precisely. Over time, this is expected to grow.

Opt in to this behavior by passing the following to build-script:

    build-script --early-swiftsyntax --extra-cmake-options=-DSWIFT_SWIFT_PARSER_MODE:STRING=ROUNDTRIP
2022-09-01 08:56:22 -07:00
Robert Widmann
6f3cdb6c02 Update Windows Build Scripts 2022-08-31 13:53:52 -07:00
Saleem Abdulrasool
1eb294d95b Merge pull request #60823 from 3405691582/cross
Preliminary Linux-OpenBSD cross-compile support.
2022-08-31 08:28:02 -07:00
3405691582
47ae4d9a53 Preliminary Linux-OpenBSD cross-compile support.
With a properly prepared sysroot and toolchain file, these changes permit
cross-compilation of Swift as well as LLVM, CMark, and Dispatch (picking,
as usual, apple/swift-corelibs-libdispatch#556) from a Linux host
generating OpenBSD binaries.

The toolchain file must be specified as an environment variable to
`build-script` and discussion on how to properly set up the sysroot and
toolchain file will be handled later.
2022-08-28 22:39:46 -04:00
Doug Gregor
98e50258b8 Merge pull request #60814 from DougGregor/build-early-swiftsyntax
[build-script] Support building "early" SwiftSyntax via `--early-swiftsyntax`
2022-08-27 23:01:25 -07:00
Doug Gregor
5ae31c0029 Address Python linting failures 2022-08-27 07:25:32 -07:00
Doug Gregor
e771660526 [build-script] Support building "early" SwiftSyntax via --early-swiftsyntax
Similar to the way the early Swift Driver is built, introduce a
build-script option `--early-swiftsyntax` that uses the host Swift and
CMake to build the parts of the swift-syntax package that are expected
to become be used in the compiler.

Note that this does not obviate the need for the `--swiftsyntax`
option, because that build product uses the just-built Swift compiler
and SwiftPM to build, test, and install everything from the
swift-syntax package.
2022-08-27 00:06:09 -07:00
YOCKOW
c1e154a9cb [Gardening] Remove trailing whitespaces in Python scripts. (W291)
That has been marked as 'FIXME' for three years.
This commit fixes it.
2022-08-25 16:08:36 +09:00
swift-ci
920c6deeb7 Merge pull request #60017 from keith/ks/build-ignore-.git-in-ninja-copy
[build] Ignore .git in ninja copy
2022-08-22 14:29:31 -07:00
YOCKOW
d10381557b [NFC] Python Lint: Fix E275(missing whitespace after keyword) issues. 2022-08-21 16:07:07 +09:00
Alex Hoppen
059128feca Build indexstore-db and sourcekit-lsp in a unified build 2022-08-05 19:04:02 +02:00
Mishal Shah
196ee143c5 Xcode 14 beta 4 no longer supports iOS armv7, armv7s, and i386 architectures
> Building iOS projects with deployment targets for the armv7, armv7s, and i386 architectures is no longer supported. (92831716)
2022-08-02 20:42:08 -07:00
Alex Hoppen
c488f76075 Don’t cross-compile sourcekit-lsp and indexstore-db when running tests
Running swift test with `--test-product SourceKitLSPPackageTest` fails when cross-compiling with an error message like the following (rdar://97876450)
```
error: Could not find target named 'SourceKitLSPPackageTests_-6F17C3BE20775DA1_PackageProduct'
```

Since we don’t run the test on the cross-compile host anyway, just disable cross-compilation during testing.
2022-08-02 18:47:58 +02:00
Mishal Shah
caf9bf5d7b Merge pull request #41223 from apple/log-build-time
[Build System] Add support to log build times for each products
2022-07-28 10:39:29 -07:00
Mishal Shah
dbf9aca8b0 Only clean the log file if it exists 2022-07-15 01:39:50 -07:00
Keith Smiley
a61af54545 [build] Ignore .git in ninja copy
As part of the build the entire ninja source dir is copied to the build
dir and then built. When using git's fsmonitor feature the .git
directory contains a socket which causes the copytree to fail. With this
change .git is ignored entirely instead. Error:

```
Traceback (most recent call last):
  ...
  File "/Users/ksmiley/dev/oss-swift/swift/utils/swift_build_support/swift_build_support/build_script_invocation.py", line 69, in build_ninja
    ninja_build.build()
  File "/Users/ksmiley/dev/oss-swift/swift/utils/swift_build_support/swift_build_support/products/ninja.py", line 80, in build
    shell.copytree(self.source_dir, self.build_dir)
  File "/Users/ksmiley/dev/oss-swift/swift/utils/swift_build_support/swift_build_support/shell.py", line 193, in copytree
    shutil.copytree(src, dest)
  File "/Users/ksmiley/.pyenv/versions/3.10.2/lib/python3.10/shutil.py", line 556, in copytree
    return _copytree(entries=entries, src=src, dst=dst, symlinks=symlinks,
  File "/Users/ksmiley/.pyenv/versions/3.10.2/lib/python3.10/shutil.py", line 512, in _copytree
    raise Error(errors)
shutil.Error: [('/Users/ksmiley/dev/oss-swift/ninja/.git/fsmonitor--daemon.ipc', '/Users/ksmiley/dev/oss-swift/build/buildbot_osx/ninja-build/.git/fsmonitor--daemon.ipc', "[Errno 102] Operation not supported on socket: '/Users/ksmiley/dev/oss-swift/ninja/.git/fsmonitor--daemon.ipc'")]
```
2022-07-12 08:37:49 -07:00
QuietMisdreavus
872d4ff12e tell CTest to print on failure for cmark tests (#59978) 2022-07-12 09:20:15 -06:00
Kim de Vos
adbeb8b4e9 [SwiftSyntax] Clean build script
https://github.com/apple/swift-syntax/pull/458
2022-06-26 21:19:51 +02:00
Mishal Shah
4c19ba404b Merge branch 'main' into log-build-time 2022-06-08 16:55:34 -07:00