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
Move most stuff to a lib #40
Conversation
# Conflicts: # Package.resolved
Addresses #39 |
b651f54
to
8e881bf
Compare
Poked Travis settings to use Swift 5.1, the only thing still failing is |
Hi @designatednerd, I'm looking into this (almost two months later, I know 🙈). First of all, thank you very much for doing this. I think it's a great change for the repo. Few changes I'd like to do before merging:
I'm going to try to push this changes, but never done that on a fork PR before, so not sure how it works. Will see. |
Looks like I cannot push to this PR, so a new one has been created: #41 |
So the problem with moving the command-handling code back to the library is that I can't actually call any of the commands outside the library if we do that. Here's how I'm using it now. If there's a way to separate the options stuff from the commander stuff, that'd probably be best, but I didn't see a straightforward way to do that. Basically this isn't all that helpful if I can't run the commands from outside the CLI 🙃 |
I see, thanks for the link. Yeah, a new public interface will have to be defined. The idea is that the library part would not need to depend on Commandant, Rainbow, or any other command line related code. I can take care of that, not sure how soon but will work towards it. Will ping you when I have something ready! :) |
Hi @designatednerd, I've submitted a new pull request to move code into You would need to update your code in apollo-ios like this: let options = DocumentOptions(moduleName: target.name,
linkEndingText: "/",
inputFolder: sourceRootURL.path,
outputFolder: outputURL.path,
clean: true,
xcodeArguments: [
"-scheme",
target.scheme,
"-project",
"Apollo.xcodeproj"])
do {
try DocumentationGenerator(options: options).run()
CodegenLogger.log("Generated docs for \(target.name)")
} catch {
CodegenLogger.log("Error generating docs for \(target.name): \(error)", logLevel: .error)
exit(1)
} |
#### Breaking - Add `SourceDocsLib` so it can be used by other Swift tools to generate documentation. #### Enhancements - Migrated from `Commandant` to [`Swift Argument Parser`](https://github.com/apple/swift-argument-parser) for command line parsing #### Bug Fixes - None ### Discussion This pull requests is based in the work done by @designatednerd on #40, to move most code to `SourceDocsLib`, a new library that can be imported y other Swift applications to generate documentation. With the migration from **Commandant** to **Swift Argument Parser**, this pull request also sets the base for version 1.0.0. Command line arguments have not changed from prior versions of the tool.
Closed in favor of #42 |
#### Breaking - Add `SourceDocsLib` so it can be used by other Swift tools to generate documentation. #### Enhancements - Migrated from `Commandant` to [`Swift Argument Parser`](https://github.com/apple/swift-argument-parser) for command line parsing #### Bug Fixes - None ### Discussion This pull requests is based in the work done by @designatednerd on SourceDocs#40, to move most code to `SourceDocsLib`, a new library that can be imported y other Swift applications to generate documentation. With the migration from **Commandant** to **Swift Argument Parser**, this pull request also sets the base for version 1.0.0. Command line arguments have not changed from prior versions of the tool.
Enhancements
SourceDocsLib
which can be imported separately from the executable, and used within Swift Package Manager ScriptsBug Fixes
Further comments
swift run MyProject
and not when I build my project in Xcode. When I build in Xcode i'm gettingPlease confirm that
xcodebuildis building a Swift module.
. I think from looking at a bunch of issues on Jazzy, this is probably related to SourceKitten, which they also depend on. However, I think this is at least workable in terms of running on the command line similarly to the previous version.swift test
but will fail if run via Xcode - thesystem
lib seems to not really enjoy being run from Xcode.Commandant
and a bunch of other stuff being used here just pipe everything out tostdout
, which makes it awfully hard to test. I know there'sShellOut
that returns strings in addition to sending them to the console, which makes it a LOT easier to test that things are working correctly.I'm good with this getting merged as a phase one since it works, but wanted to share those notes for use in terms of future rethinks.