scaffold: Epic 1 — project scaffold
Add the full Rust + GTK4 + libadwaita project skeleton: - Cargo.toml with all dependencies (gtk4 0.11, libadwaita 0.9, webkit6 0.6, reqwest, serde, tokio, libsecret) - build.rs that compiles Blueprint .blp files and bundles a GResource - data/ui/window.blp — AdwApplicationWindow with AdwNavigationSplitView, sidebar with refresh button/spinner and primary menu, content page with article menu - data/resources.gresource.xml bundling UI, HTML, and CSS - data/net.jeena.FeedTheMonkey.gschema.xml with all GSettings keys - html/content.html and html/content.css (minimal placeholders) - src/main.rs, src/app.rs — AdwApplication with APP_ID net.jeena.FeedTheMonkey - src/window.rs — AdwApplicationWindow GObject subclass loading the Blueprint template and persisting window size in GSettings - COPYING (GPL-3.0) restored from master The app compiles and the binary is ready to open a blank window.
This commit is contained in:
parent
3196988c98
commit
3339bb5ec8
15 changed files with 3761 additions and 2 deletions
52
build.rs
Normal file
52
build.rs
Normal file
|
|
@ -0,0 +1,52 @@
|
|||
use std::path::PathBuf;
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let manifest_dir = PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap());
|
||||
let data_dir = manifest_dir.join("data");
|
||||
let ui_dir = data_dir.join("ui");
|
||||
let out_dir = PathBuf::from(std::env::var("OUT_DIR").unwrap());
|
||||
|
||||
// Compile all .blp files to .ui files
|
||||
let blp_files: Vec<_> = std::fs::read_dir(&ui_dir)
|
||||
.expect("data/ui/ directory not found")
|
||||
.filter_map(|e| e.ok())
|
||||
.map(|e| e.path())
|
||||
.filter(|p| p.extension().map_or(false, |ext| ext == "blp"))
|
||||
.collect();
|
||||
|
||||
for blp in &blp_files {
|
||||
println!("cargo:rerun-if-changed={}", blp.display());
|
||||
}
|
||||
|
||||
if !blp_files.is_empty() {
|
||||
let status = Command::new("blueprint-compiler")
|
||||
.arg("batch-compile")
|
||||
.arg(&ui_dir)
|
||||
.arg(&ui_dir)
|
||||
.args(&blp_files)
|
||||
.status()
|
||||
.expect("failed to run blueprint-compiler — is it installed?");
|
||||
assert!(status.success(), "blueprint-compiler failed");
|
||||
}
|
||||
|
||||
// Compile GSettings schema
|
||||
let schema_file = data_dir.join("net.jeena.FeedTheMonkey.gschema.xml");
|
||||
println!("cargo:rerun-if-changed={}", schema_file.display());
|
||||
|
||||
// Compile GResource
|
||||
let gresource_xml = data_dir.join("resources.gresource.xml");
|
||||
println!("cargo:rerun-if-changed={}", gresource_xml.display());
|
||||
|
||||
let gresource_out = out_dir.join("feedthemonkey.gresource");
|
||||
let status = Command::new("glib-compile-resources")
|
||||
.arg(format!("--sourcedir={}", data_dir.display()))
|
||||
.arg(format!("--sourcedir={}", manifest_dir.display()))
|
||||
.arg(format!("--target={}", gresource_out.display()))
|
||||
.arg(&gresource_xml)
|
||||
.status()
|
||||
.expect("failed to run glib-compile-resources — is it installed?");
|
||||
assert!(status.success(), "glib-compile-resources failed");
|
||||
|
||||
println!("cargo:rustc-env=GRESOURCE_FILE={}", gresource_out.display());
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue