Skip to content

Disable Swift Configuration Traits - #184

Open
0xTim wants to merge 1 commit into
apple:mainfrom
0xTim:no-swift-config-traits
Open

Disable Swift Configuration Traits#184
0xTim wants to merge 1 commit into
apple:mainfrom
0xTim:no-swift-config-traits

Conversation

@0xTim

@0xTim 0xTim commented Aug 11, 2026

Copy link
Copy Markdown

Motivation

Swift Configuration's default traits pull in full Foundation because they enable the JSON configuration provider, which uses JSONSerialization. That undoes all the hard work in the library to only use FoundationEssentials as full foundation will be linked anyway. Since the HTTP APIs doesn't need any of the trait-hidden code, let's not include them.

Related to swift-server/swift-http-server#109

Modifications

Don't link full Foundation

Result

Downstream packages won't be forced to include the full Foundation

Test Plan

Compilation is enough

Comment thread Package.swift
.package(url: "https://github.com/apple/swift-nio-extras.git", from: "1.34.1"),
.package(url: "https://github.com/apple/swift-nio-http2.git", from: "1.44.0"),
.package(url: "https://github.com/apple/swift-configuration.git", from: "1.2.0"),
.package(url: "https://github.com/apple/swift-configuration.git", from: "1.2.0", traits: []),

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

we should likely have a test case (/ci job), that validates that we don't link full Foundation when default traits are being used.

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.

3 participants