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

Release version with analyzer's Element2 APIs #743

Open
srawlins opened this issue Mar 6, 2025 · 12 comments
Open

Release version with analyzer's Element2 APIs #743

srawlins opened this issue Mar 6, 2025 · 12 comments

Comments

@srawlins
Copy link
Member

srawlins commented Mar 6, 2025

In order to migrate downstream packages like drift_dev, we need a release of source_gen that is compatible with Element2, like spanForElement2.

@jakemac53
Copy link
Contributor

jakemac53 commented Mar 6, 2025

Afaik we have been trying to avoid propagating the *2 pattern out to the other packages. So the goal is to just do a breaking change that just immediately swaps to the *2 APIs, as opposed to doubling the API surface of this package.

This is also what package:builds as a whole is (at least trying) to do.

It is very messy though, internally we do actually have both APIs at once because we have no alternative, and the world is also simpler there so there isn't as much downside. cc @scheglov what is the status of the internal migration?

@srawlins
Copy link
Member Author

srawlins commented Mar 6, 2025

Either way is fine by me. Consumers like drift_dev can bump to a new major version when it is released and use Element2 in all the existing APIs.

@jakemac53
Copy link
Contributor

Either way is fine by me. Consumers like drift_dev can bump to a new major version when it is released and use Element2 in all the existing APIs.

Fwiw iirc package:builds has a branch which does use the new APIs (and this is what is in google3), and the plan was that any package that is merged internally would have a branch also that depends on that, which allows us to migrate the internal world prior to publishing the breaking change externally.

@jakemac53
Copy link
Contributor

Oh, and this package does in fact have a corresponding branch, https://github.com/dart-lang/source_gen/tree/analyzer-element2

@scheglov
Copy link
Contributor

scheglov commented Mar 6, 2025

I don't know exactly how many, if any, internal generators we still have to migrate.
@stereotype441 posted a few days ago that there was a small handful.
And @srawlins actively worked on them, so I'd not be surprised that we have zero.
But I did not check.

@srawlins
Copy link
Member Author

srawlins commented Mar 6, 2025

the plan was that any package that is merged internally would have a branch also that depends on that

This would include drift_dev?

@srawlins
Copy link
Member Author

srawlins commented Mar 6, 2025

which allows us to migrate the internal world prior to publishing the breaking change externally.

What is the benefit of this?

@jakemac53
Copy link
Contributor

jakemac53 commented Mar 6, 2025

Internally we have a one version policy but we can't realistically migrate all internal code at once. This is why analyzer has no choice other than the *2, *3, etc APIs for migrations.

So, we get an incremental internal migration because its a requirement, and externally we just rely on pub solves and don't double the API surface.

@srawlins
Copy link
Member Author

srawlins commented Mar 6, 2025

I don't see what the internal migration has to do with the pub publish.

If you publish source_gen 3.0 today, without doubling the surface area, only relying on Element2, and you keep pushing the analyzer_element2 branch internally, then you comply with one-version, and you continue to migrate incrementally internally.

@jakemac53
Copy link
Contributor

If you publish source_gen 3.0 today, without doubling the surface area, only relying on Element2, and you keep pushing the analyzer_element2 branch internally, then you comply with one-version, and you continue to migrate incrementally internally.

We are using the internal migration to validate the new APIs, and just generally don't want to publish externally while in this limbo state since we can't easily roll that back.

@srawlins
Copy link
Member Author

srawlins commented Mar 6, 2025

We are using the internal migration to validate the new APIs, and just generally don't want to publish externally while in this limbo state since we can't easily roll that back.

Sounds good.

@srawlins
Copy link
Member Author

srawlins commented Mar 7, 2025

Almost everything internal using source_gen has been migrated. There is one package that requires #738.

In simolus3/drift#3492, @simolus3 was able to migrate almost everything in drift_dev.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants