Commit Graph

915 Commits

Author SHA1 Message Date
Ben Barham
85f7797dd6 Merge pull request #82514 from bnbarham/use-compiler-version
Use SWIFT_COMPILER_VERSION before SWIFT_TOOLCHAIN_VERSION if it exists
2025-07-21 13:38:50 -07:00
Max Desiatov
44a68115bf Merge pull request #83135 from MaxDesiatov/test-wasm-stdlib
build-script: allow `--test-wasm-stdlib` without `--build-wasm-stdlib`

This allows testing Wasm stdlib without fully rebuilding WASI sysroot and stdlib, while changes to stdlib itself are still detected by ninja as dependencies and are built incrementally, which is great for local builds.
2025-07-21 17:22:25 +01:00
Max Desiatov
cf0e96c84b build_script_invocation.py: add a note about wasi-sdk-26 adoption 2025-07-21 12:14:48 +01:00
Yuta Saito
e76997aad2 Merge pull request #83191 from kateinoigakukun/yt/xctest-build-wasi 2025-07-21 18:42:04 +09:00
Yuta Saito
960afc5754 Merge pull request #83167 from kateinoigakukun/yt/wasip1
[wasm] Rename `wasm32-unknown-wasi` to `wasm32-unknown-wasip1`
2025-07-21 10:35:33 +09:00
Yuta Saito
686d65513d [wasm] Build and install XCTest for Wasm Swift SDK
Install static XCTest library and its Swift module files in the following
directory structure:

```
usr/lib/swift_static/wasi/libXCTest.a
usr/lib/swift_static/wasi/XCTest.swiftmodule
```
2025-07-20 00:14:34 +00:00
Max Desiatov
0cd57218aa Merge pull request #83134 from MaxDesiatov/consistent-wasmkit-path
wasm-run.py: consistent `wasmkit` path with `build_runtime_with_host_compiler`

