Skip to content

Conversation

@mosuem
Copy link

@mosuem mosuem commented Sep 1, 2025

Requires flutter config --enable-dart-data-assets.

This is an example of how replacing asset transformers with build/link hooks could look like. The basic idea is that package vector_graphics_compiler exposes a helper method, here compileSvg, which is then called in the package's build hook. Options can be set there as well.

For now, asset transformers and build hooks can simply co-exist - in the future, when hooks are stable enough, we will want to deprecate asset transformers and move towards this mechanism.

@mosuem mosuem changed the title Add example Use hooks instead of asset transformers Sep 3, 2025
@mosuem mosuem requested a review from bkonyi September 3, 2025 13:39
@mosuem mosuem changed the title Use hooks instead of asset transformers Use hooks in addition to asset transformers Sep 4, 2025
@mosuem mosuem marked this pull request as ready for review September 4, 2025 08:13
@mosuem mosuem requested a review from jtmcdole as a code owner September 4, 2025 08:13
Copy link
Contributor

@bkonyi bkonyi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@chinmaygarde
Copy link
Member

Any progress on the presubmit failures?

@mosuem
Copy link
Author

mosuem commented Sep 23, 2025

Slow progress :) There are a lot of presubmits..

@mosuem mosuem force-pushed the addExampleDataAssets branch from d8f56f4 to 162deb3 Compare September 23, 2025 07:16
@mosuem mosuem changed the title Use hooks in addition to asset transformers [vector_graphics] Use hooks in addition to asset transformers Sep 23, 2025
@mosuem
Copy link
Author

mosuem commented Sep 23, 2025

@chinmaygarde How to solve the remaining failures?

The legacy N-1 will fail as this is a feature only present on Flutter main branch. For the other failures, I don't understand how to read what is failing. They are quite verbose. Help would be appreciated!

@jtmcdole
Copy link
Member

This PR needs to re-target the master branch. It cannot land on main.

@stuartmorgan-g
Copy link
Collaborator

This PR needs to re-target the master branch. It cannot land on main.

flutter/packages doesn't have master.

@stuartmorgan-g
Copy link
Collaborator

The legacy N-1 will fail as this is a feature only present on Flutter main branch.

N-1 and N-2 tests only run if the package's pubspec.yaml claims to support that version of the SDK. If this PR makes a package not work with older versions of the SDK, then it's an error to land it without changing the SDK requirement, as that would break clients using older versions of Flutter.

@stuartmorgan-g
Copy link
Collaborator

For the other failures, I don't understand how to read what is failing. They are quite verbose. Help would be appreciated!

A bunch of them appear to be flake. At least these two appear to be real though:

For the second, I'm not sure what "the logs" that flutter error message is referring to are.

@mosuem mosuem force-pushed the addExampleDataAssets branch from 852637a to 4d0ddc9 Compare September 29, 2025 14:18
@mosuem
Copy link
Author

mosuem commented Sep 29, 2025

For the other failures, I don't understand how to read what is failing. They are quite verbose. Help would be appreciated!

A bunch of them appear to be flake. At least these two appear to be real though:

For the second, I'm not sure what "the logs" that flutter error message is referring to are.

Thanks! This is probably due to the fact that the data-assets feature is not on stable yet. How do I only run the tests against dev?

@mosuem
Copy link
Author

mosuem commented Sep 29, 2025

Also, I did upgrade the minimum SDK version, but the N-1 and N-2 tests are still running and failing. Or did I misunderstand something?

@stuartmorgan-g
Copy link
Collaborator

Thanks! This is probably due to the fact that the data-assets feature is not on stable yet. How do I only run the tests against dev?

Generally speaking, you don't. Is there a specific need for landing this PR prior to stable support that requires overriding our standard policy?

Also, I did upgrade the minimum SDK version, but the N-1 and N-2 tests are still running and failing.

These lines are breaking things. It looks like those are something from the original repo's configuration that I didn't notice and clean up when importing, and they should be removed.

@mosuem
Copy link
Author

mosuem commented Sep 29, 2025

Thanks! This is probably due to the fact that the data-assets feature is not on stable yet. How do I only run the tests against dev?

Generally speaking, you don't. Is there a specific need for landing this PR prior to stable support that requires overriding our standard policy?

I would be interested in having people try out this feature easily. So a -dev version of vector_graphics_compiler could be released with a dependency on a -dev version of the SDK. Or is that overly complicated? Alternatively, I could release a new package with the functionality which could be used as a drop-in replacement, and deprecate that package sometime in the future in favor of merging into this package.

@stuartmorgan-g
Copy link
Collaborator

So a -dev version of vector_graphics_compiler could be released with a dependency on a -dev version of the SDK.

I'm aware of that, but we aren't really set up to allow for that.

Or is that overly complicated?

We do not currently have a release branch system for the packages repo, so doing this would in practice prevent us from shipping any updates of any kind to current clients of vector_graphics for as long as it takes to ship a new version of Flutter stable, which is the reason for the policy.

