-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Evaluate using pub workspace feature, dropping custom package config generator #56220
Comments
Yes please! :) Dart-Code might require some changes (because we have some assumptions about having a There are some other minor niggles for some tests in VS Code (for ex. we don't understand (FWIW, how the package_config is generated is less important to me/Dart-Code, as long as the SDK is flagged in a way that means |
Have you tried the pub workspaces feature? Does it have the same issue or no? It would be worth fixing it to work with workspaces if it doesn't currently because that is now a more general feature. |
💯 I haven't looked at the impl. tool closely. The SDK+gclient is (mostly? completely?) hermetic currently. Can this work with running a You may try replacing this bootstrap into the dart setup code with the |
No, I thought it was still being designed/work in progress 😄 Are there instructions for trying it out? Does it need flags and/or a specific SDK version? |
If all dependencies are workspace packages I would think: yes. I don't even think you need to do There could be corner cases, but it's worth testing, and possibly fixing if it doesn't work. |
@jonasfj Would it be possible to add an |
I am not sure on instructions, but you can look at the build repo. Or the branch of the SDK I linked above. tldr;
|
cc @athomas I hear you might be a good person to discuss this with? |
@jakemac53 Happy to, I've wanted to use pub for a while to generate the package config and discussed it with sigurdm in the past (though this was pre-workspaces and never high enough priority). I see in DEPS you didn't remove the old package_config generator. It should be replaced running pub get from the checked-in SDK. We'd also need to ensure the bots manage their pub cache but that's a relatively simple change (we should do anyway). I would suggest we split "use workspaces" from the "run tests with the package:test runner". I'm broadly supportive of removing bespoke things, but I don't think these need to be coupled. I would assume that generating the package config in a different way can be made compatible with the SDK test runner relatively easily. |
Correct, my CL is not complete, just enough to get basic functionality working to test things out. I would be happy to complete it though if we want to move forward.
Agreed, I think running actual tests using the test runner on the bots might not be a task worth investing in. In particular I am not sure how that would interact with the test database. But, developers would be able to use the test runner locally still to run tests more easily. And the IDE tooling could use it to run tests, which would enable some nice functionality there.
Yes I don't believe anything has to be changed here, it should just work. |
Thanks! I grabbed I'll work on this (tracked via Dart-Code/Dart-Code#5067).
|
I updated my PR to change how I ran into a separate issue, which is This ends up needing many more transitive deps because In general, in the old world we had the ability to pull in only the transitive deps of packages that were used, which was a subset of their |
cc @srawlins have you considered splitting it out a |
I have not, I guess the primary benefit would be smaller, more targeted I am mostly surprised that mockito is in DEPS, and would 100% support an effort to get it out.
Those seem reconcilable... |
Right, it may not be worth it, idk. I didn't think mockito was useful for much without the codegen nowadays.
Yeah, this would be another approach, just don't allow it in the SDK. |
I don't have the full context here, but if we can't use |
I think we should be able to rewrite this test to not rely on mockito if we need to. |
I had a similar-ish request here: dart-lang/pub#4328 |
Note that I realized |
I should probably know more about workspaces than I do, because maybe then I wouldn't have any questions. But ... Is there any problem with a package like |
If the workspace contains package:analyzer and package:foo, and package:analyzer depends on package:foo, then the version of foo in the workspace must satisfy the version constraint in package analyzer when resolving the workspace. When analyzer and foo are published, and some app depends on analyzer, they will get the published version of foo. |
I think So I think we should do that some day, unless there is a lot of pull for such feature, I propose prioritizing on other things. For the Dart SDK, it might be better to just make a test in CI that runs |
That makes sense, thanks. I hadn't considered that issue. I don't think that will be a problem, though, because we generally bump the version of But I was thinking about differences between |
The workspace pubspec would have path dependency overrides (see my WIP one). Dependency constraints are still expressed at the per-package level, although there is the constraint that there must be some common version solves which is possible for the entire workspace. However, this would actually not be enforced due to the dependency overrides (afaik at least). In other words, there would be no change from how the SDK works today, no version enforcement or solving when developing in the SDK. |
I've played a bit with this too. I've found a few further observations:
Several packages in third_party/pkg depend on packages that are not currently in package_config.json. Eg. third_party/pkg/mockito/pubspec.yaml depends on |
fwiw, I'm in the process of removing the mockito dep; https://dart-review.googlesource.com/c/sdk/+/392465 and https://dart-review.googlesource.com/c/sdk/+/392402. |
Is the effect of this basically that packages in the SDK won't be able to set their minimum bound to anything higher than the precompiled (checked in) SDK? Ultimately that is probably acceptable if so, assuming it is fairly trivial to update the checked in SDK. |
Yes, if we use the checked in sdk to make the resolution (which I suggest doing) Perhaps it is not a big issue, but I think it might make a few things harder than it currently is. |
It probably means that part of changing the SDK version to the next minor version will be building the SDK as that version, uploading the result, and using that as the checked-in SDK. |
I don't think it has to happen as a part of that PR, just shortly afterwords. Really it will need to happen any time a package starts depending on new features from the SDK, which is newer than the precompiled SDK, which could happen at any time. Although, I am actually surprised this would be an issue because we will need path dependency overrides for all packages anyways? That should bypass the check. |
We don't need path overrides for the |
Oh right because they are in the workspace already so they implicitly come from there. IIRC pub doesn't actually even allow path overrides for those? This does bring up a larger issue - for package:macros (or any other SDK vendored package), this will be much more problematic. A new precompiled SDK might have to be included in the same CL as any change to package:_macros (if that change is not backwards compatible for the analyzer/cfe). We are looking to move away from the SDK vendored package approach for that package though. |
That's right - you cannot override the workspace packages.
Looking forward to this :) . It is wrecking all kinds of havoc... |
I have a WIP CL here https://dart-review.googlesource.com/c/sdk/+/397164 It reveals several problems with the current generate_package_config.dart script. (Dependencies that are not fulfilled) It is able to run a |
For context on workspaces, see flutter.dev/go/pub-workspace. cc @jonasfj @sigurdm in case you all had considered this, or think I am off my rocker 🤣.
Proposal
See my WIP branch, which gets package:analyzer working. More packages would have to be added to complete it.
Benefits
dart run
anddart test
(anddart pub get
) in SDK packages without negative consequence.Risks
pub get
, and also wouldn't be able to build a new SDK that is compatible, because that requires apub get
.pub get
ingclient runhooks
to resolve this issue.Additional work required
gclient runhooks
to runpub get
instead of invoking the custom tool.pub get
just like today.Other ideas
Trying out the example
Run
gclient sync -D
(need some extra deps for the test runner)Run
pub get
from the root of the SDK (creates the package config). Note that you should not rungclient runhooks
, that will currently bash over this package config.Note: You can also now run this from any workspace package, and it will not create a new package config for that package. It will only update the root one.
Actually, you will see some tests fail because they take command line arguments which isn't allowed in the test runner, this is called out above. It is rare but we would have to look into these.
The text was updated successfully, but these errors were encountered: