Skip to content

[native_assets_cli] HookConfigBuilder.checksum should exclude some keys #1803

Closed
@dcharkes

Description

@dcharkes

The refactoring in #1643 does a blanket checksum over the whole json representation of the config, this leads to the build-directory changing and cache disappearing for various config elements that should not have this effect:

If any of these change, we're likely not interested in any previous invocations of the same hook with the previous versions. (Note for config.codeConfig.targetIOSSdk we do actually want to cache the simulator and device separately, because you'd actually switch between building those in a Flutter project.)

I worked around linkConfig.assetsForLinking by applying setupLinkConfig after computing the hash, but that doesn't work for setupCodeConfig, because some parts should be taken into account for the hash while others don't.

Possible solutions:

  1. Keep a json and a jsonForChecksum.
  2. Keep a listOfPathsForChecksum

Side note, currently the checksum is dependent on the order in which the separate parts are added. This is a bug, the maps in the JSON should be regarded as inherently unsorted.

Possible solutions:

  1. recursively sort before hashing
  2. Use a hashing algorithm for sets

cc @mkustermann

Metadata

Metadata

Assignees

No one assigned

    Labels

    P2A bug or feature request we're likely to work onpackage:hookstype-bugIncorrect behavior (everything from a crash to more subtle misbehavior)

    Type

    No type

    Projects

    Status

    Done

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions