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

Use for local and private packages #6

Open
timstudt opened this issue Jul 3, 2021 · 7 comments
Open

Use for local and private packages #6

timstudt opened this issue Jul 3, 2021 · 7 comments

Comments

@timstudt
Copy link

timstudt commented Jul 3, 2021

This is a great project!
I was looking for exactly this tool but for generating a graph of local dependencies on a private repo.

It seems dependencies are of type String which has to be a valid URL. How about extending it and support all types of dependencies?
E.g.

.package(name: "APIClient", path: "../APIClient")

It wouldn't break the primary intend of using it on https://swiftpackageindex.com, but could as well be run locally on private repos.

@adam-fowler
Copy link
Owner

@timstudt I'm ready to accept a PR if you want to implement.

@timstudt
Copy link
Author

timstudt commented Jul 5, 2021

will try my best

@rogerluan
Copy link

rogerluan commented Aug 28, 2021

+1!

I'll investigate the complexity to implement this. @adam-fowler any leads/pointers would be highly appreciated 😊

@adam-fowler
Copy link
Owner

@rogerluan First thing you'll need to do it support loading private repos. Currently the url load is basic GET without any authentication. You'll need to add authentication details here if you want to access private repos.

Then you'll need to support the loading of both local filesystem packages as well as ones found on GitHub/gitlab. Looking at the package dependency type PackageDependencyDescription in the SPM code it looks like you check if the requirement is set to .localPackage to identify a local package.

This is really two different tasks

  • private repo access
  • local package parsing

So if you do some of this work, please separate it out into 2 PRs
cheers

@rogerluan
Copy link

Thanks for the tips @adam-fowler ! I agree it makes sense to separate in two different PRs 👍 I'll see what I can do 😊

@timstudt
Copy link
Author

timstudt commented Aug 30, 2021

sorry, I got a bit stuck with this, and then put it on hold..

maybe it's easier to start with local packages w/o having to deal with authentication. if I run it locally on a project, I assume I have access to other local packages (e.g. .package(name: "APIClient", path: "../APIClient"))
-> check for .localPackage then read file from local path.

the PackageLoader's func load(url: String, packages: Packages) needs to be extended to handle local package files
like

        } else  if /* is local package */ {
            let data = try Data(contentsOf: URL(fileURLWithPath: url))
            ... // parse file 

@adam-fowler
Copy link
Owner

@timstudt Yeah I don't know how the authentication works you'd need to spend some time with the GitHub documentation for that. Local packages should be easier. What you describe above seems about right.

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

No branches or pull requests

3 participants