Initial commit: HereIAm mouse movement monitor
- Complete macOS application with PyQt5 GUI - Smart mouse monitoring with configurable timing - System menu bar integration with adaptive theming - Comprehensive build system with PyInstaller - Professional DMG creation for distribution - Full documentation and testing scripts
This commit is contained in:
115
build_app.sh
Executable file
115
build_app.sh
Executable file
@@ -0,0 +1,115 @@
|
||||
#!/bin/bash
|
||||
|
||||
# HereIAm Build Script
|
||||
# This script builds the macOS .app bundle for distribution
|
||||
|
||||
set -e # Exit on any error
|
||||
|
||||
echo "🚀 Building HereIAm.app for macOS..."
|
||||
echo "======================================="
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m' # No Color
|
||||
|
||||
# Get script directory
|
||||
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
# Check if virtual environment exists and activate it
|
||||
if [ -d ".venv" ]; then
|
||||
echo -e "${BLUE}📦 Activating virtual environment...${NC}"
|
||||
source .venv/bin/activate
|
||||
else
|
||||
echo -e "${YELLOW}⚠️ No virtual environment found. Using system Python.${NC}"
|
||||
fi
|
||||
|
||||
# Check Python version
|
||||
echo -e "${BLUE}🐍 Checking Python version...${NC}"
|
||||
python_version=$(python3 --version 2>&1)
|
||||
echo "Using: $python_version"
|
||||
|
||||
# Install/upgrade build dependencies
|
||||
echo -e "${BLUE}📚 Installing build dependencies...${NC}"
|
||||
pip install --upgrade pip
|
||||
pip install pyinstaller
|
||||
pip install -r requirements.txt
|
||||
|
||||
# Clean previous builds
|
||||
echo -e "${BLUE}🧹 Cleaning previous builds...${NC}"
|
||||
rm -rf build/
|
||||
rm -rf dist/
|
||||
rm -rf __pycache__/
|
||||
find . -name "*.pyc" -delete
|
||||
find . -name "__pycache__" -type d -exec rm -rf {} + 2>/dev/null || true
|
||||
|
||||
# Verify assets exist
|
||||
echo -e "${BLUE}🎨 Verifying assets...${NC}"
|
||||
if [ ! -f "assets/Enabled.icns" ]; then
|
||||
echo -e "${RED}❌ Error: assets/Enabled.icns not found!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "assets/Disabled-Light.icns" ]; then
|
||||
echo -e "${RED}❌ Error: assets/Disabled-Light.icns not found!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ ! -f "assets/Disabled-Dark.icns" ]; then
|
||||
echo -e "${RED}❌ Error: assets/Disabled-Dark.icns not found!${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo -e "${GREEN}✅ All assets found${NC}"
|
||||
|
||||
# Build the application
|
||||
echo -e "${BLUE}🔨 Building application with PyInstaller...${NC}"
|
||||
pyinstaller --clean HereIAm.spec
|
||||
|
||||
# Check if build was successful
|
||||
if [ -d "dist/HereIAm.app" ]; then
|
||||
echo -e "${GREEN}✅ Build successful!${NC}"
|
||||
|
||||
# Get app size
|
||||
app_size=$(du -sh "dist/HereIAm.app" | cut -f1)
|
||||
echo -e "${GREEN}📦 App size: $app_size${NC}"
|
||||
|
||||
# Verify the app structure
|
||||
echo -e "${BLUE}🔍 Verifying app structure...${NC}"
|
||||
if [ -f "dist/HereIAm.app/Contents/MacOS/HereIAm" ]; then
|
||||
echo -e "${GREEN}✅ Executable found${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Executable not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
if [ -d "dist/HereIAm.app/Contents/Resources/assets" ]; then
|
||||
echo -e "${GREEN}✅ Assets bundled${NC}"
|
||||
else
|
||||
echo -e "${RED}❌ Assets not found${NC}"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Optional: Test if the app can be launched (basic check)
|
||||
echo -e "${BLUE}🧪 Testing app launch (will quit immediately)...${NC}"
|
||||
timeout 5s dist/HereIAm.app/Contents/MacOS/HereIAm || true
|
||||
|
||||
echo ""
|
||||
echo -e "${GREEN}🎉 Build completed successfully!${NC}"
|
||||
echo -e "${GREEN}📱 Your app is ready at: dist/HereIAm.app${NC}"
|
||||
echo ""
|
||||
echo -e "${YELLOW}📝 Next steps:${NC}"
|
||||
echo "1. Test the app: open dist/HereIAm.app"
|
||||
echo "2. For distribution, consider code signing:"
|
||||
echo " codesign --deep --force --verify --verbose --sign \"Developer ID Application: Your Name\" dist/HereIAm.app"
|
||||
echo "3. Create a DMG for distribution:"
|
||||
echo " ./create_dmg.sh"
|
||||
echo ""
|
||||
|
||||
else
|
||||
echo -e "${RED}❌ Build failed! Check the output above for errors.${NC}"
|
||||
exit 1
|
||||
fi
|
||||
Reference in New Issue
Block a user