Skip to content

Commit

Permalink
Merge pull request #287 from zong-zhe/fix-missing-mod
Browse files Browse the repository at this point in the history
fix: fix missing deps in local path
  • Loading branch information
Peefy committed Mar 27, 2024
2 parents 90314fd + 3d2873b commit bede720
Show file tree
Hide file tree
Showing 21 changed files with 55 additions and 1 deletion.
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"

Empty file.
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

0 comments on commit bede720

Please sign in to comment.