diff --git a/.gitmodules b/.gitmodules index f5753d5c5d5..bdd72086a02 100644 --- a/.gitmodules +++ b/.gitmodules @@ -10,3 +10,6 @@ path = external/mxe url = https://github.com/xamarin/mxe.git branch = xamarin +[submodule "external/sqlite"] + path = external/sqlite + url = https://github.com/xamarin/sqlite.git diff --git a/external/sqlite b/external/sqlite new file mode 160000 index 00000000000..382b7beebed --- /dev/null +++ b/external/sqlite @@ -0,0 +1 @@ +Subproject commit 382b7beebed97d38f55c7703b1af879c5c323d7c diff --git a/src/Mono.Data.Sqlite/Mono.Data.Sqlite.csproj b/src/Mono.Data.Sqlite/Mono.Data.Sqlite.csproj new file mode 100644 index 00000000000..60a5d11b4c7 --- /dev/null +++ b/src/Mono.Data.Sqlite/Mono.Data.Sqlite.csproj @@ -0,0 +1,161 @@ + + + + Debug + AnyCPU + {EFBA0AD7-5A72-4C68-AF49-83D382785DCF};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + {26781D3A-FF20-4F55-9824-C8A06AA9E484} + Library + Mono.Data.Sqlite + Assets + Resources + Resource + Resources\Resource.designer.cs + True + Mono.Data.Sqlite + v5.0 + + + true + full + false + ..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\v1.0 + DEBUG;TRACE;NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;SQLITE_STANDARD;MONODROID + prompt + 4 + None + false + true + + + true + ..\..\bin\$(Configuration)\lib\xbuild-frameworks\MonoAndroid\v1.0 + prompt + 4 + false + false + true + NET_4_0;NET_4_5;MONO;DISABLE_CAS_USE;SQLITE_STANDARD;MONODROID + + + + + + + + + + + + + PreserveNewest + + + + + Android.Runtime\CPUArchitecture.cs + + + Assembly\AssemblyInfo.cs + + + Mono.Data.Sqlite_2.0\MonoPInvokeCallbackAttribute.cs + + + Mono.Data.Sqlite_2.0\SQLite3.cs + + + Mono.Data.Sqlite_2.0\SQLite3_UTF16.cs + + + Mono.Data.Sqlite_2.0\SQLiteBase.cs + + + Mono.Data.Sqlite_2.0\SQLiteCommandBuilder.cs + + + Mono.Data.Sqlite_2.0\SQLiteCommand.cs + + + Mono.Data.Sqlite_2.0\SQLiteConnection.cs + + + Mono.Data.Sqlite_2.0\LINQ\SQLiteConnection_Linq.cs + + + Mono.Data.Sqlite_2.0\SQLiteConnectionPool.cs + + + Mono.Data.Sqlite_2.0\SQLiteConnectionStringBuilder.cs + + + Mono.Data.Sqlite_2.0\SQLiteConvert.cs + + + Mono.Data.Sqlite_2.0\SQLiteDataAdapter.cs + + + Mono.Data.Sqlite_2.0\SQLiteDataReader.cs + + + Mono.Data.Sqlite_2.0\SqliteDataSourceEnumerator.cs + + + Mono.Data.Sqlite_2.0\SQLiteEnlistment.cs + + + Mono.Data.Sqlite_2.0\SQLiteException.cs + + + Mono.Data.Sqlite_2.0\SQLiteFactory.cs + + + Mono.Data.Sqlite_2.0\LINQ\SQLiteFactory_Linq.cs + + + Mono.Data.Sqlite_2.0\SQLiteFunctionAttribute.cs + + + Mono.Data.Sqlite_2.0\SQLiteFunction.cs + + + Mono.Data.Sqlite_2.0\SQLiteKeyReader.cs + + + Mono.Data.Sqlite_2.0\SQLiteMetaDataCollectionNames.cs + + + Mono.Data.Sqlite_2.0\SQLiteParameterCollection.cs + + + Mono.Data.Sqlite_2.0\SQLiteParameter.cs + + + Mono.Data.Sqlite_2.0\SQLiteStatement.cs + + + Mono.Data.Sqlite_2.0\SQLiteTransaction.cs + + + Mono.Data.Sqlite_2.0\SR.Designer.cs + + + Mono.Data.Sqlite_2.0\UnsafeNativeMethods.cs + + + Locale.cs + + + Consts.cs + + + + + + + + + <_SupportedAbi Include="$(AndroidSupportedAbis)" /> + + + diff --git a/src/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.config b/src/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.config new file mode 100644 index 00000000000..5e01176193d --- /dev/null +++ b/src/Mono.Data.Sqlite/Mono.Data.Sqlite.dll.config @@ -0,0 +1,3 @@ + + + diff --git a/src/sqlite-xamarin/.gitignore b/src/sqlite-xamarin/.gitignore new file mode 100644 index 00000000000..79939837e36 --- /dev/null +++ b/src/sqlite-xamarin/.gitignore @@ -0,0 +1,7 @@ +.stamp +build.gradle +gradle/ +gradlew +gradlew.bat +src/ + diff --git a/src/sqlite-xamarin/sqlite-xamarin.mdproj b/src/sqlite-xamarin/sqlite-xamarin.mdproj new file mode 100644 index 00000000000..516a4aa659f --- /dev/null +++ b/src/sqlite-xamarin/sqlite-xamarin.mdproj @@ -0,0 +1,60 @@ + + + + Debug + AnyCPU + GenericProject + {B8F799C5-D7CE-4E09-9CE6-BAA4173E7EC8} + + + ..\..\bin\Debug\ + + + ..\..\bin\Release\ + + + + + _CreateProject; + _NdkBuild; + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/sqlite-xamarin/src-jni/Android.mk b/src/sqlite-xamarin/src-jni/Android.mk new file mode 100644 index 00000000000..fef1679802a --- /dev/null +++ b/src/sqlite-xamarin/src-jni/Android.mk @@ -0,0 +1,61 @@ +# It is based on sqlite/dist/Android.mk with some changes. + +## +## +## Build the library +## +## + +LOCAL_PATH:= $(call my-dir) + +# NOTE the following flags, +# SQLITE_TEMP_STORE=3 causes all TEMP files to go into RAM. and thats the behavior we want +# SQLITE_ENABLE_FTS3 enables usage of FTS3 - NOT FTS1 or 2. +# SQLITE_DEFAULT_AUTOVACUUM=1 causes the databases to be subject to auto-vacuum +minimal_sqlite_flags := \ + -DNO_ANDROID_FUNCS=1 \ + -DHAVE_POSIX_FALLOCATE=0 \ + -DNDEBUG=1 \ + -DHAVE_USLEEP=1 \ + -DSQLITE_HAVE_ISNAN \ + -DSQLITE_DEFAULT_JOURNAL_SIZE_LIMIT=1048576 \ + -DSQLITE_THREADSAFE=2 \ + -DSQLITE_TEMP_STORE=3 \ + -DSQLITE_POWERSAFE_OVERWRITE=1 \ + -DSQLITE_DEFAULT_FILE_FORMAT=4 \ + -DSQLITE_DEFAULT_AUTOVACUUM=1 \ + -DSQLITE_ENABLE_MEMORY_MANAGEMENT=1 \ + -DSQLITE_ENABLE_FTS3 \ + -DSQLITE_ENABLE_FTS3_BACKWARDS \ + -DSQLITE_ENABLE_FTS4 \ + -DSQLITE_OMIT_BUILTIN_TEST \ + -DSQLITE_OMIT_COMPILEOPTION_DIAGS \ + -DSQLITE_OMIT_LOAD_EXTENSION \ + -DSQLITE_DEFAULT_FILE_PERMISSIONS=0600 + +device_sqlite_flags := $(minimal_sqlite_flags) \ + -DHAVE_MALLOC_H=1 + +common_src_files := ../../../../../external/sqlite/dist/sqlite3.c + +# the device library +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := $(common_src_files) + +LOCAL_CFLAGS += $(device_sqlite_flags) + +LOCAL_SHARED_LIBRARIES := libdl + +LOCAL_MODULE:= libsqlite3_xamarin + +LOCAL_C_INCLUDES += $(call include-path-for, system-core)/cutils + +LOCAL_SHARED_LIBRARIES += liblog + +# include android specific methods +#LOCAL_WHOLE_STATIC_LIBRARIES := libsqlite3_xamarin + +include $(BUILD_SHARED_LIBRARY) + + diff --git a/src/sqlite-xamarin/src-jni/Application.mk b/src/sqlite-xamarin/src-jni/Application.mk new file mode 100644 index 00000000000..ceeb0b40ef5 --- /dev/null +++ b/src/sqlite-xamarin/src-jni/Application.mk @@ -0,0 +1 @@ +APP_ABI := armeabi armeabi-v7a arm64-v8a x86 x86_64