Skip to content

Conversation

milseman
Copy link
Member

@milseman milseman commented Sep 2, 2025

Add System to the toolchain, so that Foundation can depend on it.


Whether this product is produced by build-script-impl.
"""
return True
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should avoid to implement new build products in build-script-impl unless it is absolutely necessary -- at first glance, it looks like SwiftSystem can build in the same "phase" as EarlySwiftDriver.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agree, we are trying to deprecate the bash script build-script-impl, not add to it. Take a look at the cmark, Testing, or massive LLVM Python product config for examples.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would love to not have to touch build-script-impl. Would these python files and build.ps1 then be the only things that need to be touched?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, this file would be longer, as you'd move that build config from build-script-impl here, as was done for LLVM before.

@@ -61,7 +61,7 @@ set TMPDIR=%BuildRoot%\tmp
set NINJA_STATUS=[%%f/%%t][%%p][%%es]

:: Build the -Test argument, if any, by subtracting skipped tests
set TestArg=-Test lld,lldb,swift,dispatch,foundation,xctest,swift-format,sourcekit-lsp,
set TestArg=-Test lld,lldb,swift,dispatch,system,foundation,xctest,swift-format,sourcekit-lsp,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

From a quick peek at build.ps1, it looks we may need to change the Build-Foundation function to add the SwiftSystem dependency.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, we will need to re-organise the build a bit. We will need to add a new Build-System invocations in the SDK phases (should measure with static and dynamic linking) and pass that to the Foundation build.

@milseman
Copy link
Member Author

@swift-ci Please Build Toolchain

@milseman
Copy link
Member Author

milseman commented Oct 2, 2025

@swift-ci Please Build Toolchain

@milseman milseman marked this pull request as ready for review October 16, 2025 16:33
"--lldb-build-type", args.lldb_build_variant,
"--foundation-build-type", args.foundation_build_variant,
# TODO: Do I have the option here?
# "--swift-system-build-type", args.swift_system_build_variant,
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if I should add the option here and do more plumbing, or if these arguments are just for the legacy build_script_impl path.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, these are only to pass flags to build-script-impl, which you correctly are no longer using for this new build product, so nothing to add here.

def _for_each_host_target(self, base_target, body):
body(base_target)

# TODO: what do we do here? We're not built on Darwin
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note: I was cribbing off of SwiftTesting. Not sure whether I need all of this machinery. System won't be built on Darwin as part of the toolchain (it's like SwiftFoundation in that regard).

override_deployment_version = None

# TODO: Do we need this, or should we adjust our own version?
if host_target.startswith('macosx'):
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similarly, should this just go away?

@milseman
Copy link
Member Author

@edymtt @finagolfin I pushed updates that get us off of modifying build_script_impl. Could you take a look?

@milseman
Copy link
Member Author

@swift-ci Please Build Toolchain

const='Debug',
help='build the Debug variant of System')

option('--swift-system-tests-build-type', store('swift_system_tests_build_variant'),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added this flag for Foundation only because it was super slow to build in release mode: is that a problem for System too? If not, no reason to add a separate flag for the test build variant.

# `install_with_cmake` later which already has the same prefix.
self.cmake_options.define('CMAKE_INSTALL_PREFIX', '')

self.cmake_options.define('CMAKE_BUILD_TYPE', self.args.build_variant)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the default build variant, you'll want to override it with the system_build_variant flag you are adding.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants