Skip to content
Open
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
1 change: 1 addition & 0 deletions configs/android.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: false # Not needed for Android
depot_tools: false

# Snippets runtime flags
android: true # Android development tools
Expand Down
1 change: 1 addition & 0 deletions configs/backend.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: false
depot_tools: false

# Snippets runtime flags
android: false
Expand Down
1 change: 1 addition & 0 deletions configs/everything.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: true # iOS and React Native
depot_tools: true

# All snippets runtime flags enabled
android: true
Expand Down
1 change: 1 addition & 0 deletions configs/example-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: false
depot_tools: false

# Snippets runtime flags
android: false
Expand Down
1 change: 1 addition & 0 deletions configs/ios.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: true # Required for iOS development
depot_tools: false

# Snippets runtime flags
android: false
Expand Down
1 change: 1 addition & 0 deletions configs/macos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: false # Not needed for general macOS dev
depot_tools: false

# Snippets runtime flags
android: false
Expand Down
1 change: 1 addition & 0 deletions configs/minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: false
git: false
cocoapods: false
depot_tools: false

# Snippets runtime flags (control what loads from entry.zsh)
android: false
Expand Down
1 change: 1 addition & 0 deletions configs/react-native.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: true # Required for React Native iOS
depot_tools: false

# Snippets runtime flags
android: true # React Native Android support
Expand Down
1 change: 1 addition & 0 deletions configs/web.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ components:
mise: true
git: true
cocoapods: false
depot_tools: false

