Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Comments

Close side panel

Refactor responsibility of writing generated output out of Generate command#117

Merged
liamnichols merged 6 commits intomainCreateAPI/CreateAPI:mainfrom
ln/refactor-output-writingCreateAPI/CreateAPI:ln/refactor-output-writingCopy head branch name to clipboard
Aug 5, 2022
Merged

Refactor responsibility of writing generated output out of Generate command#117
liamnichols merged 6 commits intomainCreateAPI/CreateAPI:mainfrom
ln/refactor-output-writingCreateAPI/CreateAPI:ln/refactor-output-writingCopy head branch name to clipboard

Conversation

@liamnichols
Copy link
Member

In some upcoming changes I want to make adjustments to the logic around writing outputs but I had a bit of a hard time with the way things were currently written. For that reason, I think it was time for a bit of a cleanup 🙂

In this change, I bring in two new types:

  1. OutputWriter, a small and generic class that helps make it easy to write files out into various directory structures. It's completely generic and not tied to any generator implementation details and does a few other things like throw errors if you try writing a file to the same location twice.
  2. Output, basically a wrapper around the two GeneratorOutput's that also includes the generated Package.swift manifest and the relevant GenerateOptions. It provides a nice isolated location for us the new write(to:) method that interacts with OutputWriter and writes the appropriate files to the filesystem.

While I didn't write any tests for these types directly, the overall generator test fixtures remain unchanged which is good proof that it results in an identical output.

@liamnichols liamnichols merged commit a8b5a70 into main Aug 5, 2022
@liamnichols liamnichols deleted the ln/refactor-output-writing branch August 5, 2022 23:33
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.

1 participant

Morty Proxy This is a proxified and sanitized view of the page, visit original site.