Alternatively, I could release a new package with the functionality which could be used as a drop-in replacement, and deprecate that package sometime in the future in favor of merging into this package.

Is that really easier than having people use a git dependency pointing to a branch? The discoverability of -dev versions is low (one of the reasons we've never prioritized making shipping -dev versions from this repo a thing), and the discoverability of a new alternate package would be even lower. I would think anyone who could be told to use a new package could be told to use a canned snippet with the correct git dependency?

@stuartmorgan-g
Copy link
Collaborator

From triage: What's the status of this PR? Was the decision to wait for the next stable release?

@stuartmorgan-g
Copy link
Collaborator

From triage: Is this unblocked now that Flutter 3.38 is out?

@mosuem mosuem force-pushed the addExampleDataAssets branch from 6c30333 to 3a91358 Compare December 17, 2025 15:43
@github-actions github-actions bot added the triage-engine Should be looked at in engine triage label Dec 17, 2025
@mosuem mosuem force-pushed the addExampleDataAssets branch from 3ef27cb to dc9d0a8 Compare December 18, 2025 12:41
@mosuem
Copy link
Author

mosuem commented Dec 19, 2025

What to do about

[0:03] Running for packages/vector_graphics...
  No version change.
  Found NEXT; validating next version in the CHANGELOG.
No version change found, but the change to this package could not be verified to be exempt
from version changes according to repository policy.
If this is a false positive, please comment in the PR to explain why the PR
is exempt, and add (or ask your reviewer to add) the "override: no versioning needed" label.

I added a line to the changelog already, but this doesn't seem to help.

@mosuem
Copy link
Author

mosuem commented Dec 19, 2025

Also, is there a way to run these checks locally? Pushing to get the results is tedious.

@stuartmorgan-g
Copy link
Collaborator

I added a line to the changelog already, but this doesn't seem to help.

It's flagging the lack of versioning, no the lack of changelog ("No version change found, but the change to this package could not be verified to be exempt from version changes"). It looks like the change can be exempted since it only affects the example.

Also, is there a way to run these checks locally? Pushing to get the results is tedious.

Sure, essentially all of the CI is just driving repo tooling commands. If you're looking for the specific command to run locally for some CI task, you can look at .ci/targets/* to find the corresponding task.

@stuartmorgan-g stuartmorgan-g added the override: no versioning needed Override the check requiring version bumps for most changes label Dec 22, 2025
@stuartmorgan-g
Copy link
Collaborator

version exemption: The vector_graphics pubspec change only affects local development.

@mosuem mosuem force-pushed the addExampleDataAssets branch from c8a0e70 to caef266 Compare December 28, 2025 10:59
@mosuem mosuem force-pushed the addExampleDataAssets branch from bfe8b44 to ae618cc Compare December 29, 2025 10:18
@mosuem
Copy link
Author

mosuem commented Dec 29, 2025

Are some of the failures flakes? Mac_arm64 custom_package_tests stable reports a failure in package:pigeon, which I did not touch.

Also, I can't reproduce the failure of flutter build linux in packages/vector_graphics_compiler/example locally, using the newest flutter version on master and after running git clean -xfd. Anything special happening in CI here?

@stuartmorgan-g
Copy link
Collaborator

Are some of the failures flakes? Mac_arm64 custom_package_tests stable reports a failure in package:pigeon, which I did not touch.

That one looks like some kind of Xcode-level flake, yes.

Also, I can't reproduce the failure of flutter build linux in packages/vector_graphics_compiler/example locally, using the newest flutter version on master and after running git clean -xfd. Anything special happening in CI here?

The specific command CI is running is the repo tooling's build-examples --linux, but I would expect that to pretty much just be flutter build linux.

If it's helpful, the macOS version of the failure seems to have more inline error details:

The output contained unsupported output:
- Asset with type "data_assets/data" is not a supported asset type (code_assets/code are supported)

  Building assets for package:example failed.
  build.dart returned with exit code: 1.
  To reproduce run:
  /Volumes/Work/s/w/ir/x/w/flutter/bin/cache/dart-sdk/bin/dart --packages=/Volumes/Work/s/w/ir/x/w/packages/packages/vector_graphics_compiler/.dart_tool/package_config.json /Volumes/Work/s/w/ir/x/w/packages/packages/vector_graphics_compiler/.dart_tool/hooks_runner/example/181d858fc5/hook.dill --config=/Volumes/Work/s/w/ir/x/w/packages/packages/vector_graphics_compiler/.dart_tool/hooks_runner/example/181d858fc5/input.json
  stderr:
  The output contained unsupported output:
- Asset with type "data_assets/data" is not a supported asset type (code_assets/code are supported)

- convert
- crypto
- dart_style
- data_assets
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the rollout plan here? We generally do not publish production packages with labs dependencies.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

override: no versioning needed Override the check requiring version bumps for most changes p: vector_graphics platform-linux platform-macos platform-web platform-windows triage-engine Should be looked at in engine triage

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants