Skip to content

Commit

Permalink
revert the experimental fix for #389 and try a different approach. .n…
Browse files Browse the repository at this point in the history
…et framework now uses the dynamic provider again, but now the search possibilities includes WHERE_ADJACENT to catch the case where a RuntimeIdentifier was specified so the right dll ends up adjacent to the other outputs instead of in a runtime/rid subdir. trying to un-break anycpu builds. attempts to fix #444 and #446 and #451
  • Loading branch information
ericsink committed Sep 29, 2021
1 parent e4370bd commit 1bf1e73
Show file tree
Hide file tree
Showing 9 changed files with 30 additions and 25 deletions.
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
<Copyright>Copyright 2014-2021 SourceGear, LLC</Copyright>
<Company>SourceGear</Company>
<Authors>Eric Sink</Authors>
<Version>2.0.7-pre20210927145209</Version>
<AssemblyVersion>2.0.7.1365</AssemblyVersion>
<FileVersion>2.0.7.1365</FileVersion>
<Version>2.0.7-pre20210929111533</Version>
<AssemblyVersion>2.0.7.1367</AssemblyVersion>
<FileVersion>2.0.7.1367</FileVersion>
<Description>SQLitePCLRaw is a Portable Class Library (PCL) for low-level (raw) access to SQLite</Description>
<ProviderLangVersion>7.3</ProviderLangVersion>
<GenerateAssemblyProductAttribute>false</GenerateAssemblyProductAttribute>
Expand Down
18 changes: 6 additions & 12 deletions gen_nuspecs/gen_nuspecs.cs
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ private static void gen_nuspec_bundle_e_sqlcipher(string dir_src)

write_bundle_dependency_group(f, WhichProvider.INTERNAL, WhichLib.E_SQLCIPHER, TFM.IOS);
write_bundle_dependency_group(f, WhichProvider.E_SQLCIPHER, WhichLib.E_SQLCIPHER, TFM.ANDROID);
write_bundle_dependency_group(f, WhichProvider.E_SQLCIPHER, WhichLib.E_SQLCIPHER, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.E_SQLCIPHER, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.E_SQLCIPHER, WhichLib.E_SQLCIPHER, TFM.NETSTANDARD20);
#if NETCOREAPP3_NATIVELIBRARY
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.E_SQLCIPHER, TFM.NETCOREAPP31);
Expand All @@ -849,19 +849,17 @@ private static void gen_nuspec_bundle_e_sqlcipher(string dir_src)
);

