155 lines
3.8 KiB
Markdown
155 lines
3.8 KiB
Markdown
# Phase 01 — Project Scaffold
|
|
|
|
## Goal
|
|
Create the complete Rust project skeleton with correct Cargo.toml, build system,
|
|
directory structure, and verify that the project compiles (empty/stub implementations).
|
|
|
|
## Prerequisites
|
|
- Rust toolchain installed (rustup, cargo)
|
|
- System dependencies installed (see docs/architecture.md — System Dependencies section)
|
|
- Verify with: `pkg-config --exists gtk4 libadwaita-1 && echo "OK"`
|
|
|
|
## Steps
|
|
|
|
### 1. Create project
|
|
```bash
|
|
cargo new --bin mangotune
|
|
cd mangotune
|
|
```
|
|
|
|
### 2. Create full directory structure
|
|
```bash
|
|
mkdir -p src/{config,system,launcher,integrations,ui/{pages,widgets}}
|
|
mkdir -p data/icons
|
|
```
|
|
|
|
### 3. Write Cargo.toml
|
|
Copy the exact dependency block from `docs/architecture.md` → Cargo.toml section.
|
|
Do not add or remove any dependencies without updating docs/architecture.md.
|
|
|
|
### 4. Write build.rs
|
|
```rust
|
|
// build.rs
|
|
fn main() {
|
|
glib_build_tools::compile_schemas("data");
|
|
}
|
|
```
|
|
|
|
### 5. Create GSettings schema
|
|
File: `data/com.mangotune.MangoTune.gschema.xml`
|
|
```xml
|
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
<schemalist>
|
|
<schema id="com.mangotune.MangoTune" path="/com/mangotune/MangoTune/">
|
|
<key name="last-config-path" type="s">
|
|
<default>''</default>
|
|
<summary>Last edited config file path</summary>
|
|
</key>
|
|
<key name="window-width" type="i">
|
|
<default>1200</default>
|
|
<summary>Window width</summary>
|
|
</key>
|
|
<key name="window-height" type="i">
|
|
<default>780</default>
|
|
<summary>Window height</summary>
|
|
</key>
|
|
<key name="active-page" type="s">
|
|
<default>'performance'</default>
|
|
<summary>Currently active sidebar page</summary>
|
|
</key>
|
|
<key name="show-raw-editor" type="b">
|
|
<default>false</default>
|
|
<summary>Whether raw editor tab is visible</summary>
|
|
</key>
|
|
</schema>
|
|
</schemalist>
|
|
```
|
|
|
|
### 6. Create .desktop file
|
|
File: `data/com.mangotune.MangoTune.desktop`
|
|
```ini
|
|
[Desktop Entry]
|
|
Name=MangoTune
|
|
Comment=MangoHud Overlay Configurator
|
|
Exec=mangotune
|
|
Icon=com.mangotune.MangoTune
|
|
Terminal=false
|
|
Type=Application
|
|
Categories=Settings;System;
|
|
Keywords=MangoHud;overlay;gaming;performance;
|
|
StartupNotify=true
|
|
StartupWMClass=mangotune
|
|
```
|
|
|
|
### 7. Create all source stub files
|
|
Each file listed in docs/architecture.md → Target Source Tree must be created
|
|
as a stub with correct module declarations and a `todo!()` placeholder where needed.
|
|
|
|
Required stub content for each module file:
|
|
```rust
|
|
// src/config/parser.rs
|
|
//! MangoHud config file parser and writer.
|
|
//! See: mangotune-plan/modules/config_parser.md for full spec.
|
|
|
|
pub struct Parser;
|
|
|
|
impl Parser {
|
|
pub fn new() -> Self { todo!() }
|
|
}
|
|
```
|
|
|
|
### 8. Wire up main.rs
|
|
```rust
|
|
// src/main.rs
|
|
mod app;
|
|
mod config;
|
|
mod system;
|
|
mod launcher;
|
|
mod integrations;
|
|
mod ui;
|
|
|
|
fn main() {
|
|
tracing_subscriber::fmt::init();
|
|
let app = app::MangoTuneApp::new();
|
|
std::process::exit(app.run());
|
|
}
|
|
```
|
|
|
|
### 9. Wire up app.rs stub
|
|
```rust
|
|
// src/app.rs
|
|
use gtk4::prelude::*;
|
|
use libadwaita::prelude::*;
|
|
|
|
pub struct MangoTuneApp {
|
|
app: libadwaita::Application,
|
|
}
|
|
|
|
impl MangoTuneApp {
|
|
pub fn new() -> Self {
|
|
let app = libadwaita::Application::builder()
|
|
.application_id("com.mangotune.MangoTune")
|
|
.build();
|
|
MangoTuneApp { app }
|
|
}
|
|
|
|
pub fn run(&self) -> i32 {
|
|
self.app.run().into()
|
|
}
|
|
}
|
|
```
|
|
|
|
### 10. Verify compilation
|
|
```bash
|
|
cargo check 2>&1
|
|
```
|
|
Must produce zero errors (warnings acceptable at this stage).
|
|
|
|
## Acceptance Criteria
|
|
- [ ] `cargo check` exits with code 0
|
|
- [ ] All directories from the target source tree exist
|
|
- [ ] All source stub files exist with correct module declarations
|
|
- [ ] `data/` contains gschema.xml and .desktop file
|
|
- [ ] `build.rs` compiles the schema without error
|
|
- [ ] No `.unwrap()` calls in non-stub code (stubs with `todo!()` are exempt)
|