When passing `--build-runtime-with-host-compiler` there's no such executable `wasmkit-cli` in the host toolchain, where it's named `wasmkit` when installed. Let's make that consistent to make it work in both cases.
2025-07-18 15:52:18 +01:00
Max Desiatov
b9721408f7 wasmkit.py: copy to wasmkit not wasmkit-cli path 2025-07-18 09:54:46 +01:00
Yuta Saito
3a0d5fd0a1 [wasm] Rename wasm32-unknown-wasi to wasm32-unknown-wasip1 2025-07-18 02:03:16 +00:00
Max Desiatov
b6c791784d [NFC] wasmstdlib.py: fix Python typing error (#83125)
Fix type error in `should_test_executable`:
```
reportIncompatibleMethodOverride: Method "should_test_executable" overrides class "WasmStdlib" in an incompatible manner
Return type mismatch: base method returns type "Literal[True]", override returns type "Literal[False]"
"Literal[False]" is not assignable to type "Literal[True]"
```
2025-07-17 16:14:30 -07:00
Max Desiatov
f895331630 wasisysroot.py: fix build_runtime_with_host_compiler diagnostics (#83129)
Improve diagnostics when `llvm-ar` is not detected in the currently select toolchain.
2025-07-17 21:59:52 +01:00
Max Desiatov
95bbfd3406 build-script: allow --test-wasm-stdlib without --build-wasm-stdlib
This allows testing Wasm stdlib without rebuilding WASI sysroot and stdlib, while some changes are still detected by ninja as dependencies and are rebuilt, which is great for local incremental builds.
2025-07-17 17:46:01 +01:00
Ben Barham
ec46a4f026 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.
2025-07-11 15:21:43 -07:00
Max Desiatov
113ddb45d5 wasisysroot.py: respect args.build_runtime_with_host_compiler (#82946)
This allows quickly building WASI sysroot when `--skip-build-llvm --skip-build-swift --build-runtime-with-host-compiler --build-wasm-stdlib` combination of options is passed to `build-script`.
2025-07-11 11:51:46 -07:00
finagolfin
d2ea4789d8 Merge pull request #82924 from finagolfin/cmake
[build] Fix libcurl and cross-compiling corelibs
2025-07-11 16:15:03 +05:30
Max Desiatov
f1a1bb09f7 WasmLLVMRuntimeLibs: respect args.build_runtime_with_host_compiler (#82949)
This allows quickly building `WasmLLVMRuntimeLibs` product with the host toolchain (usually Swift nightly development snapshot toolchain) when `--skip-build-llvm --skip-build-swift --build-runtime-with-host-compiler` combination of options is passed to `build-script`.
2025-07-10 17:58:22 -07:00
Max Desiatov
b0f1283c40 wasmstdlib.py: respect args.build_runtime_with_host_compiler (#82944)
This allows quickly building WASI-libc and Swift stdlib with WASI when `--skip-build-llvm --skip-build-swift --build-runtime-with-host-compiler` combination of options is passed to `build-script`.
2025-07-10 14:22:18 -07:00
Finagolfin
fd369624de [build] Fix libcurl for typos and correct name of build target 2025-07-10 12:41:09 +05:30
Max Desiatov
6f6ce0ad53 build-script: Add --install-wasmkit option (#82871)
This allows skipping the installation for WasmKit when building it, which is consistent to how other products are handled by `build-script`, where they have separate `--install` options. Existing behavior is preserved: passing `--wasmkit` alone will install it, but now `--wasmkit --install-wasmkit false` will skip its installation step.
2025-07-08 20:26:54 +01:00
Max Desiatov
9ae9696cd3 build-script: add missing ignore_extra_cmake_options for Wasm (#82873)
With the addition of libxml2 and Foundation builds, lack of `ignore_extra_cmake_options=True` regressed macOS builds, where `extra-cmake-options` from macOS presets are picked up, overriding required `CMAKE_CXX_FLAGS` that need to be used for these products instead.
2025-07-08 17:09:45 +01:00
Max Desiatov
0889db77aa build-script: flush compiler-rt embedded builtins logs in llvm.py (#82872)
Current use of `print` without `flush=True` outputs these logs at the end of a `build-script` run, after the supposedly final `--- Build Script Analyzer ---` output, which is quite confusing when reading logs.
2025-07-08 07:53:12 -07:00
Max Desiatov
407bbb6bc0 build-script: Add --install-wasmkit option
This allows skipping the installation step and only building WasmKit, which is consistent to how other products are handled by `build-script`, where they have separate `--install` options. Existing behavior is preserved, where passing `--wasmkit` alone will install it, but now `--wasmkit --install-wasmkit false` will skip its installation step.
2025-07-08 10:22:39 +01:00
Max Desiatov
a073e6610e Merge pull request #82839 from MaxDesiatov/maxd/wasmkit-with-host-tools
For small local incremental builds that require WasmKit it's faster to build WasmKit with the host toolchain instead of waiting for a full bootstrap build to complete.
2025-07-08 08:10:40 +01:00
Max Desiatov
4a8871f94b Respect --build-runtime-with-host-compiler in wasmkit.py 2025-07-07 15:21:51 +01:00
Max Desiatov
03dd520646 Add swift_build/swift-build to swift_build_support/toolchain.py
This exposes `swift-build` from toolchains, which allows products to use this tool directly when building
2025-07-07 15:16:52 +01:00
Max Desiatov
461f7d026b Fix typo in reset func in productpipeline_list_builder.py (#82777)
`pipelinst_list` -> `pipeline_list`

There are no other uses of `pipelinst_list`, so it's clearly a typo when trying to refer to `pipeline_list`
2025-07-04 23:02:16 +01:00
Max Desiatov
0c4e56174b Merge pull request #82399 from swiftlang/maxd/embedded-wasm-tests
These tests still require a manual `lit.py` invocation for Wasm, which will be added as a separate CMake target in a future PR.
2025-07-04 15:36:15 +01:00
Yuta Saito
05204bdf63 Merge pull request #82285 from kateinoigakukun/yt/build-foundation 2025-07-04 22:02:14 +09:00
Max Desiatov
572c52955b NFC: Fix doc comment typo in productpipeline_list_builder.py (#82771)
`Product a final schedule` -> `Produce a final schedule`
2025-07-04 05:49:38 -07:00
Mishal Shah
65d9f5f71c Merge pull request #82729 from etcwilde/ewilde/build-script-divide-by-zero
Build-Script: Don't divide by zero
2025-07-03 15:46:49 -07:00
Yuta Saito
838e9543e8 [wasm] Build and install Foundation for Wasm SDK 2025-07-03 03:25:17 +00:00
Yuta Saito
245dd83e47 Revert "Revert "[wasm] Build and install libxml2 for Wasm SDK""
This reverts commit d5abfa431b.
2025-07-03 03:25:17 +00:00
Evan Wilde
f64b5a0488 Build-Script: Don't divide by zero
If things crash very early on, build-script tries to divide by zero when
computing the percent time spent in each project because the build time
is zero. While this is a failure state, all it does is add more output
to the crashing stack trace.
2025-07-02 10:59:55 -07:00
finagolfin
b2f52524c5 [android] Disable a couple Reflection tests and fix an install path (#82620)
The tests broke on the community Android CI since #82325, and 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-02 09:41:59 +05:30
Max Desiatov
27e5d5c551 Fix/xfail/disable remaining tests for embedded Wasm 2025-07-01 11:43:43 +01:00
3405691582
1cf426c905 Plumb native-clang-tools-path to build support. (#81587)
The build support Python libraries assume by default that if we do not
supply a Swift toolchain path, we can find clang in the installed
toolchain path: i.e., the clang that we just built. However, possibly
during bootstrap, we may not have a preexisting Swift compiler but still
want to use the clang on the platform that is already installed.

build-script already gives us native-clang-tools-path. Here, we plumb
this through to the relevant Python modules. If the
native-clang-tools-path is not specified, we use the
install_toolchain_path, just like native_toolchain_path, and the
existing behavior is effectively unchanged. If we do specify a
native-clang-tools-path, then we return it to ensure that we properly
refer to the clang that lives there instead of always defaulting to the
just-built clang.
2025-06-30 10:07:59 -07:00
Max Desiatov
92dd843a18 Fix building Wasm stdlib with macOS presets (#80850)
Added optional `ignore_extra_cmake_options` to `cmake_product.py`, existing behavior is preserved with the default argument value set to `False`.

Passed `ignore_extra_cmake_options=True` in `wasisysroot.py`. This allows libc++ for WASI to be built correctly with `-fno-exceptions` in presence of `extra-cmake-options` in macOS presets (which are absent in Linux presets).
2025-06-24 11:15:25 -07:00
Yuta Saito
9488df15e0 Merge pull request #82393 from wti/wasmkit-universal-fix-82390
Update wasmkit toolchain build to emit universal binary on macOS to fix #82390
2025-06-23 13:58:09 +09:00
Max Desiatov
9b9db58b21 Discover embedded tests when testing wasmstdlib.py (#82376)
Embedded tests are only included in test discovery for `wasmstdlib` product, a separate change is needed to mark relevant tests as supported.

Without this change:

```
[2025-06-21T00:53:52.507Z] --- Running tests for wasmstdlib ---
[...]
[2025-06-21T00:59:22.874Z] Total Discovered Tests: 1405
[2025-06-21T00:59:22.874Z]   Excluded         :   2 (0.14%)
[2025-06-21T00:59:22.874Z]   Unsupported      : 725 (51.60%)
[2025-06-21T00:59:22.874Z]   Passed           : 674 (47.97%)
[2025-06-21T00:59:22.874Z]   Expectedly Failed:   4 (0.28%)
[...]
[2025-06-20T17:42:41.045Z] Build Percentage 	 Build Duration (sec) 	 Build Phase
[2025-06-20T17:42:41.045Z] ================ 	 ==================== 	 ===========
[...]
[2025-06-21T02:02:24.048Z] 3.0%              	 324.31                	 Running tests for wasmstdlib
```

With this change:

```
[2025-06-20T16:33:58.389Z] --- Running tests for wasmstdlib ---
[...]
[2025-06-20T16:39:29.285Z] Total Discovered Tests: 1626
[2025-06-20T16:39:29.285Z]   Excluded         :   2 (0.12%)
[2025-06-20T16:39:29.285Z]   Unsupported      : 946 (58.18%)
[2025-06-20T16:39:29.285Z]   Passed           : 674 (41.45%)
[2025-06-20T16:39:29.285Z]   Expectedly Failed:   4 (0.25%)
[...]
[2025-06-20T17:42:41.045Z] Build Percentage 	 Build Duration (sec) 	 Build Phase
[2025-06-20T17:42:41.045Z] ================ 	 ==================== 	 ===========
[...]
[2025-06-20T17:42:41.045Z] 3.0%              	 322.87                	 Running tests for wasmstdlib
```
2025-06-21 13:47:55 -07:00
wti
65302367d0 Update wasmkit toolchain build to emit universal on macOS to fix #82390
[platform_args] has platform variants of SwiftPM wasmkit build command:
- unchanged: non-macOS + set_installation_rpath -> rpath config
- added: macOS -> universal binaries using --arch

side effect ok?: binary path changes are captured by '--show-bin-path'
2025-06-21 11:20:40 -07:00
Eric Miotto
218799aedb [build-script] build LLVMTestingSupport only if target is generated
Otherwise the build will fail if we pass `--no-llvm-include-tests` or we
set directly `LLVM_INCLUDE_TESTS` directly to `FALSE`/`OFF`

Addresses rdar://153562845
2025-06-16 15:01:32 -07:00
Eric Miotto
d3f8bbffcb Merge pull request #82124 from edymtt/edymtt/remove-old-way-of-building-compiler-rt
build-script: Remove support for legacy way of building compiler-rt
2025-06-16 12:35:21 -07:00
Max Desiatov
d733338626 build-script: fix --skip-build-llvm not having full effect (#82233)
While LLVM cannot be completely disabled when Swift or LLDB are built, we should still allow skipping LLVM configuration and build steps when Swift and LLDB are not built. This can happen, for example, when `build-script` user wants an ad-hoc incremental build with `--skip-build-swift` and `--skip-build-lldb` for products that don't depend on LLVM and Swift, or if LLVM and Swift were already configured and built in previous `build-script` invocations.
2025-06-16 12:05:31 -07:00
Yuta Saito
df9bed6a29 [wasm] Enable building swift-testing for wasm32-unknown-wasip1-threads 2025-06-12 07:57:40 +09:00
Eric Miotto
b7f8eb7480 build-script: Remove support for legacy way of building compiler-rt
Addresses rdar://149293315
2025-06-11 14:39:05 -07:00
Yuta Saito
2549627293 Merge pull request #82123 from kateinoigakukun/yt/fix-swt-crash-wmo 2025-06-11 06:25:57 +09:00
Yuta Saito
e46480e98c [wasm] Emit libTesting.a objects with single-threaded LLVM codegen unit
Since 5f2b0022d1, swift-testing is being
compiled with WMO, which removes some of inter-object references in
object files by DCE. The inter-object reference removal revealed a
long-standing issue that the runtime metadata sections of objects in an
archive are not always included in the final binary if symbols from
those objects are not referenced anywhere. To force including all
metadata sections in the final binary, we have to emit everything in a
single object file when building the archive.
This issue happens only for Wasm SDK, which ships swift-testing as a
static archive.
2025-06-09 21:48:59 +00:00
Ben Barham
3982ebbbb3 [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`).
2025-06-06 15:09:21 -07:00
Alastair Houghton
df35df17ce [Build] Fix the minimal-stdlib build by setting a deployment version.
We need to set a deployment version, not just blank, because otherwise
we don't know the correct deployment target to use for the standard
library.
2025-06-05 13:09:43 +01:00
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