Copy Flutter dep assets/shaders/fonts into .clojuredart/deps stubs#379
Closed
dankinsoid wants to merge 1 commit into
Closed
Copy Flutter dep assets/shaders/fonts into .clojuredart/deps stubs#379dankinsoid wants to merge 1 commit into
dankinsoid wants to merge 1 commit into
Conversation
sync-pubspec! mirrors each Flutter dependency into
.clojuredart/deps/<sha>/ as a bare pubspec.yaml stub. Flutter's asset
bundler then reads that stub's `flutter:` section and resolves the
declared assets/shaders/fonts relative to it — but the stub only ever
contained the pubspec, never the files it references. As a result a
package that ships shaders or assets (e.g. FragmentProgram.fromAsset
"packages/<pkg>/shaders/x.frag") silently gets nothing bundled and
fails at runtime.
Copy the files declared under flutter: {assets, shaders, fonts} from the
dep's source checkout (:deps/root, :local/root, or a classpath dir) into
the stub when materializing it. Trailing-slash asset entries are copied
recursively; map-form asset entries ({path: ...}) and font asset lists
are handled. No-op for jar-only deps or deps that declare no bundle.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Author
|
Duplicate of #378 — consolidated there (that one keeps find-pubspec's search precise for multi-path deps and carries the fonts handling from here). Closing this one. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
sync-pubspec!mirrors each Flutter dependency into.clojuredart/deps/<sha>/as a barepubspec.yamlstub. Flutter's asset bundler reads that stub'sflutter:section and resolves the declaredassets/shaders/fontsrelative to it (asset.dart_parseAssetsruns per-package). But the stub only ever contained the pubspec — never the files it references.So a package that ships shaders or assets — e.g. a widget lib that does
gets nothing bundled under
packages/my_pkg/…and fails at runtime (missing shader/asset). There's no way to fix this from the consuming app's pubspec, because the shaders live at the dep's package root, not underlib/. Today the only workaround is a post-compilescript that copies the files into every stub by hand.Fix
When materializing a stub, also copy the files the dep declares under
flutter: {assets, shaders, fonts}from its source checkout into the stub dir. Source dir is resolved from the already-available coordinate (:deps/rootfor git /:local/root, or a directory on:paths); jar-only deps are a no-op.{path: …, flavors: …}) andfonts: [{fonts: [{asset: …}]}]are handled.flutter:bundle.Runs inside the existing
deps-to-addloop, so it only fires when a dep is (re)materialized.Testing
Loaded
cljd.buildto confirm it compiles, and unit-testedcopy-flutter-assets!against a fixture covering shaders, single assets, wildcard directories, fonts, map-form entries, missing-file skip, and nil src/flutter guards — all pass.🤖 Generated with Claude Code