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

Enhancement : Supports adding third-party dependencies from git repo with the version field #266

Closed
zong-zhe opened this issue Feb 18, 2024 · 8 comments · Fixed by #556
Closed
Labels
enhancement New feature or request good first issue Good for newcomers help wanted Extra attention is needed

Comments

@zong-zhe
Copy link
Contributor

zong-zhe commented Feb 18, 2024

This issue comes from the preceding #190
The content in the above issue #190 is outdated, so add some more detail to this issue.

Related PR: #254

Context

KPM currently supports adding third-party dependencies from git repositories as dependencies, mainly supporting through tags or commits from the git repository.

You can use command as below to add a kcl package from git repo

kcl mod add --git https://github.com/KusionStack/catalog.git --commit a29e3db

Then you will see the below content added in kcl.mod

[dependencies]
catalog = { git = "https://github.com/KusionStack/catalog.git", commit = "a29e3db" }

or

You can use command as below to add a kcl package from git repo

kcl mod add --git https://github.com/KusionStack/catalog.git --tag 0.1.0

Then you will see the below content added in kcl.mod

[dependencies]
catalog = { git = "https://github.com/KusionStack/catalog.git", tag = “0.1.0” }

Referring to the implementation of Cargo in Rust, we hope to support adding dependencies from git repositories with the version of kcl package.

Feature

  1. If you add a dependency using the following command,
kcl mod add --git https://github.com/KusionStack/catalog.git --commit a29e3db

Then the following content will appear in your kcl.mod file, because the version field in the kcl.mod of the KCL package corresponding to commit a29e3db is 0.1.1.

[dependencies]
catalog = { git = "https://github.com/KusionStack/catalog.git", commit = “a29e3db”, version = “0.1.1” }
  1. If you add a dependency using the following command,
kcl mod add --git https://github.com/KusionStack/catalog.git --tag 0.0.2

Then the following content will appear in your kcl.mod file, because the version field in the kcl.mod of the KCL package corresponding to tag 0.0.2 is 0.1.1.

[dependencies]
catalog = { git = "https://github.com/KusionStack/catalog.git", tag=“0.0.2”, version = “0.1.1” }
  1. If you manually write the kcl.mod file as follows,
[dependencies]
catalog = { git = "https://github.com/KusionStack/catalog.git", tag=“0.0.3, version = “0.1.1}

But the version field in the kcl.mod of the KCL package corresponding to tag 0.0.3 is 0.0.1, i.e., version 0.1.1 does not exist in the KCL package with tag 0.0.3. Then, during the process of compiling or updating KCL third-party libraries that trigger the re-download of third-party libraries, an error should be thrown to notify the user that this third-party library with version 0.1.1 does not exist in the repo with tag 0.0.3.

@zong-zhe zong-zhe added the enhancement New feature or request label Feb 18, 2024
@zong-zhe zong-zhe self-assigned this Feb 18, 2024
@zong-zhe zong-zhe removed their assignment Feb 18, 2024
@zong-zhe zong-zhe added help wanted Extra attention is needed good first issue Good for newcomers labels Feb 18, 2024
@zong-zhe zong-zhe changed the title [WIP] Enhancement : Supports adding third-party dependencies from git repo via the version field Enhancement : Supports adding third-party dependencies from git repo via the version field Feb 18, 2024
@zong-zhe zong-zhe changed the title Enhancement : Supports adding third-party dependencies from git repo via the version field Enhancement : Supports adding third-party dependencies from git repo with the version field Feb 18, 2024
@AkashKumar7902
Copy link
Contributor

@Peefy please assign me this issue

@Peefy
Copy link
Contributor

Peefy commented Apr 3, 2024

@AkashKumar7902 Thank you for the contribution. ❤️

@vinayakjaas
Copy link

Hey @zong-zhe @Peefy I'd like to work on this issue, but I see there's still ongoing work. If any tasks are left to be completed, please let me know so I can move forward with this issue.

@Peefy Peefy assigned vinayakjaas and unassigned AkashKumar7902 Jul 26, 2024
@Peefy
Copy link
Contributor

Peefy commented Jul 26, 2024

Hello @vinayakjaas

This is an unfinished feature, I assigned it to you, good luck! ❤️

@Manoramsharma
Copy link
Contributor

@vinayakjaas, can you please pass this issue to me? I saw that you are working on another issue, and I have already worked with Git dependencies in one of my PRs.

@vinayakjaas
Copy link

Hey @Manoramsharma I started planning to work on this issue , but if you want to take over and move forward with it, that's okay no problem at all.

@Manoramsharma
Copy link
Contributor

Thanks @vinayakjaas I already have a draft PR in mind that would possibly solve this issue .

I would like get this assigned @Peefy

@Manoramsharma
Copy link
Contributor

Manoramsharma commented Jul 28, 2024

Hi @Gmin2 I think your changes in pkg/package/toml.go and pkg/package/modfile.go were not required as this would not have solved the parsing of version to dependencies struct from the corresponding mod files. Rather directly setting it as a a value here sourceWithoutBrace += fmt.Sprintf(, version = "%s", dep.Version) which is not an ideal approach.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment