Delete the decisions and design logs; scripts, rigs and xtask off the root

Iris: "remove both decisions and iris.md. I've decided to instead make
decisions when planning with agents rather than after they do things, and
they're both too long for me to wanna read, + don't cover all the
decisions I'll wanna make about the code anyways. I'll just naturally run
into things for now. Todo is important though."

So docs/DECISIONS.md (850 lines) and docs/IRIS.md (1,986) are gone, and
AGENTS.md now says not to start another: raise a choice while planning it
with her, otherwise decide it and put the reasoning at the code it
governs. The TODO lists stay. docs/SUBAGENTS_DECISIONS.md went with them
-- same artefact, same reasoning, and she did not name it, so its six
decisions were folded into docs/SUBAGENTS.md rather than deleted.

Deleting the logs left ~30 citations dangling in code comments and docs.
Each states its reason inline and cited the file only for provenance, so
they now read "decided 2026-09-07" or name the module doc that carries
the reasoning.

The root had six things that were not a program or a document. Moved,
per "I only meant top level sh files":

  run-tests.sh, test-wg-tunnel.sh, wg-setup-host.sh  -> scripts/
  rigs/                                              -> scripts/rigs/
  xtask/                                             -> scripts/xtask/

A project's own scripts stayed with the project: app/*.sh, app-rust/*.sh,
iris/*.sh and server/enroll-link.sh did not move.

`target/` at the root is deleted and cannot come back: there was never a
workspace there, and the 29 MB was only xtask's scratch space, now in
scripts/xtask/target/. `cargo xtask apk` still runs from the repo root
and now publishes to scripts/build/outputs/apk/<mode>/ -- one directory
deep, because that is what Dev Updater's `*/build/outputs/apk/*/*.apk`
discovery pattern needs, and scripts/xtask/build would have been two.

Verified: ./scripts/run-tests.sh and `cd iris && cargo test` green, clippy
and fmt clean everywhere, `cargo xtask apk debug --abi x86_64` builds and
signs an APK carrying lib/x86_64/libai_app.so at the new publish path, and
the repo root is now eleven entries with no build output among them.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
This commit is contained in:
irisandClaude Opus 5 committed 2026-09-09 00:16:24 -04:00
1 parent 09778346a0
commit 4ccfda6b8e
44 files changed
+198 -2994

No files matched your search

+130
View File
@@ -0,0 +1,130 @@
//! Finds the Android SDK/NDK pieces the packaging pipeline needs, the same
//! way `app/android-env.sh` and `app/build-apk.sh` do: `$ANDROID_HOME`, then
//! `$ANDROID_SDK_ROOT`, then `~/Android/Sdk`. Kept in one place because
//! every step in `main.rs` needs at least one of these paths, and a
//! mismatch between them (an `android.jar` from one SDK, `d8` from
//! another) fails in ways that point at the wrong cause.
use std::path::{Path, PathBuf};
use crate::Fail;
/// compileSdk / targetSdk, matching `app/shellApp/build.gradle.kts`. Not
/// read from that file -- if the two drift, `android.jar` or a platform
/// tools directory goes missing and the error below names the exact path
/// that wasn't there, which is no harder to act on than a parsed number
/// would have been.
pub const COMPILE_SDK: u32 = 37;
pub const MIN_SDK: u32 = 24;
pub struct Sdk {
pub root: PathBuf,
pub build_tools: PathBuf,
pub android_jar: PathBuf,
}
impl Sdk {
pub fn tool(&self, name: &str) -> PathBuf {
self.build_tools.join(name)
}
}
pub fn find() -> Result<Sdk, Fail> {
let root = std::env::var_os("ANDROID_HOME")
.or_else(|| std::env::var_os("ANDROID_SDK_ROOT"))
.map(PathBuf::from)
.filter(|p| p.is_dir())
.or_else(|| {
let home = std::env::var_os("HOME").map(PathBuf::from)?;
let candidate = home.join("Android/Sdk");
candidate.is_dir().then_some(candidate)
})
.ok_or_else(|| {
Fail::new(
"no Android SDK found",
"checked $ANDROID_HOME, $ANDROID_SDK_ROOT and ~/Android/Sdk",
"set ANDROID_HOME, or run app/android-env.sh once to install one",
)
})?;
let build_tools = latest_build_tools(&root)?;
let android_jar = root
.join("platforms")
.join(format!("android-{COMPILE_SDK}.0"))
.join("android.jar");
let android_jar = if android_jar.is_file() {
android_jar
} else {
// Some installs use the bare "android-37" directory name instead of
// "android-37.0" -- both exist on this machine's SDK depending on
// how the platform was installed, so try the other spelling before
// giving up.
let alt = root
.join("platforms")
.join(format!("android-{COMPILE_SDK}"))
.join("android.jar");
if alt.is_file() {
alt
} else {
return Err(Fail::new(
&format!("no android.jar for API {COMPILE_SDK}"),
&format!("checked {} and {}", android_jar.display(), alt.display()),
&format!("install it: android sdk install \"platforms/android-{COMPILE_SDK}.0\""),
));
}
};
Ok(Sdk {
root,
build_tools,
android_jar,
})
}
fn latest_build_tools(sdk_root: &Path) -> Result<PathBuf, Fail> {
let dir = sdk_root.join("build-tools");
let mut versions: Vec<(Vec<u32>, PathBuf)> = std::fs::read_dir(&dir)
.map_err(|e| {
Fail::new(
"no build-tools directory in the Android SDK",
&format!("{}: {e}", dir.display()),
"install one: android sdk install \"build-tools;37.0.0\"",
)
})?
.filter_map(|entry| entry.ok())
.filter(|entry| entry.path().is_dir())
.filter_map(|entry| {
let name = entry.file_name();
let name = name.to_str()?;
let parts: Vec<u32> = name.split('.').filter_map(|p| p.parse().ok()).collect();
(!parts.is_empty()).then_some((parts, entry.path()))
})
.collect();
versions.sort();
versions.pop().map(|(_, path)| path).ok_or_else(|| {
Fail::new(
"no usable build-tools version found",
&format!("{} has no version-numbered subdirectory", dir.display()),
"install one: android sdk install \"build-tools;37.0.0\"",
)
})
}
/// The NDK version `cargo ndk` should find on its own by scanning
/// `$ANDROID_HOME/ndk/*` -- this just checks one exists, so a missing NDK
/// is reported before `cargo ndk` does it with a less specific message.
pub fn require_ndk_installed(sdk_root: &Path) -> Result<(), Fail> {
let ndk_dir = sdk_root.join("ndk");
let has_one = std::fs::read_dir(&ndk_dir)
.map(|entries| entries.filter_map(|e| e.ok()).any(|e| e.path().is_dir()))
.unwrap_or(false);
if has_one {
Ok(())
} else {
Err(Fail::new(
"no NDK installed under the Android SDK",
&format!("{} has no version subdirectory", ndk_dir.display()),
"install one: android sdk install \"ndk;29.0.14206865\"",
))
}
}