# Snippets runtime flags
android: false
Expand Down
28 changes: 19 additions & 9 deletions osa-cli.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -208,25 +208,25 @@ load_json_config() {

# For backward compatibility during installation, also set OSA_SETUP_* variables
# These are used by run_component() to determine what to install
local -a component_keys=(symlinks oh_my_zsh zsh_plugins homebrew mise osa_snippets git android iterm2 vscode cocoapods)
local -a component_keys=(symlinks oh_my_zsh zsh_plugins homebrew mise osa_snippets git android iterm2 vscode cocoapods depot_tools)

for key in "${component_keys[@]}"; do
local enabled=$(yq eval ".components.${key} // false" "$resolved_path" 2>/dev/null)
local enabled=$(yq eval ".components.${key} // false" "$resolved_path" 2>/dev/null | tr -d '\n')
local var_name="OSA_SETUP_$(normalize_key "$key")"

if [[ "$enabled" == "true" ]]; then
typeset -g "$var_name=true"
typeset -gx "$var_name=true"
else
typeset -g "$var_name=false"
typeset -gx "$var_name=false"
fi
done

# Load runtimes into MISE_*_VERSION for runtime installation
local -a runtime_keys=(node python ruby java rust go deno elixir erlang)

for runtime in "${runtime_keys[@]}"; do
local enabled=$(yq eval ".runtimes.${runtime}.enabled // false" "$resolved_path" 2>/dev/null)
local version=$(yq eval ".runtimes.${runtime}.version // \"latest\"" "$resolved_path" 2>/dev/null)
local enabled=$(yq eval ".runtimes.${runtime}.enabled // false" "$resolved_path" 2>/dev/null | tr -d '\n')
local version=$(yq eval ".runtimes.${runtime}.version // \"latest\"" "$resolved_path" 2>/dev/null | tr -d '\n')

if [[ "$enabled" == "true" ]]; then
# Validate version string contains only safe characters
Expand Down Expand Up @@ -356,6 +356,7 @@ init_components() {
# Development tools with install scripts
register_component "git" "Configure Git (version control)" "all" "src/setup/git.zsh"
register_component "cocoapods" "Install CocoaPods for iOS development" "macos" "src/setup/install-cocoapods.zsh"
register_component "depot_tools" "Install depot_tools (Chromium development utilities)" "all" "src/setup/install-depot-tools.zsh"
}

# Check if component is available for current platform
Expand Down Expand Up @@ -435,7 +436,7 @@ save_config() {
# If no OSA_CONFIG_* variables exist (interactive mode), convert OSA_SETUP_* to OSA_CONFIG_*
if [[ -z "$(echo $all_vars | grep '^OSA_CONFIG_')" ]]; then
# Convert OSA_SETUP_* component flags to OSA_CONFIG_COMPONENTS_*
local -a component_keys=(symlinks homebrew oh_my_zsh zsh_plugins mise osa_snippets git android iterm2 vscode cocoapods)
local -a component_keys=(symlinks homebrew oh_my_zsh zsh_plugins mise osa_snippets git android iterm2 vscode cocoapods depot_tools)
for key in "${component_keys[@]}"; do
local var_name="OSA_SETUP_$(echo $key | tr a-z A-Z | tr '-' '_')"
local value="${(P)var_name}"
Expand Down Expand Up @@ -708,7 +709,7 @@ validate_config() {

# Show enabled components
echo -e "${COLOR_BOLD}Setup Components (to be installed):${COLOR_RESET}"
local -a component_keys=(symlinks oh_my_zsh zsh_plugins homebrew mise osa_snippets git cocoapods)
local -a component_keys=(symlinks oh_my_zsh zsh_plugins homebrew mise osa_snippets git cocoapods depot_tools)
for key in "${component_keys[@]}"; do
local enabled=$(yq eval ".components.${key} // false" "$resolved_path" 2>/dev/null)
if [[ "$enabled" == "true" ]]; then
Expand Down Expand Up @@ -1057,6 +1058,10 @@ automated_setup() {
selected_components+=("cocoapods")
fi

if [[ "$OSA_SETUP_DEPOT_TOOLS" == "true" ]]; then
selected_components+=("depot_tools")
fi

if [[ ${#selected_components[@]} -eq 0 ]]; then
echo -e "${COLOR_YELLOW}No components enabled in configuration.${COLOR_RESET}"
echo "Run with --interactive to select components."
Expand Down Expand Up @@ -1310,6 +1315,7 @@ enable_minimal() {
OSA_SETUP_ITERM2=false
OSA_SETUP_VSCODE=false
OSA_SETUP_OSA_SNIPPETS=false
OSA_SETUP_DEPOT_TOOLS=false

# Enable homebrew on macOS
if [[ "$OSA_IS_MACOS" == "true" ]]; then
Expand Down Expand Up @@ -1956,7 +1962,11 @@ main() {
;;
-a|--auto)
# Load saved config for auto mode
load_config
if ! load_config; then
echo -e "${COLOR_YELLOW}⚠${COLOR_RESET} No saved configuration found at: $OSA_CONFIG_FILE"
echo "Run with --interactive to create a configuration first"
exit 1
fi
automated_setup
exit $?
;;
Expand Down
3 changes: 3 additions & 0 deletions src/setup/install-cmake.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Install cmake for building C/C++ projects
Copy link

Copilot AI Dec 28, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing shebang at the beginning of the file. All zsh script files must start with #!/usr/bin/env zsh according to the project's coding guidelines.

Copilot generated this review using guidance from repository custom instructions.
echo "Installing cmake "
brew install cmake
8 changes: 4 additions & 4 deletions src/setup/install-cocoapods.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -15,22 +15,22 @@ mkdir -p "$GEM_HOME/bin" "$GEM_HOME/specs" 2>/dev/null || true
# Try installing with --user-install flag first (avoids permission issues)
if gem install cocoapods --user-install 2>&1; then
echo "βœ“ CocoaPods $(pod --version) installed successfully"
exit 0
return 0
else
# Fallback to standard install
echo "⚠ Standard gem install attempt..."
if gem install cocoapods 2>&1; then
if command -v pod &>/dev/null; then
echo "βœ“ CocoaPods $(pod --version) installed successfully"
exit 0
return 0
else
echo "βœ— CocoaPods installation verification failed"
exit 1
return 1
fi
else
echo "βœ— Failed to install CocoaPods"
echo "β†’ This usually means the gem directory doesn't have write permissions"
echo "β†’ Try running: sudo gem install cocoapods"
exit 1
return 1
fi
fi
46 changes: 46 additions & 0 deletions src/setup/install-depot-tools.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/usr/bin/env zsh
# Install/update depot_tools - Chromium development utilities
# https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html

echo "Installing depot_tools (Chromium development utilities)..."

# Configuration - install to external-libs like other tools
DEPOT_TOOLS_REPO="${DEPOT_TOOLS_REPO:-https://chromium.googlesource.com/chromium/tools/depot_tools.git}"
DEPOT_TOOLS_DIR="${DEPOT_TOOLS_DIR:-$OSA_REPO_PATH/external-libs/depot_tools}"

# Create parent directory if needed
mkdir -p "$(dirname "$DEPOT_TOOLS_DIR")"

# Check if depot_tools is already installed
if [[ -d "$DEPOT_TOOLS_DIR/.git" ]]; then
echo "Updating depot_tools..."
cd "$DEPOT_TOOLS_DIR"
if ! git pull --rebase; then
echo "βœ— Failed to update depot_tools via git pull"
return 1
fi
cd - > /dev/null
else
# Clone depot_tools if not already present
echo "Cloning depot_tools from $DEPOT_TOOLS_REPO..."

if ! git clone "$DEPOT_TOOLS_REPO" "$DEPOT_TOOLS_DIR"; then
echo "βœ— Failed to clone depot_tools from $DEPOT_TOOLS_REPO"
echo "Ensure git is installed and you have internet access"
return 1
fi
fi

# Note: depot_tools will be added to PATH via plugin-init/depot-tools.zsh
# which sources the symlink created by initialize-repo-symlinks.zsh

echo "βœ“ depot_tools installed at: $DEPOT_TOOLS_DIR"
echo ""
echo "To complete setup:"
echo " 1. Restart your shell or run: source ~/.zshrc"
echo " 2. Verify installation: gclient --version"
echo ""
echo "For Chromium development, run:"
echo " cd ~/chromium_workspace"
echo " fetch chromium"
echo ""
3 changes: 3 additions & 0 deletions src/setup/install-tree.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Install tree which is a useful utility for displaying directory structures
echo "Installing tree utility..."
brew install tree
3 changes: 3 additions & 0 deletions src/zsh/constructors/base.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ if [[ "${OSA_CONFIG_COMPONENTS_ANDROID}" == "true" ]]; then
safe_source "$OSA_ZSH_PLUGINS/android-sdk.zsh"
fi

# Depot tools for Chromium development
safe_source "$OSA_ZSH_PLUGINS/depot-tools.zsh"

# OSA CLI runtime - exposes 'osa-setup' command for quick access
# Noting that `osa` CLI is installed via osa-scripts repo and can run osa-setup by doing `osa setup`
safe_source "$OSA_ZSH_ALIASES/osa-setup.zsh"
Expand Down
18 changes: 18 additions & 0 deletions src/zsh/plugin-init/depot-tools.zsh
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
#!/usr/bin/env zsh
# depot_tools plugin initialization
# Add depot_tools to PATH if installed
# https://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html

DEPOT_TOOLS_HOME="${DEPOT_TOOLS_HOME:-$OSA_CONFIG/external-libs/depot_tools}"

if [[ -d "$DEPOT_TOOLS_HOME" ]]; then
export PATH="$DEPOT_TOOLS_HOME:$PATH"
else
# Inform user depot_tools is not installed
if [[ -z "$DEPOT_TOOLS_SKIP_INIT_MESSAGE" ]]; then
echo "Note: depot_tools not found at: $DEPOT_TOOLS_HOME"
echo "Install with: ./osa-cli.zsh --enable depot_tools"
echo "Or manually: git clone https://chromium.googlesource.com/chromium/tools/depot_tools.git $DEPOT_TOOLS_HOME"
export DEPOT_TOOLS_SKIP_INIT_MESSAGE=1
fi
fi
1 change: 0 additions & 1 deletion src/zsh/snippets

This file was deleted.