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

fix: fix missing deps in local path #287

Merged
merged 1 commit into from
Mar 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 9 additions & 1 deletion pkg/client/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,10 @@ func (c *KpmClient) ResolvePkgDepsMetadata(kclPkg *pkg.KclPkg, update bool) erro
return err
}
d.FromKclPkg(depPkg)
kclPkg.Dependencies.Deps[name] = d
err = c.AddDepToPkg(kclPkg, &d)
if err != nil {
return err
}
} else {
// Otherwise, re-vendor it.
if kclPkg.IsVendorMode() {
Expand Down Expand Up @@ -815,6 +818,11 @@ func (c *KpmClient) Download(dep *pkg.Dependency, homePath, localPath string) (*
return nil, err
}
dep.FromKclPkg(kpkg)
abspath, err := filepath.Abs(dep.GetLocalFullPath(homePath))
if err != nil {
return nil, err
}
dep.Source.Local.Path = abspath
}

var err error
Expand Down
5 changes: 5 additions & 0 deletions test/e2e/test_suites/test_data/test_add_with_name/kcl.mod
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "test_add_with_name"
edition = "v0.8.0"
version = "0.0.1"

Empty file.
1 change: 1 addition & 0 deletions test/e2e/test_suites/test_data/test_add_with_name/main.k
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The_first_kcl_program = 'Hello World!'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "pkg2"
edition = "v0.8.0"
version = "0.0.1"

[dependencies]
pkg3 = { path = "../pkg3" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[dependencies]
[dependencies.pkg3]
name = "pkg3"
full_name = "pkg3_0.0.1"
version = "0.0.1"
sum = "T29gAv6K/tLithhP5jVHyurV5zRFui+i1ulyMt/ncnM="
path = "../pkg3"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pkg3

The_first_kcl_program = pkg3.The_first_kcl_program
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[package]
name = "pkg3"
edition = "v0.8.0"
version = "0.0.1"

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
The_first_kcl_program = 'Hello World!'
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[package]
name = "pkg1"
edition = "v0.8.0"
version = "0.0.1"

[dependencies]
pkg2 = { path = "../pkg/pkg2" }
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
[dependencies]
[dependencies.pkg2]
name = "pkg2"
full_name = "pkg2_0.0.1"
version = "0.0.1"
sum = "JbfIAXPJb3L6xX7hi/A5mrXzjpB8eFoKfEmJMdHsewY="
path = "../pkg/pkg2"
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import pkg2

The_first_kcl_program = pkg2.The_first_kcl_program
Loading