Skip to content

feat(spm): add support for self-hosted and GitLab repositories#6358

Merged
jdx merged 1 commit intojdx:mainfrom
roele:issues/spm-gitlab
Sep 26, 2025
Merged

feat(spm): add support for self-hosted and GitLab repositories#6358
jdx merged 1 commit intojdx:mainfrom
roele:issues/spm-gitlab

Conversation

@roele
Copy link
Contributor

@roele roele commented Sep 21, 2025

As requested in #6299, this adds support for the SPM backed for GitLab and self-hosted repositories. It uses the same ToolOptions patterns (provider, api_url) as used in Ubi, GitHub/GitLab backends.

Copilot AI review requested due to automatic review settings September 21, 2025 12:42
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

This PR adds support for GitLab and self-hosted repositories to the SPM (Swift Package Manager) backend. It introduces a provider-based approach similar to other backends in the codebase, allowing users to specify GitLab or self-hosted Git repositories as sources for SPM packages.

Key changes:

  • Added GitProvider struct and GitProviderKind enum to handle multiple Git providers (GitHub, GitLab)
  • Modified repository URL parsing to support GitLab and self-hosted instances
  • Updated the release fetching logic to use provider-specific APIs

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
src/backend/spm.rs Added GitProvider infrastructure, updated SwiftPackageRepo to handle multiple providers, and modified release fetching logic
docs/dev-tools/backends/spm.md Updated documentation to reflect GitLab support and added tool options section

Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.

@jdx
Copy link
Owner

jdx commented Sep 21, 2025

bugbot run

cursor[bot]

This comment was marked as outdated.

@jdx
Copy link
Owner

jdx commented Sep 24, 2025

bugbot run

};
let url_str = format!("https://{}/{}.git", host, name);
let url = Url::parse(&url_str)?;
(name, url)
Copy link

Choose a reason for hiding this comment

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

Bug: SPM Incorrectly Constructs URLs for Custom Git Providers

Shorthand SPM package notation with self-hosted Git providers constructs incorrect clone URLs. The SwiftPackageRepo hardcodes github.com or gitlab.com as the host instead of extracting it from the GitProvider's api_url, which prevents cloning from custom instances.

Fix in Cursor Fix in Web

Copy link
Owner

Choose a reason for hiding this comment

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

is this a problem @roele ?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I did not account for supporting shorthand notation for self-hosted repositories. Not sure we can reliably derive the repository URL from the API URL, so i rather only have support for self-hosted via https:// notation. This should probably be stated in the docs though.

@jdx jdx merged commit 2863f69 into jdx:main Sep 26, 2025
19 checks passed
@jdx jdx mentioned this pull request Sep 26, 2025
@roele roele deleted the issues/spm-gitlab branch September 26, 2025 17:45
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.

4 participants