trevordevore / levure

Application development framework for LiveCode
MIT License
32 stars 14 forks source link

Registered file component callback stack not re-resolved in deployed app #202

Closed montegoulding closed 1 year ago

montegoulding commented 1 year ago

There's a couple of issues with the callbacks for registered components so this might need some discussion:

  1. Currently the full path to the callback stackfile is stored in the standalone uApp array of the standalone so even if the callback stackfile is included in the build it is not found
  2. The packaging callback processPackagedFileAsset is called on the callback stackfile so if you don't need loadRegisteredKeyFile but want to process the packaged file assets and some of them are distributed you end up being hit by 1 anyway

To resolve 1 in _pruneAppArray we could delete the callback stackfile of registered components then at startup of a packaged build we could re-resolve the callback stackfile from the helper info. We could also sanity check existence here.

To resolve 2 we could check for a packager callbacks stackfile for the helper and call that if either the callback stackfile is empty or processPackagedFileAsset was unhandled with perhaps with an additional parameter for of the registered key.

montegoulding commented 1 year ago

The workaround for these issues at the moment is to add a packager callbacks stackfile to the helper and then (registered key is data here):

command finalizePackagedAssets \
        pBuildProfile, \
        pPlatform, \
        @xAppA, \
        pAppFolder

    delete variable xAppA["registered components"]["files"]["data"]["callback stackfile"]
end finalizePackagedAssets
montegoulding commented 1 year ago

Actually ^ workaround doesn't work :-(

montegoulding commented 1 year ago

Aha issue was the above callback is before assets have been processed, possible solution is a finalizePackagedApp callback just after (or before?) calling _pruneAppArray to have one final chance to fiddle with things:

_dispatchFinalizeApp pBuildProfile, tPlatform, tAppA, tAppFolder
montegoulding commented 1 year ago

I'll open a new issue for implementing a finalizePackagedApp packager callback which I can workaround this issue with

trevordevore commented 1 year ago

@montegoulding I'll take a look at this and the other issues/PRs you submitted this week and let you know my thoughts.