Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce a pure Swift runfiles library #1310

Open
wants to merge 44 commits into
base: master
Choose a base branch
from

Conversation

cerisier
Copy link
Contributor

@cerisier cerisier commented Sep 17, 2024

First shot at implementing #890

Main implementation

I followed guidance from @fmeum and based this implementation on the runfiles library of rules_python where applicable since this was pointed as the reference implementation.

In addition to rules_python implementation, this implementation uses a similar mechanism as the C++ implementation for deducing the RUNFILES_DIR and RUNFILES_MANIFEST_FILE location based on argv0.

TODO

  • Implement runfiles directory detection from argv0
  • Discuss the proper way to solve the current repository issue and whether to keep the BazelRunfilesConstants file generation.
  • Fix Linux compat

swift/runfiles/README.md Outdated Show resolved Hide resolved
@cerisier cerisier changed the title Introduce a runfiles library Introduce a pure Swift runfiles library Jan 4, 2025
swift/runfiles/README.md Outdated Show resolved Hide resolved
examples/runfiles/main.swift Outdated Show resolved Hide resolved
Co-authored-by: Brentley Jones <[email protected]>
Copy link
Contributor

@luispadron luispadron left a comment

Choose a reason for hiding this comment

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

Looking great, thank you for all the work on this. Some comments for an initial review

examples/runfiles/BUILD Outdated Show resolved Hide resolved
examples/runfiles/main.swift Outdated Show resolved Hide resolved
swift/runfiles/README.md Outdated Show resolved Hide resolved
swift/runfiles/README.md Outdated Show resolved Hide resolved
swift/runfiles/README.md Outdated Show resolved Hide resolved
swift/runfiles/Runfiles.swift Outdated Show resolved Hide resolved
swift/runfiles/Runfiles.swift Outdated Show resolved Hide resolved
swift/runfiles/Runfiles.swift Show resolved Hide resolved
swift/runfiles/Runfiles.swift Outdated Show resolved Hide resolved
swift/runfiles/Runfiles.swift Outdated Show resolved Hide resolved
Copy link

@fmeum fmeum left a comment

Choose a reason for hiding this comment

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

Well done, thanks for adding this!

swift/runfiles/README.md Outdated Show resolved Hide resolved
let lines = content.split(separator: "\n")
for line in lines {
let fields = line.split(separator: " ", maxSplits: 1)
if fields.count == 1 {
Copy link

Choose a reason for hiding this comment

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

Optional, but you could already implement support for spaces in runfiles paths, with bazelbuild/bazel@7407cef#diff-eda2cfbaa083288dc8cae33e5028d63831a52cf4967e1e88d4eb02aa103ea56f as a reference.

Co-authored-by: Fabian Meumertzheim <[email protected]>
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