Commit Graph

8541 Commits

Author SHA1 Message Date
Charles Zablit
459a69232b [windows] move llvm test overrides to the llvm-project repository
(cherry picked from commit e48c9a42f7)
2025-09-24 12:48:41 -07:00
Mishal Shah
5bae58a1cf Merge pull request #81342 from swiftlang/maxd/bump-wasmkit-6.2
6.2: Bump WasmKit in `update-checkout-config.json` to 0.1.6
2025-09-15 11:57:50 -07:00
Eric Miotto
f17d8909f0 [6.2] Do not require CMake to be in the path for build-script tests
(cherry picked from commit 4e854dea88)
2025-09-12 00:43:38 -07:00
Adrian Prantl
35c6b992ba Merge pull request #84156 from charles-zablit/charles-zablit/update-checkout/add-locked-repository-check-to-6.2
🍒 [update-checkout] add a check for locked repositories
2025-09-09 08:53:37 -07:00
Adrian Prantl
94b6d59cf6 Merge pull request #84153 from charles-zablit/charles-zablit/windows/fix-arm64-build-error-to-6.2
🍒 [windows] update to the 6.1.2 toolchain in build.ps1
2025-09-09 08:53:17 -07:00
Charles Zablit
f2c3d97c54 [update-checkout] add a check for locked repositories 2025-09-08 17:27:55 +01:00
Charles Zablit
a1f70d608e [windows] update to the 6.1.2 toolchain in build.ps1 2025-09-08 11:59:19 +01:00
Max Desiatov
2e9e12a8bd [6.2] Build CMake on macOS if one is not preinstalled
We build CMake on all platforms (except Darwin for an unknown reason) if CMake is not preinstalled. Since CMake 4.0 regresses certain build configurations, there's currently no way to build on Darwin without installing an older CMake version 3.x manually. This can be simplified if we build a pinned version of CMake consistently on all platforms.

Addresses rdar://159939866

(cherry picked from commit 7db6c5ddaa)
2025-09-05 07:19:46 -07:00
Max Desiatov
0a5ed62617 Update WasmKit to 0.1.6 in update-checkout-config.json 2025-08-16 14:49:01 +01:00
Finagolfin
50689519db [build] Change Foundation macro checks because of #83422
I missed that `build-script` passes back `false` instead, so use the `true_false`
function for broader checking.
2025-08-11 04:31:28 +05:30
Finagolfin
1d8a95fab3 [build] Make the new --cross-compile-build-swift-tools flag public
This new flag makes it easy to build Swift cross-compilation toolchains, by
disabling cross-compilation of all host tools, like the Swift compiler and
various macros, building on prior pulls #38441 and #82163.

