Open mkustermann opened 5 days ago
- Perform a build for each asset type separately
We could consider this. It indeed solves the issue of inconsistent data assets. However, it doesn't solve the issue with inconsistent code assets. Code assets must be provided identically for the various architectures as well.
- to ensure there's only one build. But that would possibly require changing CLI protocol to have a
List<Architecture>
instead of just oneArchitecture
- which then would have other implications (e.g. one may need a per-architecturecCompilerConfig
compiler toolchain, ...)
This is what my very first prototypes had. (Back then os and architecture was combined into "target", so you could build android_arm64
and linux_x64
in one invocation.) This indeed led to the issue described, that all config that is correlated with target ends up having to stuck in a map.
- to ensure the bundling tool allows different data assets (and other kinds of things) per architecture
We probably don't want that, due to Flutter supporting multi-arch apps where we don't want to increase the app size by duplicating assets.
- to make bundling tool error if the different architecture builds resulted in conflicting data assets (maybe I'll do that for now)
That seems reasonable. 👍 (And is consistent with the checking for code assets. (I hope we have that checking for code assets!))
A bundling tool may support multiple asset types. It then has the option to
The motivation for this is for example flutter: Currently flutter has a loop over architectures and performs a build for each of them separately. Now if we add data asset support we are in a strange spot if we say
supportedAssetTypes: [code, data]
for all builds:hook/build.dart
will emit data assets for each of the builds (which differ only in architecture) => There's room for error, the duplicate data assets could be conflicting (imagine the arm32 build emits data asset with IDfoo
and fileX
, but arm64 build emits data asset with IDfoo
with fileY
)Though flutter only wants one set of data assets irrespective of whether the app runs in arm32 or arm64. So the natural choice is for it to build code assets separately from data assets (and it may not want to supply the architecture for data asset build)
Though that will have implications for our system:
To me this sounds somewhat reasonable. It puts more restrictions on the system but allows more flexibility on the bundling tool (e.g. it can ensure data assets don't depend on architecture). It's not entirely ideal because it means sometimes the hook may be invoked with only data asset type with no architecture and sometimes it may be invoked with code+data asset type with architecture, so the second one the hook theoretically could make it's output dependent on the architecture.
The alternatives would be
List<Architecture>
instead of just oneArchitecture
- which then would have other implications (e.g. one may need a per-architecturecCompilerConfig
compiler toolchain, ...)/cc @dcharkes