Skip to content

Commit be85fe2

Browse files
abueideclaude
andcommitted
refactor: remove stale build command references, use native build tools
android.sh build and ios.sh build were intentionally removed. Replace all references with native tool commands (gradle assembleDebug, xcodebuild, ios.sh xcodebuild wrapper). Update deploy.sh fallbacks to error instead of calling non-existent commands. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent d070a2f commit be85fe2

15 files changed

Lines changed: 60 additions & 215 deletions

File tree

plugins/android/REFERENCE.md

Lines changed: 1 addition & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -45,49 +45,6 @@ Configure the plugin by setting environment variables in `plugin.json`. These ar
4545

4646
## Commands
4747

48-
### Build
49-
50-
```bash
51-
android.sh build [--config Debug|Release] [--task gradle_task] [--quiet]
52-
[-- extra_gradle_args...]
53-
```
54-
- Auto-detects Gradle project by looking for `build.gradle`, `build.gradle.kts`, or `settings.gradle`
55-
- Default: runs `gradle assembleDebug` (or `assembleRelease` if `--config Release`)
56-
- Uses `gradlew` if present in the project, otherwise falls back to system `gradle`
57-
58-
**Project detection order:**
59-
1. Current working directory
60-
2. `$DEVBOX_PROJECT_ROOT` (if different)
61-
3. `$PWD/android/` (React Native convention)
62-
4. `$DEVBOX_PROJECT_ROOT/android/` (if different)
63-
64-
**Examples:**
65-
```bash
66-
# Build with defaults (assembleDebug)
67-
android.sh build
68-
69-
# Build Release
70-
android.sh build --config Release
71-
72-
# Custom Gradle task
73-
android.sh build --task bundleRelease
74-
75-
# Pass extra Gradle flags
76-
android.sh build -- --info --stacktrace
77-
```
78-
79-
Use in `devbox.json`:
80-
```json
81-
{
82-
"shell": {
83-
"scripts": {
84-
"build": ["android.sh build"],
85-
"build:release": ["android.sh build --config Release"]
86-
}
87-
}
88-
}
89-
```
90-
9148
### Emulator
9249

9350
- `devbox run --pure android.sh emulator start [--pure] [device]`
@@ -150,7 +107,7 @@ android.sh app stop
150107
2. Recursive search of project root for `*.apk` files (excludes .gradle/, build/intermediates/, node_modules/, .devbox/)
151108
3. Recursive search of `$PWD` if different from project root (same exclusions)
152109

153-
**Build script detection:** Tries `build:android` first, then falls back to `build`. If neither script exists, it runs `android.sh build` to auto-detect and build the Gradle project.
110+
**Build script detection:** Tries `build:android` first, then falls back to `build`. Define a build script in `devbox.json` using native tools (e.g., `gradle assembleDebug`).
154111

155112
### Device management
156113

plugins/android/virtenv/scripts/domain/deploy.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,15 @@ android_run_build() {
3535

3636
echo "Building Android project: $project_root"
3737

38-
# Try platform-specific build command first, then generic, then auto-detect
38+
# Try platform-specific build command first, then generic
3939
if (cd "$project_root" && devbox run --list 2>/dev/null | grep -q "build:android"); then
4040
(cd "$project_root" && devbox run --pure build:android)
4141
elif (cd "$project_root" && devbox run --list 2>/dev/null | grep -q "build"); then
4242
(cd "$project_root" && devbox run --pure build)
4343
else
44-
android_log_info "deploy.sh" "No build:android or build script found; using android.sh build"
45-
(cd "$project_root" && android.sh build)
44+
android_log_error "deploy.sh" "No build:android or build script found in devbox.json."
45+
android_log_error "deploy.sh" "Define a build script using native tools (e.g., gradle assembleDebug)."
46+
return 1
4647
fi
4748
}
4849

