A high-performance Android storage analyzer that bypasses MTP using a native C++ daemon, a Rust TCP bridge, and a React Treemap UI.
Rust
Support isolated daemon cross-builds for additional Android ABIs (#141)
Vishnu Srivatsava19e7526e89e5
diff --git a/.gitignore b/.gitignoreindex 7494597..0db0ab7 100644--- a/.gitignore+++ b/.gitignore@@ -25,6 +25,9 @@ dist-ssr# SocketSweep custom ignoresengine/daemon+/engine/daemon-armeabi-v7a+/engine/daemon-x86+/engine/daemon-x86_64/src-tauri/bin/adb/src-tauri/bin/adb.exe/src-tauri/bin/AdbWinApi.dlldiff --git a/README.md b/README.mdindex 361ffb0..edf2e37 100644--- a/README.md+++ b/README.md@@ -266,6 +266,11 @@ configured path fails explicitly rather than selecting a different toolchain.copies it into `src-tauri/bin/daemon`, which Tauri bundles. Rebuild after changingthe daemon so local development uses the current protocol (v3).*+For cross-compilation experiments, pass `--abi armeabi-v7a`, `--abi x86`,+or `--abi x86_64` to the build command. These builds write+`engine/daemon-<abi>` for Android API 31. The desktop app still bundles+and runs the ARM64 daemon.+Ordinary storage scans use a bounded pool of four workers. For daemon-levelcomparisons, append `--threads N` (1–8) after `PORT TOKEN_FILE`; one workerprovides a serial reference. The pending directory queue holds at most 64 jobsdiff --git a/engine/build_daemon.py b/engine/build_daemon.pyindex b1c3e64..2ea7e50 100644--- a/engine/build_daemon.py+++ b/engine/build_daemon.py@@ -1,4 +1,4 @@-"""Build the Android ARM64 daemon with an installed Android NDK."""+"""Build the Android daemon with an installed Android NDK."""import argparseimport os@@ -16,7 +16,15 @@ HOSTS = {}-def toolchain():+TARGETS = {+ "arm64-v8a": "aarch64-linux-android",+ "armeabi-v7a": "armv7a-linux-androideabi",+ "x86_64": "x86_64-linux-android",+ "x86": "i686-linux-android",+}+++def toolchain(abi):host = HOSTS.get(sys.platform)if host is None:raise ValueError(f"Unsupported build host: {sys.platform}")@@ -24,7 +32,7 @@ def toolchain():"NDK", "ANDROID_NDK_LATEST_HOME", "ANDROID_NDK_HOME") if os.environ.get(name)), None)suffix = ".cmd" if sys.platform == "win32" else ""- compiler_name = f"aarch64-linux-android31-clang++{suffix}"+ compiler_name = f"{TARGETS[abi]}31-clang++{suffix}"if override:candidates = [Path(override)]else:@@ -47,11 +55,13 @@ def toolchain():raise ValueError("Android NDK not found. Set NDK, ANDROID_NDK_LATEST_HOME, or ANDROID_NDK_HOME.")-def build(platform, commit):- compiler = toolchain()- bundle = REPO / "src-tauri/bin/daemon"+def build(platform, commit, abi):+ compiler = toolchain(abi)local = REPO / "engine/daemon"- for output in (bundle,) if platform else (bundle, local):+ experimental = abi != "arm64-v8a"+ bundle = local.with_name(f"daemon-{abi}") if experimental else REPO / "src-tauri/bin/daemon"+ outputs = (bundle,) if platform or experimental else (bundle, local)+ for output in outputs:if output.exists() and not output.is_file():raise ValueError(f"Output path is not a regular file: {output}")print(f"[build] Compiler: {compiler}", flush=True)@@ -63,6 +73,8 @@ def build(platform, commit):"-Wpedantic", "-fno-exceptions", "-fno-rtti", "-DNDEBUG","-static-libstdc++",]+ if abi in ("armeabi-v7a", "x86"):+ args.append("-D_FILE_OFFSET_BITS=64")if platform:symbols = REPO / "daemon-symbols/socketsweep_daemon"symbols.parent.mkdir(exist_ok=True)@@ -74,10 +86,11 @@ def build(platform, commit):subprocess.run([str(strip), "--strip-all", "-o", str(staged), str(symbols)], check=True)else:subprocess.run([*args, "-s", "-o", str(staged), str(REPO / "engine/daemon.cpp")], check=True)- with TemporaryDirectory(prefix=".daemon-build-", dir=local.parent) as local_stage:- local_copy = Path(local_stage) / "daemon"- shutil.copy2(staged, local_copy)- local_copy.replace(local)+ if not experimental:+ with TemporaryDirectory(prefix=".daemon-build-", dir=local.parent) as local_stage:+ local_copy = Path(local_stage) / "daemon"+ shutil.copy2(staged, local_copy)+ local_copy.replace(local)staged.replace(bundle)if platform:subprocess.run([@@ -91,11 +104,14 @@ def main():parser = argparse.ArgumentParser(description=__doc__)parser.add_argument("--platform", choices=("linux", "macos", "windows"))parser.add_argument("--commit", help="Commit for the CI symbol manifest")+ parser.add_argument("--abi", choices=TARGETS, default="arm64-v8a")args = parser.parse_args()if bool(args.platform) != bool(args.commit):parser.error("--platform and --commit must be passed together")+ if args.platform and args.abi != "arm64-v8a":+ parser.error("CI packaging currently supports arm64-v8a only")try:- build(args.platform, args.commit)+ build(args.platform, args.commit, args.abi)except (ValueError, OSError, subprocess.CalledProcessError) as error:parser.exit(1, f"ERROR: {error}\n")diff --git a/tests/test_engine_build.py b/tests/test_engine_build.pyindex b3678a6..b3ed185 100644--- a/tests/test_engine_build.py+++ b/tests/test_engine_build.py@@ -47,8 +47,8 @@ class EngineBuildTests(unittest.TestCase):compiler.chmod(0o700)return ndk- def build(self, **variables):- return subprocess.run(["bash", str(self.engine / "build.sh")], cwd=self.root,+ def build(self, *args, **variables):+ return subprocess.run(["bash", str(self.engine / "build.sh"), *args], cwd=self.root,env={**self.environment, **{key: str(value) for key, value in variables.items()}},capture_output=True, text=True, timeout=15)@@ -126,3 +126,15 @@ class EngineBuildTests(unittest.TestCase):self.assertEqual(list(output.iterdir()), [sentinel])self.assertEqual(self.bundled.read_bytes(), b"existing bundle")self.assertFalse((self.ndks["explicit"] / "calls.json").exists())+++ def test_experimental_32_bit_build_keeps_existing_arm64_artifacts(self):+ ndk = self.ndks["explicit"]+ compiler = next(ndk.rglob("aarch64-linux-android31-clang++"))+ compiler.rename(compiler.with_name("armv7a-linux-androideabi31-clang++"))+ result = self.build("--abi", "armeabi-v7a", NDK=ndk)+ self.assertEqual(result.returncode, 0, result.stdout + result.stderr)+ self.assertEqual((self.engine / "daemon-armeabi-v7a").read_bytes(), b"explicit")+ self.assertEqual((self.engine / "daemon").read_bytes(), b"existing engine")+ self.assertEqual(self.bundled.read_bytes(), b"existing bundle")+ self.assertIn("-D_FILE_OFFSET_BITS=64", json.loads((ndk / "calls.json").read_text()))