sdk: Fix gl-sdk bindings generation for multiple OS #642
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
UNIFFI crates a dynamic lib file which is used for generating bindings for different languages. On different OS dynamic files have different extension: Linux -
.os, Darwin -.dylib, Windows -.dll. For now, only a Linux case is handled (.osfiles are supported).Solution
In order to use a dynamic library file for bindings generation on multiple OS, OS should be defined in
.task.yamlvia shell command. Moreover,bindings-...tasks scripts should be expanded to copylibglsdk.*file from thetargetdirectory into theglsdkdirectory.The same should be done for
pyproject.tomlfile which usesforce-includeoption for checking whetherlibglsdk.*is included intoglsdkdirectory. Since it is not possible to follow the same approach as it is introduced in.task.yaml,pyproject.tomlshould use a build hook with custom force inclusion Python script.Using hooks for
pyproject.tomlfile result some changes inuv synccommand. Sinceuv syncbuilds hatch module only once, build hook is also called only once. Futureuv synccalls will omit the hook, so adding--reinstall-package='gl-sdk'flag will reinstall gl-sdk package every time the command is executed and check forlibglsdk.*. Also, I do not think that it is necessary to changeuv synccommand in Dockerfiles since gl-sdk should be rebuilt each time (assuming PR #639) resulting hook call.Changes
.task.yaml;libglsdk_force_include.pyhook to handle force inclusion oflibglsdk.*dynamic lib;--reinstall-package='gl-sdk'tolibs/gl-client-py/Makefileuv synccommand to handle force-inclusion hook.