From ad0943f88ba9f5ed6eae198ecb4835c0f44701de Mon Sep 17 00:00:00 2001 From: 魏曹先生 <1992414357@qq.com> Date: Wed, 17 Jun 2026 21:33:40 +0800 Subject: chore: initialize project structure and add core modules --- rola-devtools/scripts/check-all.py | 38 +++++++++++++++++++++++ rola-devtools/scripts/run-desktop.py | 11 +++++++ rola-devtools/scripts/windows-folder-hide.ps1 | 43 +++++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100644 rola-devtools/scripts/check-all.py create mode 100644 rola-devtools/scripts/run-desktop.py create mode 100644 rola-devtools/scripts/windows-folder-hide.ps1 (limited to 'rola-devtools/scripts') diff --git a/rola-devtools/scripts/check-all.py b/rola-devtools/scripts/check-all.py new file mode 100644 index 0000000..cd2ddf1 --- /dev/null +++ b/rola-devtools/scripts/check-all.py @@ -0,0 +1,38 @@ +#!/usr/bin/env python3 + +import subprocess +import sys +from pathlib import Path + +script_dir = Path(__file__).resolve().parent +root_dir = script_dir.parent.parent + +steps = [ + ("cargo check --workspace", [ + "cargo", "check", "--workspace", + ]), + ("cargo clippy --workspace -- -D warnings", [ + "cargo", "clippy", "--workspace", "--", "-D", "warnings", + ]), + ("cargo build --workspace --release", [ + "cargo", "build", "--workspace", "--release", + ]), + ("dotnet restore", [ + "dotnet", "restore", "rola-desktop.sln", + ]), + ("dotnet build", [ + "dotnet", "build", "rola-desktop.sln", "--nologo", + ]), +] + +ok = True +for label, cmd in steps: + print(f"\nSTEP - \"{label}\": ", flush=True) + result = subprocess.run(cmd, cwd=root_dir) + if result.returncode != 0: + print(f" [FAILED] Failed (exit code {result.returncode})", flush=True) + ok = False + break + print(f" [SUCCESS] Passed", flush=True) + +sys.exit(0 if ok else 1) diff --git a/rola-devtools/scripts/run-desktop.py b/rola-devtools/scripts/run-desktop.py new file mode 100644 index 0000000..e9d4093 --- /dev/null +++ b/rola-devtools/scripts/run-desktop.py @@ -0,0 +1,11 @@ +#!/usr/bin/env python3 + +import subprocess +import sys +from pathlib import Path + +script_dir = Path(__file__).resolve().parent +project_dir = script_dir.parent.parent / "rola-desktop" +csproj = project_dir / "rola-desktop.csproj" + +subprocess.run(["dotnet", "run", "--project", str(csproj), *sys.argv[1:]]) diff --git a/rola-devtools/scripts/windows-folder-hide.ps1 b/rola-devtools/scripts/windows-folder-hide.ps1 new file mode 100644 index 0000000..0ab2632 --- /dev/null +++ b/rola-devtools/scripts/windows-folder-hide.ps1 @@ -0,0 +1,43 @@ +# Check `last_check` + +$lastCheckFile = Join-Path $PSScriptRoot "last_check" +$currentTime = Get-Date +$timeThreshold = 10 + +if (Test-Path $lastCheckFile) { + $lastCheckTime = Get-Content $lastCheckFile | Get-Date + $timeDiff = ($currentTime - $lastCheckTime).TotalMinutes + + if ($timeDiff -lt $timeThreshold) { + exit + } +} + +$currentTime.ToString() | Out-File -FilePath $lastCheckFile -Force + +# Hide Files + +Set-Location -Path (Join-Path $PSScriptRoot "..\..") + +Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object { + $_.FullName -notmatch '\\.temp\\' -and $_.FullName -notmatch '\\.git\\' +} | ForEach-Object { + attrib -h $_.FullName 2>&1 | Out-Null +} + +Get-ChildItem -Path . -Force -Recurse -ErrorAction SilentlyContinue | Where-Object { + $_.Name -match '^\..*' -and $_.FullName -notmatch '\\\.\.$' -and $_.FullName -notmatch '\\\.$' +} | ForEach-Object { + attrib +h $_.FullName 2>&1 | Out-Null +} + +if (Get-Command git -ErrorAction SilentlyContinue) { + git status --ignored --short | ForEach-Object { + if ($_ -match '^!!\s+(.+)$') { + $ignoredPath = $matches[1] + if ($ignoredPath -notmatch '\.lnk$' -and (Test-Path $ignoredPath)) { + attrib +h $ignoredPath 2>&1 | Out-Null + } + } + } +} -- cgit