Resolve relative paths in additional_includes and additional_lib_directories - #394
Resolve relative paths in additional_includes and additional_lib_directories#394dariyooo wants to merge 1 commit into
Conversation
simolus3
left a comment
There was a problem hiding this comment.
Note that these options are intended to be used internally only.
If you want to add extensions, is it a requirement for you to link those statically? Dynamically loading extensions through a separate asset is much simpler, doesn't require changes to this package, and allows us to refine the build in the future (exposing new options puts constraints on that).
| /// [HookInputUserDefines.path] does for `path`. That method only resolves a | ||
| /// single string, so list-valued options need the base itself. | ||
| static Uri? _userDefinesBase(BuildInput input) { | ||
| final userDefines = input.json['user_defines']; |
There was a problem hiding this comment.
It looks like there is no better way to do this at the moment, but us crawling through undocumented JSON structures doesn't seem great. I've opened dart-lang/native#3515 to ask for a proper API.
Sadly, I do not really see another option. l also thought about just compiling a complete sqlite dynamic library that has all symbols in it but I also do not see a way to load that. |
|
Out of interest, what extension are you trying to load (if it's public)? Most extensions can be configured to call SQLite APIs through function pointers, which means you don't need SQLite and the extension to be linked together statically. |
With
source: source,pathis resolved against the pubspec, butadditional_includesandadditional_lib_directoriesare passed through as-is.native_toolchain_cthen resolves them against its build directory (.dart_tool/hooks_runner/shared/sqlite3/build/<checksum>/), so relative entries can never point at anything useful and only absolute paths work today.This resolves both against the pubspec, matching
path. Absolute entries pass through unchanged. Not breaking, since relative values are currently unusable.The base is read from
input.json['user_defines']['workspace_pubspec']['base_path']becauseHookInputUserDefines.path()only resolves a single string.Test added to
test/hook/description_test.dart.