Skip to content

Commit

Permalink
Revert changes on release profile & create custom profiles for frb
Browse files Browse the repository at this point in the history
Add comments on profile settings
  • Loading branch information
erdemyerebasmaz committed Apr 30, 2024
1 parent 68fde12 commit 8a211c6
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 13 deletions.
21 changes: 15 additions & 6 deletions lib/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
[profile.release]
lto = "thin"
opt-level = "z"
codegen-units = 1
panic = "abort"
lto = true
opt-level = "z" # Optimize for size.
codegen-units = 1 # Reduce Parallel Code Generation Units to Increase Optimization
panic = "abort" # Abort on panic, as unwinding code does require extra binary size
rpath = true
strip = "symbols"

[profile.min]
[profile.frb]
inherits = "release"
strip = true # Automatically strip symbols from the binary.
opt-level = 3
lto = "thin"
debug = 0
split-debuginfo = "unpacked"
incremental = false

[profile.frb-min]
inherits = "frb"
opt-level = "z" # Optimize for size.
lto = true

[workspace]
Expand Down
10 changes: 5 additions & 5 deletions lib/ls-sdk-flutter/melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -23,18 +23,18 @@ scripts:
melos run build-other

# the only time 'melos run build-*' is called is to prepare
# for distribution, so use the 'min' profile.
build-apple: dart scripts/build_apple.dart --profile min
build-android: bash scripts/build-android.sh --profile min
build-other: dart scripts/build_other.dart --profile min
# for distribution, so use the 'frb-min' profile.
build-apple: dart scripts/build_apple.dart --profile frb-min
build-android: bash scripts/build-android.sh --profile frb-min
build-other: dart scripts/build_other.dart --profile frb-min

# Platform-specific builds, mainly for testing
build-ios: dart scripts/build_apple.dart --ios
build-macos: dart scripts/build_apple.dart --local
build-other-local: dart scripts/build_other.dart --local

test:
cargo build --package ls-sdk --release &&
cargo build --package ls-sdk --profile=frb &&
melos run test-dart &&
melos run test-flutter

Expand Down
2 changes: 1 addition & 1 deletion lib/ls-sdk-flutter/scripts/build_apple.dart
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Future<void> mainImpl(List<String> args) async {
for (final target in targets) {
print(' Building target $target');
await run('rustup target add $target');
await run('cargo build --target=$target $profileArg');
await run('cargo build --target=$target $profileArg');
}

await run('mkdir -p mac-lipo ios-sim-lipo');
Expand Down
2 changes: 1 addition & 1 deletion lib/ls-sdk-flutter/scripts/build_other.dart
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Future<void> mainImpl(List<String> args) async {
profileArg = '--profile=dev';
} else {
profile = 'release';
profileArg = '--release';
profileArg = '--profile=frb';
}

// -- Begin --
Expand Down

0 comments on commit 8a211c6

Please sign in to comment.