plugins/android/virtenv/scripts/user/android.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ case "$command_name" in
156156
project_root="${DEVBOX_PROJECT_ROOT:-${DEVBOX_PROJECT_DIR:-${DEVBOX_WD:-$PWD}}}"
157157
apk_path="$(android_find_apk "$project_root" || true)"
158158
if [ -z "$apk_path" ] || [ ! -f "$apk_path" ]; then
159-
echo "ERROR: No APK found. Build first with 'android.sh build'." >&2
159+
echo "ERROR: No APK found. Build first (e.g., gradle assembleDebug) or define a build:android script in devbox.json." >&2
160160
exit 1
161161
fi
162162
fi

plugins/ios/README.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ devbox run ios.sh devices list
1515
# Start simulator
1616
devbox run start:sim
1717

18-
# Build iOS app (auto-detects project)
19-
ios.sh build
18+
# Build iOS app (define build:ios in devbox.json)
19+
devbox run build:ios
2020

2121
# Build, install, and launch app on simulator
2222
ios.sh run
@@ -76,9 +76,10 @@ devbox run ios.sh devices sync # Ensure simulators match device definitions
7676

7777
### Build Commands
7878
```sh
79-
ios.sh build # Build iOS app (auto-detects project)
80-
ios.sh build --config Release # Build Release
81-
ios.sh build --action test # Run xcodebuild tests
79+
# Define build scripts in devbox.json using native xcodebuild:
80+
# "build:ios": ["ios.sh xcodebuild -scheme MyApp build"]
81+
devbox run build:ios # Build iOS app
82+
ios.sh xcodebuild <args> # Run xcodebuild with Nix flags stripped
8283
devbox run test:e2e # Run E2E tests with simulator
8384
```
8485

plugins/ios/REFERENCE.md

Lines changed: 2 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -124,56 +124,6 @@ ios.sh app stop
124124
- Terminates the deployed app via `xcrun simctl terminate`
125125
- Reads bundle ID and simulator UDID from suite-namespaced state files
126126

127-
### Build
128-
129-
```bash
130-
ios.sh build [--config Debug|Release] [--scheme name] [--workspace path]
131-
[--project path] [--derived-data path] [--quiet] [--action build|test]
132-
[-- extra_xcodebuild_args...]
133-
```
134-
- Auto-detects Xcode project (.xcworkspace preferred over .xcodeproj)
135-
- Default action: `build`. Use `--action test` for xcodebuild tests.
136-
- Calls `xcodebuild` directly (Nix vars are stripped at init time)
137-
138-
**Project detection order:**
139-
1. Current working directory
140-
2. `$DEVBOX_PROJECT_ROOT` (if different)
141-
3. `$PWD/ios/` (React Native convention)
142-
4. `$DEVBOX_PROJECT_ROOT/ios/` (if different)
143-
144-
Within each directory, prefers `.xcworkspace` over `.xcodeproj`. Scheme is derived from the project filename (e.g., `MyApp.xcodeproj``MyApp`), overridable via `--scheme` or `IOS_APP_SCHEME`.
145-
146-
**Examples:**
147-
```bash
148-
# Build with defaults (Debug, auto-detect project)
149-
ios.sh build
150-
151-
# Build Release
152-
ios.sh build --config Release
153-
154-
# Run xcodebuild tests
155-
ios.sh build --action test
156-
157-
# Explicit workspace and scheme
158-
ios.sh build --workspace ios/MyApp.xcworkspace --scheme MyApp
159-
160-
# Pass extra flags to xcodebuild
161-
ios.sh build --quiet -- -allowProvisioningUpdates
162-
```
163-
164-
Use in `devbox.json`:
165-
```json
166-
{
167-
"shell": {
168-
"scripts": {
169-
"build": ["ios.sh build"],
170-
"build:release": ["ios.sh build --config Release"],
171-
"test": ["ios.sh build --action test"]
172-
}
173-
}
174-
}
175-
```
176-
177127
### Xcode Build Wrapper
178128

