From 423674539fae3257f780439bcdff9fae4e48c617 Mon Sep 17 00:00:00 2001 From: Android ROM Builder Date: Sun, 29 Jun 2025 23:49:43 +0200 Subject: [PATCH] Simplified pipeline: Direct Android building without Docker - Removed Docker dependency for simpler setup - Added direct Android build environment setup - Streamlined ROM building process - Works directly on Buildkite agent with minimal setup --- .buildkite/pipeline.yml | 261 +++++++++++++++++++++++++++++++--------- README.md | 179 --------------------------- scripts/build-rom.sh | 65 ---------- scripts/init-source.sh | 32 ----- scripts/package-rom.sh | 68 ----------- scripts/sync-source.sh | 39 ------ setup.sh | 88 -------------- 7 files changed, 206 insertions(+), 526 deletions(-) delete mode 100644 README.md delete mode 100755 scripts/build-rom.sh delete mode 100755 scripts/init-source.sh delete mode 100755 scripts/package-rom.sh delete mode 100755 scripts/sync-source.sh delete mode 100755 setup.sh diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 651537b..1cb7bdd 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -1,51 +1,107 @@ steps: - - label: ":android: Setup Environment" + - label: ":android: Setup Android Environment" key: "setup" command: | - echo "Setting up Android build environment..." - docker --version - docker-compose --version - echo "Environment ready!" + echo "๐Ÿš€ Setting up Android build environment..." + + # Check system requirements + echo "๐Ÿ“Š System info:" + uname -a + free -h + df -h . + nproc + + # Check required tools + echo "๐Ÿ”ง Checking required tools..." + which python3 || echo "โš ๏ธ Python3 not found" + which git || echo "โš ๏ธ Git not found" + which curl || echo "โš ๏ธ Curl not found" + + echo "โœ… Environment check complete!" agents: queue: "default" - - label: ":package: Build Docker Image" - key: "build-image" + - label: ":package: Install Dependencies" + key: "install-deps" depends_on: "setup" command: | - echo "Building Android ROM builder Docker image..." - cd docker - docker build -t android-rom-builder:latest . - echo "Docker image built successfully!" + echo "๐Ÿ“ฆ Installing Android build dependencies..." + + # Update package lists + sudo apt-get update + + # Install essential packages for Android building + sudo apt-get install -y \ + git curl python3 python3-pip \ + openjdk-8-jdk build-essential \ + libssl-dev libc6-dev libncurses5 \ + libncurses5-dev libreadline-dev \ + libtinfo5 libxml2-utils xsltproc \ + zip zlib1g-dev g++-multilib \ + gcc-multilib lib32ncurses5-dev \ + lib32readline-dev lib32z1-dev \ + ccache bison flex bc rsync \ + schedtool squashfs-tools \ + python3-mako libffi-dev + + # Install repo tool + sudo curl https://storage.googleapis.com/git-repo-downloads/repo -o /usr/local/bin/repo + sudo chmod a+x /usr/local/bin/repo + + echo "โœ… Dependencies installed!" agents: queue: "default" + timeout_in_minutes: 20 - label: ":octocat: Initialize Android Source" key: "init-source" - depends_on: "build-image" + depends_on: "install-deps" command: | - echo "Initializing Android source repository..." - mkdir -p source - docker run --rm \ - -v $$(pwd)/source:/home/buildbot/android/source \ - -v $$(pwd)/scripts:/home/buildbot/scripts:ro \ - android-rom-builder:latest \ - /home/buildbot/scripts/init-source.sh + echo "๐Ÿ”ง Initializing Android source repository..." + + # Configuration + MANIFEST_URL="${MANIFEST_URL:-https://github.com/LineageOS/android.git}" + MANIFEST_BRANCH="${MANIFEST_BRANCH:-lineage-21.0}" + + echo "๐Ÿ“‹ Using manifest: $MANIFEST_URL" + echo "๐ŸŒฟ Branch: $MANIFEST_BRANCH" + + # Configure git + git config --global user.email "buildbot@buildkite.local" + git config --global user.name "Buildkite Android Builder" + + # Create and initialize source directory + mkdir -p android-source + cd android-source + + if [ ! -d ".repo" ]; then + echo "๐Ÿ”„ Initializing repo..." + repo init -u "$MANIFEST_URL" -b "$MANIFEST_BRANCH" --depth=1 --no-clone-bundle + echo "โœ… Repository initialized!" + else + echo "๐Ÿ“ Repository already initialized" + fi agents: queue: "default" - timeout_in_minutes: 30 + timeout_in_minutes: 10 + env: + MANIFEST_URL: "https://github.com/LineageOS/android.git" + MANIFEST_BRANCH: "lineage-21.0" - - label: ":arrows_counterclockwise: Sync Android Source" + - label: ":arrows_counterclockwise: Sync Android Source" key: "sync-source" depends_on: "init-source" command: | - echo "Syncing Android source code..." - docker run --rm \ - -v $$(pwd)/source:/home/buildbot/android/source \ - -v $$(pwd)/ccache:/home/buildbot/android/ccache \ - -v $$(pwd)/scripts:/home/buildbot/scripts:ro \ - android-rom-builder:latest \ - /home/buildbot/scripts/sync-source.sh + echo "โฌ‡๏ธ Syncing Android source code..." + + cd android-source + + # Sync with parallel jobs + echo "๐Ÿš€ Starting source sync with $(nproc) parallel jobs..." + repo sync -c -j$(nproc) --force-sync --no-clone-bundle --no-tags --optimized-fetch --prune + + echo "โœ… Source sync completed!" + echo "๐Ÿ“Š Source size: $(du -sh . | cut -f1)" agents: queue: "default" timeout_in_minutes: 120 @@ -54,54 +110,149 @@ steps: key: "build-rom" depends_on: "sync-source" command: | - echo "Building Android ROM..." - docker run --rm \ - -v $$(pwd)/source:/home/buildbot/android/source \ - -v $$(pwd)/out:/home/buildbot/android/out \ - -v $$(pwd)/ccache:/home/buildbot/android/ccache \ - -v $$(pwd)/scripts:/home/buildbot/scripts:ro \ - --shm-size=2g \ - android-rom-builder:latest \ - /home/buildbot/scripts/build-rom.sh + echo "๐Ÿ”จ Building Android ROM..." + + cd android-source + + # Configuration + TARGET_DEVICE="${TARGET_DEVICE:-generic}" + BUILD_TYPE="${BUILD_TYPE:-userdebug}" + BUILD_VARIANT="${BUILD_VARIANT:-lineage}" + + echo "๐ŸŽฏ Build configuration:" + echo " Device: $TARGET_DEVICE" + echo " Type: $BUILD_TYPE" + echo " Variant: $BUILD_VARIANT" + + # Set up build environment + echo "โš™๏ธ Setting up build environment..." + source build/envsetup.sh + + # Configure ccache + export USE_CCACHE=1 + export CCACHE_DIR=$PWD/../ccache + mkdir -p $CCACHE_DIR + ccache -M 50G + + # Select build target + echo "๐ŸŽฏ Selecting build target..." + lunch "${BUILD_VARIANT}_${TARGET_DEVICE}-${BUILD_TYPE}" + + # Start build + echo "๐Ÿš€ Starting compilation..." + START_TIME=$(date +%s) + + if [ "$BUILD_VARIANT" = "lineage" ]; then + brunch "$TARGET_DEVICE" + else + make -j$(nproc) otapackage + fi + + END_TIME=$(date +%s) + BUILD_TIME=$((END_TIME - START_TIME)) + + echo "โœ… Build completed successfully!" + echo "โฑ๏ธ Build time: $(date -u -d @$BUILD_TIME +%H:%M:%S)" agents: queue: "default" timeout_in_minutes: 480 env: + TARGET_DEVICE: "generic" + BUILD_TYPE: "userdebug" + BUILD_VARIANT: "lineage" USE_CCACHE: "1" - CCACHE_DIR: "/home/buildbot/android/ccache" - - label: ":package: Package ROM" + - label: ":package: Package ROM Artifacts" key: "package-rom" depends_on: "build-rom" command: | - echo "Packaging ROM artifacts..." - docker run --rm \ - -v $$(pwd)/out:/home/buildbot/android/out \ - -v $$(pwd)/artifacts:/home/buildbot/artifacts \ - -v $$(pwd)/scripts:/home/buildbot/scripts:ro \ - android-rom-builder:latest \ - /home/buildbot/scripts/package-rom.sh + echo "๐Ÿ“ฆ Packaging ROM artifacts..." + + TARGET_DEVICE="${TARGET_DEVICE:-generic}" + OUT_DIR="android-source/out/target/product/$TARGET_DEVICE" + + # Create artifacts directory + mkdir -p artifacts + + echo "๐Ÿ“ Copying build artifacts..." + + # Copy ROM files + find "$OUT_DIR" -name "*.zip" -exec cp {} artifacts/ \; 2>/dev/null || true + find "$OUT_DIR" -name "recovery.img" -exec cp {} artifacts/ \; 2>/dev/null || true + find "$OUT_DIR" -name "boot.img" -exec cp {} artifacts/ \; 2>/dev/null || true + find "$OUT_DIR" -name "system.img" -exec cp {} artifacts/ \; 2>/dev/null || true + + # Create build info + cat > artifacts/build-info.json << EOF + { + "build_number": "${BUILDKITE_BUILD_NUMBER:-unknown}", + "commit": "${BUILDKITE_COMMIT:-unknown}", + "branch": "${BUILDKITE_BRANCH:-unknown}", + "device": "$TARGET_DEVICE", + "build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", + "build_type": "${BUILD_TYPE:-userdebug}", + "variant": "${BUILD_VARIANT:-lineage}" + } + EOF + + # Generate checksums + cd artifacts + for file in *.zip *.img 2>/dev/null; do + [ -f "$file" ] && md5sum "$file" > "$file.md5" + [ -f "$file" ] && sha256sum "$file" > "$file.sha256" + done + + echo "๐Ÿ“Š Artifacts created:" + ls -lh + + echo "โœ… Packaging completed!" agents: queue: "default" timeout_in_minutes: 30 + env: + TARGET_DEVICE: "generic" + BUILD_TYPE: "userdebug" + BUILD_VARIANT: "lineage" - - label: ":arrow_up: Upload Artifacts" + - label: ":arrow_up: Upload Artifacts" key: "upload-artifacts" depends_on: "package-rom" command: | - echo "Uploading ROM artifacts..." - buildkite-agent artifact upload "artifacts/*.zip" - buildkite-agent artifact upload "artifacts/*.img" + echo "โฌ†๏ธ Uploading ROM artifacts..." + + # Upload all ROM files + if ls artifacts/*.zip >/dev/null 2>&1; then + buildkite-agent artifact upload "artifacts/*.zip" + fi + + if ls artifacts/*.img >/dev/null 2>&1; then + buildkite-agent artifact upload "artifacts/*.img" + fi + + # Upload metadata buildkite-agent artifact upload "artifacts/*.json" + buildkite-agent artifact upload "artifacts/*.md5" + buildkite-agent artifact upload "artifacts/*.sha256" + + echo "โœ… Artifacts uploaded successfully!" agents: queue: "default" - label: ":white_check_mark: Build Complete" depends_on: "upload-artifacts" command: | - echo ":tada: Android ROM build completed successfully!" - echo "Build Number: $BUILDKITE_BUILD_NUMBER" - echo "Commit: $BUILDKITE_COMMIT" - echo "Branch: $BUILDKITE_BRANCH" + echo "๐ŸŽ‰ Android ROM build completed successfully!" + echo "" + echo "๐Ÿ“Š Build Information:" + echo " Build Number: ${BUILDKITE_BUILD_NUMBER}" + echo " Commit: ${BUILDKITE_COMMIT}" + echo " Branch: ${BUILDKITE_BRANCH}" + echo " Device: ${TARGET_DEVICE:-generic}" + echo " Variant: ${BUILD_VARIANT:-lineage}" + echo "" + echo "๐Ÿ“ฑ Your ROM is ready for download in the Artifacts tab!" agents: - queue: "default" \ No newline at end of file + queue: "default" + env: + TARGET_DEVICE: "generic" + BUILD_VARIANT: "lineage" \ No newline at end of file diff --git a/README.md b/README.md deleted file mode 100644 index 31b6070..0000000 --- a/README.md +++ /dev/null @@ -1,179 +0,0 @@ -# Android ROM Building with Buildkite - -This repository contains everything you need to build Android ROMs using Buildkite CI/CD with Docker containers. - -## ๐Ÿš€ Quick Setup - -### 1. Buildkite Pipeline Setup - -1. Go to your Buildkite dashboard -2. Click "New Pipeline" -3. Connect this GitHub repository -4. Set the pipeline configuration to use `.buildkite/pipeline.yml` -5. Add your agent queue (usually "default") - -### 2. Agent Configuration - -Make sure your Buildkite agent has: -- Docker installed and running -- Sufficient disk space (200GB+ recommended) -- Good internet connection for source sync - -### 3. Environment Configuration - -Copy `.env.example` to `.env` and configure: - -```bash -cp .env.example .env -# Edit .env with your specific settings -``` - -## ๐Ÿ“‹ Pipeline Steps - -The pipeline includes these automated steps: - -1. **๐Ÿ”ง Setup Environment** - Verify Docker and dependencies -2. **๐Ÿ“ฆ Build Docker Image** - Create Android build environment -3. **๐Ÿ™ Initialize Source** - Set up Android source repository -4. **๐Ÿ”„ Sync Source** - Download Android source code (~100GB) -5. **๐Ÿ”จ Build ROM** - Compile the Android ROM (2-8 hours) -6. **๐Ÿ“ฆ Package ROM** - Prepare artifacts for download -7. **โฌ†๏ธ Upload Artifacts** - Upload ROM files to Buildkite -8. **โœ… Complete** - Build finished notification - -## ๐ŸŽฏ Device Configuration - -To build for a specific device, modify these environment variables: - -```yaml -env: - TARGET_DEVICE: "your_device_codename" - BUILD_VARIANT: "lineage" # or aosp, etc. - BUILD_TYPE: "userdebug" # or user, eng -``` - -## ๐Ÿ—๏ธ Supported ROM Types - -- **LineageOS** (default configuration) -- **AOSP** (Android Open Source Project) -- **Custom ROMs** (modify manifest URL) - -## ๐Ÿ“ฑ Popular Device Examples - -### OnePlus 9 Pro (lemonades) -```yaml -env: - TARGET_DEVICE: "lemonades" - MANIFEST_URL: "https://github.com/LineageOS/android.git" - MANIFEST_BRANCH: "lineage-21.0" -``` - -### Pixel 7 Pro (cheetah) -```yaml -env: - TARGET_DEVICE: "cheetah" - MANIFEST_URL: "https://github.com/PixelExperience/manifest.git" - MANIFEST_BRANCH: "thirteen" -``` - -## ๐Ÿ”ง Manual Build Commands - -If you want to run builds manually: - -```bash -# Build Docker image -cd docker && docker build -t android-rom-builder . - -# Run full build process -docker-compose up - -# Run individual steps -docker run --rm -v $(pwd)/source:/home/buildbot/android/source android-rom-builder /home/buildbot/scripts/init-source.sh -docker run --rm -v $(pwd)/source:/home/buildbot/android/source android-rom-builder /home/buildbot/scripts/sync-source.sh -docker run --rm -v $(pwd)/source:/home/buildbot/android/source -v $(pwd)/out:/home/buildbot/android/out android-rom-builder /home/buildbot/scripts/build-rom.sh -``` - -## ๐Ÿ“Š Build Requirements - -### System Requirements -- **CPU**: 8+ cores recommended -- **RAM**: 32GB+ recommended -- **Storage**: 200GB+ free space -- **Network**: Stable high-speed connection - -### Build Times (approximate) -- **Source Sync**: 30-60 minutes -- **First Build**: 4-8 hours -- **Incremental**: 30-120 minutes - -## ๐Ÿ—‚๏ธ Directory Structure - -``` -. -โ”œโ”€โ”€ .buildkite/ -โ”‚ โ””โ”€โ”€ pipeline.yml # Buildkite pipeline configuration -โ”œโ”€โ”€ docker/ -โ”‚ โ”œโ”€โ”€ Dockerfile # Android build environment -โ”‚ โ””โ”€โ”€ docker-compose.yml # Container orchestration -โ”œโ”€โ”€ scripts/ -โ”‚ โ”œโ”€โ”€ init-source.sh # Initialize Android source -โ”‚ โ”œโ”€โ”€ sync-source.sh # Sync source code -โ”‚ โ”œโ”€โ”€ build-rom.sh # Build ROM -โ”‚ โ””โ”€โ”€ package-rom.sh # Package artifacts -โ”œโ”€โ”€ source/ # Android source code (auto-created) -โ”œโ”€โ”€ out/ # Build outputs (auto-created) -โ”œโ”€โ”€ ccache/ # Build cache (auto-created) -โ”œโ”€โ”€ artifacts/ # Final ROM files (auto-created) -โ””โ”€โ”€ .env # Environment configuration -``` - -## ๐ŸŽ›๏ธ Advanced Configuration - -### Custom Manifest -To use a different ROM source: - -```bash -# In .env file -MANIFEST_URL=https://github.com/YourROM/android.git -MANIFEST_BRANCH=your-branch-name -``` - -### Build Optimization -```bash -# Enable ccache for faster builds -USE_CCACHE=1 - -# Set build jobs (usually = CPU cores) -BUILD_JOBS=16 - -# Clean build (slower but ensures clean state) -CLEAN_BUILD=1 -``` - -## ๐Ÿ” Troubleshooting - -### Common Issues - -1. **Out of disk space**: Ensure 200GB+ free space -2. **Build fails**: Check logs in Buildkite dashboard -3. **Sync errors**: Verify internet connection and manifest URL -4. **Docker issues**: Ensure Docker daemon is running - -### Log Locations -- Buildkite logs: Available in web dashboard -- Docker logs: `docker logs android-rom-builder` -- Build logs: `out/verbose.log.gz` - -## ๐Ÿ“ž Support - -- Check Buildkite documentation for CI/CD issues -- Android build issues: Check device-specific forums -- Docker problems: Verify container setup - -## ๐ŸŽ‰ Success! - -Once your build completes, download artifacts from the Buildkite dashboard: -- `*.zip` - Flashable ROM package -- `*.img` - Individual partition images -- `build-info.json` - Build metadata -- `*.md5`/`*.sha256` - Checksums for verification \ No newline at end of file diff --git a/scripts/build-rom.sh b/scripts/build-rom.sh deleted file mode 100755 index c3cbb98..0000000 --- a/scripts/build-rom.sh +++ /dev/null @@ -1,65 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "๐Ÿ”จ Starting Android ROM build..." - -cd /home/buildbot/android/source - -# Configuration - modify these for your target device -TARGET_DEVICE="${TARGET_DEVICE:-generic}" -BUILD_TYPE="${BUILD_TYPE:-userdebug}" -BUILD_VARIANT="${BUILD_VARIANT:-lineage}" - -echo "๐ŸŽฏ Build configuration:" -echo " Device: $TARGET_DEVICE" -echo " Type: $BUILD_TYPE" -echo " Variant: $BUILD_VARIANT" - -# Set up build environment -echo "โš™๏ธ Setting up build environment..." -source build/envsetup.sh - -# Setup ccache -if [ "${USE_CCACHE:-1}" = "1" ]; then - echo "๐Ÿš€ Configuring ccache..." - export USE_CCACHE=1 - export CCACHE_DIR=/home/buildbot/android/ccache - ccache -M 50G - ccache -s -fi - -# Clean previous builds if requested -if [ "${CLEAN_BUILD:-0}" = "1" ]; then - echo "๐Ÿงน Cleaning previous build..." - make clean -fi - -# Select build target -echo "๐ŸŽฏ Selecting build target..." -lunch "${BUILD_VARIANT}_${TARGET_DEVICE}-${BUILD_TYPE}" - -# Start build -echo "๐Ÿ”จ Starting compilation..." -START_TIME=$(date +%s) - -# Build with appropriate number of parallel jobs -JOBS=${BUILD_JOBS:-$(nproc)} -echo "๐Ÿš€ Building with $JOBS parallel jobs..." - -if [ "$BUILD_VARIANT" = "lineage" ]; then - # LineageOS specific build command - brunch "$TARGET_DEVICE" -else - # Generic AOSP build - make -j"$JOBS" otapackage -fi - -END_TIME=$(date +%s) -BUILD_TIME=$((END_TIME - START_TIME)) - -echo "โœ… Build completed successfully!" -echo "โฑ๏ธ Build time: $(date -u -d @$BUILD_TIME +%H:%M:%S)" - -# Display build artifacts -echo "๐Ÿ“ฆ Build artifacts:" -find /home/buildbot/android/out/target/product/"$TARGET_DEVICE"/ -name "*.zip" -o -name "*.img" | head -10 \ No newline at end of file diff --git a/scripts/init-source.sh b/scripts/init-source.sh deleted file mode 100755 index 23d2ad5..0000000 --- a/scripts/init-source.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "๐Ÿš€ Initializing Android source repository..." - -cd /home/buildbot/android/source - -# Configuration - you can modify these -MANIFEST_URL="https://github.com/LineageOS/android.git" -MANIFEST_BRANCH="lineage-21.0" -MANIFEST_NAME="default.xml" - -# Check if source is already initialized -if [ ! -d ".repo" ]; then - echo "๐Ÿ“ Initializing repo with manifest: $MANIFEST_URL" - echo "๐Ÿ“‹ Branch: $MANIFEST_BRANCH" - - repo init \ - -u "$MANIFEST_URL" \ - -b "$MANIFEST_BRANCH" \ - -m "$MANIFEST_NAME" \ - --depth=1 \ - --no-clone-bundle - - echo "โœ… Repository initialized successfully!" -else - echo "๐Ÿ“ Repository already initialized, skipping..." -fi - -# Display repo info -echo "๐Ÿ“Š Repository information:" -repo info | head -10 \ No newline at end of file diff --git a/scripts/package-rom.sh b/scripts/package-rom.sh deleted file mode 100755 index efbd3ac..0000000 --- a/scripts/package-rom.sh +++ /dev/null @@ -1,68 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "๐Ÿ“ฆ Packaging ROM artifacts..." - -TARGET_DEVICE="${TARGET_DEVICE:-generic}" -OUT_DIR="/home/buildbot/android/out/target/product/$TARGET_DEVICE" -ARTIFACTS_DIR="/home/buildbot/artifacts" - -# Create artifacts directory -mkdir -p "$ARTIFACTS_DIR" - -echo "๐Ÿ“ Copying build artifacts..." - -# Copy main ROM files -if [ -f "$OUT_DIR"/*.zip ]; then - echo "๐Ÿ“ฑ Copying ROM zip files..." - cp "$OUT_DIR"/*.zip "$ARTIFACTS_DIR/" || true -fi - -# Copy recovery image -if [ -f "$OUT_DIR/recovery.img" ]; then - echo "๐Ÿ”ง Copying recovery image..." - cp "$OUT_DIR/recovery.img" "$ARTIFACTS_DIR/" || true -fi - -# Copy boot image -if [ -f "$OUT_DIR/boot.img" ]; then - echo "๐Ÿฅพ Copying boot image..." - cp "$OUT_DIR/boot.img" "$ARTIFACTS_DIR/" || true -fi - -# Copy system image -if [ -f "$OUT_DIR/system.img" ]; then - echo "๐Ÿ’ฟ Copying system image..." - cp "$OUT_DIR/system.img" "$ARTIFACTS_DIR/" || true -fi - -# Copy vendor image -if [ -f "$OUT_DIR/vendor.img" ]; then - echo "๐Ÿช Copying vendor image..." - cp "$OUT_DIR/vendor.img" "$ARTIFACTS_DIR/" || true -fi - -# Create build info JSON -echo "๐Ÿ“‹ Creating build information..." -cat > "$ARTIFACTS_DIR/build-info.json" << EOF -{ - "build_number": "${BUILDKITE_BUILD_NUMBER:-unknown}", - "commit": "${BUILDKITE_COMMIT:-unknown}", - "branch": "${BUILDKITE_BRANCH:-unknown}", - "device": "$TARGET_DEVICE", - "build_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", - "build_type": "${BUILD_TYPE:-userdebug}", - "variant": "${BUILD_VARIANT:-lineage}" -} -EOF - -# Create checksums -echo "๐Ÿ” Generating checksums..." -cd "$ARTIFACTS_DIR" -find . -name "*.zip" -o -name "*.img" | xargs -I {} sh -c 'md5sum "{}" > "{}.md5"' -find . -name "*.zip" -o -name "*.img" | xargs -I {} sh -c 'sha256sum "{}" > "{}.sha256"' - -echo "๐Ÿ“Š Artifact summary:" -ls -lh "$ARTIFACTS_DIR" - -echo "โœ… Packaging completed successfully!" \ No newline at end of file diff --git a/scripts/sync-source.sh b/scripts/sync-source.sh deleted file mode 100755 index eb10317..0000000 --- a/scripts/sync-source.sh +++ /dev/null @@ -1,39 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "๐Ÿ”„ Syncing Android source code..." - -cd /home/buildbot/android/source - -# Check if repo is initialized -if [ ! -d ".repo" ]; then - echo "โŒ Repository not initialized! Run init-source.sh first." - exit 1 -fi - -# Sync with multiple jobs for faster download -echo "โฌ‡๏ธ Starting source sync..." -repo sync \ - -c \ - -j$(nproc) \ - --force-sync \ - --no-clone-bundle \ - --no-tags \ - --optimized-fetch \ - --prune - -echo "โœ… Source sync completed successfully!" - -# Display sync statistics -echo "๐Ÿ“Š Sync statistics:" -echo "Total repositories: $(find .repo/projects -name "*.git" | wc -l)" -echo "Disk usage: $(du -sh . | cut -f1)" - -# Check for any missing projects -echo "๐Ÿ” Checking for missing projects..." -if repo status | grep -q "project.*dirty\|project.*not up-to-date"; then - echo "โš ๏ธ Some projects may need attention:" - repo status | grep -E "project.*dirty|project.*not up-to-date" || true -else - echo "โœ… All projects are clean and up-to-date" -fi \ No newline at end of file diff --git a/setup.sh b/setup.sh deleted file mode 100755 index d4385be..0000000 --- a/setup.sh +++ /dev/null @@ -1,88 +0,0 @@ -#!/bin/bash -set -euo pipefail - -echo "๐Ÿš€ Setting up Android ROM building environment..." - -# Create necessary directories -echo "๐Ÿ“ Creating directory structure..." -mkdir -p source out ccache artifacts - -# Create environment file if it doesn't exist -if [ ! -f ".env" ]; then - echo "โš™๏ธ Creating environment configuration..." - cat > .env << 'EOF' -# Buildkite Agent Configuration -BUILDKITE_AGENT_TOKEN=your_buildkite_agent_token_here - -# Android Build Configuration -TARGET_DEVICE=generic -BUILD_TYPE=userdebug -BUILD_VARIANT=lineage -BUILD_JOBS=8 - -# Build Options -USE_CCACHE=1 -CLEAN_BUILD=0 - -# Manifest Configuration -MANIFEST_URL=https://github.com/LineageOS/android.git -MANIFEST_BRANCH=lineage-21.0 -MANIFEST_NAME=default.xml - -# Storage Paths (adjust these for your system) -SOURCE_DIR=./source -OUT_DIR=./out -CCACHE_DIR=./ccache -ARTIFACTS_DIR=./artifacts -EOF - echo "โœ… Created .env file - please edit it with your configuration!" -else - echo "โš ๏ธ .env file already exists, skipping..." -fi - -# Check Docker installation -echo "๐Ÿณ Checking Docker installation..." -if command -v docker &> /dev/null; then - echo "โœ… Docker is installed" - docker --version -else - echo "โŒ Docker is not installed! Please install Docker first." - exit 1 -fi - -# Check Docker Compose -if command -v docker-compose &> /dev/null; then - echo "โœ… Docker Compose is installed" - docker-compose --version -else - echo "โŒ Docker Compose is not installed! Please install Docker Compose first." - exit 1 -fi - -# Check available disk space -echo "๐Ÿ’พ Checking available disk space..." -AVAILABLE_SPACE=$(df -BG . | tail -1 | awk '{print $4}' | sed 's/G//') -if [ "$AVAILABLE_SPACE" -lt 200 ]; then - echo "โš ๏ธ Warning: Only ${AVAILABLE_SPACE}GB available. Android builds need 200GB+!" -else - echo "โœ… ${AVAILABLE_SPACE}GB available - sufficient for ROM building" -fi - -# Build Docker image -echo "๐Ÿ”จ Building Docker image (this may take a while)..." -cd docker -docker build -t android-rom-builder:latest . -cd .. - -echo "" -echo "๐ŸŽ‰ Setup completed successfully!" -echo "" -echo "Next steps:" -echo "1. Edit .env file with your device and ROM configuration" -echo "2. Set up your Buildkite pipeline using .buildkite/pipeline.yml" -echo "3. Push this repository to GitHub/GitLab" -echo "4. Connect the repository to Buildkite" -echo "5. Trigger your first build!" -echo "" -echo "For manual builds, run: docker-compose up" -echo "" \ No newline at end of file