Automated Custom ROM build script with Telegram notifications, GoFile upload.
pip3 install requests- Python 3.8+
repo,git
./build.py <device> [options]<device> can be a codename (looks up devices/<codename>.json) or a direct path to a device JSON file.
| Flag | Description |
|---|---|
--source NAME_OR_PATH |
Source name from sources/<name>.json or path to a source JSON file (default: pixelos) |
--skip-sync |
Skip source sync |
--skip-clone |
Skip device repo cloning |
--skip-upload |
Skip GoFile upload |
--clean-repos |
Clean device repos before cloning |
--build-dir PATH |
Custom build directory (default: ~/<source name>) |
# Full build using default source config (sources/pixelos.json)
./build.py spartan
# Build with explicit source config name
./build.py spartan --source pixelos
# Build with custom source config file
./build.py spartan --source ./sources/custom.json
# Incremental build (skip sync + clone)
./build.py spartan --skip-sync --skip-clone
# Build without upload
./build.py spartan --skip-uploadAdd device configs to devices/<codename>.json. See devices/device-template.json for the full template.
{
"device": {
"codename": "spartan",
"full_name": "Realme GT Neo 3T"
},
"environment": {
"EXCLUDE_RECOVERY": "true"
},
"repositories": {
"device_tree": {
"url": "https://github.com/...",
"branch": "lineage-23.0",
"path": "device/realme/spartan"
},
"vendor_tree": {
"url": "https://github.com/...",
"branch": "lineage-23.0",
"path": "vendor/realme/spartan"
}
}
}Source configs live in sources/. Use sources/rom-template.json as a starting point.
{
"name": "LineageOS",
"manifest": {
"url": "https://github.com/LineageOS/android.git",
"branch": "lineage-23.2"
},
"sync_jobs": 8,
"build": {
"envsetup": "build/envsetup.sh"
},
"output": {
"pattern": "*Lineage*.zip"
}
}Option 1: Set environment variables
export TELEGRAM_BOT_TOKEN="your-bot-token"
export TELEGRAM_CHAT_ID="your-chat-id"Option 2: Interactive prompt (script asks if vars are missing)
Disable: export TELEGRAM_DISABLE=true
The script automatically cleans all stale AOSP build variables (TARGET_PRODUCT, LUNCH_MENU_CHOICES, ANDROID_BUILD_TOP, etc.) before each build run, ensuring no state leaks from previous builds.