Skip to content

Commit 96cd3b5

Browse files
authored
Revert doc-comment reformatting in unified/swift-syntax-rs/build.rs
1 parent 266eef5 commit 96cd3b5

1 file changed

Lines changed: 15 additions & 9 deletions

File tree

‎unified/swift-syntax-rs/build.rs‎

Lines changed: 15 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ fn main() {
4949
}
5050
}
5151

52-
/// Directory containing the active Swift toolchain's runtime libraries
53-
/// (e.g. `libswiftCore.so`).
52+
/// Query the active Swift toolchain for the directory containing its runtime
53+
/// shared libraries (e.g. `libswiftCore.so`).
5454
fn swift_runtime_dir() -> Option<PathBuf> {
5555
let output = Command::new(swiftc_bin())
5656
.arg("-print-target-info")
@@ -61,7 +61,8 @@ fn swift_runtime_dir() -> Option<PathBuf> {
6161
}
6262
let info = String::from_utf8_lossy(&output.stdout);
6363

64-
// Extract `"runtimeResourcePath": "..."` without pulling in a JSON dep.
64+
// Extract the value of `"runtimeResourcePath": "..."` without pulling in a
65+
// JSON dependency.
6566
let key = "\"runtimeResourcePath\"";
6667
let start = info.find(key)?;
6768
let rest = &info[start + key.len()..];
@@ -75,20 +76,25 @@ fn swift_runtime_dir() -> Option<PathBuf> {
7576
Some(PathBuf::from(resource_path).join(if cfg!(target_os = "macos") { "macosx" } else { "linux" }))
7677
}
7778

78-
/// `swift` driver: `$SWIFT` if set, else `swift` from `PATH`.
79+
/// The `swift` driver to invoke: `$SWIFT` if set, otherwise `swift` from `PATH`.
80+
/// This keeps the build tool-agnostic — any Swift install works; no particular
81+
/// version manager is required.
7982
fn swift_bin() -> String {
8083
env::var("SWIFT").unwrap_or_else(|_| "swift".to_string())
8184
}
8285

83-
/// `swiftc` compiler: `$SWIFTC` if set, else `swiftc` from `PATH`.
86+
/// The `swiftc` compiler to invoke: `$SWIFTC` if set, otherwise `swiftc` from
87+
/// `PATH`.
8488
fn swiftc_bin() -> String {
8589
env::var("SWIFTC").unwrap_or_else(|_| "swiftc".to_string())
8690
}
8791

88-
/// Workaround for GitHub Codespaces, which sets
89-
/// `GIT_CONFIG_KEY_0=safe.bareRepository` / `GIT_CONFIG_VALUE_0=explicit` and
90-
/// breaks the cached bare git repos `swift build` uses. Relax to `all` only
91-
/// for this subprocess, and only when that exact key is set.
92+
/// Some environments (notably GitHub Codespaces) inject
93+
/// `GIT_CONFIG_KEY_0=safe.bareRepository` / `GIT_CONFIG_VALUE_0=explicit`, which
94+
/// breaks the cached bare git repositories `swift build` uses. When exactly that
95+
/// key is present, relax it to `all` for the `swift build` subprocess only
96+
/// (rather than unconditionally, which could clobber an unrelated
97+
/// `GIT_CONFIG_VALUE_0`).
9298
fn apply_bare_repository_workaround(command: &mut Command) {
9399
if env::var("GIT_CONFIG_KEY_0").as_deref() == Ok("safe.bareRepository") {
94100
command.env("GIT_CONFIG_VALUE_0", "all");

0 commit comments

Comments
 (0)