`os._exit` does not run any cleanup handlers or flush any buffers, which
means that we may end up missing helpful log output. It was being used
to avoid printing the log analysis when `--help` was passed, but we can
have the same behavior by just not using `finally`.
This was quite brittle and has now been superseded
by swift-xcodegen. Remove the CMake/build-script
logic for it, leaving the option behind to inform
users to switch to using xcodegen instead.
Currently, usage of `--preset-vars-file` (added in https://github.com/swiftlang/swift/pull/76058) introduces newlines in values of preset variables passed via this file. Calling `strip()` will remove trailing and preceding whitespace characters, including newlines.
Bump the deployment target from macOS 10.13-aligned versions to macOS
13.0-aligned versions. This allows us to stop linking CoreFoundation
in the swift runtime, which was previously required for availability
checking. It also lets us align the deployment target on x86_64 with
arm64, which was 11.0. Finally, it is a prerequisite to being able to
build swift using the macOS 15 beta SDKs.
It's not always convenient to pass preset substitution arguments on an interactive command-line. Sometimes one might also need to generate these vars automatically, outside of a `build-script` invocation and also store those vars in a file for later reuse.
This change adds a new optional `--preset-vars-file` customization point to `build-script`, which allows users to pass a a file with newline separated key-value pars for preset variables substitution in addition to passing those in a direct `build-script` invocation.
Declare a new `LINUX_STATIC` SDK and configure it.
Add options to set the build architectures for the `LINUX` and
`LINUX_STATIC` SDKs, similar to what we have for Darwin, because
we'll be cross-compiling.
Also add an option to point the build system at the sources for
the musl C library, which we're using for `LINUX_STATIC`.
rdar://123503470
This change introduces a new compilation target platform to the Swift compiler - visionOS.
- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
This allows any versions above a specific version, instead of requiring
a specific list. Since it seems like many folks just disable this check
entirely, this list definitely isn't kept up well. If we need to exclude
a specific version, like if 1 Xcode beta didn't support it but the next
did, we can add a new list using the old method to validate build
numbers and disallow the bad version(s).
I don't recall why we didn't do this over a list originally, nor can I
find any context on why in the original discussion
https://github.com/apple/swift/pull/34227
When a user passes `--sccache` flag when `sccache` is not installed, we still attempt to make a shell invocation to `sccache`, which leads to an inscrutable error:
```
Traceback (most recent call last):
File "/root/swift-source/swift/utils/build-script", line 789, in <module>
exit_code = main()
File "/root/swift-source/swift/utils/build-script", line 784, in main
return main_normal()
File "/root/swift-source/swift/utils/build-script", line 687, in main_normal
shell.capture([toolchain.sccache, "--show-stats"])
File "/root/swift-source/swift/utils/swift_build_support/swift_build_support/shell.py", line 133, in capture
return subprocess.check_output(command, env=_env, stderr=stderr,
File "/usr/lib/python3.10/subprocess.py", line 420, in check_output
return run(*popenargs, stdout=PIPE, timeout=timeout, check=True,
File "/usr/lib/python3.10/subprocess.py", line 501, in run
with Popen(*popenargs, **kwargs) as process:
File "/usr/lib/python3.10/subprocess.py", line 969, in __init__
self._execute_child(args, executable, preexec_fn, close_fds,
File "/usr/lib/python3.10/subprocess.py", line 1720, in _execute_child
and os.path.dirname(executable)
File "/usr/lib/python3.10/posixpath.py", line 152, in dirname
p = os.fspath(p)
TypeError: expected str, bytes or os.PathLike object, not NoneType
```
`validate_arguments` should be called before `shell.capture([toolchain.sccache, "--show-stats"])` so that a more meaningful error message is shown to the user, asking them to install `sccache`.
The current implementation currently requires to have physical machine
for each architecture supported by macOS, which is not desirable.
To allow all cases to be tested on a random Mac machine, allow
to inject an arbitratry current architecture into the inference
of the cross compile hosts by means of an environment variable.
Addresses rdar://99096874
The CI currently uses Xcode 13.0 beta 4. It is very likely that if the build starts failing with Xcode 12.x, this will go unnoticed. Let's warn the users to upgrade to a newer version of Xcode.
The `__future__` we relied on is now, where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):
* absolute_import
* print_function
* unicode_literals
* division
These import statements are no-ops and are no longer necessary.
The library `six` provides compatibility between Python 2, and 3. It's no
longer necessary once we migrate of Python 2 completely.
Also remove any custom logic for Python 2 (the ones referenced by
a commentanyways).
https://bugs.swift.org/browse/SR-16025
Currently, when trying to build with the latest stable Xcode, you get this error:
```
using unsupported Xcode version:
Xcode 13.2.1
Build version 13C100
```
Xcode 13.2.1 can successfully build the toolchain and should be marked as supported.
This changes build-swift script shebang to use Python 3 explicitly. The
code is already compatible and functional with python3, so this removes
any implied backward compatibility, and removes any ambiguity based on
the user's current environment, especially since some systems, like
macOS, still link 'python' to Python 2.
This also removes the now unnecessary 'from __future__' imports, and the
'six' module, which is only necessary for python2 compatibility.
This shrinks the number of lines in build-script by 50% and just makes it easier
to read. It will also enable me to refactor parts of it into pieces without
touching the main build-script file. This is really library code... build-script
itself doesn't care about how BuildScriptInvocation is actually implemented
under the hood.
Pass the Swift and CMake flags needed to cross-compile Foundation and so on, with
the first example of Android. Add a new flag, --cross-compile-deps-path, which is
used to search for cross-compiled libraries, like libcurl, that the corelibs
depend on. Also add a new flag, --common-swift-flags, to pass additional Swift
flags to the corelibs.
In the original implementation (https://github.com/apple/swift/pull/36377), using `--infer` accidentally disables the `earlyswiftdriver` product (`before_impl_product_classes` set to always empty). This change fixes that and makes sure early SwiftDriver is always built, regardless of whether or not `--infer` is used.
This change also ensures that `install_all` setting triggered by `--infer` does not affect products which specify `is_ignore_install_all_product` to return True. This is useful for products which should not be installed into the toolchain (corresponding build products that use the just-built toolchain are the products that get installed, e.g. `swiftdriver` to `earlyswiftdriver`).