Skip to content

Implement local dependencies proposal#1583

Merged
aciidgh merged 1 commit into
swiftlang:masterfrom
aciidgh:local-packages
May 24, 2018
Merged

Implement local dependencies proposal#1583
aciidgh merged 1 commit into
swiftlang:masterfrom
aciidgh:local-packages

Conversation

@aciidgh

@aciidgh aciidgh commented May 22, 2018

Copy link
Copy Markdown
Contributor

rdar://problem/39418745 [SR-7433]: Implement SE-201 Package Manager Local Dependencies

@aciidgh

aciidgh commented May 22, 2018

Copy link
Copy Markdown
Contributor Author

This is mostly complete but needs actual tests and I need to make sure I didn't miss any edge case. @hartbit I'll appreciate if you can review the code

@aciidgh aciidgh requested a review from hartbit May 22, 2018 23:59
@aciidgh aciidgh force-pushed the local-packages branch 10 times, most recently from 9ddac0b to 40c7587 Compare May 24, 2018 01:46
@aciidgh

aciidgh commented May 24, 2018

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

@aciidgh aciidgh changed the title [WIP] Implement local dependencies proposal Implement local dependencies proposal May 24, 2018
<rdar://problem/39418745> [SR-7433]: Implement SE-201 Package Manager Local Dependencies
@aciidgh

aciidgh commented May 24, 2018

Copy link
Copy Markdown
Contributor Author

@swift-ci please smoke test

@aciidgh aciidgh merged commit 876746b into swiftlang:master May 24, 2018
@aciidgh aciidgh deleted the local-packages branch May 24, 2018 02:40
url: String,
_ requirement: Package.Dependency.Requirement
) -> Package.Dependency {
// FIXME: This is suboptimal but its the only way to do this right now.

@hartbit hartbit Jun 16, 2018

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

It seems weird to encode local dependency as requirement. Could we have made dependency into an enum:

public enum Dependency {
    case remote(RemoteDependency)
    case local(LocalDependency)
}

public class RemoteDependency {
    /// The dependency requirement.
    public enum Requirement {
        case exactItem(Version)
        case rangeItem(Range<Version>)
        case revisionItem(String)
        case branchItem(String)
    }

    /// The url of the dependency.
    public let url: String

    /// The dependency requirement.
    public let requirement: Requirement

    /// Create a dependency.
    init(url: String, requirement: Requirement) {
        self.url = url
        self.requirement = requirement
    }
}

public class LocalDependency {
    public let path: String
}

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Possibly...I plan to revisit these data structure as part of upcoming runtime refactor.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Also note that we can't change the public facing data structures.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can’t we change the public facing data structures as part of a 4.2 PD?

case unsatisfiable

/// The resolver encountered a versioned container which has a revision dependency.
// FIXME: Rename this to incompatible constraints.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Didn't you want to rename it now?

case .exactItem(let version):
return .versionSet(.exact(Version(pdVersion: version)))

case .localPackageItem:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm still confused as to why we're representing local packages through Requirement. Is this the only solution?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Requirement is correct though as it is a requirement.

guard case .checkout(let currentState) = dependency.state else {
let error = WorkspaceDiagnostics.DependencyAlreadyInEditMode(dependencyName: packageName)
return diagnostics.emit(error)
// FIXME: This should be "can resolve" and not "can edit".

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Is there a reason we're not renaming it now?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Nope, just a low-priority change.

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.

2 participants