ericsink / SQLitePCL.raw

A Portable Class Library (PCL) for low-level (raw) access to SQLite
Apache License 2.0
512 stars 106 forks source link

The provider.most/uwp/net5.0 pattern is awful #469

Closed ericsink closed 2 years ago

ericsink commented 2 years ago

For SQLitePCLRaw.provider.e_sqlite3, there are four directories:

SQLitePCLRaw.provider.e_sqlite3 SQLitePCLRaw.provider.e_sqlite3.most SQLitePCLRaw.provider.e_sqlite3.uwp SQLitePCLRaw.provider.e_sqlite3.net5.0

The first one is just a dummy csproj with a nuspec to include the build output from the other 3.

Each of the other 3 has a Generated directory which contains the generated provider C# code.

The UWP version has a call to sqlite3_win32_set_directory8(). The call is omitted from other builds just in case its presence causes problems. For example, if that call is around for an iOS build, the linker will fail because the underlying C call doesn't exist in the native library.

The net5.0 version is an unfinished attempt to use UnmanagedCallersOnly attributes instead of MonoPInvokeCallback attributes. Work in progress. It builds for net5.0 TFM. See #423

The .most version covers, well, everything else. It builds for the netstandard2.0 TFM.

Note that the UWP version does NOT build for a uap10.0 TFM, which is a problem. It builds for netstandard2.0. When I converted the codebase to require netstandard2.0 as a minimum, I neglected to update all the uap10.0 TFMs to uap10.0.16299. So, for example, if I build a provider for uap10.0.16299, its reference to SQLitePCLRaw.core, which is built only for netstandard2.0, will fail.

Anyway, this is a mess. SQLitePCLRaw.provider.e_sqlite3 wants to be one directory with multitargeting. And when attempting to make that change, I tripped over this " uap10.0 isn't really netstandard2.0 " problem.

ericsink commented 2 years ago

See also notes on #450

ericsink commented 2 years ago

One could argue that the common case should have the call to sqlite3_win32_set_directory8() included, and if iOS has a problem with that, then iOS should be treated as the unusual case and have its own multi-targeted build.