Also, add two class methods to the Testing macros product so it works with #83260.
2025-08-11 04:31:19 +05:30
finagolfin
2c9dcfe11f [build][android] Use a CMake toolchain file to cross-compile Testing (#83260)
Also, disable a recently failing test for Android armv7.
2025-08-11 04:31:19 +05:30
Finagolfin
9c7ae5025f Only bring over supporting change of generate_linux_toolchain_file() from fcc03898c,
specifically the change that makes the following possible on linux:

    "* under Linux, do not cross compile LLVM when building for the host
     architecture -- that will ensure that the compiler-rt build will use
    the just built compiler and not the system one (which may not be
    new enough for this purpose);"
2025-08-11 04:31:19 +05:30
Marc Prud'hommeaux
7f09af24cf Support 16 KB page sizes on Android (#81596)
Android 15+ requires that native libraries be compiled with a linker
flag to support 16 KB page sizes. See:
https://developer.android.com/guide/practices/page-sizes#compile-r26-lower
2025-08-11 04:31:19 +05:30
Yuta Saito
e25995ac5d [wasm] Fix installation paths for libxml2.a
Clang driver only passes arch-specific library paths as search paths
to the linker for WebAssembly targets but we were installing
libxml2.a under `<sysroot>/lib` without the multiarch triple. It led
to the linker not finding libxml2.a when importing FoundationXML
2025-07-27 23:07:42 +00:00
Slava Pestov
95baef19df Merge pull request #83300 from slavapestov/update-availability-macros-26-6.0
[6.2] Update utils/availability-macros.def
2025-07-26 10:47:45 -04:00
Max Desiatov
ab7cd238fd [6.2] test/CMakeLists.txt: run Embedded Swift for Wasm tests (#83287)
Cherry-pick of #83128, #82399, and #82878, merged as ea6ca2b5db, 0c4e56174b, and e34eb3331f respectively.

**Explanation**: Currently `test/CMakeLists.txt` can only set `SWIFT_LIT_ARGS` for all tests uniformly. This means that we can't have tests for Embedded Swift with a different set of `lit.py` arguments.

Also, create new `check-swift-embedded-wasi` target from `test/CMakeLists.txt`, tweak `lit.cfg` to support WASI Clang resource dir, exclude unsupported tests based on `CPU=wasm32` instead of `OS=wasi`.

**Scope**: Limited to Embedded Swift test suite.
**Risk**: Low, due to limited scope.
**Testing**: #82878 was incubated on `main` for 2 weeks, #82399 for 3 weeks with no disruption, #83128 merged this week, but enables all these tests on CI, which are consistently passing.
**Issue**: rdar://156585717
**Reviewer**: @bnbarham
2025-07-26 09:48:47 +01:00
Slava Pestov
7fabd38ed0 Update utils/availability-macros.def 2025-07-25 15:45:44 -04:00
Charles Zablit
5954a7c07d Merge pull request #83202 from charles-zablit/charles-zablit/windows/fix-wrong-LLVM_HOST_TRIPLE-to-6.2
🍒 [windows][lldb] fix incorrect LLVM_HOST_TRIPLE when cross-compiling
2025-07-23 14:35:35 +01:00
Yuta Saito
a1a8d73ea2 [6.2][wasm] Build and install XCTest for Wasm Swift SDK (#83200)
- **Explanation**: Install static XCTest library and its Swift module files into Swift SDK for Wasm
- **Scope**: Narrow, only affects Wasm Swift SDK.
- **Original PRs**: https://github.com/swiftlang/swift/pull/83191
- **Risk**: Low, just a change to Wasm Swift SDK
- **Testing**: CI
- **Reviewers**: @MaxDesiatov
2025-07-22 23:06:50 +01:00
Yuta Saito
b7c3ceac0f [6.2][wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 (#83199)
- **Explanation**: Renames the WebAssembly target triple from `wasm32-unknown-wasi` to `wasm32-unknown-wasip1` to align with the broader WebAssembly ecosystem's naming conventions. It's important to include this in 6.2, which is going to be the first stable release of Swift SDK for Wasm, so that we won't introduce a breaking triple change in the stable version series later.

  The WebAssembly ecosystem has been migrating from the generic wasi target name to more explicit version-specific names like `wasip1` and `wasip2`. This change has been adopted across multiple toolchains and language ecosystems:

  - Rust: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/rust-lang/compiler-team/issues/607)
  - wasi-sdk: Renamed `wasm32-wasi` to `wasm32-wasip1` (https://github.com/WebAssembly/wasi-sdk/pull/386)
  - Go: Already uses `wasip1` naming convention (https://github.com/golang/go/issues/58141)

  The "p1" suffix explicitly indicates WASI Preview 1, which helps distinguish it from the newer WASI Preview 2 (wasip2) and provides clarity about which version of the WASI specification is being targeted.

  Also we already use `wasm32-unknown-wasip1` for Embedded WASI target, and having different names for Embedded and non-Embedded is confusing users.

- **Scope**: Narrow, only affects Wasm Swift SDK.
- **Original PRs**: https://github.com/swiftlang/swift/pull/83167
- **Risk**: Low, just a change to Wasm Swift SDK
- **Testing**: CI.
- **Reviewers**: @MaxDesiatov
2025-07-22 11:23:07 -07:00
Ben Barham
315de8dd74 Merge pull request #82516 from bnbarham/6.2-use-compiler-version
[6.2] Use SWIFT_COMPILER_VERSION before SWIFT_TOOLCHAIN_VERSION if it exists
2025-07-21 15:07:21 -07:00
Charles Zablit
56193998f5 [windows][lldb] fix incorrect LLVM_HOST_TRIPLE when cross-compiling 2025-07-21 13:00:13 +02:00
finagolfin
d746436d94 Merge pull request #82986 from finagolfin/droid
[6.2][android] Small test and build tweaks
2025-07-18 15:22:47 +05:30
Max Desiatov
ba7944b743 6.2: Build and install Testing and Foundation for Wasm Swift SDK (#83059)
Cherry-pick of #82285, merged as 05204bdf63

**Explanation**: Include Swift Testing Foundation and libxml2 into the Swift SDK for WebAssembly
**Scope**: Limited to Swift SDK for Wasm
**Risk**: Low, due to limited scope. Changes were incubated on `main` for 2 weeks with no known issues. Swift Testing changes were incubated for more than a month.
**Testing**: Manual testing with Swift SDKs produced off `main`.
**Issue**: rdar://155865189
**Reviewer**: @MaxDesiatov

---------

Co-authored-by: Yuta Saito <kateinoigakukun@gmail.com>
2025-07-17 15:53:19 -07:00
Saleem Abdulrasool
8bf3af09a6 Merge pull request #82166 from Steelskin/fabrice/6.2-line-directive
🍒 [6.2] line-directive: Stop expanding response files
2025-07-15 11:40:13 -07:00
Alastair Houghton
eefdd69c8d Merge pull request #82915 from al45tair/eng/PR-151147606-take2
[Concurrency] Remove custom global executors from 6.2.
2025-07-14 16:20:57 +01:00
Ben Barham
919bc88a31 Use SWIFT_COMPILER_VERSION before SWIFT_TOOLCHAIN_VERSION if it exists
We should eventually split these, but for now SWIFT_COMPILER_VERSION
matches SWIFT_TOOLCHAIN_VERSION when it's actually set. Just use it in
preference to SWIFT_TOOLCHAIN_VERSION.

(cherry picked from commit ec46a4f026)
2025-07-11 15:24:08 -07:00
Finagolfin
91360ab37b [build] Fix libcurl for typos and correct name of build target 2025-07-11 16:24:30 +05:30
Finagolfin
0bdc26a7a7 [build] Set CMAKE_Swift_COMPILER_TARGET when cross-compiling corelibs 2025-07-11 16:23:55 +05:30
finagolfin
43970ac2f0 [android] Fix an install path and the displayed NDK in the build log (#82620)
I just noticed the install issue when cross-compiling Testing with a
freshly-built compiler, which I'd never done before. Also, fix the NDK
path shown in the CMake output.
2025-07-11 16:21:18 +05:30
Doug Gregor
958e74c48c Merge pull request #82852 from DougGregor/span-back-deployment-version-fixes-6.2
[6.2] Fix deployment version for Span back-deployment library
2025-07-08 16:09:03 -07:00
Ben Barham
3abc025579 Merge pull request #82018 from al45tair/fix-freestanding-deployment-version
[Build] Fix the minimal-stdlib build by setting a deployment version.
2025-07-08 11:25:17 +01:00
Doug Gregor
6391d3df6b Fix deployment version for Span back-deployment library
Part of rdar://155252653.
2025-07-07 13:56:11 -07:00
Saleem Abdulrasool
dc4302e65d utils: avoid redirection and use pipes for output redirection
When the output is directly redirected, the output is re-encoded. This
is particularly important as `Write-PList` uses `Invoke-Program` to
invoke `python.exe` to write the plist. However, because it is writing
to a file, while the output from Python is in UTF-8, the redirection
re-encodes the output to UTF16LE (BOM). Adjust the invocation to use
PS7+ `2|` and pipe both stdout and stderr as appropriate into files with
UTF-8 encoding restoring the encoding for the file.
2025-07-07 15:44:37 -04:00
Alastair Houghton
8eb879831c Merge pull request #81940 from al45tair/eng/PR-152498657
Rename SwiftStdlibCurrentOS to StdlibDeploymentTarget.
2025-07-07 12:04:38 +01:00
Alastair Houghton
0813e95569 Merge pull request #81440 from al45tair/currentos-availability
[Concurrency][Stdlib] Add SwiftStdlibCurrentOS availability, use it.
2025-07-07 12:04:00 +01:00
wti
ea734e2c22 [6.2] Update wasmkit toolchain build to emit universal on macOS to fix #82390 (#82406)
- **Explanation**: Build wasmkit, a new toolchain executable, as universal binary on macOS using SwiftPM --arch flags. (Cherry picked from commit 6530236)
- **Scope**: WasmKit is new, and users targeting Wasm (and preferring WasmKit over other Wasm runtimes) might be few. WasmKit can be invoked directly by users and indirectly via `swift run` when using the official Swift SDKs for Wasm.
- **Issues**: Resolves #82390
- **Original PRs**:  #82393
- **Risk**: The new configuration only affects macOS targets. The binary is output to a new location, but the code already introspects the location correctly. The bug and fix impacts users of WasmKit binary newly added to toolchain, directly and via `swift run`. Risk of no-fix: The Swift.org wasm "Getting Started" [1] refers explicitly to this (unreleased) 6.2 toolchain WasmKit binary. Without this fix, users on Apple Silicon following those instructions get an obscure "bad CPU" error because it is built only for the host x86_64 arch.
- **Testing**: @kateinoigakukun verified WasmKit is universal after change in `main`. To verify, run shell `file usr/bin/wasmkit` and verify outputs include x86_64 and arm64 arch. An outstanding question is whether to add a check that toolchain executables are universal binaries on macOS. Currently they are, except for `docc`.
- **Reviewers**: @kateinoigakukun 

[1] https://www.swift.org/documentation/articles/wasm-getting-started.html
2025-06-26 10:32:26 +01:00
Tim Kientzle
3bacc327e9 Merge pull request #82186 from finagolfin/droid
[6.2][android] Fix the remaining tests and add a build flag that enables standalone cross-compilation SDKs
2025-06-23 11:41:14 -07:00
Andrew Kaster
78f9dc678c utils: Add llvm-symbolizer to install_components_with_clang presets
llvm-symbolizer is critical to ASAN/LSAN properly reading and applying
allowlists and suppressions. Without properly symbolized backtraces,
the tools cannot match stack traces to suppression lists, leading to
false negatives in leak detection and other issues.

Ensure that it's installed in the toolchain presets.
2025-06-16 10:19:29 -06:00
Owen Voorhees
8ddcd619cf [update-checkout] Update swift-system to 1.5.0 2025-06-12 12:59:26 -07:00
finagolfin
6065c13a23 [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 22:00:05 +05:30
finagolfin
2e5e72baa2 [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-11 21:59:52 +05:30
Joe Groff
a89f9de96a Merge pull request #82028 from Steelskin/fabrice/line-directive-stop-expanding-response-files
line-directive: Actually stop expanding response files
2025-06-10 14:31:53 -07:00
Saleem Abdulrasool
c4a2e681f4 Merge pull request #82023 from Steelskin/fabrice/line-directive-update-comment
line-directive: Update outdated comment
2025-06-10 14:31:42 -07:00
Saleem Abdulrasool
3407cecfaf Merge pull request #81996 from Steelskin/fabrice/line-directive-stop-expanding-rsp
line-directive: Stop expanding response files
2025-06-10 14:31:15 -07:00
Ben Barham
849cd8ee9a [Build] Pass the toolchain version through to Swift's compilation
Passes the value of the environment variable `TOOLCHAIN_VERSION` through
to Swift's `SWIFT_TOOLCHAIN_VERSION` for use in eg.
`-print-target-info` (and some day, `--version`).

(cherry picked from commit 3982ebbbb3)
2025-06-08 17:18:36 -07:00
Evan Wilde
91c92922fd Merge pull request #81788 from etcwilde/ewilde/6.2-wmo-swift-testing
Build Swift-Testing with WMO
2025-06-03 11:15:44 -07:00
Konrad `ktoso` Malawski
c8a8183d26 [6.2][Concurrency][SE-review update] Task names update (#81132)
**Description**: This adds "task name" parameter to all task creating
functions.

This is done in a few ways, e.g. we can backdeploy this to 5.1 in APIs
which do not accept the `TaskExecutor` but it they do we provide a
version for 6.0+ etc. This was requested in the SE acceptable of this
proposal [Acceptance post
SE-0469](https://forums.swift.org/t/accepted-with-modifications-se-0469-task-naming/79438).

This moves all these declarations to gyb since going through them one by
one has become unmaintainable otherwise.

**Scope/Impact**: All task creation APIs now gain a new task name
parameter.
**Risk:** Medium, changes existing APIs rather than adding "even more
overloads" though this risk was discussed in the team and accepted. This
has a potential to be source breaking it someone used Task.init and
friends as function.
**Testing**: CI testing, source compatibility suite testing
**Reviewed by**: 

**Original PR:** 
- https://github.com/swiftlang/swift/pull/81107 build changes required
for this
- https://github.com/swiftlang/swift/pull/80984


**Radar:**

---------

Co-authored-by: Kuba Mracek <mracek@apple.com>
2025-05-29 07:52:33 +09:00
Evan Wilde
379e445238 Build Swift-Testing with WMO
This tells build-script to build Swift-testing with WMO.
This results in a faster build products, but is also necessary for
configurations using the legacy swift driver, which would emit an
invalid swift interface in non-WMO builds.

Fixes: rdar://151357567
(cherry picked from commit 5f2b0022d1)
2025-05-27 14:37:03 -07:00