BuildChain v1.0.0 — on-device Android build toolchain
System-level KernelSU module: aapt2/aidl/zipalign (API 35), BusyBox, platform-tools, all as static arm64 binaries in the Android framework. Termux integration for Java/Kotlin/Gradle/Python via pkg. CLI tools: buildchain, bc-build, bc-sign. WebUI on :8089 for toolchain management. Turns any Android phone into a native compilation powerhouse.
This commit is contained in:
51
webroot/css/style.css
Normal file
51
webroot/css/style.css
Normal file
@@ -0,0 +1,51 @@
|
||||
:root {
|
||||
--bg: #0a0e17; --card: #111827; --card-hover: #1a2332; --input: #1e293b;
|
||||
--border: #1e3a5f; --text: #e2e8f0; --text2: #94a3b8; --muted: #64748b;
|
||||
--accent: #10b981; --accent-glow: rgba(16,185,129,0.3);
|
||||
--success: #22c55e; --warn: #f59e0b; --danger: #ef4444;
|
||||
--radius: 12px; --sm: 8px;
|
||||
}
|
||||
* { margin:0; padding:0; box-sizing:border-box; }
|
||||
body { font-family:-apple-system,BlinkMacSystemFont,'Segoe UI',system-ui,sans-serif; background:var(--bg); color:var(--text); min-height:100vh; }
|
||||
body::before { content:''; position:fixed; inset:0; background:radial-gradient(ellipse at 30% 50%,rgba(16,185,129,0.06) 0%,transparent 50%),radial-gradient(ellipse at 70% 20%,rgba(59,130,246,0.05) 0%,transparent 50%); pointer-events:none; z-index:0; }
|
||||
.app { position:relative; z-index:1; max-width:540px; margin:0 auto; padding:16px; padding-bottom:80px; }
|
||||
.header { text-align:center; padding:20px 0 16px; }
|
||||
.header h1 { font-size:22px; font-weight:700; color:var(--accent); }
|
||||
.header p { font-size:13px; color:var(--muted); margin-top:4px; }
|
||||
.section { margin-bottom:16px; }
|
||||
.section-title { font-size:11px; font-weight:600; text-transform:uppercase; letter-spacing:1.2px; color:var(--muted); padding:0 4px; margin-bottom:8px; }
|
||||
.card { background:var(--card); border:1px solid var(--border); border-radius:var(--radius); overflow:hidden; margin-bottom:8px; }
|
||||
.card-row { display:flex; align-items:center; justify-content:space-between; padding:12px 16px; }
|
||||
.card-row+.card-row { border-top:1px solid var(--border); }
|
||||
.card-row-info { flex:1; min-width:0; }
|
||||
.card-row-label { font-size:14px; font-weight:500; }
|
||||
.card-row-desc { font-size:12px; color:var(--muted); margin-top:2px; word-break:break-all; }
|
||||
.prop-name { font-family:'SF Mono','Fira Code',monospace; font-size:12px; color:var(--accent); }
|
||||
.badge { display:inline-block; padding:2px 8px; border-radius:10px; font-size:11px; font-weight:600; }
|
||||
.badge-ok { background:rgba(34,197,94,0.15); color:var(--success); }
|
||||
.badge-miss { background:rgba(239,68,68,0.15); color:var(--danger); }
|
||||
.badge-info { background:rgba(59,130,246,0.15); color:#3b82f6; }
|
||||
.tool-grid { display:grid; grid-template-columns:1fr 1fr; gap:6px; padding:12px 16px; }
|
||||
.tool-chip { padding:8px 10px; border-radius:var(--sm); border:1px solid var(--border); background:var(--input); font-size:12px; display:flex; align-items:center; gap:6px; }
|
||||
.tool-chip .dot { width:6px; height:6px; border-radius:50%; flex-shrink:0; }
|
||||
.tool-chip .dot.ok { background:var(--success); box-shadow:0 0 6px var(--success); }
|
||||
.tool-chip .dot.miss { background:var(--muted); }
|
||||
.btn { padding:10px 16px; border-radius:var(--sm); border:1px solid var(--border); background:var(--card); color:var(--text); font-size:13px; font-weight:500; cursor:pointer; text-align:center; }
|
||||
.btn:hover { border-color:var(--accent); }
|
||||
.btn-primary { background:var(--accent); border-color:var(--accent); color:#000; font-weight:600; }
|
||||
.btn-primary:hover { box-shadow:0 4px 16px var(--accent-glow); }
|
||||
.actions { display:grid; grid-template-columns:1fr 1fr; gap:8px; margin-top:12px; }
|
||||
pre.output { background:#030712; border:1px solid var(--border); border-radius:var(--sm); padding:12px; font-family:'SF Mono','Fira Code',monospace; font-size:11px; line-height:1.5; color:var(--text2); white-space:pre-wrap; word-break:break-all; max-height:400px; overflow-y:auto; }
|
||||
.toast { position:fixed; bottom:20px; left:50%; transform:translateX(-50%) translateY(80px); padding:12px 20px; border-radius:var(--sm); background:var(--card); border:1px solid var(--border); color:var(--text); font-size:13px; box-shadow:0 8px 32px rgba(0,0,0,0.4); opacity:0; transition:all 0.3s; z-index:100; }
|
||||
.toast.show { transform:translateX(-50%) translateY(0); opacity:1; }
|
||||
.toast.success { border-color:var(--success); }
|
||||
.toast.error { border-color:var(--danger); }
|
||||
.tab-bar { position:fixed; bottom:0; left:0; right:0; background:rgba(10,14,23,0.95); backdrop-filter:blur(20px); border-top:1px solid var(--border); display:flex; justify-content:center; gap:4px; padding:8px 16px; padding-bottom:max(8px,env(safe-area-inset-bottom)); z-index:50; }
|
||||
.tab-item { flex:1; max-width:90px; display:flex; flex-direction:column; align-items:center; gap:3px; padding:6px 4px; border-radius:var(--sm); color:var(--muted); font-size:10px; font-weight:500; cursor:pointer; border:none; background:none; }
|
||||
.tab-item.active { color:var(--accent); }
|
||||
.tab-item svg { width:20px; height:20px; fill:currentColor; }
|
||||
.page { display:none; } .page.active { display:block; }
|
||||
.info-grid { display:grid; grid-template-columns:1fr 1fr; gap:1px; background:var(--border); border:1px solid var(--border); border-radius:var(--radius); }
|
||||
.info-cell { background:var(--card); padding:10px 14px; }
|
||||
.info-label { font-size:11px; color:var(--muted); text-transform:uppercase; letter-spacing:0.5px; }
|
||||
.info-value { font-size:13px; font-weight:600; margin-top:3px; }
|
||||
136
webroot/index.html
Normal file
136
webroot/index.html
Normal file
@@ -0,0 +1,136 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="en">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=no">
|
||||
<meta name="theme-color" content="#0a0e17">
|
||||
<title>BuildChain</title>
|
||||
<link rel="stylesheet" href="/css/style.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class="app">
|
||||
<div class="header">
|
||||
<h1>BuildChain</h1>
|
||||
<p id="device-info">Detecting...</p>
|
||||
</div>
|
||||
|
||||
<!-- DASHBOARD -->
|
||||
<div class="page active" id="page-dash">
|
||||
<div class="section">
|
||||
<div class="section-title">Environment</div>
|
||||
<div class="info-grid">
|
||||
<div class="info-cell"><div class="info-label">Device</div><div class="info-value" id="env-device">-</div></div>
|
||||
<div class="info-cell"><div class="info-label">Android / API</div><div class="info-value" id="env-api">-</div></div>
|
||||
<div class="info-cell"><div class="info-label">Architecture</div><div class="info-value" id="env-arch">-</div></div>
|
||||
<div class="info-cell"><div class="info-label">Build Tools</div><div class="info-value" id="env-bt">35.0.2</div></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">Toolchain Status</div>
|
||||
<div class="card">
|
||||
<div id="status-grid" class="tool-grid"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="section">
|
||||
<div class="section-title">Setup</div>
|
||||
<div class="card">
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-label">Termux Packages</div>
|
||||
<div class="card-row-desc" id="setup-status">Checking...</div>
|
||||
</div>
|
||||
<span class="badge" id="setup-badge">...</span>
|
||||
</div>
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-desc">Run in Termux: <span class="prop-name">buildchain setup</span></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="actions">
|
||||
<button class="btn btn-primary" onclick="loadDash()">Refresh</button>
|
||||
<button class="btn" onclick="redetect()">Re-detect</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TOOLS -->
|
||||
<div class="page" id="page-tools">
|
||||
<div class="section">
|
||||
<div class="section-title">Build Tools (API 35 — Static ARM64)</div>
|
||||
<div class="card" id="build-tools-list"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-title">Platform Tools</div>
|
||||
<div class="card" id="platform-tools-list"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-title">Termux Packages</div>
|
||||
<div class="card" id="termux-tools-list"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-title">BusyBox</div>
|
||||
<div class="card" id="busybox-info"></div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- TEST -->
|
||||
<div class="page" id="page-test">
|
||||
<div class="section">
|
||||
<div class="section-title">Tool Test Results</div>
|
||||
<div class="card" style="padding:12px 16px">
|
||||
<button class="btn btn-primary" onclick="runTest()" style="width:100%;margin-bottom:8px">Run All Tests</button>
|
||||
<pre class="output" id="test-output">Tap "Run All Tests" to verify the toolchain.</pre>
|
||||
</div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-title">Service Log</div>
|
||||
<div class="card" style="padding:12px 16px">
|
||||
<button class="btn" onclick="loadLog()" style="width:100%;margin-bottom:8px">Load Log</button>
|
||||
<pre class="output" id="log-output">Tap to load.</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- PATHS -->
|
||||
<div class="page" id="page-paths">
|
||||
<div class="section">
|
||||
<div class="section-title">System PATH</div>
|
||||
<div class="card" id="path-list"></div>
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="section-title">Environment Variables</div>
|
||||
<div class="card" style="padding:12px 16px">
|
||||
<pre class="output" id="env-output">Loading...</pre>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="toast" id="toast"></div>
|
||||
|
||||
<div class="tab-bar">
|
||||
<button class="tab-item active" data-tab="dash">
|
||||
<svg viewBox="0 0 24 24"><path d="M3 13h8V3H3v10zm0 8h8v-6H3v6zm10 0h8V11h-8v10zm0-18v6h8V3h-8z"/></svg>
|
||||
Status
|
||||
</button>
|
||||
<button class="tab-item" data-tab="tools">
|
||||
<svg viewBox="0 0 24 24"><path d="M22.7 19l-9.1-9.1c.9-2.3.4-5-1.5-6.9-2-2-5-2.4-7.4-1.3L9 6 6 9 1.6 4.7C.4 7.1.9 10.1 2.9 12.1c1.9 1.9 4.6 2.4 6.9 1.5l9.1 9.1c.4.4 1 .4 1.4 0l2.3-2.3c.5-.4.5-1.1.1-1.4z"/></svg>
|
||||
Tools
|
||||
</button>
|
||||
<button class="tab-item" data-tab="test">
|
||||
<svg viewBox="0 0 24 24"><path d="M20 8h-2.81c-.45-.78-1.07-1.45-1.82-1.96L17 4.41 15.59 3l-2.17 2.17C12.96 5.06 12.49 5 12 5s-.96.06-1.41.17L8.41 3 7 4.41l1.62 1.63C7.88 6.55 7.26 7.22 6.81 8H4v2h2.09c-.05.33-.09.66-.09 1v1H4v2h2v1c0 .34.04.67.09 1H4v2h2.81c1.04 1.79 2.97 3 5.19 3s4.15-1.21 5.19-3H20v-2h-2.09c.05-.33.09-.66.09-1v-1h2v-2h-2v-1c0-.34-.04-.67-.09-1H20V8zm-6 8h-4v-2h4v2zm0-4h-4v-2h4v2z"/></svg>
|
||||
Test
|
||||
</button>
|
||||
<button class="tab-item" data-tab="paths">
|
||||
<svg viewBox="0 0 24 24"><path d="M20 6h-8l-2-2H4c-1.1 0-2 .9-2 2v12c0 1.1.9 2 2 2h16c1.1 0 2-.9 2-2V8c0-1.1-.9-2-2-2zm0 12H4V8h16v10z"/></svg>
|
||||
Paths
|
||||
</button>
|
||||
</div>
|
||||
|
||||
<script src="/js/app.js"></script>
|
||||
</body>
|
||||
</html>
|
||||
194
webroot/js/app.js
Normal file
194
webroot/js/app.js
Normal file
@@ -0,0 +1,194 @@
|
||||
// BuildChain WebUI
|
||||
|
||||
let currentTab = 'dash';
|
||||
let toastTimer = null;
|
||||
|
||||
async function api(path) {
|
||||
try { return await (await fetch(path)).json(); } catch(e) { showToast('Connection error','error'); return null; }
|
||||
}
|
||||
async function post(path, body) {
|
||||
try { return await (await fetch(path, {method:'POST',headers:{'Content-Type':'application/json'},body:JSON.stringify(body)})).json(); } catch(e) { return null; }
|
||||
}
|
||||
|
||||
function showToast(msg, type='success') {
|
||||
const el = document.getElementById('toast');
|
||||
el.textContent = msg; el.className = 'toast ' + type + ' show';
|
||||
clearTimeout(toastTimer); toastTimer = setTimeout(() => el.className = 'toast', 2500);
|
||||
}
|
||||
|
||||
function switchTab(tab) {
|
||||
currentTab = tab;
|
||||
document.querySelectorAll('.page').forEach(p => p.classList.remove('active'));
|
||||
document.querySelectorAll('.tab-item').forEach(t => t.classList.remove('active'));
|
||||
document.getElementById('page-' + tab).classList.add('active');
|
||||
document.querySelector(`[data-tab="${tab}"]`).classList.add('active');
|
||||
switch(tab) {
|
||||
case 'dash': loadDash(); break;
|
||||
case 'tools': loadTools(); break;
|
||||
case 'test': break;
|
||||
case 'paths': loadPaths(); break;
|
||||
}
|
||||
}
|
||||
|
||||
function esc(s) { return (s||'').replace(/&/g,'&').replace(/</g,'<').replace(/>/g,'>'); }
|
||||
|
||||
// ---- Dashboard ----
|
||||
async function loadDash() {
|
||||
const env = await api('/api/status');
|
||||
if (env) {
|
||||
document.getElementById('device-info').textContent = `${env.device || '?'} — Android ${env.api_level || '?'} — ${env.arch || '?'}`;
|
||||
document.getElementById('env-device').textContent = env.device || '-';
|
||||
document.getElementById('env-api').textContent = `API ${env.api_level || '?'}`;
|
||||
document.getElementById('env-arch').textContent = env.arch || '-';
|
||||
}
|
||||
|
||||
// Tool status grid
|
||||
const tools = await api('/api/tools');
|
||||
const grid = document.getElementById('status-grid');
|
||||
if (tools) {
|
||||
grid.innerHTML = tools.map(t => `
|
||||
<div class="tool-chip">
|
||||
<span class="dot ${t.exists ? 'ok' : 'miss'}"></span>
|
||||
${t.name}
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// Setup status
|
||||
const setup = await api('/api/setup');
|
||||
const statusEl = document.getElementById('setup-status');
|
||||
const badgeEl = document.getElementById('setup-badge');
|
||||
if (setup) {
|
||||
if (setup.complete) {
|
||||
statusEl.textContent = 'All packages installed';
|
||||
badgeEl.textContent = 'Ready';
|
||||
badgeEl.className = 'badge badge-ok';
|
||||
} else {
|
||||
statusEl.textContent = 'Missing: ' + setup.missing.join(', ');
|
||||
badgeEl.textContent = 'Incomplete';
|
||||
badgeEl.className = 'badge badge-miss';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
async function redetect() {
|
||||
showToast('Re-detecting environment...');
|
||||
await post('/api/redetect', {});
|
||||
setTimeout(loadDash, 3000);
|
||||
}
|
||||
|
||||
// ---- Tools ----
|
||||
async function loadTools() {
|
||||
const tools = await api('/api/tools');
|
||||
if (!tools) return;
|
||||
|
||||
const buildTools = tools.filter(t => t.category === 'build-tools');
|
||||
const platTools = tools.filter(t => t.category === 'platform-tools');
|
||||
const termuxTools = tools.filter(t => t.category === 'termux');
|
||||
|
||||
document.getElementById('build-tools-list').innerHTML = buildTools.map(t => `
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-label">${t.name}</div>
|
||||
<div class="card-row-desc">${t.path}</div>
|
||||
</div>
|
||||
<span class="badge ${t.exists ? 'badge-ok' : 'badge-miss'}">${t.exists ? (t.size/1024).toFixed(0)+'K' : 'missing'}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
document.getElementById('platform-tools-list').innerHTML = platTools.map(t => `
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-label">${t.name}</div>
|
||||
<div class="card-row-desc">${t.path}</div>
|
||||
</div>
|
||||
<span class="badge ${t.exists ? 'badge-ok' : 'badge-miss'}">${t.exists ? (t.size/1024).toFixed(0)+'K' : 'missing'}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
document.getElementById('termux-tools-list').innerHTML = termuxTools.map(t => `
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-label">${t.name}</div>
|
||||
<div class="card-row-desc">${t.category}</div>
|
||||
</div>
|
||||
<span class="badge ${t.exists ? 'badge-ok' : 'badge-miss'}">${t.exists ? 'installed' : 'not found'}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
|
||||
// BusyBox
|
||||
const bb = await api('/api/busybox');
|
||||
const bbc = document.getElementById('busybox-info');
|
||||
if (bb) {
|
||||
bbc.innerHTML = `
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-label">${esc(bb.version)}</div>
|
||||
<div class="card-row-desc">${bb.count} applets</div>
|
||||
</div>
|
||||
<span class="badge badge-ok">active</span>
|
||||
</div>
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<div class="card-row-desc" style="font-family:monospace;font-size:10px;line-height:1.4;max-height:120px;overflow-y:auto">${esc(bb.applets).replace(/,/g, ', ')}</div>
|
||||
</div>
|
||||
</div>
|
||||
`;
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Test ----
|
||||
async function runTest() {
|
||||
const out = document.getElementById('test-output');
|
||||
out.textContent = 'Running tests...';
|
||||
const res = await api('/api/test');
|
||||
if (res && res.output) {
|
||||
out.textContent = res.output;
|
||||
} else {
|
||||
out.textContent = 'Failed to run tests';
|
||||
}
|
||||
}
|
||||
|
||||
async function loadLog() {
|
||||
const out = document.getElementById('log-output');
|
||||
out.textContent = 'Loading...';
|
||||
const res = await api('/api/log');
|
||||
if (res && res.log) {
|
||||
out.textContent = res.log;
|
||||
} else {
|
||||
out.textContent = 'No log available';
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Paths ----
|
||||
async function loadPaths() {
|
||||
const paths = await api('/api/paths');
|
||||
const pc = document.getElementById('path-list');
|
||||
if (paths) {
|
||||
pc.innerHTML = paths.map((p, i) => `
|
||||
<div class="card-row">
|
||||
<div class="card-row-info">
|
||||
<span class="prop-name">${esc(p)}</span>
|
||||
</div>
|
||||
<span class="badge badge-info">#${i}</span>
|
||||
</div>
|
||||
`).join('');
|
||||
}
|
||||
|
||||
// Env file
|
||||
const envOut = document.getElementById('env-output');
|
||||
try {
|
||||
const res = await fetch('/api/status');
|
||||
const env = await res.json();
|
||||
envOut.textContent = JSON.stringify(env, null, 2);
|
||||
} catch(e) {
|
||||
envOut.textContent = 'Failed to load';
|
||||
}
|
||||
}
|
||||
|
||||
// ---- Init ----
|
||||
document.addEventListener('DOMContentLoaded', () => {
|
||||
document.querySelectorAll('.tab-item').forEach(t =>
|
||||
t.addEventListener('click', () => switchTab(t.dataset.tab)));
|
||||
switchTab('dash');
|
||||
});
|
||||
Reference in New Issue
Block a user