Add domain documents and workspace skeleton with a GPUI window #14
No files matched your search
@@ -0,0 +1,3 @@
|
||||
/target
|
||||
*.local.toml
|
||||
.env
|
||||
Generated
+8493
File diff suppressed because it is too large.
Load diff
@@ -0,0 +1,9 @@
|
||||
[workspace]
|
||||
resolver = "3"
|
||||
members = ["crates/core", "crates/app"]
|
||||
default-members = ["crates/core"]
|
||||
|
||||
[workspace.package]
|
||||
edition = "2024"
|
||||
rust-version = "1.98"
|
||||
version = "0.1.0"
|
||||
@@ -0,0 +1,26 @@
|
||||
# Arena Tracker
|
||||
|
||||
Application de bureau Windows qui suit les Parties d'Arena de League of Legends. Le vocabulaire du domaine est dans `CONTEXT.md` et les décisions d'architecture dans `docs/adr/`.
|
||||
|
||||
## Prérequis
|
||||
|
||||
- Windows avec la chaîne d'outils Rust (rustup), version 1.98 ou plus récente, accessible depuis WSL sous le nom `cargo.exe`.
|
||||
- WSL avec une chaîne d'outils Rust Linux (`cargo`), version 1.98 ou plus récente, pour exécuter les tests du coeur.
|
||||
- Les outils de compilation C++ de Visual Studio (Build Tools) côté Windows.
|
||||
|
||||
## Commandes
|
||||
|
||||
Depuis WSL, à la racine du dépôt :
|
||||
|
||||
- `scripts/win build` : compile l'application avec la chaîne d'outils Windows. Le dossier de build est `%LOCALAPPDATA%\arena-tracker\target`, sur le disque Windows. Les arguments supplémentaires sont transmis à cargo (par exemple `scripts/win build --release`).
|
||||
- `scripts/win run` : compile si besoin puis lance l'application ; la fenêtre « Arena Tracker » s'ouvre sur Windows.
|
||||
|
||||
La première compilation de GPUI prend plusieurs minutes.
|
||||
|
||||
## Tests
|
||||
|
||||
Les tests du coeur (`arena-tracker-core`, sans dépendance graphique) s'exécutent nativement dans WSL :
|
||||
|
||||
```
|
||||
cargo test
|
||||
```
|
||||
@@ -0,0 +1,9 @@
|
||||
[package]
|
||||
name = "arena-tracker"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
arena-tracker-core = { path = "../core" }
|
||||
gpui-kit = "=0.9.1"
|
||||
@@ -0,0 +1,32 @@
|
||||
#![cfg_attr(not(debug_assertions), windows_subsystem = "windows")]
|
||||
|
||||
use gpui_kit::component::*;
|
||||
use gpui_kit::*;
|
||||
|
||||
struct RootView;
|
||||
|
||||
impl Render for RootView {
|
||||
fn render(&mut self, _: &mut Window, _: &mut Context<Self>) -> impl IntoElement {
|
||||
div()
|
||||
.v_flex()
|
||||
.size_full()
|
||||
.items_center()
|
||||
.justify_center()
|
||||
.child(arena_tracker_core::startup_message())
|
||||
}
|
||||
}
|
||||
|
||||
fn main() {
|
||||
gpui_kit::application().run(move |cx| {
|
||||
gpui_kit::init(cx);
|
||||
let options = WindowOptions {
|
||||
titlebar: Some(TitlebarOptions {
|
||||
title: Some("Arena Tracker".into()),
|
||||
..Default::default()
|
||||
}),
|
||||
..Default::default()
|
||||
};
|
||||
gpui_kit::open_window(options, cx, |_, cx| cx.new(|_| RootView))
|
||||
.expect("Failed to open window");
|
||||
});
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
[package]
|
||||
name = "arena-tracker-core"
|
||||
edition.workspace = true
|
||||
rust-version.workspace = true
|
||||
version.workspace = true
|
||||
|
||||
[dependencies]
|
||||
@@ -0,0 +1,14 @@
|
||||
/// Text shown at startup while no Match has been imported yet.
|
||||
pub fn startup_message() -> &'static str {
|
||||
"Aucune Partie importée pour l'instant."
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn startup_message_announces_no_imported_match() {
|
||||
assert_eq!(startup_message(), "Aucune Partie importée pour l'instant.");
|
||||
}
|
||||
}
|
||||
Executable
+40
@@ -0,0 +1,40 @@
|
||||
#!/usr/bin/env bash
|
||||
# Builds and runs Arena Tracker with the Windows Rust toolchain, from WSL (ADR-0003).
|
||||
set -euo pipefail
|
||||
|
||||
cd "$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")/.."
|
||||
|
||||
usage() {
|
||||
echo "Usage : scripts/win <build|run> [arguments cargo...]" >&2
|
||||
exit 2
|
||||
}
|
||||
|
||||
[ $# -ge 1 ] || usage
|
||||
subcommand="$1"
|
||||
shift
|
||||
case "$subcommand" in
|
||||
build | run) ;;
|
||||
*) usage ;;
|
||||
esac
|
||||
|
||||
if ! command -v cargo.exe >/dev/null 2>&1; then
|
||||
echo "Erreur : cargo.exe est introuvable. Installez Rust pour Windows (rustup) et vérifiez qu'il est dans le PATH de WSL." >&2
|
||||
exit 1
|
||||
fi
|
||||
if ! command -v cmd.exe >/dev/null 2>&1; then
|
||||
echo "Erreur : cmd.exe est introuvable. Vérifiez que les programmes Windows sont dans le PATH de WSL." >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# The build directory lives on the Windows drive: %LOCALAPPDATA%\arena-tracker\target.
|
||||
# cmd.exe is started from a Windows directory to avoid its warning about UNC paths.
|
||||
windows_dir="$(dirname "$(command -v cmd.exe)")"
|
||||
local_app_data="$(cd "$windows_dir" && cmd.exe /c 'echo %LOCALAPPDATA%' 2>/dev/null | tr -d '\r' || true)"
|
||||
if [ -z "$local_app_data" ] || [ "$local_app_data" = '%LOCALAPPDATA%' ]; then
|
||||
echo "Erreur : impossible de déterminer %LOCALAPPDATA% via cmd.exe." >&2
|
||||
exit 1
|
||||
fi
|
||||
target_dir="${local_app_data}\\arena-tracker\\target"
|
||||
|
||||
# --locked: fail when Cargo.lock is stale instead of rewriting it (run `cargo test` in WSL to refresh it).
|
||||
exec cargo.exe "$subcommand" --locked -p arena-tracker --target-dir "$target_dir" "$@"
|
||||
Reference in new issue
Block a user