179129
```bash
@@ -197,7 +147,7 @@ Use this in `devbox.json` build scripts instead of manually stripping Nix flags:
197147
}
198148
```
199149

200-
The iOS init hook (`devbox_omit_nix_env()`) strips Nix compilation variables at shell startup, so `xcodebuild` works natively in devbox shell. The `ios.sh xcodebuild` subcommand forwards directly to `xcodebuild`.
150+
The iOS init hook strips Nix compilation variables at shell startup, so `xcodebuild` works natively in devbox shell. The `ios.sh xcodebuild` subcommand forwards directly to `xcodebuild`.
201151

202152
### Run App
203153

@@ -217,7 +167,7 @@ ios.sh run [app_path] [device]
217167

218168
Bundle ID is auto-extracted from the .app's `Info.plist` via PlistBuddy, or from `xcodebuild -showBuildSettings` if available.
219169

220-
**Build script detection:** The `run` command tries `build:ios` first, then falls back to `build`. If neither script exists, it runs `ios.sh build` to auto-detect and build the Xcode project.
170+
**Build script detection:** The `run` command tries `build:ios` first, then falls back to `build`. Define a build script in `devbox.json` using native tools (e.g., `xcodebuild`).
221171

222172
### Device Management
223173

plugins/ios/virtenv/scripts/domain/deploy.sh

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -308,16 +308,17 @@ ios_run_build() {
308308
return 0
309309
fi
310310

311-
# Try platform-specific build command first, then fall back to generic, then auto-detect
311+
# Try platform-specific build command first, then fall back to generic
312312
if (cd "$_build_root" && "$_devbox_bin" run --list 2>/dev/null | grep -q "build:ios"); then
313313
ios_log_info "deploy.sh" "Running build:ios"
314314
(cd "$_build_root" && "$_devbox_bin" run --pure build:ios)
315315
elif (cd "$_build_root" && "$_devbox_bin" run --list 2>/dev/null | grep -q "build"); then
316316
ios_log_info "deploy.sh" "Running build"
317317
(cd "$_build_root" && "$_devbox_bin" run --pure build)
318318
else
319-
ios_log_info "deploy.sh" "No build:ios or build script found; using ios.sh build"
320-
(cd "$_build_root" && ios.sh build)
319+
ios_log_error "deploy.sh" "No build:ios or build script found in devbox.json."
320+
ios_log_error "deploy.sh" "Define a build script using native tools (e.g., xcodebuild)."
321+
return 1
321322
fi
322323
}
323324

plugins/ios/virtenv/scripts/user/ios.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ case "$command_name" in
391391
project_root="$(ios_resolve_project_root)"
392392
app_path="$(ios_find_app "$project_root" || true)"
393393
if [ -z "$app_path" ] || [ ! -d "$app_path" ]; then
394-
echo "ERROR: No .app bundle found. Build first with 'ios.sh build'." >&2
394+
echo "ERROR: No .app bundle found. Build first (e.g., xcodebuild) or define a build:ios script in devbox.json." >&2
395395
exit 1
396396
fi
397397
fi

