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

Init package refactor #967

Merged
merged 2 commits into from Feb 21, 2017
Merged

Init package refactor #967

merged 2 commits into from Feb 21, 2017

Conversation

mike-ferris
Copy link

This pull request is motivated by the ongoing hoisting of functionality that may be of use to clients other than the command line tools into the SwiftPM library.

The main change here is to move the InitPackage class from the Commands module to the Workspace module so it will be included in the library. This required also moving the new ToolsVersionWriter. Some tests were migrated as well, and a new test suite was added to test the InitPackage class directly as part of WorkspaceTests in addition to the command-line based tests in CommandsTests for package creation.

The pull request is split into two commits. The first moves all the functional code and the second moves and adds tests.

Mike Ferris added 2 commits February 20, 2017 18:17
…the SwiftPM dynamic library.

    - Move the source to the Workspace module
    - Renamed InitMode enum to PackageType and nested it within the InitPackage class.
    - Renamed a couple properties on InitPackage
    - Introduced a progress reporter block so that InitPackage doesn't always just print to stdout.
    - Moved ToolsVersionWriter into Workspace as well.
    - Updated SwiftPackageTool to adapt changes (and to provide a progress reporter that prints to stdout)
    - Added a new InitTests to the WorkspaceTests module
    - Added tests for creating each of the four current package types
    - Moved another existing init test that testes a specific special case with non C99 package names here to consolidate all the primary init testing in one place.
    - Moved ToolsVersionWriterTests from CommandsTests to WorkspaceTests to follow the underlying code.
@mike-ferris
Copy link
Author

@swift-ci please test

Copy link
Member

@ankitspd ankitspd left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

/// The name of the example package to create.

/// A block that will be called to report progress during package creation
public var progressReporter: ((String) -> Void)?
Copy link
Member

Choose a reason for hiding this comment

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

This can be a let, right?

// Create a tools version with current version but with patch set to zero.
// We do this to avoid adding unnecessary constraints to patch versions, if
// the package really needs it, they should add it manually.
let version = ToolsVersion.currentToolsVersion.zeroedPatch

Copy link
Member

Choose a reason for hiding this comment

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

We try to avoid the whitespace diffs

@ankitspd ankitspd merged commit fda4c2c into apple:master Feb 21, 2017
@mike-ferris mike-ferris deleted the InitPackageRefactor branch February 21, 2017 17:28
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