Commit Graph

426 Commits

Author SHA1 Message Date
Evan Wilde
6ad5c40caa Merge pull request #81364 from etcwilde/ewilde/extend-swift-cmake-options
[Build-Script]: Extend Swift cmake options
2025-05-09 09:07:48 -07:00
finagolfin
e76b97e2b7 [build-script] Add an option to build the Foundation tests in another mode (#78390)
Use it in the linux CI presets to set them to Debug mode and speed up
the linux CI, plus add a new preset which keeps building them in Release
mode.

I was looking at a passing linux CI run and saw the log timings at the
end: it takes [longer to build and test the swift-foundation repos than
to compile all 7k+ mostly C++ files in
LLVM](https://ci.swift.org/job/swift-PR-Linux/18996/console)!
```
--- Build Script Analyzer ---
Build Script Log: /home/build-user/build/.build_script_log
Build Percentage 	 Build Duration (sec) 	 Build Phase
================ 	 ==================== 	 ===========
9.2%              	 1132.94               	 Running tests for foundationtests
9.1%              	 1120.57               	 linux-x86_64-swift-build
9.0%              	 1104.2                	 Building llvm
7.2%              	 878.84                	 Running tests for swiftfoundationtests
6.5%              	 796.81                	 Running tests for swiftpm
5.6%              	 684.7                 	 Building swiftpm
5.5%              	 667.92                	 linux-x86_64-swift-test
4.9%              	 597.64
```
Looking at the log, building swift-foundation in release mode takes a
long time, so let's see if changing it to debug mode helps. Some
background - the Foundation repos are built twice on the linux CI: once
by CMake, which is the version installed in the toolchain, then a second
time by SwiftPM purely for testing.

This pull only affects that second SwiftPM build for testing, which is
not shipped in the final toolchain but thrown away.
2025-05-09 21:07:01 +05:30
Evan Wilde
004a738c70 [Build-Script]: Extend Swift cmake options
The existing swift-cmake-options flag overwrites all flags computed by
build-script. Sometimes it is useful to be able to append additional
CMake flags without overwriting the existing flags.
This patch adds `--extra-swift-cmake-options` that adds the specified
flags to the Swift CMake configuration instead of overwriting them.

This also adds a similar `--extra-llvm-cmake-options`, which adds the
new flags to the end, allowing one to replace and overwrite CMake flags
that build-script computed.
Due to the parameter passing mechanisms in build-script-impl, while this
behavior would be useful for Swift, it is not immediately apparent how
one would best implement this at this time.
2025-05-07 14:49:45 -07:00
Eric Miotto
26bdff8fe5 Merge pull request #80253 from edymtt/edymtt/use-runtimes-build-quater-enabled-by-default
Use LLVM_USE_RUNTIMES to build compiler-rt by default
2025-04-30 12:05:13 -07:00
Evan Wilde
838d69f0f4 Build Swift Testing: Add build_subdir
Adding a build_subdir preset default for the stage 0 and stage 1 build
configurations.
2025-04-25 16:18:52 -07:00
Eric Miotto
c983cac3a9 Use LLVM_ENABLE_RUNTIMES to build compiler-rt by default
Addresses rdar://113972453
2025-04-22 08:13:33 -07: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
Evan Wilde
9402a1689b Automatically choose a built ninja
Instead of using `--build-ninja` to decide to build ninja, build it
automatically if a sufficiently new enough version is not available.
Also record the build time taken to build the local Ninja so that we can
see how much time we would save by stashing a pre-built Ninja in CI.
2025-03-19 07:35:32 -07:00
Michael Gottesman
243cfe0719 Merge pull request #79804 from gottesmm/pr-f26aec536f9d333150b49e0faf50a70a9a26ac53
Add a flag to enable-new-runtime-build that enables the new runtime build
2025-03-07 16:03:49 -08:00
Alex Hoppen
67f312cc2f Merge pull request #79834 from ahoppen/remove-syntax-lint
[build-script] Remove option to lint swift-syntax
2025-03-07 06:42:29 -08:00
Alex Hoppen
7256a92775 [build-script] Remove option to lint swift-syntax
This is being verified by GitHub Actions now as of https://github.com/swiftlang/swift-syntax/pull/2998.
2025-03-06 18:38:47 -08:00
Michael Gottesman
7418b42215 Add a flag to enable-new-runtime-build that enables the new runtime build.
What is nice about this is that by not using extra-cmake-args, we can avoid
passing this into LLVM as well when attempting to reproduce failures on the bots
(thus avoiding having to rebuild LLVM as well).
2025-03-05 14:10:26 -08:00
Michael Gottesman
f68e23aaf1 Merge pull request #79329 from gottesmm/pr-295dfc37ee8e5bf71b1249c2717a30c37de1aee2
[build-script] Add an option to force the linker used.
2025-02-14 21:09:09 -08:00
Michael Gottesman
3e2a6f6665 [build-script] Add an option to force the linker used.
I have been doing this using extra-cmake-args/etc... just feels better to have
an actual option to do this.

Just did this quickly while waiting for my Linux build to finish that uses
extra-cmake-args to set the linker.
2025-02-12 11:49:01 -08: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
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
Alastair Houghton
ca233af1ea [Backtracing] Fix Python test failure.
We needed to add `--enable-runtime-module` in the Python test scripts.

rdar://124913332
2025-01-21 19:02:47 +00:00
Alastair Houghton
760cc57bef [Backtracing] Rename _Backtracing to Runtime.
Move the backtracing code into a new Runtime module.  This means renaming
the Swift Runtime's CMake target because otherwise there will be a name
clash.

rdar://124913332
2025-01-17 10:09:36 +00:00
Yuta Saito
c68db65453 Merge pull request #78341 from kateinoigakukun/katei/add-sourcekit-lsp-verify
CI: Add `--sourcekit-lsp-verify-generated-files` build-script option
2025-01-16 01:09:43 +09:00
Yuta Saito
57cc7c28b9 CI: Add --sourcekit-lsp-verify-generated-files build-script option
To verify that autogenerated files in the source tree match the ones that
would be generated from source.
2024-12-21 19:03:07 +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
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
Mishal Shah
9a48056f15 Bump the Swift version to 6.2 2024-11-22 01:04:37 -08: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
Meghana Gupta
5b5acc64e0 Promote Nonescapable types to a language feature 2024-11-18 18:09:17 -08:00
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
Rintaro Ishizaki
3bc20a9596 [build-script] Enable new parser validation by default
Widen the parser validation coverage.
This encourages the developers to implement the new grammar in
SwiftParser in addition to the old C++ parser.

In case  there's an unavoidable reason not to implement in SwiftParser,
disable the validation for each test case by passing a frontend option
'-disable-experimental-parser-round-trip'. But please file an issue
and add FIXME like:

  // FIXME: Remove '-disable-experimental-parser-round-trip' (rdar://xxx).
2024-10-11 14:46:23 -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
Ian Anderson
5bf2c937ab [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

rdar://115192929
2024-09-11 22:26:37 -07:00
Artem Chikin
1baff87879 Revert "[CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms" 2024-09-09 09:57:14 -07:00
Ian Anderson
8959dd97fe [CMake] [Darwin] Don't build the SDK overlays by default on Apple platforms
The Apple SDKs have been providing the Darwin overlay since macOS 10.14.4, iOS 12.2, et al. More recently the SDK version has diverged from the Swift version making them incompatible. Stop building the overlay from Swift. Once the SDK overlays aren't being built, the clang overlays need to be built in testing.

%target-swift-emit-pcm doesn't use the sdk, but %target-swift-frontend does, which will cause them to have a mismatch with "builtin headers belong to system modules, and _Builtin_ modules are ignored for cstdlib headers" aka LANGOPT(BuiltinHeadersInSystemModules) aka -fbuiltin-headers-in-system-modules.

rdar://115192929
2024-09-06 13:28:14 -07:00
Ben Langmuir
44b68cb5dc Merge pull request #75914 from benlangmuir/turn-it-up-to-11
Bump the deployment target for the compiler to macOS 13.0
2024-09-06 13:23:47 -07:00
Vera Mitchell
c9cc58cd0b update build-script python tests 2024-09-03 13:52:43 -06:00
Vera Mitchell
2dc3995d56 add preview-stdlib-docs command to spin up DocC's preview server 2024-09-03 13:52:42 -06:00
Vera Mitchell
b4529a69eb add build-stdlib-docs flag that generates stdlib symbol graphs 2024-09-03 13:52:42 -06: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
Mishal Shah
3ac0dff27d Bump the Swift version to 6.1 2024-08-19 23:09:31 -07:00
Rintaro Ishizaki
e98c5eab61 [build-script] Separate SwiftTestinMacros from SwiftTesting product
Also, build them for all hosts including cross compiling host.
2024-08-09 14:43:20 -07:00
Stuart Montgomery
c8d7d134b0 Improve description of new build-script flags 2024-08-08 13:13:44 -07:00
Stuart Montgomery
97e85a6bf2 Build script changes to begin building and installing swift-testing into toolchains (on Darwin, so far) 2024-08-08 13:13:44 -07:00
Jeremy Schonfeld
f89db53698 Ensure Foundation tests don't run when passing --skip-foundation-tests (#75573) 2024-07-31 12:54:48 -07:00
Kuba Mracek
c9513c7925 [embedded] Add missing option to expected_options.py 2024-07-30 11:54:18 -07:00
Kuba Mracek
69964f9f22 [embedded] Don't build embedded stdlibs in 'standalone' builds 2024-07-30 10:42:55 -07:00
Finagolfin
6ede1c25e1 [android][build-script] Update the default arch to AArch64, as that is by far the most commonly used now 2024-07-20 17:56:51 +05:30
Jeremy Schonfeld
f3acbb079f Remove ICU from the toolchain (#75262)
* Remove ICU from the toolchain

* Remove icu comment from GettingStarted.md
2024-07-17 18:19:16 -07:00
Carl Peto
ee57481d7c [AVR] AVR support - Initial PR
- Add simple support for the AVR architecture, as a supported conditional compilation value, and added to the default llvm targets to build.

(Later PRs will fix support for 16-bit pointers, which is broken in places, and any fixes needed to get the standard library to build.)

(Note: AVR as a target is expected to always be compiled with -enable-experimental-feature Embedded.)
2024-07-06 18:22:10 +01:00
Kuba (Brecka) Mracek
9e7501601c Merge pull request #74489 from kubamracek/embedded-less-stdlibs
[embedded] Don't build *all* the embedded stdlibs by default
2024-06-18 13:50:25 -07:00
Kuba Mracek
37ed08dc7b Add a build-script + CMake flag to enable/disable building the _Volatile module 2024-06-17 13:18:55 -07:00
Kuba Mracek
dc2edb6e9b [embedded] Don't build *all* the embedded stdlibs by default 2024-06-17 10:32:56 -07:00