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

Fix adding file reference to bundle and package files #234

Merged
merged 5 commits into from
Feb 13, 2018

Conversation

fuzza
Copy link

@fuzza fuzza commented Feb 12, 2018

Short description πŸ“

Resolves #230

Solution πŸ“¦

As it was discussed in original issue, addFile method of PBXProjObjects+Helpers.swift now checks an existence of a file by given path.

Implementation πŸ‘©β€πŸ’»πŸ‘¨β€πŸ’»

  • Replace check isFile with exists for a filePath in addFile method
  • Add some more test cases
  • Update changelog

Misc:

  • Add XCTAssertThrowsSpecificError assert to check if specific error was
    thrown

Review notes

XCodeProjEditingError enum was changed in this PR, please review if it should be considered as a breaking change.


This change is Reviewable

@welcome
Copy link

welcome bot commented Feb 12, 2018

Thanks for opening this pull request! Please check out our contributing guidelines.

- Replace check `isFile` with `exists` for a filePath in `addFile`
  method defined in PBXProjObjects+Helpers.swift
- Add checks for supported files based on PBXFileReference's
  `fileTypeHash`
- Add some more test cases

Misc:
- Add XCTAssertThrowsSpecificError assert to check if specific error was
  thrown
@fuzza fuzza changed the title Fix error thrown on adding file reference to framework Fix adding file reference to bundle and package files Feb 12, 2018
@fuzza
Copy link
Author

fuzza commented Feb 12, 2018

πŸŽ‰

}

guard let fileType = PBXFileReference.fileType(path: filePath) else {
Copy link
Collaborator

Choose a reason for hiding this comment

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

I don't think we should require that it's a file we know about. PBXFileReference.fileType isn't an exhaustive list of every possible file, and explicitFileType and lastKnownFileType are optional properties anyway that get filled in by Xcode when the project is opened.

@fuzza
Copy link
Author

fuzza commented Feb 13, 2018

@yonaskolb fixed

Copy link
Collaborator

@yonaskolb yonaskolb left a comment

Choose a reason for hiding this comment

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

Cool, thanks!

@yonaskolb yonaskolb merged commit 0c87a53 into tuist:master Feb 13, 2018
@welcome
Copy link

welcome bot commented Feb 13, 2018

Congrats on merging your first pull request! We here at xcode.swift are proud of you! Join our slack channel to talk to other contributors.

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.

None yet

2 participants