apple / apple/swift-system

Isolate Windows codebase from UN*X systems

Open
#94 4 comments 5 reactions 0 assignees View on GitHub
Windows
Dominant language
Swift
Stars
1.4k
Forks
154
PR merge metrics
No merged PRs in 30d

Description

We keep breaking the Windows port whenever we land a new feature for Darwin and/or Linux. This needs to stop.

There is absolutely no reason the Windows port of swift-system needs to be built from the same sources (or provide the same APIs) as UN*X systems; in fact, this is detrimental to the objective of this project and only serves to make it more difficult/error-prone to maintain this package. To a lesser extent, this is also true of Linux vs Darwin.

- Set up platform-specific directories under Sources/ and Tests/. Explicitly exclude source files that wrap POSIX/Darwin/Linux syscalls from the Windows build, and vice versa.
- For cases where code sharing across platforms actually makes sense (i.e. _some_ POSIX calls on Linux & Darwin), set up a POSIX/ platform directory, and include the sources therein in both the Darwin and Linux builds. **If** we want to keep some parts of the implementation of `FilePath` shared across all platforms, then move those parts into a `shared/` or `common/` subdirectory.
- Just like the actual build, tests are platform specific, and they need to be configured accordingly. The test suite in this package is currently completely broken on Windows.
- Never, ever, pretend that Windows implements POSIX system calls.

Contributor guide

Open the contributing guide

Research direction

Start by inspecting the platform layout under Sources/ and Tests/ and how the current Swift package build selects files. Run the test suite on Windows to identify the broken cross-platform assumptions, then verify that POSIX, Darwin, Linux, and Windows sources and tests are selected separately, with shared code isolated only where appropriate.

Written by the indexing model from the issue text.

Assessment

Tech stack
swift
Domain
build-system, operating-systems, testing
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.