-
Notifications
You must be signed in to change notification settings - Fork 46
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: The feature renaming dependency is incomplete #420
Conversation
Signed-off-by: Manoramsharma <[email protected]>
Signed-off-by: Manoramsharma <[email protected]>
Signed-off-by: Manoramsharma <[email protected]>
Signed-off-by: Manoramsharma <[email protected]>
Pull Request Test Coverage Report for Build 10278727053Details
💛 - Coveralls |
@zong-zhe I have implemented the asked subtask and also changed test according to the implementation need. PTAL !!! |
pkg/client/client_test.go
Outdated
_ = os.Remove(filepath.Join(pkgPath, "kcl.mod.lock")) | ||
}() | ||
} | ||
// func TestUpdateWithNoSumCheck(t *testing.T) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why remove this test ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This test is not working and this is not due to my changes.
pkg/package/toml.go
Outdated
@@ -82,7 +82,7 @@ func (dep *Dependencies) MarshalTOML() string { | |||
const DEP_PATTERN = "%s = %s" | |||
|
|||
func (dep *Dependency) MarshalTOML() string { | |||
source := dep.Source.MarshalTOML() | |||
source := dep.Source.MarshalTOML(dep.Name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do not go this way, because the purpose of adding the package
field is to support renaming dependency, you need to add a field on the Dependency
structure to hold the package name and use this field when serializing to kcl.mod. Instead of simply using dep.Name
, the value of package
will not be the same as dep.Name
when the rename function is implemented later.
Hi @Manoramsharma 😃 Is this work still moving forward ? |
Hi @zong-zhe , |
Hi @Manoramsharma 😊 Is this PR finished? You can ping me if it's done or if there's any trouble. |
Hi @zong-zhe |
Signed-off-by: Manoramsharma <[email protected]>
Hey @zong-zhe, I have added a field named package in the dependency. Now, I am confused because this package is also printed in kcl.lock.mod file. Can you please provide me some guidance on how to add this in packages/toml? see here,
|
@@ -0,0 +1 @@ | |||
{ git = "https://github.com/kcl-lang/flask-demo-kcl-manifests", version = "v0.1.0", package = "flask-demo-kcl-manifests" } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why changed here ?
pkg/package/modfile.go
Outdated
@@ -193,6 +193,7 @@ type Dependency struct { | |||
FullName string `json:"-" toml:"full_name,omitempty"` | |||
Version string `json:"-" toml:"version,omitempty"` | |||
Sum string `json:"-" toml:"sum,omitempty"` | |||
Package string `json:"package" toml:"package,omitempty"` |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
At present, we do not need to serialize json when the output of this field Package
, do not output first, to prevent users from relying on it, causing difficulties for our subsequent changes and updates. So set json:"-"
This part of the situation is normal, and it makes sense to specify the package's original name through the |
"Hey @zong-zhe, I have one last confusion. How can I add a |
Hi @Manoramsharma 😃 You can adjust the entire rendering toml flow to suit this process. Raises the generation "{}" to top level. For example : const DEP_PATTERN = "%s = %s"
func (dep *Dependency) MarshalTOML() string {
source := dep.Source.MarshalTOML()
var sb strings.Builder
# Here is just a example, you need to implement this according to the actual situation
source := "{"+ source + "package =" + dep.package "}"
if len(source) != 0 {
sb.WriteString(fmt.Sprintf(DEP_PATTERN, dep.Name, source))
}
return sb.String()
} |
Signed-off-by: Manoramsharma <[email protected]>
@zong-zhe Please review this one i have done the suggested changes. |
Signed-off-by: Manoramsharma <[email protected]>
Signed-off-by: Manoramsharma <[email protected]>
@zong-zhe I have implemented the required changes. Previously, when encountering the |
cc @zong-zhe Could you help review it again? |
1. Does this PR affect any open issues?(Y/N) and add issue references (e.g. "fix #123", "re #123".):
Fixes #397
2. What is the scope of this PR (e.g. component or file name):
/package/toml.go
/downloader/toml.go
/downloader/toml_test.go
/downloader/test_data/test_data_toml
3. Provide a description of the PR(e.g. more details, effects, motivations or doc link):
4. Are there any breaking changes?(Y/N) and describe the breaking changes(e.g. more details, motivations or doc link):
5. Are there test cases for these changes?(Y/N) select and add more details, references or doc links: