Skip to content

Commit 3ea7760

Browse files
committed
build(swift): generate artifacts using correct profile
1 parent c91323f commit 3ea7760

File tree

3 files changed

+9
-21
lines changed

3 files changed

+9
-21
lines changed

.gitignore

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

Makefile.toml

Lines changed: 6 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ CARGO_TARGET_DIR = { value = "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/target",
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"] } }
1515
CARGO_BUILD_TYPE = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
16+
CARGO_PROFILE = { source = "${CARGO_BUILD_TYPE}", mapping = { "debug" = "dev", "release" = "release" } }
1617
SWIFT_CONFIGURATION = { source = "${CARGO_MAKE_PROFILE}", default_value = "debug", mapping = { "development" = "debug", "release" = "release" } }
1718
BACKTRACE_DEFAULT = { source = "${CARGO_MAKE_CI}", mapping = { "true" = "1", "false" = "0" } }
1819
RUST_BACKTRACE = { value = "${BACKTRACE_DEFAULT}", condition = { env_not_set = ["RUST_BACKTRACE"] } }
@@ -92,7 +93,7 @@ script = [
9293
echo "*************************************"
9394
echo "Cargo:"
9495
echo " Home: ${CARGO_MAKE_CARGO_HOME}"
95-
echo " Profile: ${CARGO_MAKE_CARGO_PROFILE}"
96+
echo " Profile: ${CARGO_MAKE_PROFILE}"
9697
echo "*************************************"
9798
'''
9899
]
@@ -107,7 +108,7 @@ args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "check", "${@}"]
107108
category = "Build"
108109
description = "Runs cargo build"
109110
command = "rustup"
110-
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "--", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "${@}"]
111+
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "--profile", "${CARGO_PROFILE}", "--", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "${@}"]
111112

112113
[tasks.swift]
113114
workspace = false
@@ -132,46 +133,30 @@ args = [
132133
"-headers", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNativeCore/include",
133134
"-output", "${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative/LiveViewNativeCore.xcframework"
134135
]
135-
dependencies = ["build-universal-macos", "build-universal-ios", "remove-existing-xcframework"]
136+
dependencies = ["build-macos", "build-ios", "remove-existing-xcframework"]
136137

137138
[tasks.remove-existing-xcframework]
138139
workspace = false
139140
private = true
140141
script_runner = "@duckscript"
141142
script = "rm -r ${CARGO_MAKE_WORKSPACE_WORKING_DIRECTORY}/swift/LiveViewNative/LiveViewNativeCore.xcframework"
142143

143-
[tasks.build-universal-macos]
144+
[tasks.build-macos]
144145
workspace = false
145146
category = "Build"
146147
description = "Compiles for all targets needed to produce a universal library for macOS"
147148
command = "rustup"
148149
args = ["run", "${CARGO_MAKE_TOOLCHAIN}", "cargo", "build", "@@remove-empty(CARGO_MAKE_CARGO_VERBOSE_FLAGS)", "--target", "aarch64-apple-darwin", "--target", "x86_64-apple-darwin", "-p", "liveview-native-core"]
149150
dependencies = ["install-targets"]
150151

151-
[tasks.package-universal-macos]
152-
workspace = false
153-
category = "Packaging"
154-
description = "Produces a universal library for macOS"
155-
command = "lipo"
156-
args = ["${CARGO_TARGET_DIR}/aarch64-apple-darwin/debug/libliveview_native_core.a", "${CARGO_TARGET_DIR}/x86_64-apple-darwin/debug/libliveview_native_core.a", "-create", "-output", "${CARGO_TARGET_DIR}/universal-macos/debug/libliveview_native_core.a"]
157-
dependencies = ["build-universal-macos"]
158-
159-
[tasks.build-universal-ios]
152+
[tasks.build-ios]
160153
workspace = false
161154
category = "Build"
162155
description = "Compiles for all targets needed to produce a universal library for iOS"
163156
command = "rustup"
164157
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"]
165158
dependencies = ["prepare-targets"]
166159

167-
[tasks.package-universal-ios]
168-
workspace = false
169-
category = "Packaging"
170-
description = "Produces a universal library for iOS"
171-
command = "lipo"
172-
args = ["${CARGO_TARGET_DIR}/aarch64-apple-ios/debug/libliveview_native_core.a", "${CARGO_TARGET_DIR}/x86_64-apple-ios/debug/libliveview_native_core.a", "-create", "-output", "${CARGO_TARGET_DIR}/universal-ios/debug/libliveview_native_core.a"]
173-
dependencies = ["build-universal-ios"]
174-
175160
[tasks.prepare-targets]
176161
workspace = false
177162
private = true

swift/LiveViewNative/build.xcconfig

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
BUILD_LIBRARY_FOR_DISTRIBUTION = YES
2+
SKIP_INSTALL = NO

0 commit comments

Comments
 (0)