Skip to content

Commit 9966a18

Browse files
committed
chore: extract swift bindings to separate repo
1 parent 3ea7760 commit 9966a18

File tree

12 files changed

+8
-856
lines changed

12 files changed

+8
-856
lines changed

.gitignore

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
/.elixir_ls
22
/target
33
/Cargo.lock
4-
**/.swiftpm

Makefile.toml

Lines changed: 8 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ CARGO_MAKE_TOOLCHAIN_DEFAULT = { source = "${CARGO_MAKE_CI}", default_value = "n
1414
CARGO_MAKE_TOOLCHAIN = { value = "${CARGO_MAKE_TOOLCHAIN_DEFAULT}", condition = { env_not_set = ["CARGO_MAKE_TOOLCHAIN"] } }
1515
CARGO_BUILD_TYPE = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
1616
CARGO_PROFILE = { source = "${CARGO_BUILD_TYPE}", mapping = { "debug" = "dev", "release" = "release" } }
17-
SWIFT_CONFIGURATION = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
1817
BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
1918
RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = ["RUST_BACKTRACE"] } }
2019

@@ -110,36 +109,28 @@ description = "Runs cargo build"
110109
command = "rustup"
111110
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "--profile", "${CARGO_PROFILE}", "--", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "${@}"]
112111

113-
[tasks.swift]
114-
workspace = false
115-
category = "Build"
116-
description = "Builds the Swift package"
117-
command = "swift"
118-
args = ["build", "--configuration", "${SWIFT_CONFIGURATION}", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
119-
dependencies = ["build-xcframework"]
120-
121-
[tasks.build-xcframework]
112+
[tasks.xcframework]
122113
workspace = false
123114
category = "Packaging"
124115
description = "Generates the LiveViewNativeCore.xcframework package"
125116
command = "xcodebuild"
126117
args = [
127118
"-create-xcframework",
128119
"-library", "${CARGO_TARGET_DIR}/aarch64-apple-darwin/debug/libliveview_native_core.a",
129-
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNativeCore/include",
120+
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
130121
"-library", "${CARGO_TARGET_DIR}/aarch64-apple-ios/debug/libliveview_native_core.a",
131-
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNativeCore/include",
122+
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
132123
"-library", "${CARGO_TARGET_DIR}/aarch64-apple-ios-sim/debug/libliveview_native_core.a",
133-
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNativeCore/include",
134-
"-output", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative/LiveViewNativeCore.xcframework"
124+
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/crates/core/c_src/include",
125+
"-output", "${CARGO_TARGET_DIR}/swift/liveview_native_core.xcframework"
135126
]
136127
dependencies = ["build-macos", "build-ios", "remove-existing-xcframework"]
137128

138129
[tasks.remove-existing-xcframework]
139130
workspace = false
140131
private = true
141132
script_runner = "@duckscript"
142-
script = "rm -r ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative/LiveViewNativeCore.xcframework"
133+
script = "rm -r ${CARGO_TARGET_DIR}/swift/liveview_native_core.xcframework"
143134

144135
[tasks.build-macos]
145136
workspace = false
@@ -155,12 +146,7 @@ category = "Build"
155146
description = "Compiles for all targets needed to produce a universal library for iOS"
156147
command = "rustup"
157148
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "--target", "aarch64-apple-ios", "--target", "aarch64-apple-ios-sim", "--target", "x86_64-apple-ios", "-p", "liveview-native-core"]
158-
dependencies = ["prepare-targets"]
159-
160-
[tasks.prepare-targets]
161-
workspace = false
162-
private = true
163-
run_task = { name = ["install-targets", "create-universal-targets"], parallel = true }
149+
dependencies = ["install-targets"]
164150

165151
[tasks.install-targets]
166152
workspace = false
@@ -169,45 +155,16 @@ description = "Installs all toolchain targets needed for packaging"
169155
command = "rustup"
170156
args = ["target", "add", "--toolchain", "${CARGO_MAKE_TOOLCHAIN}", "aarch64-apple-darwin", "x86_64-apple-darwin", "aarch64-apple-ios", "aarch64-apple-ios-sim", "x86_64-apple-ios"]
171157

172-
[tasks.create-universal-targets]
173-
workspace = false
174-
private = true
175-
script_runner = "@duckscript"
176-
script = '''
177-
macos_dir = set "${CARGO_TARGET_DIR}/universal-macos/${CARGO_BUILD_TYPE}"
178-
ios_dir = set "${CARGO_TARGET_DIR}/universal-ios/${CARGO_BUILD_TYPE}"
179-
180-
echo Creating ${macos_dir}
181-
mkdir ${macos_dir}
182-
183-
echo "Creating ${ios_dir}"
184-
mkdir "${ios_dir}"
185-
'''
186-
187158
[tasks.clean]
188159
category = "Build"
189160
description = "Clean build artifacts"
190-
dependencies = ["clean-rust", "clean-swift", "clean-artifacts"]
191-
192-
[tasks.clean-artifacts]
193-
category = "Build"
194-
script_runner = "@duckscript"
195-
script = '''
196-
rm -r ${CARGO_TARGET_DIR}/universal-macos/${CARGO_BUILD_TYPE}
197-
rm -r ${CARGO_TARGET_DIR}/universal-ios/${CARGO_BUILD_TYPE}
198-
'''
199-
dependencies = ["remove-existing-xcframework"]
161+
dependencies = ["clean-rust", "clean-swift", "remove-existing-xcframework"]
200162

201163
[tasks.clean-rust]
202164
category = "Build"
203165
command = "cargo"
204166
args = ["clean"]
205167

206-
[tasks.clean-swift]
207-
category = "Build"
208-
command = "swift"
209-
args = ["package", "clean", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
210-
211168
[tasks.test]
212169
category = "Test"
213170
description = "Runs all tests"
@@ -219,13 +176,6 @@ description = "Runs tests written in Rust"
219176
command = "rustup"
220177
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "test", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", "${@}"]
221178

222-
[tasks.test-swift]
223-
workspace = false
224-
category = "Test"
225-
description = "Runs the Swift package tests"
226-
command = "swift"
227-
args = ["test", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
228-
229179
[tasks.bloat]
230180
category = "Development"
231181
description = "Run cargo-bloat"

swift/LiveViewNative/.gitignore

Lines changed: 0 additions & 12 deletions
This file was deleted.

swift/LiveViewNative/Package.swift

Lines changed: 0 additions & 28 deletions
This file was deleted.

swift/LiveViewNative/README.md

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)