From 02199fdfa754b1a5fc55f170c310a082dba5b580 Mon Sep 17 00:00:00 2001 From: zongz Date: Fri, 17 Nov 2023 16:19:06 +0800 Subject: [PATCH] feat: create a symbolic link for the dependencies Signed-off-by: zongz --- pkg/client/client.go | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/pkg/client/client.go b/pkg/client/client.go index f5ea53b0..60b03579 100644 --- a/pkg/client/client.go +++ b/pkg/client/client.go @@ -701,6 +701,13 @@ func (c *KpmClient) Download(dep *pkg.Dependency, localPath string) (*pkg.Depend } dep.Version = dep.Source.Git.Tag dep.LocalFullPath = localPath + // Creating symbolic links in a global cache is not an optimal solution. + // This allows kclvm to locate the package by default. + // This feature is unstable and will be removed soon. + err = utils.CreateSymlink(dep.LocalFullPath, filepath.Join(filepath.Dir(localPath), dep.Name)) + if err != nil { + return nil, err + } dep.FullName = dep.GenDepFullName() } @@ -711,6 +718,13 @@ func (c *KpmClient) Download(dep *pkg.Dependency, localPath string) (*pkg.Depend } dep.Version = dep.Source.Oci.Tag dep.LocalFullPath = localPath + // Creating symbolic links in a global cache is not an optimal solution. + // This allows kclvm to locate the package by default. + // This feature is unstable and will be removed soon. + err = utils.CreateSymlink(dep.LocalFullPath, filepath.Join(filepath.Dir(localPath), dep.Name)) + if err != nil { + return nil, err + } dep.FullName = dep.GenDepFullName() }