-
-
Notifications
You must be signed in to change notification settings - Fork 41
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
64 changed files
with
731 additions
and
294 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
[package] | ||
name = "hemtt" | ||
description = "HEMTT - Arma 3 Build Tool" | ||
version = "1.13.1" | ||
version = "1.13.2" | ||
edition = "2021" | ||
license = "GPL-2.0" | ||
authors = ["Brett Mayson <[email protected]>"] | ||
|
@@ -38,7 +38,7 @@ glob = "0.3.1" | |
num_cpus = "1.16.0" | ||
rayon = "1.10.0" | ||
regex = { workspace = true } | ||
reqwest = { version = "0.12.7", features = ["blocking", "json"] } | ||
reqwest = { version = "0.12.8", features = ["blocking", "json"] } | ||
rhai = "1.19.0" | ||
rust-embed = "8.5.0" | ||
semver = "1.0.23" | ||
|
@@ -50,7 +50,8 @@ tracing = { workspace = true } | |
tracing-subscriber = { version = "0.3.18", features = ["json"] } | ||
vfs = { workspace = true } | ||
walkdir = { workspace = true } | ||
whoami = "1.5.1" | ||
webbrowser = "1.0.2" | ||
whoami = "1.5.2" | ||
zip = { workspace = true } | ||
|
||
[target.'cfg(windows)'.dependencies] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
use clap::{ArgMatches, Command}; | ||
|
||
use crate::{report::Report, Error}; | ||
|
||
#[must_use] | ||
pub fn cli() -> Command { | ||
Command::new("book").about("Open The HEMTT book") | ||
} | ||
|
||
/// Execute the book command | ||
/// | ||
/// # Errors | ||
/// Will not return an error | ||
pub fn execute(_: &ArgMatches) -> Result<Report, Error> { | ||
if let Err(e) = webbrowser::open("https://brettmayson.github.io/HEMTT/") { | ||
eprintln!("Failed to open the HEMTT book: {e}"); | ||
} | ||
Ok(Report::new()) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
pub mod book; | ||
pub mod build; | ||
pub mod check; | ||
pub mod dev; | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
use std::{io::Read, path::PathBuf, sync::Arc}; | ||
|
||
use hemtt_workspace::reporting::Code; | ||
|
||
use crate::{context::Context, report::Report}; | ||
|
||
use super::Module; | ||
|
||
#[derive(Default)] | ||
pub struct BOMCheck {} | ||
|
||
impl Module for BOMCheck { | ||
fn name(&self) -> &'static str { | ||
"BOM Check" | ||
} | ||
|
||
fn check(&self, ctx: &Context) -> Result<Report, crate::Error> { | ||
fn files_to_check(root: &PathBuf) -> Vec<PathBuf> { | ||
const IGNORED_EXTENSIONS: [&str; 4] = ["p3d", "rtm", "bin", "paa"]; | ||
walkdir::WalkDir::new(root) | ||
.into_iter() | ||
.filter_map(std::result::Result::ok) | ||
.filter(|e| e.file_type().is_file()) | ||
.filter(|e| !e.path().display().to_string().contains(".hemttout")) | ||
.filter(|e| { | ||
e.path().extension().map_or(false, |e| { | ||
!IGNORED_EXTENSIONS.contains(&e.to_str().unwrap_or_default()) | ||
}) | ||
}) | ||
.map(|e| e.path().to_path_buf()) | ||
.collect::<Vec<_>>() | ||
} | ||
let mut report = Report::new(); | ||
for folder in ["addons", "optionals"] { | ||
let folder = ctx.project_folder().join(folder); | ||
if !folder.exists() { | ||
continue; | ||
} | ||
let files = files_to_check(&folder); | ||
for path in files { | ||
let mut buffer = [0; 3]; | ||
let mut file = std::fs::File::open(&path)?; | ||
if file.read_exact(&mut buffer).is_err() { | ||
continue; | ||
} | ||
if buffer == [0xEF, 0xBB, 0xBF] { | ||
report.push(Arc::new(BOMError { | ||
file: { | ||
path.display() | ||
.to_string() | ||
.strip_prefix(&ctx.project_folder().display().to_string()) | ||
.unwrap_or_default() | ||
.to_string() | ||
}, | ||
})); | ||
} | ||
} | ||
} | ||
Ok(report) | ||
} | ||
} | ||
|
||
struct BOMError { | ||
file: String, | ||
} | ||
|
||
impl Code for BOMError { | ||
fn ident(&self) -> &'static str { | ||
"BOM" | ||
} | ||
|
||
fn message(&self) -> String { | ||
format!("File `{}` has a BOM marker", self.file) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -11,7 +11,7 @@ git_hash = 0 | |
[asc] | ||
enabled = true | ||
|
||
[hemtt.launch] | ||
[hemtt.launch.default] | ||
dlc = [ | ||
"ws" | ||
] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.