Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,13 @@ lto = true # Enables link to optimizations
opt-level = "s" # Optimize for binary size
panic = "unwind" # Sadly we need unwind to avoid unexpected crashes on third party crates
strip = true # Remove debug symbols

# Fast mobile development profile - trades binary size for build speed
# Use with: cargo build --profile mobile-dev
# For production mobile releases, use --release instead
[profile.mobile-dev]
inherits = "release"
codegen-units = 16 # Allow parallel compilation (vs 1 in release)
lto = false # Disable link-time optimization (saves 15-20 min per arch)
opt-level = 2 # Good optimization without extreme size focus
strip = true # Still remove debug symbols
19 changes: 12 additions & 7 deletions apps/mobile/metro.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,12 @@ const workspaceRoot = path.resolve(projectRoot, "../..");

const config = getDefaultConfig(projectRoot);

// Watch entire monorepo for hot reload
config.watchFolders = [workspaceRoot];
// Watch only relevant directories for hot reload (not entire monorepo)
// This avoids watching Rust target/ dirs (4.5GB+) and other build artifacts
config.watchFolders = [
path.resolve(projectRoot, "src"),
path.resolve(workspaceRoot, "packages"),
];

// Configure resolver for monorepo and SVG support
config.resolver = {
Expand All @@ -25,17 +29,18 @@ config.resolver = {
path.resolve(workspaceRoot, "node_modules"),
],

// Exclude build outputs and prevent loading wrong React version from root
// Exclude build outputs
blockList: [
/\/apps\/mobile\/ios\/build\/.*/,
/\/apps\/mobile\/android\/build\/.*/,
// Block React from workspace root to force local version
new RegExp(`^${workspaceRoot}/node_modules/react/.*`),
],

// Force React resolution from mobile app's node_modules
// Dynamically resolve React/React Native from wherever the package manager installed them
extraNodeModules: {
Comment thread
StarbirdTech marked this conversation as resolved.
react: path.resolve(projectRoot, "node_modules/react"),
react: path.dirname(require.resolve("react/package.json", { paths: [projectRoot, workspaceRoot] })),
"react-native": path.dirname(
require.resolve("react-native/package.json", { paths: [projectRoot, workspaceRoot] })
),
},
};

Expand Down
12 changes: 8 additions & 4 deletions apps/mobile/modules/sd-mobile-core/ios/build-rust.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@ pwd
export CFLAGS_aarch64_apple_ios="-fno-stack-check -fno-stack-protector"
export CFLAGS_aarch64_apple_ios_sim="-fno-stack-check -fno-stack-protector"

# Clean aws-lc-sys build cache to avoid stale cmake state
echo "Cleaning aws-lc-sys build cache..."
rm -rf apps/mobile/modules/sd-mobile-core/core/target/aarch64-apple-ios/release/build/aws-lc-sys-* || true
rm -rf apps/mobile/modules/sd-mobile-core/core/target/aarch64-apple-ios-sim/release/build/aws-lc-sys-* || true
# Clean aws-lc-sys build cache if requested (fixes stale cmake state when
# switching between device/simulator or after Xcode updates)
# Usage: export CLEAN_AWS_LC=1 before building in Xcode, or: CLEAN_AWS_LC=1 bun run ios
if [ "${CLEAN_AWS_LC:-0}" = "1" ]; then
echo "Cleaning aws-lc-sys build cache..."
rm -rf target/aarch64-apple-ios/release/build/aws-lc-sys-* || true
rm -rf target/aarch64-apple-ios-sim/release/build/aws-lc-sys-* || true
fi

# Run xtask to build mobile libraries
cargo xtask build-mobile
Expand Down
6 changes: 3 additions & 3 deletions packages/assets/types.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ declare module "@sd/assets/images/*.jpg" {
}

declare module "@sd/assets/svgs/*.svg" {
import type { FC, SVGProps } from "react";
const content: FC<SVGProps<SVGSVGElement>>;
import type { FC } from "react";
const content: FC<Record<string, unknown>>;
export default content;
}

Expand All @@ -32,7 +32,7 @@ declare module "@sd/assets/videos/*.mp4" {
}

declare module "@sd/assets/sounds/*.mp3" {
const value: string;
const value: number | string; // number on React Native (asset ID), string on web (URL)
export default value;
}

Expand Down
8 changes: 8 additions & 0 deletions packages/ts-client/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@
"types": "./src/hooks/index.ts",
"default": "./src/hooks/index.ts"
},
"./hooks/useClient": {
"types": "./src/hooks/useClient.tsx",
"default": "./src/hooks/useClient.tsx"
},
"./hooks/useNormalizedQuery": {
"types": "./src/hooks/useNormalizedQuery.ts",
"default": "./src/hooks/useNormalizedQuery.ts"
},
"./src/hooks/useClient": {
"types": "./src/hooks/useClient.tsx",
"default": "./src/hooks/useClient.tsx"
Expand Down
11 changes: 4 additions & 7 deletions xtask/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,16 +120,13 @@ pub fn generate_cargo_config(
protoc,
mobile_native_deps,
android_ndk_home,
// Android NDK host tag - the prebuilt directory is always named darwin-x86_64 on macOS,
// but the binaries are universal (fat) binaries with native ARM64 support.
// Google kept the path name for backwards compatibility.
host_tag: match system.os {
Os::Windows => "windows-x86_64",
Os::Linux => "linux-x86_64",
Os::MacOS => {
if cfg!(target_arch = "aarch64") {
"darwin-aarch64"
} else {
"darwin-x86_64"
}
}
Os::MacOS => "darwin-x86_64",
},
is_win: matches!(system.os, Os::Windows),
is_macos: matches!(system.os, Os::MacOS),
Expand Down