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

Exposed method to write project, workspace, schemes and breakpoints #215

Merged
merged 2 commits into from
Jan 13, 2018

Conversation

ilyapuchka
Copy link
Contributor

@ilyapuchka ilyapuchka commented Jan 11, 2018

Short description 📝

When writing project with XcodeProj.write there is no control over what parts of it will be written, so i.e. workspace and schemes are being overridden when only project changes. Together with #214 it leads to unneeded changes.

Solution 📦

There are public methods to write scheme, workspace, project etc. but methods used by XcodeProj.write provide more functionality and automatically write data in correct paths, when writing project through pbxproj.write requires to construct correct path to project file manually. Also added public methods to get those paths to give users more flexibility, i.e. to write individual scheme file instead of overriding all schemes folder.


This change is Reviewable

CHANGELOG.md Outdated
@@ -9,6 +9,7 @@

### Changed
- **Breaking:** `XCWorkspace.Data` renamed to `XCWorkspaceData` and removed `references`.
- Added methods to get paths to workspace, project and breakpoints and shemes files, added public methods to write them separatery.
Copy link
Contributor

Choose a reason for hiding this comment

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

Don't forget to add your GitHub handle at the end here @ilyapuchka 😛

///
/// - Parameter path: `.xcodeproj` file path
/// - Returns: worspace file path relative to the given path.
public func workspacePath(_ path: Path) -> Path {
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this method can be static since it doesn't need anything from the XcodeProj instance.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'd add a simple unit test to make sure the path si properly generated.

///
/// - Parameter path: `.xcodeproj` file path
/// - Returns: project file path relative to the given path.
public func projectPath(_ path: Path) -> Path {
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment here regarding making this method static and testing it.

Copy link
Contributor

Choose a reason for hiding this comment

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

What about naming it pbxprojPath to make it consistent with the write method?

/// - Parameter path: `.xcodeproj` file path
/// - Returns: shared data path relative to the given path.
public func sharedDataPath(_ path: Path) -> Path {
return path + "xcshareddata"
Copy link
Contributor

Choose a reason for hiding this comment

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

Same comment regarding making it static and testing it

Copy link
Contributor

Choose a reason for hiding this comment

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

Actually the same comment applies to all the path methods that you added 😜

Copy link
Contributor

@pepicrft pepicrft left a comment

Choose a reason for hiding this comment

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

Just left some minor comments @ilyapuchka. Great job on this PR 👏 . Once addressed feel free to merge it since you got another thumb up. If I'm not wrong, you should have received an invitation to be a contributor of the organization. That gives you permissions to merge PRs.

@pepicrft
Copy link
Contributor

By the way! A downside of keeping a CHANGELOG.md file is that it causes these conflicts when branches get merged. Don't forget to rebase master into this branch before merging.

@tuist tuist deleted a comment Jan 12, 2018
@tuist tuist deleted a comment Jan 12, 2018
@ilyapuchka
Copy link
Contributor Author

All code review comments addressed, but I can't merge this myself yet.

@alvarhansen
Copy link
Contributor

alvarhansen commented Jan 13, 2018

@ilyapuchka you have to accept invitation to @xcodeswift contributors team.
https://github.com/settings/organizations

GitHub
GitHub is where people build software. More than 27 million people use GitHub to discover, fork, and contribute to over 75 million projects.

@pepicrft pepicrft merged commit cfbc63a into tuist:master Jan 13, 2018
@ilyapuchka ilyapuchka deleted the write-paths branch January 13, 2018 11:56
@ilyapuchka
Copy link
Contributor Author

@allu22 I didn't get invitation yet =)

@pepicrft
Copy link
Contributor

Weird...
image

@pepicrft
Copy link
Contributor

I sent you the invitation again @ilyapuchka

@ilyapuchka
Copy link
Contributor Author

👍

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.

3 participants