Commit Graph

1359 Commits

Author SHA1 Message Date
Jake Petroules 306b4396f4 Encode the minimum OS version in ToolchainInfo.plist (fix typo)
Fix typo from initial change in #89062
2026-05-13 10:19:55 -07:00
Jake Petroules f86d26d39d Encode the minimum OS version in ToolchainInfo.plist (#89062)
The packaging scripts will use this to populate <allowed-os-versions> in
the final toolchain .pkg distribution
2026-05-12 20:13:39 -07:00
Duo Wang 0a32fd8960 Merge pull request #88364 from swiftlang/duow310/continue_on_test_failure
[build-script] Add option to continue the build on test failures
2026-04-09 17:58:53 -07:00
Jerry Chen ab663c6f6a Enable find_package(SwiftTestingMacros) in XCTest CMake build (#88354)
Enables building XCTest's lit tests that require `import Testing`, which
is new for testing the interop feature.
2026-04-09 07:01:36 -07:00
Duo Wang 1ef18da95d [build-script] Add option to continue the build on test failures 2026-04-08 11:53:39 -07:00
Med Ismail Bennani 87a06e80fd Merge pull request #87583 from medismailben/main
[build-script] Remove redundant LLDB DWARFImporter test run
2026-03-26 15:19:50 -07:00
finagolfin a9c41155a0 [build] libdispatch hasn't used ENABLE_TESTING in awhile (#87767)
Properly use `BUILD_TESTING` to disable when cross-compiling instead.

swiftlang/swift-corelibs-libdispatch#518 switched to `BUILD_TESTING`
used by CMake almost seven years ago, so this `ENABLE_TESTING` flag did
nothing since. Don't build Dispatch tests when cross-compiling because
we have no support for running them cross-compiled, and they don't
always cross-compile.
2026-03-10 13:41:35 -07:00
Med Ismail Bennani bedb9ed771 [build-script] Remove redundant LLDB DWARFImporter test run
Now that the LLDB test infrastructure generates clangimporter and
dwarfimporter variants automatically for @swiftTest-decorated tests,
there is no need to run lit a second time with
--setting symbols.use-swift-clangimporter=false.

Remove the second invocation and the now-unused
FILTER_SWIFT_API_OPTION variable.

Signed-off-by: Med Ismail Bennani <ismail@bennani.ma>
2026-02-27 14:22:19 -08:00
Jerry Chen c802acf6f6 Fix build script for XCTest so it can link _TestingInterop (#87464)
Fix build script for XCTest so it can link _TestingInterop

This is follow up for #87318, where I updated the build script but still left a
few shortcomings that are addressed here.

I've validated these changes more extensively by building in CI against the
(currently) draft PR in swift-corelibs-xctest that introduces the
_TestingInterop linkage requirement.

* Update the cmake search path SwiftTesting_DIR (swift_testing -> swifttesting)

  Failed to find SwiftTesting in the earlier build: https://ci.swift.org/job/swift-corelibs-xctest-PR-Linux/139/consoleText
  ```
  -DSwiftTesting_DIR=/home/build-user/build/Ninja-ReleaseAssert/swift_testing-linux-x86_64/cmake/modules
  ...
  [2026-02-23T23:30:38.885Z] -- Could NOT find SwiftTesting (missing: SwiftTesting_DIR)
  ```

  But it was created earlier as swifttesting without the underscore:
  ```
  [2026-02-23T23:29:27.132Z] + mkdir -p /home/build-user/build/Ninja-ReleaseAssert/swifttesting-linux-x86_64
  ```

* Update build.ps1 for linking XCTest against _TestingInterop on Windows too

  * Test-XCTest: include Testing in `$env:Path` so it can find the interop dll

    Note that we provide `$(Get-ProjectBinaryCache $BuildPlatform
    Testing)**\bin**` (emphasis added) because of this setting in Testing's
    cmake config.

    ```
    set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
    ```


  * Fix build ordering: put Testing before XCTest

  * Specify SwiftTesting_DIR for cmake
2026-02-27 08:46:37 -08:00
Jerry Chen 90a3237181 Pass SwiftTesting_DIR to cmake_options for swift-corelibs-xctest (#87318)
Provides the path to the swift-testing modules
(https://github.com/swiftlang/swift-testing/pull/1573) when building
swift-corelibs-xctest. This allows xctest to link against the
_TestingInterop library, which is produced by the swift-testing project.

It's only passed when these conditions are met:

* ${product} is swift-corelibs-xctest

* ${host} is not macosx

The macosx pipeline is unchanged (and probably broken), although I don't
believe it is currently in use since swift-corelibs-xctest is not
present in the macOS OSS toolchain.
2026-02-20 06:49:39 -08:00
Jonas Devlieghere 9143271dfd Add missing = 2025-12-16 10:23:08 -08:00
Jonas Devlieghere 3d12031ca6 Always pass --verify-dwarf none 2025-12-11 11:09:39 -08:00
Jonas Devlieghere 74c141819f [build-script] Don't use the just-built dsymutil by default
Doing so may have made sense back then, but at this point we should
default to the one in the toolchain. When building with asserts, the
just-built dsymutil will run the DWARF verifier which is slow and not
really desirable in this context.
2025-12-11 10:52:36 -08:00
3405691582 4f3541958b Merge pull request #85714 from 3405691582/tar
OpenBSD needs this tar invocation as well.
2025-12-04 15:22:28 -05:00
Evan Wilde 1c3541e926 Build: Remove concurrency tracing option
Stripping out the logic behind enabling concurrency tracing
independently of the rest of the standard library tracing. It's not
clear that there is a use-case where we want one without the other.
2025-12-03 14:03:40 -08:00
3405691582 9b27f91f41 OpenBSD needs this tar invocation as well. 2025-11-26 17:36:02 -05:00
Evan Wilde b6b152eabd FreeBSD: Drop system libxml2 dep in tools
This drops the dependency on the system libxml2 from the tools shipped
in the toolchain bundle. libxml2 is disabled entirely for the LLVM/lld
build, which uses it for processing the Windows manifest files. LLDB is
changed to link against the static libxml2 built for the FoundationXML
library. This is technically incorrect since the runtime may be
cross-compiled for a different platform than what the toolchain is built
to run on, but build-script is already mixing toolchain and runtime
content in inconsistent ways, so this is no worse off than we are
already.

libxml2 is updated pretty frequently in inconsistent ways, resulting in
failures to launch due to version incompatibilities.
2025-11-07 09:57:41 -08:00
Jake Petroules 51683c4931 Fix the Swift for macOS installer to encode a minimum OS version for installation (#83273)
Right now it defaults to macOS 10.11, which is of course far below the
intended supported version.
2025-08-25 11:06:32 -07:00
Jake Petroules b2ad48352c Remove some obsolete properties from the macOS ToolchainInfo.plist (#83274)
- CompatibilityVersionDisplayString isn't required and it's misleading
to write Xcode 8 here, which is far below the actual compatibility
- ENABLE_BITCODE is now ignored by Swift Build
- SWIFT_DISABLE_REQUIRED_ARCLITE is now ignored by Swift Build
- SWIFT_LINK_OBJC_RUNTIME doesn't need to be set as it's already set to
an appropriate per-platform default
2025-08-25 10:52:37 -07:00
finagolfin e251aea113 [build] Change Foundation macro checks because of #83422 (#83629)
I missed that `build-script` passes back `false` instead, so use the
`true_false` function for broader checking.
2025-08-10 18:29:24 -07:00
Finagolfin 1a0a44b670 [build] Set CMAKE_Swift_COMPILER_TARGET when cross-compiling corelibs 2025-07-10 12:40:24 +05:30
Eric Miotto 1218df3f4e Wire --llvm-include-tests in build-script
This was apparently missing in the migration of the llvm product
from build-script-impl to build-script,
2025-06-16 15:01:52 -07:00
finagolfin 2d735e8c39 [build] Switch over to new --cross-compile-build-swift-tools flag when cross-compiling Foundation macros (#82163)
Follow-on to #38441, missed this there.
2025-06-11 21:43:56 +05:30
Alastair Houghton d5ed335339 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-06-03 15:01:22 +01:00
finagolfin d8243f8328 [build] Add a new --cross-compile-build-swift-tools flag to disable cross-compiling the compiler (#38441)
This is useful when building cross-compilation toolchains where you want
the stdlib and corelibs cross-compiled but don't want the Swift compiler
cross-compiled too with `--cross-compile-hosts`.
2025-06-03 14:57:29 +05:30
Evan Wilde fd2ba8b95d Fix the ARM architecture on FreeBSD
The 64-bit ARM architecture spelling on FreeBSD is aarch64, not arm64.
This results in a build failure about a missing
`freebsd/arm64/swiftrt.o` while building the runtimes.
2025-05-20 21:38:41 -07:00
Alastair Houghton 28f96e64ab [Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
If you use SwiftStdlibCurrentOS availability, you will be able to
use new types and functions from within the implementation. This
works by, when appropriate, building with the CurrentOS availability
set to the current deployment target.

rdar://150944675
2025-05-12 12:07:24 +01:00
Eric Miotto 7b001765bd Merge pull request #80174 from edymtt/edymtt/use-runtimes-build-quater
build-script: Permit to build compiler-rt with `LLVM_ENABLE_RUNTIMES`
2025-04-22 06:48:17 -07:00
Eric Miotto 0c8171f53c build-script: Permit to build compiler-rt with LLVM_ENABLE_RUNTIMES
LLVM-21 plans to remove the legacy method for building compiler-rt
in the same invocation as LLVM using `LLVM_ENABLED_PROJECTS` and
`LLVM_BUILD_EXTERNAL_COMPILER_RT`.

Support the new way of building compiler-rt with a new build-script
opt-in flag `--llvm-build-compiler-rt-with-use-runtimes` --
this will allow a staged introduction, and will ensure we can revert
back to the old behaviour temporarily in case of unforeseen regression.

Since this flag is meant to be short lived, in an attempt to keep the
logic simple we are gating on it only the
CMake cache entries that strictly control the compilation mode, all the
other entries used for configuring are added in both modes.

Take this chance to remove some stale code from `build-script-impl`, and
move some code in the generic CMake product to the LLVM one.

Addresses rdar://147505298
2025-03-31 13:53:08 -07:00
3405691582 a341ce5570 Add a build flavor to opt-out of BTCFI on OpenBSD.
To work-around #80059, we need to stop return address signing and
opt-out of BTCFI enforcement via enabling a platform linker option.

We don't want to completely undo the BTCFI work in the rare case that
we later figure out how to properly address the above issue, or allow
users who might want to benefit from BTCFI enforcement and won't use
Concurrency. To do this, condition the existing BTCFI flag enforcement
into a configuration option that defaults to off for now.

Because the new swift-driver needs to "know" whether the frontend is
configured to opt-out or not, and since the new driver communicates with
the frontend via the target info JSON to begin with, we add a field
that emits the build flavor to signal the right behavior.
2025-03-29 10:47:23 -04:00
Max Desiatov eb1a2960b6 Enable _Concurrency for Embedded Swift with WASI (#79292)
WASI with Embedded Swift provides WASI-libc and libc++ headers necessary to build the `_Concurrency` module for Wasm. We now add `wasm32-unknown-wasip1-wasm` triple to `EMBEDDED_STDLIB_TARGET_TRIPLES` when `SWIFT_WASI_SYSROOT_PATH` is set, which builds the necessary stdlib slice.

---------

Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
2025-03-26 21:14:05 +00:00
Hamish Knight d260bd8ddb [build-script] Remove Xcode generation support
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.
2025-02-12 12:19:21 +00:00
3405691582 610c351184 Enable PACBTI on OpenBSD/arm64. (#78394)
BTI enforcement is mandatory, which means if PAC and BTI instructions
are not emitted, then the compiled binary gets killed with SIGILL. The
platform default compiler achieves enabling PAC and BTI by embedding the
relevant enabled Clang compilation option flags into the local platform
toolchain, which affects C/C++ code generation.

For Swift however, to achieve the same effect, we would need to add the
relevant LLVM module flags in the IRGen process. But, since Swift uses
the Clang code generator when doing this, using the same option flag
approach will work here as well, and is probably preferable to
introducing operating system-dependent logic to the ClangImporter, for
example.

Finally, the stdlib needs to be built with PACBTI as well, since the
stdlib's global constructors get run when a compiled binary does. Since
the Swift build uses the just-built Clang for the stdlib, just embed the
necessary options into `CMAKE_C_FLAGS` and `CMAKE_CXX_FLAGS` via
`build-script-impl`. This will be redundant with the host compiler, but
at least it will be thorough.
2025-02-04 07:33:08 +05:30
Cyndy Ishida 3232df4d67 Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)' (#79018)
* Reapply '[BuildSystem] Stop building for i386-watch-simulator (#77692)'

    * [BuildSystem] Stop building for i386-watch-simulator

    In Xcode16 it is not supported.

This initially broke client projects who were still building the legacy
architecture but now that's resolved.
2025-01-31 15:04:28 -08:00
finagolfin 1aded39ea5 [build-script] Disable building and installing the Foundation macros for standalone SDKs (#78782)
Also, remove CMake flag for Android that is now directly set in that repo.
2025-01-30 14:01:58 +05:30
Anthony Latsis 28160c9d09 Merge pull request #78049 from AnthonyLatsis/nelumbo-lutea
build: Unhardcode Swift source directory name
2025-01-09 11:23:17 +00:00
Anthony Latsis 4a5e0daa9d build: Unhardcode Swift source directory name
This is useful if you maintain several swift worktrees that reside in
the source root directory.
2025-01-07 09:58:47 +00:00
Henrik G. Olsson ef9d2b744d Rename pointer bounds (#78210)
* Make pointer bounds non-experimental

* Rename @PointerBounds to @_SwiftifyImport

* Rename filenames containing PointerBounds

* Add _PointerParam exception to stdlib ABI test

* Add _PointerParam to stdlib API changes

* Rename _PointerParam to _SwiftifyInfo
2024-12-20 11:36:01 +01:00
Ben Barham 95c30115b9 Merge pull request #77647 from finagolfin/llbuildSwift
[build-script] Stop installing the llbuildSwift library that is no longer used
2024-12-06 12:53:53 -08:00
Cyndy Ishida 1b869ef828 Revert "[BuildSystem] Stop building for i386-watch-simulator" (#77911)
* Revert "[Build] Fix swift_build_support tests."

This reverts commit fc2d1b3b23.

* Revert "[BuildSystem] Stop building for i386-watch-simulator (#77692)"

This reverts commit 1ab968d2b6.

This change can't be made without other issues fixed downstream first.
2024-12-03 23:17:12 -08:00
3405691582 301a0c49fc Swift on OpenBSD supports arm64.
However, to do this, we end up changing how amd64 is supported too.
Previously, I had tried to keep some meaningful separation between
platform spelling and LLVM spelling, but this is becoming more difficult
to meaningfully maintain.

Target specifications are trivially converted LLVM triples, and the
module files are looked up by LLVM triples. We can make sure that the
targets align, but then the Glibc to SwiftGlibc import breaks. That could
also be addressed, but then we get to a point where the targets set up
by build-script and referenced by cmake begin to misalign. There are
references in build-script-impl for a potential renaming site, but it's
not quite enough.

It's far simpler to give up and rename to LLVM spellings right at the
beginning. This does mean that this commit is less constrained to just
adding the necessary parts to enable arm64, but it should mean less
headaches overall from differing architecture spellings.
2024-11-30 16:33:46 -05:00
Cyndy Ishida 1ab968d2b6 [BuildSystem] Stop building for i386-watch-simulator (#77692)
* [BuildSystem] Stop building for i386-watch-simulator

In Xcode16 it is not supported.
2024-11-20 08:57:19 -08:00
Finagolfin 85f38080b1 [build-script] Stop installing the llbuildSwift library that is no longer used 2024-11-15 19:59:17 +05:30
Henrik G. Olsson 0678829cf7 Add @PointerBounds macro (#76969)
Add @PointerBounds macro

@PointerBounds is a macro intended to be applied by ClangImporter when
importing functions with pointer parameters from C headers. By
leveraging C attributes we can get insight into bounds, esapability, and
(eventually) lifetimes of pointers, allowing us to map them to safe(r)
and more ergonomic types than UnsafePointer.

This initial macro implementation supports CountedBy and Sizedby, but
not yet EndedBy. It can generate function overloads with and without an
explicit count parameter, as well as with UnsafeBufferPointer or Span
(if marked nonescaping), and any of their combinations. It supports
nullable/optional pointers, and both mutable and immutable pointers.
It supports arbitrary count expressions. These are passed to the macro
as a string literal since any parameters referred to in the count
expression will not have been declared yet when parsing the macro.

It does not support indirect pointers or inout parameters. It supports
functions with return values, but returned pointers can not be bounds
checked yet.

Bounds checked pointers must be of type Unsafe[Mutable]Pointer[?]<T>
or Unsafe[Mutable]RawPointer[?]. Count expressions must conform to
the BinaryInteger protocol, and have an initializer with signature
"init(exactly: Int) -> T?" (or be of type Int).

rdar://137628612

---------

Co-authored-by: Doug Gregor <dgregor@apple.com>
2024-11-11 14:54:25 -08:00
Felipe de Azevedo Piovezan 50f1930783 Revert "[build-script] Run LLDB tests with new redecl-completion setting"
This reverts commit 8858585677.

This mode is not working well with rebranch, so we're disabling its testing to
reduce the CI noise.
2024-09-27 08:50:50 -07:00
Adrian Prantl a341986e75 Remove the LLDB (classic) test configuration. 2024-09-25 10:16:17 -07:00
Ben Barham a7b50f357f Merge remote-tracking branch 'origin/main' into manual-main-merge
Conflicts:
  - `lib/Driver/ToolChains.cpp` conflicting with the `addAllArgs` rename
    for multiple options
2024-09-16 13:53:18 -07:00
Ben Langmuir 46a83bea0c Roll back to watchOS 6.0 to keep armv7k support
While the swift compiler in Xcode links against tbd files in the sdk
that contain an armv7k slice, the open source swift toolchain links
against the stdlib dylb that is in the toolchain itself. This means that
we cannot drop support for armv7k support in the stdlib dylib without
losing support for building armv7k when back deploying to older watch
targets. For now, roll back the recent deployment target bump from 9.0
to 6.0 so that we keep armv7k and i386 simulator.

rdar://135560598
2024-09-13 08:49:09 -07:00
swift-ci a377cfa315 Merge remote-tracking branch 'origin/main' into rebranch 2024-09-06 13:33:57 -07:00
Ben Langmuir ad82d86041 Bump the deployment target for the compiler to macOS 13.0
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.
2024-08-29 14:30:09 -07:00