wiki/guides/android-guide.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -228,10 +228,10 @@ The plugin provides emulator and device management. Build and deploy commands ar
228228
"shell": {
229229
"scripts": {
230230
"build:android": [
231-
"android.sh build"
231+
"gradle assembleDebug"
232232
],
233233
"build:release": [
234-
"android.sh build --config Release"
234+
"gradle assembleRelease"
235235
],
236236
"start:app": [
237237
"android.sh run ${1:-}"

wiki/guides/cheatsheets/ios.md

Lines changed: 8 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,8 @@ devbox run stop:sim
5656
## Build and Deploy
5757

5858
```bash
59-
# Build (auto-detects project)
60-
ios.sh build
61-
62-
# Build Release
63-
ios.sh build --config Release
64-
65-
# Run xcodebuild tests
66-
ios.sh build --action test
59+
# Build (define build:ios in devbox.json using xcodebuild)
60+
devbox run build:ios
6761

6862
# Run app (starts simulator, builds, installs, launches)
6963
ios.sh run
@@ -78,9 +72,8 @@ ios.sh run /path/to/MyApp.app
7872
Build scripts in `devbox.json`:
7973

8074
```bash
81-
# "build": ["ios.sh build"]
82-
# "build:release": ["ios.sh build --config Release"]
83-
# "test": ["ios.sh build --action test"]
75+
# "build:ios": ["ios.sh xcodebuild -scheme MyApp -configuration Debug -destination 'generic/platform=iOS Simulator' build"]
76+
# "build:release": ["ios.sh xcodebuild -scheme MyApp -configuration Release build"]
8477
# "start:app": ["ios.sh run ${1:-}"]
8578
```
8679

@@ -182,13 +175,13 @@ reports/
182175
## Common Xcode Commands
183176

184177
```bash
185-
# Build project (preferred)
186-
ios.sh build
187-
188-
# Build project (direct xcodebuild - works natively, Nix vars stripped at init)
178+
# Build project (xcodebuild works natively, Nix vars stripped at init)
189179
xcodebuild -project ios.xcodeproj -scheme ios -configuration Debug \
190180
-destination 'generic/platform=iOS Simulator' build
191181

182+
# Or use ios.sh xcodebuild wrapper if Nix vars cause issues
183+
ios.sh xcodebuild -project ios.xcodeproj -scheme ios build
184+
192185
# Install app to simulator
193186
xcrun simctl install booted path/to/app.app
194187

wiki/guides/ios-guide.md

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ Create or modify your `devbox.json` to include the iOS plugin:
3535
}
3636
```
3737

38-
The `ios.sh build` command stores build output in `.devbox/virtenv/ios/DerivedData` by default (configurable via `IOS_DERIVED_DATA_PATH`).
38+
Build output is stored in `.devbox/virtenv/ios/DerivedData` by default (configurable via `IOS_DERIVED_DATA_PATH`).
3939

4040
### Initial Setup
4141

@@ -241,10 +241,10 @@ The plugin provides simulator and device management. Build and deploy commands a
241241
"shell": {
242242
"scripts": {
243243
"build:ios": [
244-
"ios.sh build"
244+
"ios.sh xcodebuild -scheme MyApp -configuration Debug -destination 'generic/platform=iOS Simulator' build"
245245
],
246246
"build:release": [
247-
"ios.sh build --config Release"
247+
"ios.sh xcodebuild -scheme MyApp -configuration Release build"
248248
],
249249
"start:app": [
250250
"ios.sh run ${1:-}"
@@ -645,14 +645,12 @@ This shows:
645645

646646
**Symptom**: Xcode build errors related to linker flags or Nix environment variables.
647647

648-
**Solution**: The iOS init hook now strips Nix compilation variables (`LD`, `LDFLAGS`, `NIX_LDFLAGS`, `NIX_CFLAGS_COMPILE`, `NIX_CFLAGS_LINK`) at shell startup, so `xcodebuild` works natively in devbox shell. If you still encounter issues, use `ios.sh build` which handles this automatically:
648+
**Solution**: The iOS init hook strips Nix compilation variables (`LD`, `LDFLAGS`, `NIX_LDFLAGS`, `NIX_CFLAGS_COMPILE`, `NIX_CFLAGS_LINK`) at shell startup, so `xcodebuild` works natively in devbox shell. If you still encounter issues, use the `ios.sh xcodebuild` wrapper which strips these variables in a subshell:
649649

650650
```bash
651-
ios.sh build
651+
ios.sh xcodebuild -scheme MyApp build
652652
```
653653

654-
The `ios.sh xcodebuild` wrapper is also available for backward compatibility when running outside devbox shell.
655-
656654
### Lock File Out of Sync
657655

658656
**Symptom**: "Warning: devices.lock may be stale" or checksum mismatch.

0 commit comments

Comments
 (0)