@op-engineering/op-sqlite 15.1.4 → 15.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/op-sqlite.podspec +19 -15
- package/package.json +1 -1
package/op-sqlite.podspec
CHANGED
|
@@ -5,19 +5,17 @@ log_message = lambda do |message|
|
|
|
5
5
|
puts "\e[34m#{message}\e[0m"
|
|
6
6
|
end
|
|
7
7
|
|
|
8
|
+
# In the sample app the dir is not inside of node_modules
|
|
8
9
|
is_user_app = __dir__.include?("node_modules")
|
|
9
10
|
package = JSON.parse(File.read(File.join(__dir__, "package.json")))
|
|
10
|
-
parent_folder_name = File.basename(__dir__)
|
|
11
11
|
app_package = nil
|
|
12
12
|
package_json_path = nil
|
|
13
13
|
|
|
14
14
|
# When installed on user node_modules lives inside node_modules/@op-engineering/op-sqlite
|
|
15
|
+
# Find the users package.json by searching up through parent directories
|
|
15
16
|
if is_user_app
|
|
16
|
-
current_dir = File.expand_path(__dir__)
|
|
17
|
-
# Move one level up to the parent directory
|
|
18
|
-
current_dir = File.dirname(current_dir)
|
|
17
|
+
current_dir = File.dirname(File.expand_path(__dir__))
|
|
19
18
|
|
|
20
|
-
# Find the package.json by searching up through parent directories
|
|
21
19
|
loop do
|
|
22
20
|
package_path = File.join(current_dir, "package.json")
|
|
23
21
|
if File.exist?(package_path)
|
|
@@ -25,20 +23,17 @@ if is_user_app
|
|
|
25
23
|
break
|
|
26
24
|
end
|
|
27
25
|
|
|
28
|
-
|
|
29
|
-
break if parent_dir == current_dir # reached filesystem root
|
|
26
|
+
break if File.dirname(current_dir) == current_dir # reached filesystem root
|
|
30
27
|
current_dir = parent_dir
|
|
31
28
|
end
|
|
32
29
|
|
|
33
|
-
raise "package.json not found" if package_json_path.nil?
|
|
34
|
-
|
|
35
|
-
app_package = JSON.parse(File.read(package_json_path))
|
|
30
|
+
raise "package.json not found? It's needed to read any op-sqlite config (if available)" if package_json_path.nil?
|
|
36
31
|
else
|
|
37
|
-
# When running on the example app
|
|
38
32
|
package_json_path = File.join(__dir__, "example", "package.json")
|
|
39
|
-
app_package = JSON.parse(File.read(File.join(__dir__, "example", "package.json")))
|
|
40
33
|
end
|
|
41
34
|
|
|
35
|
+
app_package = JSON.parse(File.read(package_json_path))
|
|
36
|
+
|
|
42
37
|
op_sqlite_config = app_package["op-sqlite"]
|
|
43
38
|
use_sqlcipher = false
|
|
44
39
|
use_crsqlite = false
|
|
@@ -127,15 +122,24 @@ Pod::Spec.new do |s|
|
|
|
127
122
|
|
|
128
123
|
if use_sqlcipher then
|
|
129
124
|
log_message.call("[OP-SQLITE] using SQLCipher")
|
|
130
|
-
exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h"]
|
|
125
|
+
exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h", "ios/libsql.xcframework/**/*"]
|
|
131
126
|
xcconfig[:GCC_PREPROCESSOR_DEFINITIONS] += " OP_SQLITE_USE_SQLCIPHER=1 HAVE_FULLFSYNC=1 SQLITE_HAS_CODEC SQLITE_TEMP_STORE=3 SQLITE_EXTRA_INIT=sqlcipher_extra_init SQLITE_EXTRA_SHUTDOWN=sqlcipher_extra_shutdown"
|
|
132
127
|
s.dependency "OpenSSL-Universal"
|
|
133
128
|
elsif use_libsql then
|
|
134
129
|
log_message.call("[OP-SQLITE] using libsql. Please contact turso (via Discord) for libsql issues")
|
|
135
130
|
exclude_files += ["cpp/sqlite3.c", "cpp/sqlite3.h", "cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h", "cpp/bridge.h", "cpp/bridge.cpp"]
|
|
136
131
|
else
|
|
137
|
-
log_message.call("[OP-SQLITE] using pure SQLite
|
|
138
|
-
exclude_files += ["cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h"]
|
|
132
|
+
log_message.call("[OP-SQLITE] using pure SQLite")
|
|
133
|
+
exclude_files += ["cpp/sqlcipher/sqlite3.c", "cpp/sqlcipher/sqlite3.h", "cpp/libsql/bridge.c", "cpp/libsql/bridge.h", "cpp/libsql/bridge.cpp", "cpp/libsql/libsql.h", "ios/libsql.xcframework/**/*"]
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Exclude xcframeworks that aren't being used
|
|
137
|
+
if !use_crsqlite then
|
|
138
|
+
exclude_files += ["ios/crsqlite.xcframework/**/*"]
|
|
139
|
+
end
|
|
140
|
+
|
|
141
|
+
if !use_sqlite_vec then
|
|
142
|
+
exclude_files += ["ios/sqlitevec.xcframework/**/*"]
|
|
139
143
|
end
|
|
140
144
|
|
|
141
145
|
other_cflags = '$(inherited) -DSQLITE_DBCONFIG_ENABLE_LOAD_EXTENSION=1 -DHAVE_USLEEP=1 -DSQLITE_ENABLE_LOCKING_STYLE=0'
|