Skip to content

Commit afeb68b

Browse files
committed
build: add a few more helper tasks to makefile
1 parent 6346b78 commit afeb68b

File tree

1 file changed

+29
-3
lines changed

1 file changed

+29
-3
lines changed

Makefile.toml

Lines changed: 29 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,8 @@ CARGO_MAKE_CARGO_BUILD_TEST_FLAGS = "--no-fail-fast"
1212
CARGO_TARGET_DIR = { value = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target", condition = { env_not_set = ["CARGO_TARGET_DIR"] } }
1313
CARGO_MAKE_TOOLCHAIN_DEFAULT = { source = "${CARGO_MAKE_CI}", default_value = "nightly", mapping = { "true" = "nightly-2022-08-08", "false" = "nightly" } }
1414
CARGO_MAKE_TOOLCHAIN = { value = "${CARGO_MAKE_TOOLCHAIN_DEFAULT}", condition = { env_not_set = ["CARGO_MAKE_TOOLCHAIN"] } }
15-
CARGO_BUILD_TYPE = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "dev" = "debug", "release" = "release" } }
15+
CARGO_BUILD_TYPE = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
16+
SWIFT_CONFIGURATION = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
1617
BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
1718
RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = ["RUST_BACKTRACE"] } }
1819

@@ -113,7 +114,7 @@ workspace = false
113114
category = "Build"
114115
description = "Builds the Swift package"
115116
command = "swift"
116-
args = ["build", "--configuration", "${CARGO_MAKE_PROFILE}", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
117+
args = ["build", "--configuration", "${SWIFT_CONFIGURATION}", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
117118
dependencies = ["build-xcframework"]
118119

119120
[tasks.build-xcframework]
@@ -201,20 +202,45 @@ mkdir "${ios_dir}"
201202
[tasks.clean]
202203
category = "Build"
203204
description = "Clean build artifacts"
205+
dependencies = ["clean-rust", "clean-swift", "clean-artifacts"]
206+
207+
[tasks.clean-artifacts]
208+
category = "Build"
209+
script_runner = "@duckscript"
210+
script = '''
211+
rm -r ${CARGO_TARGET_DIR}/universal-macos/${CARGO_BUILD_TYPE}
212+
rm -r ${CARGO_TARGET_DIR}/universal-ios/${CARGO_BUILD_TYPE}
213+
'''
214+
dependencies = ["remove-existing-xcframework"]
215+
216+
[tasks.clean-rust]
217+
category = "Build"
204218
command = "cargo"
205219
args = ["clean"]
206220

221+
[tasks.clean-swift]
222+
category = "Build"
223+
command = "swift"
224+
args = ["package", "clean", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
225+
207226
[tasks.test]
208227
category = "Test"
209228
description = "Runs all tests"
210-
dependencies = ["test-rust"]
229+
dependencies = ["test-rust", "test-swift"]
211230

212231
[tasks.test-rust]
213232
category = "Test"
214233
description = "Runs tests written in Rust"
215234
command = "rustup"
216235
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "test", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "@@split(CARGO_MAKE_CARGO_BUILD_TEST_FLAGS, )", "${@}"]
217236

237+
[tasks.test-swift]
238+
workspace = false
239+
category = "Test"
240+
description = "Runs the Swift package tests"
241+
command = "swift"
242+
args = ["test", "--package-path", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative", "--scratch-path", "${CARGO_TARGET_DIR}/swift/.build", "${@}"]
243+
218244
[tasks.bloat]
219245
category = "Development"
220246
description = "Run cargo-bloat"

0 commit comments

Comments
 (0)