write_nuspec_file_entry_lib_batteries(
"e_sqlcipher.dllimport",
"e_sqlcipher.dynamic",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#if not
write_nuspec_file_entry_lib_mt(
"SQLitePCLRaw.nativelibrary",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#endif

#if NETCOREAPP3_NATIVELIBRARY
write_nuspec_file_entry_lib_batteries(
Expand Down Expand Up @@ -917,7 +915,7 @@ private static void gen_nuspec_bundle_zetetic(string dir_src)
f.WriteStartElement("dependencies");

write_bundle_dependency_group(f, WhichProvider.INTERNAL, WhichLib.NONE, TFM.IOS);
write_bundle_dependency_group(f, WhichProvider.SQLCIPHER, WhichLib.NONE, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.NONE, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.SQLCIPHER, WhichLib.NONE, TFM.NETSTANDARD20);
#if NETCOREAPP3_NATIVELIBRARY
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.NONE, TFM.NETCOREAPP31);
Expand All @@ -936,19 +934,17 @@ private static void gen_nuspec_bundle_zetetic(string dir_src)
);

write_nuspec_file_entry_lib_batteries(
"sqlcipher.dllimport",
"sqlcipher.dynamic",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#if not
write_nuspec_file_entry_lib_mt(
"SQLitePCLRaw.nativelibrary",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#endif

#if NETCOREAPP3_NATIVELIBRARY
write_nuspec_file_entry_lib_batteries(
Expand Down Expand Up @@ -1322,7 +1318,7 @@ WhichBasicBundle bund
}

write_bundle_dependency_group(f, WhichProvider.E_SQLITE3, WhichLib.E_SQLITE3, TFM.ANDROID);
write_bundle_dependency_group(f, WhichProvider.E_SQLITE3, WhichLib.E_SQLITE3, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.E_SQLITE3, TFM.NET461);
write_bundle_dependency_group(f, WhichProvider.E_SQLITE3, WhichLib.E_SQLITE3, TFM.NETSTANDARD20);
#if NETCOREAPP3_NATIVELIBRARY
write_bundle_dependency_group(f, WhichProvider.DYNAMIC_CDECL, WhichLib.E_SQLITE3, TFM.NETCOREAPP31);
Expand Down Expand Up @@ -1399,19 +1395,17 @@ WhichBasicBundle bund
}

write_nuspec_file_entry_lib_batteries(
"e_sqlite3.dllimport",
"e_sqlite3.dynamic",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#if not
write_nuspec_file_entry_lib_mt(
"SQLitePCLRaw.nativelibrary",
tfm_build: TFM.NETSTANDARD20,
tfm_dest: TFM.NET461,
f
);
#endif

#if NETCOREAPP3_NATIVELIBRARY
write_nuspec_file_entry_lib_batteries(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
</group>
<group targetFramework="net461">
<dependency id="SQLitePCLRaw.core" version="$version$" />
<dependency id="SQLitePCLRaw.provider.e_sqlcipher" version="$version$" />
<dependency id="SQLitePCLRaw.provider.dynamic_cdecl" version="$version$" />
<dependency id="SQLitePCLRaw.lib.e_sqlcipher" version="$version$" />
</group>
<group targetFramework="netstandard2.0">
Expand All @@ -38,7 +38,8 @@
</metadata>
<files>
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlcipher.internal.ios\bin\Release\Xamarin.iOS10\SQLitePCLRaw.batteries_v2.dll" target="lib\Xamarin.iOS10\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlcipher.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlcipher.dynamic\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.nativelibrary\bin\Release\netstandard2.0\SQLitePCLRaw.nativelibrary.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlcipher.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\netstandard2.0\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@
</group>
<group targetFramework="net461">
<dependency id="SQLitePCLRaw.core" version="$version$" />
<dependency id="SQLitePCLRaw.provider.e_sqlite3" version="$version$" />
<dependency id="SQLitePCLRaw.provider.dynamic_cdecl" version="$version$" />
<dependency id="SQLitePCLRaw.lib.e_sqlite3" version="$version$" />
</group>
<group targetFramework="netstandard2.0">
Expand All @@ -44,7 +44,8 @@
<files>
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.internal.ios\bin\Release\Xamarin.iOS10\SQLitePCLRaw.batteries_v2.dll" target="lib\Xamarin.iOS10\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.internal.tvos\bin\Release\Xamarin.tvOS10\SQLitePCLRaw.batteries_v2.dll" target="lib\Xamarin.tvOS10\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dynamic\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.nativelibrary\bin\Release\netstandard2.0\SQLitePCLRaw.nativelibrary.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\netstandard2.0\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
</group>
<group targetFramework="net461">
<dependency id="SQLitePCLRaw.core" version="$version$" />
<dependency id="SQLitePCLRaw.provider.e_sqlite3" version="$version$" />
<dependency id="SQLitePCLRaw.provider.dynamic_cdecl" version="$version$" />
<dependency id="SQLitePCLRaw.lib.e_sqlite3" version="$version$" />
</group>
<group targetFramework="netstandard2.0">
Expand All @@ -37,7 +37,8 @@
</metadata>
<files>
<file src="$src_path$\SQLitePCLRaw.batteries_v2.sqlite3.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\Xamarin.iOS10\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dynamic\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.nativelibrary\bin\Release\netstandard2.0\SQLitePCLRaw.nativelibrary.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.e_sqlite3.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\netstandard2.0\" />
</files>
</package>
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
</group>
<group targetFramework="net461">
<dependency id="SQLitePCLRaw.core" version="$version$" />
<dependency id="SQLitePCLRaw.provider.sqlcipher" version="$version$" />
<dependency id="SQLitePCLRaw.provider.dynamic_cdecl" version="$version$" />
</group>
<group targetFramework="netstandard2.0">
<dependency id="SQLitePCLRaw.core" version="$version$" />
Expand All @@ -30,7 +30,8 @@
</metadata>
<files>
<file src="$src_path$\SQLitePCLRaw.batteries_v2.sqlcipher.internal.ios\bin\Release\Xamarin.iOS10\SQLitePCLRaw.batteries_v2.dll" target="lib\Xamarin.iOS10\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.sqlcipher.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.sqlcipher.dynamic\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.nativelibrary\bin\Release\netstandard2.0\SQLitePCLRaw.nativelibrary.dll" target="lib\net461\" />
<file src="$src_path$\SQLitePCLRaw.batteries_v2.sqlcipher.dllimport\bin\Release\netstandard2.0\SQLitePCLRaw.batteries_v2.dll" target="lib\netstandard2.0\" />
</files>
</package>
1 change: 1 addition & 0 deletions src/SQLitePCLRaw.nativelibrary/defines.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ public static partial class NativeLibrary
public const int WHERE_PLAIN = 0x01;
public const int WHERE_RUNTIME_RID = 0x02;
public const int WHERE_ARCH = 0x04;
public const int WHERE_ADJACENT = 0x08;
}
}

6 changes: 6 additions & 0 deletions src/SQLitePCLRaw.nativelibrary/for_netstandard2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,12 @@ LibSuffix suffix
a.Add(Path.Combine(dir, arch, libname));
}

if ((flags & WHERE_ADJACENT) != 0)
{
var dir = System.IO.Path.GetDirectoryName(assy.Location);
a.Add(Path.Combine(dir, libname));
}

return a;
}

Expand Down
4 changes: 2 additions & 2 deletions src/common/batteries_v2.cs
Original file line number Diff line number Diff line change
Expand Up @@ -102,9 +102,9 @@ public static void Init()
#elif PROVIDER_dynamic

#if PROVIDER_NAME_e_sqlite3
DoDynamic_cdecl("e_sqlite3", NativeLibrary.WHERE_RUNTIME_RID);
DoDynamic_cdecl("e_sqlite3", NativeLibrary.WHERE_RUNTIME_RID | NativeLibrary.WHERE_ADJACENT);
#elif PROVIDER_NAME_e_sqlcipher
DoDynamic_cdecl("e_sqlcipher", NativeLibrary.WHERE_RUNTIME_RID);
DoDynamic_cdecl("e_sqlcipher", NativeLibrary.WHERE_RUNTIME_RID | NativeLibrary.WHERE_ADJACENT);
#elif PROVIDER_NAME_sqlcipher
DoDynamic_cdecl("sqlcipher", NativeLibrary.WHERE_ARCH); // TODO coordinate with zetetic
#elif PROVIDER_NAME_winsqlite3
Expand Down

0 comments on commit 1bf1e73

Please sign in to comment.