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

Misleading diagnostic ordering when resolving packages #37193

Open
pubudu91 opened this issue Aug 1, 2022 · 0 comments
Open

Misleading diagnostic ordering when resolving packages #37193

pubudu91 opened this issue Aug 1, 2022 · 0 comments
Labels
Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler Area/ProjectAPI Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Improvement

Comments

@pubudu91
Copy link
Contributor

pubudu91 commented Aug 1, 2022

Consider a scenario where I have specified a package version in the Ballerina.toml which is not available locally, but I have included the property repository=local. e.g.,

[[dependency]]
org = "pubudu"
name = "policy_validator"
version = "0.3.3"
repository="local"

In the above case, 0.3.3 is not available locally but it is there in Central. When I run the package, I get the following:

Compiling source
    pubudu/addHeader:2.0.0
pubudu/policy_validator:0.3.3 [central.ballerina.io -> home repo]  100% [====================================================================================================================] 12/12 KB (0:00:00 / 0:00:00) 
    pubudu/policy_validator:0.3.3 pulled from central successfully
Generating 'policy-meta.json' file...
WARNING [Ballerina.toml:(10:1,14:19)] Dependency version (0.3.3) cannot be found in the local repository. org: `pubudu` name: policy_validator

Although there was this warning, it ran without any issue. The ordering of the events/diagnostics is a bit confusing here. When I saw that the package was pulled successfully, the expectation was that now it's available locally (it was available now). But when the compiler gave the warning about not being able to find the package locally, I thought there must've been something wrong in pulling the package or that the package wasn't getting resolved properly.

Had a chat with @azinneera and she pointed out that it's just that the diagnostic is getting printed later. It would be better if these sort of diagnostics are printed first, before attempting to pull the package from Central. e.g.,

Compiling source
    pubudu/addHeader:2.0.0
WARNING [Ballerina.toml:(10:1,14:19)] Dependency version (0.3.3) cannot be found in the local repository. org: `pubudu` name: policy_validator
pubudu/policy_validator:0.3.3 [central.ballerina.io -> home repo]  100% [====================================================================================================================] 12/12 KB (0:00:00 / 0:00:00) 
    pubudu/policy_validator:0.3.3 pulled from central successfully
Generating 'policy-meta.json' file...

Basically the requirement is, clearly communicate to the user that it'll try and fetch the package from Central if it's not available locally.

@pubudu91 pubudu91 added Type/Improvement Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler Area/ProjectAPI labels Aug 1, 2022
@gimantha gimantha added the Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) label Sep 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area/Diagnostics Issues related Diagnostics reported by the Compiler. #Compiler Area/ProjectAPI Team/DevTools Ballerina Developer Tooling ( CLI, Test FW, Package Management, OpenAPI, APIDocs ) Type/Improvement
Projects
None yet
Development

No branches or pull requests

2 participants