-
Notifications
You must be signed in to change notification settings - Fork 137
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
Support a relative path for the options to "link to source" for the --target-path CLI option #490
Comments
- related to swiftlang#490, updates the documentation to identify that --checkout-path requires an absolute oath, not a relative path.
- related to swiftlang#490, updates the documentation to identify that --checkout-path requires an absolute oath, not a relative path.
* documentation update to clarify CLI option - related to #490, updates the documentation to identify that --checkout-path requires an absolute oath, not a relative path. * Update Sources/docc/DocCDocumentation.docc/distributing-documentation-to-other-developers.md
/cc @ethan-kusters @franklinsch @QuietMisdreavus - the symbol graph extension issue that I mentioned, where extraction from a local binary target resulted in no symbols being found |
Hi, I'm interested in working on this issue. Could I please be assigned it? |
For clarification is the goal of this issue to add support for using relative paths with the Edit: I understand that changes should be made to how Specifically, should a path be assumed to be absolute only if it begins with a slash ("/")? Likewise, should a path be assumed to be relative if it beings with a period (".")? If a path doesn't begin with either a period or a comma, should we validate whether the path is valid as an absolute path or a relative path, giving precedence to treating it as an absolute path if both are valid? Otherwise, using whichever path (relative or absolute) is valid. |
For my part, I would tend to lean to defaulting to a relative path if there wasn't a clear indicator of an absolute path, which aligns with more of the Unix tools patterns and their general philosophy. So if the path begins with a |
The goal is to use the same command line option for both relative and absolute paths.
I would try to not inspect the raw paths and instead rely on Foundation to determine what's an absolute and a relative file path. You can see that a URL will include the current directory for a relative path string but not for an absolute path string: print(URL(fileURLWithPath: "/some/absolute/url").absoluteString)
// "file:///some/absolute/url"
print(URL(fileURLWithPath: "some/relative/url").absoluteString)
// "file:///path/to/current-directory/some/relative/url" Since this is a user provided command line option, it could also be good to check that the checkout directory exists using guard FileManager.default.directoryExists(atPath: theDeveloperProvidedCheckoutPath) else {
throw ValidationError("...")
} |
I have all the test cases except
Several other test cases within the The same behavior is persistent when I'm running the unit tests locally against apple:main branch. However, I noticed that the tests are passing when ran in the CICD. So the issue is probably on my end. |
@Anthony-Eid I had run into that issue myself for a while and hadn't narrowed it down. It turns out that the failure was when the tests were run sequentially (i.e. |
Feature Name
support relative paths for --target-path
Description
I started trying to use the feature for including links to hosted online source, as described in Distributing Documentation to Other Developers.
The
--target-path
option currently requires an absolute path to the location to reference the source, and it would tremendously more convenient if this were provided in the form of a relative path.Per a thread in swift forums, Franklin made a reference to a likely location for the possible enhancement.
Motivation
Allowing a relative path makes any CI/scripted work significantly easier for generating documentation, as it more easily divorces the location from the machine. It's possible to work around this in a shell script (something like
"$(dirname $(dirname $(filepath $0)))"
, as seen in https://github.com/apple/swift-markdown/blob/main/bin/update-gh-pages-documentation-site), but that's not common knowledge or easily found.Importance
Entirely an ease-of-use scenario
Alternatives Considered
No response
The text was updated successfully, but these errors were encountered: