Skip to repository content

tenant.openagents/omega

No repository description is available.

OpenAgents Git authority 2026-07-28T06:17:37.829Z Public web read
NIP-34 coordinate30617:7649603503856e5148d571eac2766b288a8ff1e9e35d380337a1d2b0015b4f92:omega
MaintainersHidden in public view
References2 branches · 1 tag
Read-only clonegit clone https://openagents.com/git/tenant.openagents/omega.git
Browse files

build.rs

47 lines · 1.7 KB · rust
1use std::env;
2use std::fs;
3use std::path::PathBuf;
4
5fn main() -> Result<(), Box<dyn std::error::Error>> {
6    copy_extension_api_rust_files()
7}
8
9/// rust-analyzer doesn't support include! for files from outside the crate.
10/// Copy them to the OUT_DIR, so we can include them from there, which is supported.
11fn copy_extension_api_rust_files() -> Result<(), Box<dyn std::error::Error>> {
12    let out_dir = env::var("OUT_DIR")?;
13    let input_dir = PathBuf::from("../extension_api/wit");
14    let output_dir = PathBuf::from(out_dir);
15
16    println!("cargo:rerun-if-changed={}", input_dir.display());
17
18    for entry in fs::read_dir(&input_dir)? {
19        let entry = entry?;
20        let path = entry.path();
21        if path.is_dir() {
22            println!("cargo:rerun-if-changed={}", path.display());
23
24            for subentry in fs::read_dir(&path)? {
25                let subentry = subentry?;
26                let subpath = subentry.path();
27                if subpath.extension() == Some(std::ffi::OsStr::new("rs")) {
28                    let relative_path = subpath.strip_prefix(&input_dir)?;
29                    let destination = output_dir.join(relative_path);
30
31                    fs::create_dir_all(destination.parent().unwrap())?;
32                    fs::copy(&subpath, &destination)?;
33                }
34            }
35        } else if path.extension() == Some(std::ffi::OsStr::new("rs")) {
36            let relative_path = path.strip_prefix(&input_dir)?;
37            let destination = output_dir.join(relative_path);
38
39            fs::create_dir_all(destination.parent().unwrap())?;
40            fs::copy(&path, &destination)?;
41            println!("cargo:rerun-if-changed={}", path.display());
42        }
43    }
44
45    Ok(())
46}
47
Served at tenant.openagents/omega Member data and write actions are omitted.