From cdb0423401935fe077fe9a35589b8c5671b45b49 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Tue, 13 Aug 2019 18:03:48 -0400 Subject: [PATCH 001/154] Initial commit --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..faa27f7 --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +/target +**/*.rs.bk +Cargo.lock + +*.iml +.idea +.vscode \ No newline at end of file From 50f832a25d5f509496c1097761819ba7b62ba16d Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Tue, 13 Aug 2019 18:11:24 -0400 Subject: [PATCH 002/154] Adding luajit submodule --- .gitmodules | 3 +++ luajit | 1 + 2 files changed, 4 insertions(+) create mode 100644 .gitmodules create mode 160000 luajit diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..e7ae3a7 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "luajit"] + path = luajit + url = https://github.com/LuaJIT/LuaJIT.git diff --git a/luajit b/luajit new file mode 160000 index 0000000..f0e865d --- /dev/null +++ b/luajit @@ -0,0 +1 @@ +Subproject commit f0e865dd4861520258299d0f2a56491bd9d602e1 From f144a4ff6a2d1a1b723d8d1eb0399f4519532785 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 19:13:42 -0400 Subject: [PATCH 003/154] Add build script and generated ffi --- Cargo.toml | 13 + bindgen.sh | 26 ++ build.rs | 71 +++ examples/hello.lua | 3 + examples/lua.rs | 54 +++ ffi.h | 4 + src/ffi.rs | 1113 ++++++++++++++++++++++++++++++++++++++++++++ src/lib.rs | 163 +++++++ tests/test.rs | 40 ++ 9 files changed, 1487 insertions(+) create mode 100644 Cargo.toml create mode 100644 bindgen.sh create mode 100644 build.rs create mode 100644 examples/hello.lua create mode 100644 examples/lua.rs create mode 100644 ffi.h create mode 100644 src/ffi.rs create mode 100644 src/lib.rs create mode 100644 tests/test.rs diff --git a/Cargo.toml b/Cargo.toml new file mode 100644 index 0000000..e407f7c --- /dev/null +++ b/Cargo.toml @@ -0,0 +1,13 @@ +[package] +name = "luajit-sys" +version = "0.0.1" +authors = ["Aaron Loucks "] +edition = "2018" +keywords = ["lua", "luajit", "script"] + +[dependencies] +libc = "0.2" + +[build-dependencies] +cc = "1.0.40" +fs_extra = "1.1.0" \ No newline at end of file diff --git a/bindgen.sh b/bindgen.sh new file mode 100644 index 0000000..5dd058d --- /dev/null +++ b/bindgen.sh @@ -0,0 +1,26 @@ +#!/bin/bash + +BINDGEN_VERSION=$(bindgen --version) + +bindgen -o src/ffi.rs \ + --raw-line "/// Generated with: ${BINDGEN_VERSION}" \ + --whitelist-var "LUA.*" \ + --whitelist-var "LUAJIT.*" \ + --whitelist-type "lua_.*" \ + --whitelist-type "luaL_.*" \ + --whitelist-function "lua_.*" \ + --whitelist-function "luaL_.*" \ + --whitelist-function "luaJIT.*" \ + --ctypes-prefix "libc" \ + --use-core \ + --impl-debug \ + ffi.h -- -I luajit/src + +sed -i -e 's/pub fn \(luaJIT_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs +sed -i -e 's/pub fn \(lua_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs +sed -i -e 's/pub fn \(luaL_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs +sed -i -e 's/pub type \(lua_[^\=]*\)/\/\/\/ \n pub type \1/' src/ffi.rs +sed -i -e 's/pub struct \(lua_[^\{]*\)/\/\/\/ \n pub struct \1/' src/ffi.rs +sed -i -e 's/pub struct \(luaL_[^\{]*\)/\/\/\/ \n pub struct \1/' src/ffi.rs + +cargo +stable fmt \ No newline at end of file diff --git a/build.rs b/build.rs new file mode 100644 index 0000000..d96daef --- /dev/null +++ b/build.rs @@ -0,0 +1,71 @@ +use cc; +use fs_extra::dir; +use fs_extra::dir::CopyOptions; +use std::env; +use std::process::{Command, Stdio}; + +fn main() { + let target = env::var("TARGET").unwrap(); + + let luajit_dir = format!("{}\\luajit", env!("CARGO_MANIFEST_DIR")); + let out_dir = env::var("OUT_DIR").unwrap(); + let src_dir = format!("{}\\luajit\\src", out_dir); + + if cfg!(target_env = "msvc") { + let lib_path = format!("{}\\lua51.lib", &src_dir); + if !std::fs::metadata(&lib_path).is_ok() { + let cl_exe: cc::Tool = cc::windows_registry::find_tool(&target, "cl.exe").unwrap(); + let msvsbuild_bat = format!("{}\\msvcbuild.bat", &src_dir); + + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; + dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + + let mut buildcmd = Command::new(msvsbuild_bat); + for (name, value) in cl_exe.env() { + buildcmd.env(name, value); + } + buildcmd.env("Configuration", "Release"); + buildcmd.args(&["static"]); + buildcmd.current_dir(&src_dir); + buildcmd.stderr(Stdio::inherit()); + + let mut child = buildcmd.spawn().expect("failed to run msvcbuild.bat"); + + if !child + .wait() + .map(|status| status.success()) + .map_err(|_| false) + .unwrap_or(false) + { + panic!("Failed to build luajit"); + } + } + println!("cargo:rustc-link-search=native={}", src_dir); + println!("cargo:rustc-link-lib=static=lua51"); + } else { + let lib_path = format!("{}\\luajit.a", &src_dir); + if !std::fs::metadata(&lib_path).is_ok() { + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; + dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + + let mut buildcmd = Command::new("make"); + buildcmd.current_dir(&src_dir); + buildcmd.stderr(Stdio::inherit()); + + let mut child = buildcmd.spawn().expect("failed to run make"); + + if !child + .wait() + .map(|status| status.success()) + .map_err(|_| false) + .unwrap_or(false) + { + panic!("Failed to build luajit"); + } + } + println!("cargo:rustc-link-search=native={}", src_dir); + println!("cargo:rustc-link-lib=static=luajit"); + } +} diff --git a/examples/hello.lua b/examples/hello.lua new file mode 100644 index 0000000..87a4120 --- /dev/null +++ b/examples/hello.lua @@ -0,0 +1,3 @@ +print("Hello from lua") + +return 1 + 2 diff --git a/examples/lua.rs b/examples/lua.rs new file mode 100644 index 0000000..aa45cae --- /dev/null +++ b/examples/lua.rs @@ -0,0 +1,54 @@ +use std::env; +use std::ffi::{CStr, CString}; +use std::ptr; + +use luajit_sys as sys; + +unsafe fn run_script(script_name: String, script_src: String) { + let lua = sys::luaL_newstate(); + assert_ne!(lua, ptr::null_mut()); + sys::luaL_openlibs(lua); + let script_data = script_src.as_bytes(); + let script_name = CString::new(script_name).unwrap(); + let mut error = sys::luaL_loadbuffer( + lua, + script_data.as_ptr() as _, + script_data.len() as _, + script_name.as_ptr() as _, + ); + if error != 0 { + eprintln!("luaL_loadbuffer failed"); + } else { + error = sys::lua_pcall(lua, 0, 1, 0); + if error != 0 { + eprintln!("lua_pcall failed"); + } + } + let idx = sys::lua_gettop(lua); + if sys::lua_isnoneornil(lua, idx) != 1 { + let s = sys::lua_tostring(lua, idx); + assert_ne!(s, ptr::null(), "lua_tostring returned null"); + let result = CStr::from_ptr(s).to_string_lossy().to_string(); + println!("script result: {}", result); + } + sys::lua_close(lua); +} + +fn main() { + if let Some(script_name) = env::args().skip(1).next() { + let script_src = std::fs::read_to_string(&script_name) + .unwrap_or_else(|e| panic!("failed to read file: '{}' {:?}", &script_name, e)); + unsafe { + run_script(script_name, script_src); + } + } else { + println!( + "{} FILE", + env::current_exe() + .unwrap() + .file_name() + .unwrap() + .to_string_lossy() + ); + } +} diff --git a/ffi.h b/ffi.h new file mode 100644 index 0000000..a9fe40a --- /dev/null +++ b/ffi.h @@ -0,0 +1,4 @@ +#include "lua.h" +#include "lualib.h" +#include "lauxlib.h" +#include "luajit.h" \ No newline at end of file diff --git a/src/ffi.rs b/src/ffi.rs new file mode 100644 index 0000000..76db086 --- /dev/null +++ b/src/ffi.rs @@ -0,0 +1,1113 @@ +/* automatically generated by rust-bindgen */ + +// Generated with: bindgen 0.49.1 + +pub const LUA_LDIR: &'static [u8; 7usize] = b"!\\lua\\\0"; +pub const LUA_CDIR: &'static [u8; 3usize] = b"!\\\0"; +pub const LUA_PATH_DEFAULT: &'static [u8; 38usize] = + b".\\?.lua;!\\lua\\?.lua;!\\lua\\?\\init.lua;\0"; +pub const LUA_CPATH_DEFAULT: &'static [u8; 30usize] = b".\\?.dll;!\\?.dll;!\\loadall.dll\0"; +pub const LUA_PATH: &'static [u8; 9usize] = b"LUA_PATH\0"; +pub const LUA_CPATH: &'static [u8; 10usize] = b"LUA_CPATH\0"; +pub const LUA_INIT: &'static [u8; 9usize] = b"LUA_INIT\0"; +pub const LUA_DIRSEP: &'static [u8; 2usize] = b"\\\0"; +pub const LUA_PATHSEP: &'static [u8; 2usize] = b";\0"; +pub const LUA_PATH_MARK: &'static [u8; 2usize] = b"?\0"; +pub const LUA_EXECDIR: &'static [u8; 2usize] = b"!\0"; +pub const LUA_IGMARK: &'static [u8; 2usize] = b"-\0"; +pub const LUA_PATH_CONFIG: &'static [u8; 11usize] = b"\\\n;\n?\n!\n-\n\0"; +pub const LUAI_MAXSTACK: u32 = 65500; +pub const LUAI_MAXCSTACK: u32 = 8000; +pub const LUAI_GCPAUSE: u32 = 200; +pub const LUAI_GCMUL: u32 = 200; +pub const LUA_MAXCAPTURES: u32 = 32; +pub const LUA_IDSIZE: u32 = 60; +pub const LUA_NUMBER_SCAN: &'static [u8; 4usize] = b"%lf\0"; +pub const LUA_NUMBER_FMT: &'static [u8; 6usize] = b"%.14g\0"; +pub const LUAI_MAXNUMBER2STR: u32 = 32; +pub const LUA_INTFRMLEN: &'static [u8; 2usize] = b"l\0"; +pub const LUA_VERSION: &'static [u8; 8usize] = b"Lua 5.1\0"; +pub const LUA_RELEASE: &'static [u8; 10usize] = b"Lua 5.1.4\0"; +pub const LUA_VERSION_NUM: u32 = 501; +pub const LUA_COPYRIGHT: &'static [u8; 41usize] = b"Copyright (C) 1994-2008 Lua.org, PUC-Rio\0"; +pub const LUA_AUTHORS: &'static [u8; 49usize] = + b"R. Ierusalimschy, L. H. de Figueiredo & W. Celes\0"; +pub const LUA_SIGNATURE: &'static [u8; 5usize] = b"\x1BLua\0"; +pub const LUA_MULTRET: i32 = -1; +pub const LUA_REGISTRYINDEX: i32 = -10000; +pub const LUA_ENVIRONINDEX: i32 = -10001; +pub const LUA_GLOBALSINDEX: i32 = -10002; +pub const LUA_OK: u32 = 0; +pub const LUA_YIELD: u32 = 1; +pub const LUA_ERRRUN: u32 = 2; +pub const LUA_ERRSYNTAX: u32 = 3; +pub const LUA_ERRMEM: u32 = 4; +pub const LUA_ERRERR: u32 = 5; +pub const LUA_TNONE: i32 = -1; +pub const LUA_TNIL: u32 = 0; +pub const LUA_TBOOLEAN: u32 = 1; +pub const LUA_TLIGHTUSERDATA: u32 = 2; +pub const LUA_TNUMBER: u32 = 3; +pub const LUA_TSTRING: u32 = 4; +pub const LUA_TTABLE: u32 = 5; +pub const LUA_TFUNCTION: u32 = 6; +pub const LUA_TUSERDATA: u32 = 7; +pub const LUA_TTHREAD: u32 = 8; +pub const LUA_MINSTACK: u32 = 20; +pub const LUA_GCSTOP: u32 = 0; +pub const LUA_GCRESTART: u32 = 1; +pub const LUA_GCCOLLECT: u32 = 2; +pub const LUA_GCCOUNT: u32 = 3; +pub const LUA_GCCOUNTB: u32 = 4; +pub const LUA_GCSTEP: u32 = 5; +pub const LUA_GCSETPAUSE: u32 = 6; +pub const LUA_GCSETSTEPMUL: u32 = 7; +pub const LUA_GCISRUNNING: u32 = 9; +pub const LUA_HOOKCALL: u32 = 0; +pub const LUA_HOOKRET: u32 = 1; +pub const LUA_HOOKLINE: u32 = 2; +pub const LUA_HOOKCOUNT: u32 = 3; +pub const LUA_HOOKTAILRET: u32 = 4; +pub const LUA_MASKCALL: u32 = 1; +pub const LUA_MASKRET: u32 = 2; +pub const LUA_MASKLINE: u32 = 4; +pub const LUA_MASKCOUNT: u32 = 8; +pub const LUA_FILEHANDLE: &'static [u8; 6usize] = b"FILE*\0"; +pub const LUA_COLIBNAME: &'static [u8; 10usize] = b"coroutine\0"; +pub const LUA_MATHLIBNAME: &'static [u8; 5usize] = b"math\0"; +pub const LUA_STRLIBNAME: &'static [u8; 7usize] = b"string\0"; +pub const LUA_TABLIBNAME: &'static [u8; 6usize] = b"table\0"; +pub const LUA_IOLIBNAME: &'static [u8; 3usize] = b"io\0"; +pub const LUA_OSLIBNAME: &'static [u8; 3usize] = b"os\0"; +pub const LUA_LOADLIBNAME: &'static [u8; 8usize] = b"package\0"; +pub const LUA_DBLIBNAME: &'static [u8; 6usize] = b"debug\0"; +pub const LUA_BITLIBNAME: &'static [u8; 4usize] = b"bit\0"; +pub const LUA_JITLIBNAME: &'static [u8; 4usize] = b"jit\0"; +pub const LUA_FFILIBNAME: &'static [u8; 4usize] = b"ffi\0"; +pub const LUA_ERRFILE: u32 = 6; +pub const LUA_NOREF: i32 = -2; +pub const LUA_REFNIL: i32 = -1; +pub const LUAJIT_VERSION: &'static [u8; 19usize] = b"LuaJIT 2.1.0-beta3\0"; +pub const LUAJIT_VERSION_NUM: u32 = 20100; +pub const LUAJIT_COPYRIGHT: &'static [u8; 34usize] = b"Copyright (C) 2005-2017 Mike Pall\0"; +pub const LUAJIT_URL: &'static [u8; 19usize] = b"http://luajit.org/\0"; +pub const LUAJIT_MODE_MASK: u32 = 255; +pub const LUAJIT_MODE_OFF: u32 = 0; +pub const LUAJIT_MODE_ON: u32 = 256; +pub const LUAJIT_MODE_FLUSH: u32 = 512; +pub type va_list = __builtin_va_list; +#[repr(C)] +#[derive(Debug, Copy, Clone)] +/// +pub struct lua_State { + _unused: [u8; 0], +} +/// +pub type lua_CFunction = + ::core::option::Option libc::c_int>; +/// +pub type lua_Reader = ::core::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + ud: *mut libc::c_void, + sz: *mut usize, + ) -> *const libc::c_char, +>; +/// +pub type lua_Writer = ::core::option::Option< + unsafe extern "C" fn( + L: *mut lua_State, + p: *const libc::c_void, + sz: usize, + ud: *mut libc::c_void, + ) -> libc::c_int, +>; +/// +pub type lua_Alloc = ::core::option::Option< + unsafe extern "C" fn( + ud: *mut libc::c_void, + ptr: *mut libc::c_void, + osize: usize, + nsize: usize, + ) -> *mut libc::c_void, +>; +/// +pub type lua_Number = f64; +/// +pub type lua_Integer = isize; +extern "C" { + /// + pub fn lua_newstate(f: lua_Alloc, ud: *mut libc::c_void) -> *mut lua_State; +} +extern "C" { + /// + pub fn lua_close(L: *mut lua_State); +} +extern "C" { + /// + pub fn lua_newthread(L: *mut lua_State) -> *mut lua_State; +} +extern "C" { + /// + pub fn lua_atpanic(L: *mut lua_State, panicf: lua_CFunction) -> lua_CFunction; +} +extern "C" { + /// + pub fn lua_gettop(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_settop(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_pushvalue(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_remove(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_insert(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_replace(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_checkstack(L: *mut lua_State, sz: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_xmove(from: *mut lua_State, to: *mut lua_State, n: libc::c_int); +} +extern "C" { + /// + pub fn lua_isnumber(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_isstring(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_iscfunction(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_isuserdata(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_type(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_typename(L: *mut lua_State, tp: libc::c_int) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_equal(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_rawequal(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_lessthan(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_tonumber(L: *mut lua_State, idx: libc::c_int) -> lua_Number; +} +extern "C" { + /// + pub fn lua_tointeger(L: *mut lua_State, idx: libc::c_int) -> lua_Integer; +} +extern "C" { + /// + pub fn lua_toboolean(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_tolstring( + L: *mut lua_State, + idx: libc::c_int, + len: *mut usize, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_objlen(L: *mut lua_State, idx: libc::c_int) -> usize; +} +extern "C" { + /// + pub fn lua_tocfunction(L: *mut lua_State, idx: libc::c_int) -> lua_CFunction; +} +extern "C" { + /// + pub fn lua_touserdata(L: *mut lua_State, idx: libc::c_int) -> *mut libc::c_void; +} +extern "C" { + /// + pub fn lua_tothread(L: *mut lua_State, idx: libc::c_int) -> *mut lua_State; +} +extern "C" { + /// + pub fn lua_topointer(L: *mut lua_State, idx: libc::c_int) -> *const libc::c_void; +} +extern "C" { + /// + pub fn lua_pushnil(L: *mut lua_State); +} +extern "C" { + /// + pub fn lua_pushnumber(L: *mut lua_State, n: lua_Number); +} +extern "C" { + /// + pub fn lua_pushinteger(L: *mut lua_State, n: lua_Integer); +} +extern "C" { + /// + pub fn lua_pushlstring(L: *mut lua_State, s: *const libc::c_char, l: usize); +} +extern "C" { + /// + pub fn lua_pushstring(L: *mut lua_State, s: *const libc::c_char); +} +extern "C" { + /// + pub fn lua_pushvfstring( + L: *mut lua_State, + fmt: *const libc::c_char, + argp: va_list, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_pushfstring(L: *mut lua_State, fmt: *const libc::c_char, ...) + -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_pushcclosure(L: *mut lua_State, fn_: lua_CFunction, n: libc::c_int); +} +extern "C" { + /// + pub fn lua_pushboolean(L: *mut lua_State, b: libc::c_int); +} +extern "C" { + /// + pub fn lua_pushlightuserdata(L: *mut lua_State, p: *mut libc::c_void); +} +extern "C" { + /// + pub fn lua_pushthread(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_gettable(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_getfield(L: *mut lua_State, idx: libc::c_int, k: *const libc::c_char); +} +extern "C" { + /// + pub fn lua_rawget(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_rawgeti(L: *mut lua_State, idx: libc::c_int, n: libc::c_int); +} +extern "C" { + /// + pub fn lua_createtable(L: *mut lua_State, narr: libc::c_int, nrec: libc::c_int); +} +extern "C" { + /// + pub fn lua_newuserdata(L: *mut lua_State, sz: usize) -> *mut libc::c_void; +} +extern "C" { + /// + pub fn lua_getmetatable(L: *mut lua_State, objindex: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_getfenv(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_settable(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_setfield(L: *mut lua_State, idx: libc::c_int, k: *const libc::c_char); +} +extern "C" { + /// + pub fn lua_rawset(L: *mut lua_State, idx: libc::c_int); +} +extern "C" { + /// + pub fn lua_rawseti(L: *mut lua_State, idx: libc::c_int, n: libc::c_int); +} +extern "C" { + /// + pub fn lua_setmetatable(L: *mut lua_State, objindex: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_setfenv(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_call(L: *mut lua_State, nargs: libc::c_int, nresults: libc::c_int); +} +extern "C" { + /// + pub fn lua_pcall( + L: *mut lua_State, + nargs: libc::c_int, + nresults: libc::c_int, + errfunc: libc::c_int, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_cpcall(L: *mut lua_State, func: lua_CFunction, ud: *mut libc::c_void) + -> libc::c_int; +} +extern "C" { + /// + pub fn lua_load( + L: *mut lua_State, + reader: lua_Reader, + dt: *mut libc::c_void, + chunkname: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_dump(L: *mut lua_State, writer: lua_Writer, data: *mut libc::c_void) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_yield(L: *mut lua_State, nresults: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_resume(L: *mut lua_State, narg: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_status(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_gc(L: *mut lua_State, what: libc::c_int, data: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_error(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_next(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_concat(L: *mut lua_State, n: libc::c_int); +} +extern "C" { + /// + pub fn lua_getallocf(L: *mut lua_State, ud: *mut *mut libc::c_void) -> lua_Alloc; +} +extern "C" { + /// + pub fn lua_setallocf(L: *mut lua_State, f: lua_Alloc, ud: *mut libc::c_void); +} +extern "C" { + /// + pub fn lua_setlevel(from: *mut lua_State, to: *mut lua_State); +} +/// +pub type lua_Hook = + ::core::option::Option; +extern "C" { + /// + pub fn lua_getstack(L: *mut lua_State, level: libc::c_int, ar: *mut lua_Debug) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_getinfo( + L: *mut lua_State, + what: *const libc::c_char, + ar: *mut lua_Debug, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_getlocal( + L: *mut lua_State, + ar: *const lua_Debug, + n: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_setlocal( + L: *mut lua_State, + ar: *const lua_Debug, + n: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_getupvalue( + L: *mut lua_State, + funcindex: libc::c_int, + n: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_setupvalue( + L: *mut lua_State, + funcindex: libc::c_int, + n: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn lua_sethook( + L: *mut lua_State, + func: lua_Hook, + mask: libc::c_int, + count: libc::c_int, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; +} +extern "C" { + /// + pub fn lua_gethookmask(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_gethookcount(L: *mut lua_State) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_upvalueid(L: *mut lua_State, idx: libc::c_int, n: libc::c_int) -> *mut libc::c_void; +} +extern "C" { + /// + pub fn lua_upvaluejoin( + L: *mut lua_State, + idx1: libc::c_int, + n1: libc::c_int, + idx2: libc::c_int, + n2: libc::c_int, + ); +} +extern "C" { + /// + pub fn lua_loadx( + L: *mut lua_State, + reader: lua_Reader, + dt: *mut libc::c_void, + chunkname: *const libc::c_char, + mode: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn lua_version(L: *mut lua_State) -> *const lua_Number; +} +extern "C" { + /// + pub fn lua_copy(L: *mut lua_State, fromidx: libc::c_int, toidx: libc::c_int); +} +extern "C" { + /// + pub fn lua_tonumberx( + L: *mut lua_State, + idx: libc::c_int, + isnum: *mut libc::c_int, + ) -> lua_Number; +} +extern "C" { + /// + pub fn lua_tointegerx( + L: *mut lua_State, + idx: libc::c_int, + isnum: *mut libc::c_int, + ) -> lua_Integer; +} +extern "C" { + /// + pub fn lua_isyieldable(L: *mut lua_State) -> libc::c_int; +} +#[repr(C)] +#[derive(Copy, Clone)] +/// +pub struct lua_Debug { + pub event: libc::c_int, + pub name: *const libc::c_char, + pub namewhat: *const libc::c_char, + pub what: *const libc::c_char, + pub source: *const libc::c_char, + pub currentline: libc::c_int, + pub nups: libc::c_int, + pub linedefined: libc::c_int, + pub lastlinedefined: libc::c_int, + pub short_src: [libc::c_char; 60usize], + pub i_ci: libc::c_int, +} +#[test] +fn bindgen_test_layout_lua_Debug() { + assert_eq!( + ::core::mem::size_of::(), + 120usize, + concat!("Size of: ", stringify!(lua_Debug)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(lua_Debug)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).event as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(event) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).namewhat as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(namewhat) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).what as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(what) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).source as *const _ as usize }, + 32usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(source) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).currentline as *const _ as usize }, + 40usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(currentline) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).nups as *const _ as usize }, + 44usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(nups) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).linedefined as *const _ as usize }, + 48usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(linedefined) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).lastlinedefined as *const _ as usize }, + 52usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(lastlinedefined) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).short_src as *const _ as usize }, + 56usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(short_src) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).i_ci as *const _ as usize }, + 116usize, + concat!( + "Offset of field: ", + stringify!(lua_Debug), + "::", + stringify!(i_ci) + ) + ); +} +impl ::core::fmt::Debug for lua_Debug { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write ! ( f , "lua_Debug {{ event: {:?}, name: {:?}, namewhat: {:?}, what: {:?}, source: {:?}, currentline: {:?}, nups: {:?}, linedefined: {:?}, lastlinedefined: {:?}, short_src: [...], i_ci: {:?} }}" , self . event , self . name , self . namewhat , self . what , self . source , self . currentline , self . nups , self . linedefined , self . lastlinedefined , self . i_ci ) + } +} +extern "C" { + /// + pub fn luaL_openlibs(L: *mut lua_State); +} +#[repr(C)] +#[derive(Debug, Copy, Clone)] +/// +pub struct luaL_Reg { + pub name: *const libc::c_char, + pub func: lua_CFunction, +} +#[test] +fn bindgen_test_layout_luaL_Reg() { + assert_eq!( + ::core::mem::size_of::(), + 16usize, + concat!("Size of: ", stringify!(luaL_Reg)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Reg)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(name) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).func as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Reg), + "::", + stringify!(func) + ) + ); +} +extern "C" { + /// + pub fn luaL_openlib( + L: *mut lua_State, + libname: *const libc::c_char, + l: *const luaL_Reg, + nup: libc::c_int, + ); +} +extern "C" { + /// + pub fn luaL_register(L: *mut lua_State, libname: *const libc::c_char, l: *const luaL_Reg); +} +extern "C" { + /// + pub fn luaL_getmetafield( + L: *mut lua_State, + obj: libc::c_int, + e: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_callmeta( + L: *mut lua_State, + obj: libc::c_int, + e: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_typerror( + L: *mut lua_State, + narg: libc::c_int, + tname: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_argerror( + L: *mut lua_State, + numarg: libc::c_int, + extramsg: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_checklstring( + L: *mut lua_State, + numArg: libc::c_int, + l: *mut usize, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn luaL_optlstring( + L: *mut lua_State, + numArg: libc::c_int, + def: *const libc::c_char, + l: *mut usize, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn luaL_checknumber(L: *mut lua_State, numArg: libc::c_int) -> lua_Number; +} +extern "C" { + /// + pub fn luaL_optnumber(L: *mut lua_State, nArg: libc::c_int, def: lua_Number) -> lua_Number; +} +extern "C" { + /// + pub fn luaL_checkinteger(L: *mut lua_State, numArg: libc::c_int) -> lua_Integer; +} +extern "C" { + /// + pub fn luaL_optinteger(L: *mut lua_State, nArg: libc::c_int, def: lua_Integer) -> lua_Integer; +} +extern "C" { + /// + pub fn luaL_checkstack(L: *mut lua_State, sz: libc::c_int, msg: *const libc::c_char); +} +extern "C" { + /// + pub fn luaL_checktype(L: *mut lua_State, narg: libc::c_int, t: libc::c_int); +} +extern "C" { + /// + pub fn luaL_checkany(L: *mut lua_State, narg: libc::c_int); +} +extern "C" { + /// + pub fn luaL_newmetatable(L: *mut lua_State, tname: *const libc::c_char) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_checkudata( + L: *mut lua_State, + ud: libc::c_int, + tname: *const libc::c_char, + ) -> *mut libc::c_void; +} +extern "C" { + /// + pub fn luaL_where(L: *mut lua_State, lvl: libc::c_int); +} +extern "C" { + /// + pub fn luaL_error(L: *mut lua_State, fmt: *const libc::c_char, ...) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_checkoption( + L: *mut lua_State, + narg: libc::c_int, + def: *const libc::c_char, + lst: *const *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_ref(L: *mut lua_State, t: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_unref(L: *mut lua_State, t: libc::c_int, ref_: libc::c_int); +} +extern "C" { + /// + pub fn luaL_loadfile(L: *mut lua_State, filename: *const libc::c_char) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_loadbuffer( + L: *mut lua_State, + buff: *const libc::c_char, + sz: usize, + name: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_loadstring(L: *mut lua_State, s: *const libc::c_char) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_newstate() -> *mut lua_State; +} +extern "C" { + /// + pub fn luaL_gsub( + L: *mut lua_State, + s: *const libc::c_char, + p: *const libc::c_char, + r: *const libc::c_char, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn luaL_findtable( + L: *mut lua_State, + idx: libc::c_int, + fname: *const libc::c_char, + szhint: libc::c_int, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn luaL_fileresult( + L: *mut lua_State, + stat: libc::c_int, + fname: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_execresult(L: *mut lua_State, stat: libc::c_int) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_loadfilex( + L: *mut lua_State, + filename: *const libc::c_char, + mode: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_loadbufferx( + L: *mut lua_State, + buff: *const libc::c_char, + sz: usize, + name: *const libc::c_char, + mode: *const libc::c_char, + ) -> libc::c_int; +} +extern "C" { + /// + pub fn luaL_traceback( + L: *mut lua_State, + L1: *mut lua_State, + msg: *const libc::c_char, + level: libc::c_int, + ); +} +extern "C" { + /// + pub fn luaL_setfuncs(L: *mut lua_State, l: *const luaL_Reg, nup: libc::c_int); +} +extern "C" { + /// + pub fn luaL_pushmodule(L: *mut lua_State, modname: *const libc::c_char, sizehint: libc::c_int); +} +extern "C" { + /// + pub fn luaL_testudata( + L: *mut lua_State, + ud: libc::c_int, + tname: *const libc::c_char, + ) -> *mut libc::c_void; +} +extern "C" { + /// + pub fn luaL_setmetatable(L: *mut lua_State, tname: *const libc::c_char); +} +#[repr(C)] +#[derive(Copy, Clone)] +/// +pub struct luaL_Buffer { + pub p: *mut libc::c_char, + pub lvl: libc::c_int, + pub L: *mut lua_State, + pub buffer: [libc::c_char; 512usize], +} +#[test] +fn bindgen_test_layout_luaL_Buffer() { + assert_eq!( + ::core::mem::size_of::(), + 536usize, + concat!("Size of: ", stringify!(luaL_Buffer)) + ); + assert_eq!( + ::core::mem::align_of::(), + 8usize, + concat!("Alignment of ", stringify!(luaL_Buffer)) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).p as *const _ as usize }, + 0usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(p) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).lvl as *const _ as usize }, + 8usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(lvl) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).L as *const _ as usize }, + 16usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(L) + ) + ); + assert_eq!( + unsafe { &(*(::core::ptr::null::())).buffer as *const _ as usize }, + 24usize, + concat!( + "Offset of field: ", + stringify!(luaL_Buffer), + "::", + stringify!(buffer) + ) + ); +} +impl ::core::fmt::Debug for luaL_Buffer { + fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { + write!( + f, + "luaL_Buffer {{ p: {:?}, lvl: {:?}, L: {:?}, buffer: [...] }}", + self.p, self.lvl, self.L + ) + } +} +extern "C" { + /// + pub fn luaL_buffinit(L: *mut lua_State, B: *mut luaL_Buffer); +} +extern "C" { + /// + pub fn luaL_prepbuffer(B: *mut luaL_Buffer) -> *mut libc::c_char; +} +extern "C" { + /// + pub fn luaL_addlstring(B: *mut luaL_Buffer, s: *const libc::c_char, l: usize); +} +extern "C" { + /// + pub fn luaL_addstring(B: *mut luaL_Buffer, s: *const libc::c_char); +} +extern "C" { + /// + pub fn luaL_addvalue(B: *mut luaL_Buffer); +} +extern "C" { + /// + pub fn luaL_pushresult(B: *mut luaL_Buffer); +} +pub const LUAJIT_MODE_ENGINE: _bindgen_ty_1 = 0; +pub const LUAJIT_MODE_DEBUG: _bindgen_ty_1 = 1; +pub const LUAJIT_MODE_FUNC: _bindgen_ty_1 = 2; +pub const LUAJIT_MODE_ALLFUNC: _bindgen_ty_1 = 3; +pub const LUAJIT_MODE_ALLSUBFUNC: _bindgen_ty_1 = 4; +pub const LUAJIT_MODE_TRACE: _bindgen_ty_1 = 5; +pub const LUAJIT_MODE_WRAPCFUNC: _bindgen_ty_1 = 16; +pub const LUAJIT_MODE_MAX: _bindgen_ty_1 = 17; +pub type _bindgen_ty_1 = i32; +extern "C" { + /// + pub fn luaJIT_setmode(L: *mut lua_State, idx: libc::c_int, mode: libc::c_int) -> libc::c_int; +} +pub type luaJIT_profile_callback = ::core::option::Option< + unsafe extern "C" fn( + data: *mut libc::c_void, + L: *mut lua_State, + samples: libc::c_int, + vmstate: libc::c_int, + ), +>; +extern "C" { + /// + pub fn luaJIT_profile_start( + L: *mut lua_State, + mode: *const libc::c_char, + cb: luaJIT_profile_callback, + data: *mut libc::c_void, + ); +} +extern "C" { + /// + pub fn luaJIT_profile_stop(L: *mut lua_State); +} +extern "C" { + /// + pub fn luaJIT_profile_dumpstack( + L: *mut lua_State, + fmt: *const libc::c_char, + depth: libc::c_int, + len: *mut usize, + ) -> *const libc::c_char; +} +extern "C" { + /// + pub fn luaJIT_version_2_1_0_beta3(); +} +pub type __builtin_va_list = *mut libc::c_char; diff --git a/src/lib.rs b/src/lib.rs new file mode 100644 index 0000000..e0d799f --- /dev/null +++ b/src/lib.rs @@ -0,0 +1,163 @@ +#![no_std] +#![allow(non_snake_case)] +#![allow(non_camel_case_types)] + +//! # LuaJIT 2.1 +//! +//! +//! +//! +//! +//! ## Performance considerations +//! +//! The _Not Yet Implemented_ guide documents which language features will be JIT compiled +//! into native machine code. +//! +//! + +mod ffi; +pub use ffi::*; + +use core::ptr; + +// These are defined as macros + +/// +#[inline] +pub unsafe fn lua_pop(L: *mut lua_State, idx: libc::c_int) { + lua_settop(L, -(idx) - 1) +} + +/// +#[inline] +pub unsafe fn lua_newtable(L: *mut lua_State) { + lua_createtable(L, 0, 0) +} + +/// +#[inline] +pub unsafe fn lua_register(L: *mut lua_State, name: *const libc::c_char, f: lua_CFunction) { + lua_pushcfunction(L, f); + lua_setglobal(L, name); +} + +/// +#[inline] +pub unsafe fn lua_pushcfunction(L: *mut lua_State, f: lua_CFunction) { + lua_pushcclosure(L, f, 0); +} + +/// +#[inline] +pub unsafe fn lua_strlen(L: *mut lua_State, idx: libc::c_int) -> usize { + lua_objlen(L, idx) +} + +/// +#[inline] +pub unsafe fn lua_isfunction(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TFUNCTION as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_istable(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TTABLE as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_islightuserdata(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TLIGHTUSERDATA as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_isnil(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TNIL as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_isboolean(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TBOOLEAN as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_isthread(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TTHREAD as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_isnone(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) == LUA_TNONE as i32) as i32 +} + +/// +#[inline] +pub unsafe fn lua_isnoneornil(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { + (lua_type(L, idx) <= 0) as i32 +} + +/// +#[inline] +pub unsafe fn lua_pushliteral(L: *mut lua_State, s: &str) { + lua_pushlstring(L, s.as_ptr() as _, s.len() as _); +} + +/// +#[inline] +pub unsafe fn lua_setglobal(L: *mut lua_State, k: *const libc::c_char) { + lua_setfield(L, LUA_GLOBALSINDEX, k); +} + +/// +#[inline] +pub unsafe fn lua_getglobal(L: *mut lua_State, k: *const libc::c_char) { + lua_getfield(L, LUA_GLOBALSINDEX, k) +} + +/// +#[inline] +pub unsafe fn lua_tostring(L: *mut lua_State, idx: libc::c_int) -> *const libc::c_char { + lua_tolstring(L, idx, ptr::null_mut()) +} + +// Additional compatibility items that are defined as macros + +/// `luaL_newstate()` +#[inline] +#[deprecated(since = "Lua 5.1", note = "replace with `luaL_newstate()`")] +pub unsafe fn lua_open() -> *mut lua_State { + luaL_newstate() +} + +/// `lua_pushvalue(L, LUA_REGISTRYINDEX)` +#[inline] +#[deprecated( + since = "Lua 5.1", + note = "replace with `lua_pushvalue(L, LUA_REGISTRYINDEX)`" +)] +pub unsafe fn lua_getregistry(L: *mut lua_State) { + lua_pushvalue(L, LUA_REGISTRYINDEX) +} + +/// `lua_gc(L, LUA_GCCOUNT as _, 0)` +#[inline] +#[deprecated( + since = "Lua 5.1", + note = "replace with `lua_gc(L, LUA_GCCOUNT as _, 0)`" +)] +pub unsafe fn lua_getgccount(L: *mut lua_State) -> libc::c_int { + lua_gc(L, LUA_GCCOUNT as _, 0) +} + +/// `lua_Reader` +#[deprecated(since = "Lua 5.1", note = "replace with `lua_Reader`")] +pub type lua_Chunkreader = lua_Reader; + +/// `lua_Writer` +#[deprecated(since = "Lua 5.1", note = "replace with `lua_Writer`")] +pub type lua_Chunkwriter = lua_Writer; diff --git a/tests/test.rs b/tests/test.rs new file mode 100644 index 0000000..e737156 --- /dev/null +++ b/tests/test.rs @@ -0,0 +1,40 @@ +use luajit_sys as sys; + +#[test] +fn run_script() { + use std::ffi::CStr; + use std::ptr; + + unsafe { + let lua = sys::luaL_newstate(); + assert_ne!(lua, ptr::null_mut()); + sys::luaL_openlibs(lua); + let script_data = b"return 1 + 2"; + let script_name = b"run_script\0"; + let mut error = sys::luaL_loadbuffer( + lua, + script_data.as_ptr() as _, + script_data.len() as _, + script_name.as_ptr() as _, + ); + if error != 0 { + eprintln!("luaL_loadbuffer failed"); + } else { + error = sys::lua_pcall(lua, 0, 1, 0); + if error != 0 { + eprintln!("lua_pcall failed"); + } + } + + let idx = sys::lua_gettop(lua); + println!("lua_gettop = {}", idx); + + let s = sys::lua_tostring(lua, idx); + assert_ne!(s, ptr::null(), "lua_tostring returned null"); + + let result = CStr::from_ptr(s).to_string_lossy().to_string(); + sys::lua_close(lua); + + assert_eq!("3", result); + } +} From dd2810e855ab4baf325a90a37cbef1d6ce1204ff Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 19:28:35 -0400 Subject: [PATCH 004/154] Add azure-pipelines config --- .azure-pipelines.yml | 47 +++++++++++++++++++++++++++++++++++++++ ci/azure-install-rust.yml | 33 +++++++++++++++++++++++++++ ci/azure-test-all.yml | 19 ++++++++++++++++ 3 files changed, 99 insertions(+) create mode 100644 .azure-pipelines.yml create mode 100644 ci/azure-install-rust.yml create mode 100644 ci/azure-test-all.yml diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml new file mode 100644 index 0000000..62ff799 --- /dev/null +++ b/.azure-pipelines.yml @@ -0,0 +1,47 @@ +trigger: + - master + +pr: + branches: + include: + - master + +jobs: + - job: Windows + pool: + vmImage: vs2017-win2016 + steps: + - template: ci/azure-install-rust.yml + - template: ci/azure-test-all.yml + strategy: + matrix: + stable: + TOOLCHAIN: stable + nightly: + TOOLCHAIN: nightly + + - job: Linux + pool: + vmImage: ubuntu-16.04 + steps: + - template: ci/azure-install-rust.yml + - template: ci/azure-test-all.yml + strategy: + matrix: + stable: + TOOLCHAIN: stable + nightly: + TOOLCHAIN: nightly + + - job: MacOS + pool: + vmImage: macOS-10.14 + steps: + - template: ci/azure-install-rust.yml + - template: ci/azure-test-all.yml + strategy: + matrix: + stable: + TOOLCHAIN: stable + nightly: + TOOLCHAIN: nightly \ No newline at end of file diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml new file mode 100644 index 0000000..b304a14 --- /dev/null +++ b/ci/azure-install-rust.yml @@ -0,0 +1,33 @@ +steps: + - bash: | + set -e -x + curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN + source $HOME/.cargo/env + echo "##vso[task.prependpath]$HOME/.cargo/bin" + rustup --version + displayName: Install rustup + condition: eq(variables['Agent.OS'], 'Darwin') +# - script: | +# echo %TOOLCHAIN% +# curl -sSf -o rustup-init.exe https://win.rustup.rs +# rustup-init.exe -v -y --default-toolchain %TOOLCHAIN% +# echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin +# rustup default %TOOLCHAIN% +# rustup component add rustfmt +# displayName: Install rust (windows) +# condition: eq(variables['Agent.OS'], 'Windows_NT') + - bash: | + set -x + rustup --version + rustup component remove --toolchain $TOOLCHAIN rust-docs || true + rustup default $TOOLCHAIN + rustup update --no-self-update $TOOLCHAIN + rustup toolchain install stable + rustup component add rustfmt --toolchain stable + displayName: Configure rust + - bash: | + set -x + rustc -Vv + cargo -Vv + cargo +stable fmt --version + displayName: Query rustc, cargo, and rustfmt versions \ No newline at end of file diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml new file mode 100644 index 0000000..e2e3f4a --- /dev/null +++ b/ci/azure-test-all.yml @@ -0,0 +1,19 @@ +steps: + - bash: | + set -e -x + cargo +stable fmt --all -- --check + displayName: Check formatting + - bash: | + set -e -x + cargo test --no-run + displayName: Build everything + env: + RUST_BACKTRACE: 1 + CARGO_INCREMENTAL: 0 + - bash: | + set -e -x + cargo test + displayName: Run unit tests + env: + RUST_BACKTRACE: 1 + CARGO_INCREMENTAL: 0 From db8d666c8af6d9a0c3d34baadf4b0790a4d5de56 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 19:32:01 -0400 Subject: [PATCH 005/154] Fix path separator --- build.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.rs b/build.rs index d96daef..d77dd1a 100644 --- a/build.rs +++ b/build.rs @@ -7,15 +7,15 @@ use std::process::{Command, Stdio}; fn main() { let target = env::var("TARGET").unwrap(); - let luajit_dir = format!("{}\\luajit", env!("CARGO_MANIFEST_DIR")); + let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); let out_dir = env::var("OUT_DIR").unwrap(); - let src_dir = format!("{}\\luajit\\src", out_dir); + let src_dir = format!("{}/luajit/src", out_dir); if cfg!(target_env = "msvc") { - let lib_path = format!("{}\\lua51.lib", &src_dir); + let lib_path = format!("{}/lua51.lib", &src_dir); if !std::fs::metadata(&lib_path).is_ok() { let cl_exe: cc::Tool = cc::windows_registry::find_tool(&target, "cl.exe").unwrap(); - let msvsbuild_bat = format!("{}\\msvcbuild.bat", &src_dir); + let msvsbuild_bat = format!("{}/msvcbuild.bat", &src_dir); let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; @@ -44,7 +44,7 @@ fn main() { println!("cargo:rustc-link-search=native={}", src_dir); println!("cargo:rustc-link-lib=static=lua51"); } else { - let lib_path = format!("{}\\luajit.a", &src_dir); + let lib_path = format!("{}/luajit.a", &src_dir); if !std::fs::metadata(&lib_path).is_ok() { let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; From 64b97a3b197e9cd1f107f1a719ac43fb2d440450 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 19:33:49 -0400 Subject: [PATCH 006/154] Debug pipeline --- build.rs | 12 ++++++++++-- ci/azure-test-all.yml | 5 +++++ 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index d77dd1a..2ff8841 100644 --- a/build.rs +++ b/build.rs @@ -11,17 +11,24 @@ fn main() { let out_dir = env::var("OUT_DIR").unwrap(); let src_dir = format!("{}/luajit/src", out_dir); + dbg!(&luajit_dir); + dbg!(&out_dir); + dbg!(&src_dir); + if cfg!(target_env = "msvc") { let lib_path = format!("{}/lua51.lib", &src_dir); + dbg!(&lib_path); if !std::fs::metadata(&lib_path).is_ok() { let cl_exe: cc::Tool = cc::windows_registry::find_tool(&target, "cl.exe").unwrap(); - let msvsbuild_bat = format!("{}/msvcbuild.bat", &src_dir); + let msvcbuild_bat = format!("{}/msvcbuild.bat", &src_dir); + + dbg!(&msvcbuild_bat); let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); - let mut buildcmd = Command::new(msvsbuild_bat); + let mut buildcmd = Command::new(msvcbuild_bat); for (name, value) in cl_exe.env() { buildcmd.env(name, value); } @@ -45,6 +52,7 @@ fn main() { println!("cargo:rustc-link-lib=static=lua51"); } else { let lib_path = format!("{}/luajit.a", &src_dir); + dbg!(&lib_path); if !std::fs::metadata(&lib_path).is_ok() { let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml index e2e3f4a..738bdba 100644 --- a/ci/azure-test-all.yml +++ b/ci/azure-test-all.yml @@ -17,3 +17,8 @@ steps: env: RUST_BACKTRACE: 1 CARGO_INCREMENTAL: 0 + - bash: | + pwd + find ./target + displayName: List files in ./target + condition: always() From 7c7cb2b56ddc72fa625dcc06bcf86bdc8b1d4314 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 20:26:56 -0400 Subject: [PATCH 007/154] Checkout submodules in azure-pipelines --- ci/azure-test-all.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml index 738bdba..7c08c69 100644 --- a/ci/azure-test-all.yml +++ b/ci/azure-test-all.yml @@ -1,4 +1,6 @@ steps: + - checkout: self + submodules: true - bash: | set -e -x cargo +stable fmt --all -- --check From 4cd8b358d73de0f38301ea3cb5aa68e952b3c37e Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 20:49:42 -0400 Subject: [PATCH 008/154] Set BUILDMODE=static in Makefile --- build.rs | 5 +- etc/Makefile | 721 +++++++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 724 insertions(+), 2 deletions(-) create mode 100644 etc/Makefile diff --git a/build.rs b/build.rs index 2ff8841..7c4c6f9 100644 --- a/build.rs +++ b/build.rs @@ -1,8 +1,8 @@ use cc; use fs_extra::dir; use fs_extra::dir::CopyOptions; -use std::env; use std::process::{Command, Stdio}; +use std::{env, fs}; fn main() { let target = env::var("TARGET").unwrap(); @@ -27,6 +27,7 @@ fn main() { let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); let mut buildcmd = Command::new(msvcbuild_bat); for (name, value) in cl_exe.env() { @@ -51,7 +52,7 @@ fn main() { println!("cargo:rustc-link-search=native={}", src_dir); println!("cargo:rustc-link-lib=static=lua51"); } else { - let lib_path = format!("{}/luajit.a", &src_dir); + let lib_path = format!("{}/libluajit.a", &src_dir); dbg!(&lib_path); if !std::fs::metadata(&lib_path).is_ok() { let mut copy_options = CopyOptions::new(); diff --git a/etc/Makefile b/etc/Makefile new file mode 100644 index 0000000..8f3cf60 --- /dev/null +++ b/etc/Makefile @@ -0,0 +1,721 @@ +############################################################################## +# LuaJIT Makefile. Requires GNU Make. +# +# Please read doc/install.html before changing any variables! +# +# Suitable for POSIX platforms (Linux, *BSD, OSX etc.). +# Also works with MinGW and Cygwin on Windows. +# Please check msvcbuild.bat for building with MSVC on Windows. +# +# Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h +############################################################################## + +MAJVER= 2 +MINVER= 1 +RELVER= 0 +ABIVER= 5.1 +NODOTABIVER= 51 + +############################################################################## +############################# COMPILER OPTIONS ############################# +############################################################################## +# These options mainly affect the speed of the JIT compiler itself, not the +# speed of the JIT-compiled code. Turn any of the optional settings on by +# removing the '#' in front of them. Make sure you force a full recompile +# with "make clean", followed by "make" if you change any options. +# +DEFAULT_CC = gcc +# +# LuaJIT builds as a native 32 or 64 bit binary by default. +CC= $(DEFAULT_CC) +# +# Use this if you want to force a 32 bit build on a 64 bit multilib OS. +#CC= $(DEFAULT_CC) -m32 +# +# Since the assembler part does NOT maintain a frame pointer, it's pointless +# to slow down the C part by not omitting it. Debugging, tracebacks and +# unwinding are not affected -- the assembler part has frame unwind +# information and GCC emits it where needed (x64) or with -g (see CCDEBUG). +CCOPT= -O2 -fomit-frame-pointer +# Use this if you want to generate a smaller binary (but it's slower): +#CCOPT= -Os -fomit-frame-pointer +# Note: it's no longer recommended to use -O3 with GCC 4.x. +# The I-Cache bloat usually outweighs the benefits from aggressive inlining. +# +# Target-specific compiler options: +# +# x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute +# the binaries to a different machine you could also use: -march=native +# +CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse +CCOPT_x64= +CCOPT_arm= +CCOPT_arm64= +CCOPT_ppc= +CCOPT_mips= +# +CCDEBUG= +# Uncomment the next line to generate debug information: +#CCDEBUG= -g +# +CCWARN= -Wall +# Uncomment the next line to enable more warnings: +#CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith +# +############################################################################## + +############################################################################## +################################ BUILD MODE ################################ +############################################################################## +# The default build mode is mixed mode on POSIX. On Windows this is the same +# as dynamic mode. +# +# Mixed mode creates a static + dynamic library and a statically linked luajit. +#BUILDMODE= mixed +# +# Static mode creates a static library and a statically linked luajit. +BUILDMODE= static +# +# Dynamic mode creates a dynamic library and a dynamically linked luajit. +# Note: this executable will only run when the library is installed! +#BUILDMODE= dynamic +# +############################################################################## + +############################################################################## +################################# FEATURES ################################# +############################################################################## +# Enable/disable these features as needed, but make sure you force a full +# recompile with "make clean", followed by "make". +XCFLAGS= +# +# Permanently disable the FFI extension to reduce the size of the LuaJIT +# executable. But please consider that the FFI library is compiled-in, +# but NOT loaded by default. It only allocates any memory, if you actually +# make use of it. +#XCFLAGS+= -DLUAJIT_DISABLE_FFI +# +# Features from Lua 5.2 that are unlikely to break existing code are +# enabled by default. Some other features that *might* break some existing +# code (e.g. __pairs or os.execute() return values) can be enabled here. +# Note: this does not provide full compatibility with Lua 5.2 at this time. +#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT +# +# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter. +#XCFLAGS+= -DLUAJIT_DISABLE_JIT +# +# Some architectures (e.g. PPC) can use either single-number (1) or +# dual-number (2) mode. Uncomment one of these lines to override the +# default mode. Please see LJ_ARCH_NUMMODE in lj_arch.h for details. +#XCFLAGS+= -DLUAJIT_NUMMODE=1 +#XCFLAGS+= -DLUAJIT_NUMMODE=2 +# +# Enable GC64 mode for x64. +#XCFLAGS+= -DLUAJIT_ENABLE_GC64 +# +############################################################################## + +############################################################################## +############################ DEBUGGING SUPPORT ############################# +############################################################################## +# Enable these options as needed, but make sure you force a full recompile +# with "make clean", followed by "make". +# Note that most of these are NOT suitable for benchmarking or release mode! +# +# Use the system provided memory allocator (realloc) instead of the +# bundled memory allocator. This is slower, but sometimes helpful for +# debugging. This option cannot be enabled on x64 without GC64, since +# realloc usually doesn't return addresses in the right address range. +# OTOH this option is mandatory for Valgrind's memcheck tool on x64 and +# the only way to get useful results from it for all other architectures. +#XCFLAGS+= -DLUAJIT_USE_SYSMALLOC +# +# This define is required to run LuaJIT under Valgrind. The Valgrind +# header files must be installed. You should enable debug information, too. +# Use --suppressions=lj.supp to avoid some false positives. +#XCFLAGS+= -DLUAJIT_USE_VALGRIND +# +# This is the client for the GDB JIT API. GDB 7.0 or higher is required +# to make use of it. See lj_gdbjit.c for details. Enabling this causes +# a non-negligible overhead, even when not running under GDB. +#XCFLAGS+= -DLUAJIT_USE_GDBJIT +# +# Turn on assertions for the Lua/C API to debug problems with lua_* calls. +# This is rather slow -- use only while developing C libraries/embeddings. +#XCFLAGS+= -DLUA_USE_APICHECK +# +# Turn on assertions for the whole LuaJIT VM. This significantly slows down +# everything. Use only if you suspect a problem with LuaJIT itself. +#XCFLAGS+= -DLUA_USE_ASSERT +# +############################################################################## +# You probably don't need to change anything below this line! +############################################################################## + +############################################################################## +# Host system detection. +############################################################################## + +ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM)) + HOST_SYS= Windows + HOST_RM= del +else + HOST_SYS:= $(shell uname -s) + ifneq (,$(findstring MINGW,$(HOST_SYS))) + HOST_SYS= Windows + HOST_MSYS= mingw + endif + ifneq (,$(findstring MSYS,$(HOST_SYS))) + HOST_SYS= Windows + HOST_MSYS= mingw + endif + ifneq (,$(findstring CYGWIN,$(HOST_SYS))) + HOST_SYS= Windows + HOST_MSYS= cygwin + endif +endif + +############################################################################## +# Flags and options for host and target. +############################################################################## + +# You can override the following variables at the make command line: +# CC HOST_CC STATIC_CC DYNAMIC_CC +# CFLAGS HOST_CFLAGS TARGET_CFLAGS +# LDFLAGS HOST_LDFLAGS TARGET_LDFLAGS TARGET_SHLDFLAGS +# LIBS HOST_LIBS TARGET_LIBS +# CROSS HOST_SYS TARGET_SYS TARGET_FLAGS +# +# Cross-compilation examples: +# make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows +# make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- + +ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) +CCOPTIONS= $(CCDEBUG) $(ASOPTIONS) +LDOPTIONS= $(CCDEBUG) $(LDFLAGS) + +HOST_CC= $(CC) +HOST_RM?= rm -f +# If left blank, minilua is built and used. You can supply an installed +# copy of (plain) Lua 5.1 or 5.2, plus Lua BitOp. E.g. with: HOST_LUA=lua +HOST_LUA= + +HOST_XCFLAGS= -I. +HOST_XLDFLAGS= +HOST_XLIBS= +HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS) +HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS) +HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS) + +STATIC_CC = $(CROSS)$(CC) +DYNAMIC_CC = $(CROSS)$(CC) -fPIC +TARGET_CC= $(STATIC_CC) +TARGET_STCC= $(STATIC_CC) +TARGET_DYNCC= $(DYNAMIC_CC) +TARGET_LD= $(CROSS)$(CC) +TARGET_AR= $(CROSS)ar rcus +TARGET_STRIP= $(CROSS)strip + +TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib) +TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER) +TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib +TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME) +TARGET_DLLNAME= lua$(NODOTABIVER).dll +TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME) +TARGET_DYNXLDOPTS= + +TARGET_LFSFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE +TARGET_XCFLAGS= $(TARGET_LFSFLAGS) -U_FORTIFY_SOURCE +TARGET_XLDFLAGS= +TARGET_XLIBS= -lm +TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) +TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) +TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) +TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) +TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) +TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) + +TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_TCFLAGS) -E lj_arch.h -dM) +ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH))) + TARGET_LJARCH= x64 +else +ifneq (,$(findstring LJ_TARGET_X86 ,$(TARGET_TESTARCH))) + TARGET_LJARCH= x86 +else +ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) + TARGET_LJARCH= arm +else +ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH))) + ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH))) + TARGET_ARCH= -D__AARCH64EB__=1 + endif + TARGET_LJARCH= arm64 +else +ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) + ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) + TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE + else + TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE + endif + TARGET_LJARCH= ppc +else +ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) + ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) + TARGET_ARCH= -D__MIPSEL__=1 + endif + ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) + TARGET_LJARCH= mips64 + else + TARGET_LJARCH= mips + endif +else + $(error Unsupported target architecture) +endif +endif +endif +endif +endif +endif + +ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) + TARGET_SYS= PS3 + TARGET_ARCH+= -D__CELLOS_LV2__ + TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC + TARGET_XLIBS+= -lpthread +endif + +TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) +TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH)) + +ifneq (,$(PREFIX)) +ifneq (/usr/local,$(PREFIX)) + TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\" + ifneq (/usr,$(PREFIX)) + TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH) + endif +endif +endif +ifneq (,$(MULTILIB)) + TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\" +endif +ifneq (,$(LMULTILIB)) + TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\" +endif + +############################################################################## +# Target system detection. +############################################################################## + +TARGET_SYS?= $(HOST_SYS) +ifeq (Windows,$(TARGET_SYS)) + TARGET_STRIP+= --strip-unneeded + TARGET_XSHLDFLAGS= -shared + TARGET_DYNXLDOPTS= +else + TARGET_AR+= 2>/dev/null +ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1)) + TARGET_XCFLAGS+= -fno-stack-protector +endif +ifeq (Darwin,$(TARGET_SYS)) + ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) + export MACOSX_DEPLOYMENT_TARGET=10.4 + endif + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= + TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) + ifeq (x64,$(TARGET_LJARCH)) + TARGET_XLDFLAGS+= -pagezero_size 10000 -image_base 100000000 + TARGET_XSHLDFLAGS+= -image_base 7fff04c4a000 + endif +else +ifeq (iOS,$(TARGET_SYS)) + TARGET_STRIP+= -x + TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC + TARGET_DYNXLDOPTS= + TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) + ifeq (arm64,$(TARGET_LJARCH)) + TARGET_XCFLAGS+= -fno-omit-frame-pointer + endif +else + ifneq (SunOS,$(TARGET_SYS)) + ifneq (PS3,$(TARGET_SYS)) + TARGET_XLDFLAGS+= -Wl,-E + endif + endif + ifeq (Linux,$(TARGET_SYS)) + TARGET_XLIBS+= -ldl + endif + ifeq (GNU/kFreeBSD,$(TARGET_SYS)) + TARGET_XLIBS+= -ldl + endif +endif +endif +endif + +ifneq ($(HOST_SYS),$(TARGET_SYS)) + ifeq (Windows,$(TARGET_SYS)) + HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS + else + ifeq (Linux,$(TARGET_SYS)) + HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX + else + ifeq (Darwin,$(TARGET_SYS)) + HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX + else + ifeq (iOS,$(TARGET_SYS)) + HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX + else + HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER + endif + endif + endif + endif +endif + +ifneq (,$(CCDEBUG)) + TARGET_STRIP= @: +endif + +############################################################################## +# Files and pathnames. +############################################################################## + +MINILUA_O= host/minilua.o +MINILUA_LIBS= -lm +MINILUA_T= host/minilua +MINILUA_X= $(MINILUA_T) + +ifeq (,$(HOST_LUA)) + HOST_LUA= $(MINILUA_X) + DASM_DEP= $(MINILUA_T) +endif + +DASM_DIR= ../dynasm +DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua +DASM_XFLAGS= +DASM_AFLAGS= +DASM_ARCH= $(TARGET_LJARCH) + +ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D ENDIAN_LE +else + DASM_AFLAGS+= -D ENDIAN_BE +endif +ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D P64 +endif +ifneq (,$(findstring LJ_HASJIT 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D JIT +endif +ifneq (,$(findstring LJ_HASFFI 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D FFI +endif +ifneq (,$(findstring LJ_DUALNUM 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D DUALNUM +endif +ifneq (,$(findstring LJ_ARCH_HASFPU 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D FPU + TARGET_ARCH+= -DLJ_ARCH_HASFPU=1 +else + TARGET_ARCH+= -DLJ_ARCH_HASFPU=0 +endif +ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D HFABI + TARGET_ARCH+= -DLJ_ABI_SOFTFP=0 +else + TARGET_ARCH+= -DLJ_ABI_SOFTFP=1 +endif +ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D NO_UNWIND + TARGET_ARCH+= -DLUAJIT_NO_UNWIND +endif +DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH)))) +ifeq (Windows,$(TARGET_SYS)) + DASM_AFLAGS+= -D WIN +endif +ifeq (x64,$(TARGET_LJARCH)) + ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) + DASM_ARCH= x86 + endif +else +ifeq (arm,$(TARGET_LJARCH)) + ifeq (iOS,$(TARGET_SYS)) + DASM_AFLAGS+= -D IOS + endif +else +ifeq (ppc,$(TARGET_LJARCH)) + ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D SQRT + endif + ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D ROUND + endif + ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) + DASM_AFLAGS+= -D GPR64 + endif + ifeq (PS3,$(TARGET_SYS)) + DASM_AFLAGS+= -D PPE -D TOC + endif + ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) + DASM_ARCH= ppc64 + endif +endif +endif +endif + +DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) +DASM_DASC= vm_$(DASM_ARCH).dasc + +BUILDVM_O= host/buildvm.o host/buildvm_asm.o host/buildvm_peobj.o \ + host/buildvm_lib.o host/buildvm_fold.o +BUILDVM_T= host/buildvm +BUILDVM_X= $(BUILDVM_T) + +HOST_O= $(MINILUA_O) $(BUILDVM_O) +HOST_T= $(MINILUA_T) $(BUILDVM_T) + +LJVM_S= lj_vm.S +LJVM_O= lj_vm.o +LJVM_BOUT= $(LJVM_S) +LJVM_MODE= elfasm + +LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ + lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o +LJLIB_C= $(LJLIB_O:.o=.c) + +LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ + lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ + lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ + lj_strfmt.o lj_strfmt_num.o lj_api.o lj_profile.o \ + lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ + lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ + lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ + lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ + lj_asm.o lj_trace.o lj_gdbjit.o \ + lj_ctype.o lj_cdata.o lj_cconv.o lj_ccall.o lj_ccallback.o \ + lj_carith.o lj_clib.o lj_cparse.o \ + lj_lib.o lj_alloc.o lib_aux.o \ + $(LJLIB_O) lib_init.o + +LJVMCORE_O= $(LJVM_O) $(LJCORE_O) +LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o) + +LIB_VMDEF= jit/vmdef.lua +LIB_VMDEFP= $(LIB_VMDEF) + +LUAJIT_O= luajit.o +LUAJIT_A= libluajit.a +LUAJIT_SO= libluajit.so +LUAJIT_T= luajit + +ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(HOST_T) +ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h \ + host/buildvm_arch.h +ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP) +WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk +ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM) + +############################################################################## +# Build mode handling. +############################################################################## + +# Mixed mode defaults. +TARGET_O= $(LUAJIT_A) +TARGET_T= $(LUAJIT_T) $(LUAJIT_SO) +TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO) + +ifeq (Windows,$(TARGET_SYS)) + TARGET_DYNCC= $(STATIC_CC) + LJVM_MODE= peobj + LJVM_BOUT= $(LJVM_O) + LUAJIT_T= luajit.exe + ifeq (cygwin,$(HOST_MSYS)) + LUAJIT_SO= cyg$(TARGET_DLLNAME) + else + LUAJIT_SO= $(TARGET_DLLNAME) + endif + # Mixed mode is not supported on Windows. And static mode doesn't work well. + # C modules cannot be loaded, because they bind to lua51.dll. + ifneq (static,$(BUILDMODE)) + BUILDMODE= dynamic + TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL + endif +endif +ifeq (Darwin,$(TARGET_SYS)) + LJVM_MODE= machasm +endif +ifeq (iOS,$(TARGET_SYS)) + LJVM_MODE= machasm +endif +ifeq (SunOS,$(TARGET_SYS)) + BUILDMODE= static +endif +ifeq (PS3,$(TARGET_SYS)) + BUILDMODE= static +endif + +ifeq (Windows,$(HOST_SYS)) + MINILUA_T= host/minilua.exe + BUILDVM_T= host/buildvm.exe + ifeq (,$(HOST_MSYS)) + MINILUA_X= host\minilua + BUILDVM_X= host\buildvm + ALL_RM:= $(subst /,\,$(ALL_RM)) + endif +endif + +ifeq (static,$(BUILDMODE)) + TARGET_DYNCC= @: + TARGET_T= $(LUAJIT_T) + TARGET_DEP= $(LIB_VMDEF) +else +ifeq (dynamic,$(BUILDMODE)) + ifneq (Windows,$(TARGET_SYS)) + TARGET_CC= $(DYNAMIC_CC) + endif + TARGET_DYNCC= @: + LJVMCORE_DYNO= $(LJVMCORE_O) + TARGET_O= $(LUAJIT_SO) + TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS) +else +ifeq (Darwin,$(TARGET_SYS)) + TARGET_DYNCC= @: + LJVMCORE_DYNO= $(LJVMCORE_O) +endif +ifeq (iOS,$(TARGET_SYS)) + TARGET_DYNCC= @: + LJVMCORE_DYNO= $(LJVMCORE_O) +endif +endif +endif + +Q= @ +E= @echo +#Q= +#E= @: + +############################################################################## +# Make targets. +############################################################################## + +default all: $(TARGET_T) + +amalg: + @grep "^[+|]" ljamalg.c + $(MAKE) all "LJCORE_O=ljamalg.o" + +clean: + $(HOST_RM) $(ALL_RM) + +libbc: + ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) + $(MAKE) all + +depend: + @for file in $(ALL_HDRGEN); do \ + test -f $$file || touch $$file; \ + done + @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c host/*.c | \ + sed -e "s| [^ ]*/dasm_\S*\.h||g" \ + -e "s|^\([^l ]\)|host/\1|" \ + -e "s| lj_target_\S*\.h| lj_target_*.h|g" \ + -e "s| lj_emit_\S*\.h| lj_emit_*.h|g" \ + -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep + @for file in $(ALL_HDRGEN); do \ + test -s $$file || $(HOST_RM) $$file; \ + done + +.PHONY: default all amalg clean libbc depend + +############################################################################## +# Rules for generated files. +############################################################################## + +$(MINILUA_T): $(MINILUA_O) + $(E) "HOSTLINK $@" + $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) + +host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua + $(E) "DYNASM $@" + $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) + +host/buildvm.o: $(DASM_DIR)/dasm_*.h + +$(BUILDVM_T): $(BUILDVM_O) + $(E) "HOSTLINK $@" + $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS) + +$(LJVM_BOUT): $(BUILDVM_T) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ + +lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C) + +lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) + +lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C) + +lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C) + +$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C) + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C) + +lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c + $(E) "BUILDVM $@" + $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c + +############################################################################## +# Object file rules. +############################################################################## + +%.o: %.c + $(E) "CC $@" + $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< + $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< + +%.o: %.S + $(E) "ASM $@" + $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< + $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< + +$(LUAJIT_O): + $(E) "CC $@" + $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $< + +$(HOST_O): %.o: %.c + $(E) "HOSTCC $@" + $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $< + +include Makefile.dep + +############################################################################## +# Target file rules. +############################################################################## + +$(LUAJIT_A): $(LJVMCORE_O) + $(E) "AR $@" + $(Q)$(TARGET_AR) $@ $(LJVMCORE_O) + +# The dependency on _O, but linking with _DYNO is intentional. +$(LUAJIT_SO): $(LJVMCORE_O) + $(E) "DYNLINK $@" + $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS) + $(Q)$(TARGET_STRIP) $@ + +$(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP) + $(E) "LINK $@" + $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS) + $(Q)$(TARGET_STRIP) $@ + $(E) "OK Successfully built LuaJIT" + +############################################################################## From 2b9a03d961ef35befebfa098a76f3f3c99116cb4 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 21:32:21 -0400 Subject: [PATCH 009/154] Set BUILDMODE=static and -fPIC in Makefile --- build.rs | 2 +- etc/Makefile | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index 7c4c6f9..59b6768 100644 --- a/build.rs +++ b/build.rs @@ -27,7 +27,6 @@ fn main() { let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); - fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); let mut buildcmd = Command::new(msvcbuild_bat); for (name, value) in cl_exe.env() { @@ -58,6 +57,7 @@ fn main() { let mut copy_options = CopyOptions::new(); copy_options.overwrite = true; dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); let mut buildcmd = Command::new("make"); buildcmd.current_dir(&src_dir); diff --git a/etc/Makefile b/etc/Makefile index 8f3cf60..04a7dd2 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -207,7 +207,7 @@ HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS) HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS) HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS) -STATIC_CC = $(CROSS)$(CC) +STATIC_CC = $(CROSS)$(CC) -fPIC DYNAMIC_CC = $(CROSS)$(CC) -fPIC TARGET_CC= $(STATIC_CC) TARGET_STCC= $(STATIC_CC) From 6e5676b8894273b938fedfef407718ddd35efbfe Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 21:46:56 -0400 Subject: [PATCH 010/154] Disable MACOSX_DEPLOYMENT_TARGET --- etc/Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/etc/Makefile b/etc/Makefile index 04a7dd2..2046c6c 100644 --- a/etc/Makefile +++ b/etc/Makefile @@ -318,7 +318,7 @@ ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector endif ifeq (Darwin,$(TARGET_SYS)) ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) - export MACOSX_DEPLOYMENT_TARGET=10.4 +# export MACOSX_DEPLOYMENT_TARGET=10.4 endif TARGET_STRIP+= -x TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC From 6a3c526cfba36503ee6ac607b94022b79a073246 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Thu, 15 Aug 2019 22:09:20 -0400 Subject: [PATCH 011/154] Add link args for x86_64-apple-darwin --- .cargo/config | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 .cargo/config diff --git a/.cargo/config b/.cargo/config new file mode 100644 index 0000000..134419d --- /dev/null +++ b/.cargo/config @@ -0,0 +1,9 @@ +[target.x86_64-apple-darwin] +rustflags = [ + "-C", + "link-arg=-pagezero_size 10000", + +] + +# "-C", +# "link-arg=-image_base 100000000", \ No newline at end of file From e0baa55c2cfbcafa2af6a34c4500cd789b64a705 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sat, 17 Aug 2019 19:59:44 -0400 Subject: [PATCH 012/154] Disable i686 and mingw tests --- .azure-pipelines.yml | 26 +++++++++++++++----------- build.rs | 9 +++++++++ ci/azure-install-rust.yml | 12 +----------- ci/azure-test-all.yml | 12 +++++++++++- 4 files changed, 36 insertions(+), 23 deletions(-) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index 62ff799..c6d683b 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -15,10 +15,14 @@ jobs: - template: ci/azure-test-all.yml strategy: matrix: - stable: - TOOLCHAIN: stable - nightly: - TOOLCHAIN: nightly + stable-x86_64-msvc: + TOOLCHAIN: stable-x86_64-pc-windows-msvc + # stable-x86_64-gnu: + # TOOLCHAIN: stable-x86_64-pc-windows-gnu + # stable-i686-msvc: + # TOOLCHAIN: stable-i686-pc-windows-msvc + # stable-i686-gnu: + # TOOLCHAIN: stable-i686-pc-windows-gnu - job: Linux pool: @@ -28,9 +32,11 @@ jobs: - template: ci/azure-test-all.yml strategy: matrix: - stable: - TOOLCHAIN: stable - nightly: + stable-x86_64: + TOOLCHAIN: stable-x86_64-unknown-linux-gnu + # stable-i686: + # TOOLCHAIN: stable-i686-unknown-linux-gnu + nightly-x86_64: TOOLCHAIN: nightly - job: MacOS @@ -41,7 +47,5 @@ jobs: - template: ci/azure-test-all.yml strategy: matrix: - stable: - TOOLCHAIN: stable - nightly: - TOOLCHAIN: nightly \ No newline at end of file + stable-x86_64: + TOOLCHAIN: stable-x86_64-apple-darwin \ No newline at end of file diff --git a/build.rs b/build.rs index 59b6768..0957824 100644 --- a/build.rs +++ b/build.rs @@ -63,6 +63,11 @@ fn main() { buildcmd.current_dir(&src_dir); buildcmd.stderr(Stdio::inherit()); + if cfg!(target_pointer_width = "32") { + buildcmd.env("HOST_CC", "gcc -m32"); + buildcmd.arg("-e"); + } + let mut child = buildcmd.spawn().expect("failed to run make"); if !child @@ -77,4 +82,8 @@ fn main() { println!("cargo:rustc-link-search=native={}", src_dir); println!("cargo:rustc-link-lib=static=luajit"); } + + // if cfg!(target_os = "macos") && cfg!(target_pointer_width = "64") { + // // RUSTFLAGS='-C link-args=-pagezero_size 10000 -image_base 100000000' + // } } diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml index b304a14..cd39cc1 100644 --- a/ci/azure-install-rust.yml +++ b/ci/azure-install-rust.yml @@ -7,19 +7,9 @@ steps: rustup --version displayName: Install rustup condition: eq(variables['Agent.OS'], 'Darwin') -# - script: | -# echo %TOOLCHAIN% -# curl -sSf -o rustup-init.exe https://win.rustup.rs -# rustup-init.exe -v -y --default-toolchain %TOOLCHAIN% -# echo ##vso[task.prependpath]%USERPROFILE%\.cargo\bin -# rustup default %TOOLCHAIN% -# rustup component add rustfmt -# displayName: Install rust (windows) -# condition: eq(variables['Agent.OS'], 'Windows_NT') - bash: | - set -x + set -e -x rustup --version - rustup component remove --toolchain $TOOLCHAIN rust-docs || true rustup default $TOOLCHAIN rustup update --no-self-update $TOOLCHAIN rustup toolchain install stable diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml index 7c08c69..1b253f7 100644 --- a/ci/azure-test-all.yml +++ b/ci/azure-test-all.yml @@ -1,6 +1,16 @@ steps: - checkout: self submodules: true +# - script: | +# call "C:\Program Files (x86)\Microsoft Visual Studio\2017\VC\Auxiliary\Build\vcvarsall.bat" x86 +# displayName: Call vcvarsalls.bat x86 +# condition: eq(variables['TOOLCHAIN'], 'stable-i686-pc-windows-msvc') +# - bash: pacman -Syu +# condition: eq(variables['TOOLCHAIN'], 'stable-x86_64-pc-windows-gnu') +# displayName: Update msys +# - bash: sudo apt install gcc-multilib +# condition: eq(variables['TOOLCHAIN'], 'stable-i686-unknown-linux-gnu') +# displayName: Install gcc-multilib - bash: | set -e -x cargo +stable fmt --all -- --check @@ -22,5 +32,5 @@ steps: - bash: | pwd find ./target - displayName: List files in ./target + displayName: List files in target condition: always() From a2b17d749c337bd994d518ae688b6356a5f58fad Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 01:02:08 -0500 Subject: [PATCH 013/154] The bash task in azure seems to find powershells find --- ci/azure-test-all.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ci/azure-test-all.yml b/ci/azure-test-all.yml index 1b253f7..877ab5a 100644 --- a/ci/azure-test-all.yml +++ b/ci/azure-test-all.yml @@ -31,6 +31,6 @@ steps: CARGO_INCREMENTAL: 0 - bash: | pwd - find ./target + /usr/bin/find ./target displayName: List files in target condition: always() From bb75b4a2fd4758cf44c85aaad2d368ea60fadbf0 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 01:13:31 -0500 Subject: [PATCH 014/154] Add README --- README.md | 3 +++ bindgen.sh | 2 +- build.rs | 3 ++- src/ffi.rs | 2 +- 4 files changed, 7 insertions(+), 3 deletions(-) create mode 100644 README.md diff --git a/README.md b/README.md new file mode 100644 index 0000000..879aa22 --- /dev/null +++ b/README.md @@ -0,0 +1,3 @@ +# Rust LuaJIT 2 Bindings + +[![Build Status](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=2&branchName=master) diff --git a/bindgen.sh b/bindgen.sh index 5dd058d..27e7b9e 100644 --- a/bindgen.sh +++ b/bindgen.sh @@ -1,6 +1,6 @@ #!/bin/bash -BINDGEN_VERSION=$(bindgen --version) +BINDGEN_VERSION=$(bindgen --version | grep -v -e '^cargo') bindgen -o src/ffi.rs \ --raw-line "/// Generated with: ${BINDGEN_VERSION}" \ diff --git a/build.rs b/build.rs index 0957824..7f749d7 100644 --- a/build.rs +++ b/build.rs @@ -19,7 +19,8 @@ fn main() { let lib_path = format!("{}/lua51.lib", &src_dir); dbg!(&lib_path); if !std::fs::metadata(&lib_path).is_ok() { - let cl_exe: cc::Tool = cc::windows_registry::find_tool(&target, "cl.exe").unwrap(); + let cl_exe: cc::Tool = + cc::windows_registry::find_tool(&target, "cl.exe").expect("cl.exe not found"); let msvcbuild_bat = format!("{}/msvcbuild.bat", &src_dir); dbg!(&msvcbuild_bat); diff --git a/src/ffi.rs b/src/ffi.rs index 76db086..a33ac54 100644 --- a/src/ffi.rs +++ b/src/ffi.rs @@ -1,6 +1,6 @@ /* automatically generated by rust-bindgen */ -// Generated with: bindgen 0.49.1 +// Generated with: bindgen 0.52.0 pub const LUA_LDIR: &'static [u8; 7usize] = b"!\\lua\\\0"; pub const LUA_CDIR: &'static [u8; 3usize] = b"!\\\0"; From a705ff7d25275b90636e3e2092a242bd25ca54e5 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 01:19:51 -0500 Subject: [PATCH 015/154] Rename to luajit2-sys --- Cargo.toml | 4 ++-- README.md | 2 +- examples/lua.rs | 2 +- tests/test.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index e407f7c..9970652 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "luajit-sys" +name = "luajit2-sys" version = "0.0.1" authors = ["Aaron Loucks "] edition = "2018" @@ -10,4 +10,4 @@ libc = "0.2" [build-dependencies] cc = "1.0.40" -fs_extra = "1.1.0" \ No newline at end of file +fs_extra = "1.1.0" diff --git a/README.md b/README.md index 879aa22..6d5e744 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,3 @@ # Rust LuaJIT 2 Bindings -[![Build Status](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=2&branchName=master) +[![Build Status](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit2-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=3&branchName=master) diff --git a/examples/lua.rs b/examples/lua.rs index aa45cae..0784409 100644 --- a/examples/lua.rs +++ b/examples/lua.rs @@ -2,7 +2,7 @@ use std::env; use std::ffi::{CStr, CString}; use std::ptr; -use luajit_sys as sys; +use luajit2_sys as sys; unsafe fn run_script(script_name: String, script_src: String) { let lua = sys::luaL_newstate(); diff --git a/tests/test.rs b/tests/test.rs index e737156..8a018ea 100644 --- a/tests/test.rs +++ b/tests/test.rs @@ -1,4 +1,4 @@ -use luajit_sys as sys; +use luajit2_sys as sys; #[test] fn run_script() { From b00970789a4e8d51f6661d23dd89600048498d5a Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 01:38:51 -0500 Subject: [PATCH 016/154] Add license --- Cargo.toml | 2 + LICENSE-APACHE | 201 +++++++++++++++++++++++++++++++++++++++++++++++++ LICENSE-MIT | 23 ++++++ 3 files changed, 226 insertions(+) create mode 100644 LICENSE-APACHE create mode 100644 LICENSE-MIT diff --git a/Cargo.toml b/Cargo.toml index 9970652..6625e10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -4,6 +4,8 @@ version = "0.0.1" authors = ["Aaron Loucks "] edition = "2018" keywords = ["lua", "luajit", "script"] +license = "MIT OR Apache-2.0" +repository = "https://github.com/aloucks/luajit2-sys" [dependencies] libc = "0.2" diff --git a/LICENSE-APACHE b/LICENSE-APACHE new file mode 100644 index 0000000..f007b81 --- /dev/null +++ b/LICENSE-APACHE @@ -0,0 +1,201 @@ + Apache License + Version 2.0, January 2004 + https://www.apache.org/licenses/LICENSE-2.0 + +TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION + +1. Definitions. + + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + +2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + +3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + +4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + +5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + +6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + +7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + +8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + +9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + +END OF TERMS AND CONDITIONS + +APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + +Copyright [yyyy] [name of copyright owner] + +Licensed under the Apache License, Version 2.0 (the "License"); +you may not use this file except in compliance with the License. +You may obtain a copy of the License at + + https://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, software +distributed under the License is distributed on an "AS IS" BASIS, +WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +See the License for the specific language governing permissions and +limitations under the License. \ No newline at end of file diff --git a/LICENSE-MIT b/LICENSE-MIT new file mode 100644 index 0000000..468cd79 --- /dev/null +++ b/LICENSE-MIT @@ -0,0 +1,23 @@ +Permission is hereby granted, free of charge, to any +person obtaining a copy of this software and associated +documentation files (the "Software"), to deal in the +Software without restriction, including without +limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software +is furnished to do so, subject to the following +conditions: + +The above copyright notice and this permission notice +shall be included in all copies or substantial portions +of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF +ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED +TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A +PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT +SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY +CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION +OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR +IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER +DEALINGS IN THE SOFTWARE. \ No newline at end of file From 727831d4135d7b3dd7396610ac73cf4e6144bc27 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 01:48:17 -0500 Subject: [PATCH 017/154] Add description --- Cargo.toml | 1 + 1 file changed, 1 insertion(+) diff --git a/Cargo.toml b/Cargo.toml index 6625e10..a293d21 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,6 @@ [package] name = "luajit2-sys" +description = "LuaJIT-2.1 FFI Bindings" version = "0.0.1" authors = ["Aaron Loucks "] edition = "2018" From 18c5d88e65318c3d7506c510fa328a82decd5b36 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 14:37:42 -0500 Subject: [PATCH 018/154] Cleanup build.rs Set the following environment variables. The luajit lib name varies by platform (lua51 on msvc and luajit everywhere else). - DEP_LUAJIT_INCLUDE - DEP_LUAJIT_LIB_NAME --- Cargo.toml | 1 + build.rs | 143 +++++++++++++++++++++++++++++------------------------ 2 files changed, 80 insertions(+), 64 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index a293d21..9dd5807 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ edition = "2018" keywords = ["lua", "luajit", "script"] license = "MIT OR Apache-2.0" repository = "https://github.com/aloucks/luajit2-sys" +links = "luajit" [dependencies] libc = "0.2" diff --git a/build.rs b/build.rs index 7f749d7..08e2bbe 100644 --- a/build.rs +++ b/build.rs @@ -1,12 +1,9 @@ -use cc; use fs_extra::dir; use fs_extra::dir::CopyOptions; +use std::env; use std::process::{Command, Stdio}; -use std::{env, fs}; fn main() { - let target = env::var("TARGET").unwrap(); - let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); let out_dir = env::var("OUT_DIR").unwrap(); let src_dir = format!("{}/luajit/src", out_dir); @@ -15,76 +12,94 @@ fn main() { dbg!(&out_dir); dbg!(&src_dir); - if cfg!(target_env = "msvc") { - let lib_path = format!("{}/lua51.lib", &src_dir); - dbg!(&lib_path); - if !std::fs::metadata(&lib_path).is_ok() { - let cl_exe: cc::Tool = - cc::windows_registry::find_tool(&target, "cl.exe").expect("cl.exe not found"); - let msvcbuild_bat = format!("{}/msvcbuild.bat", &src_dir); + // DEP_LUAJIT_INCLUDE + // DEB_LUAJIT_LIB_NAME - dbg!(&msvcbuild_bat); + let lib_name = build_luajit(&luajit_dir, &out_dir, &src_dir); - let mut copy_options = CopyOptions::new(); - copy_options.overwrite = true; - dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + println!("cargo:lib-name={}", lib_name); + println!("cargo:include={}", src_dir); + println!("cargo:rustc-link-search=native={}", src_dir); + println!("cargo:rustc-link-lib=static={}", lib_name); - let mut buildcmd = Command::new(msvcbuild_bat); - for (name, value) in cl_exe.env() { - buildcmd.env(name, value); - } - buildcmd.env("Configuration", "Release"); - buildcmd.args(&["static"]); - buildcmd.current_dir(&src_dir); - buildcmd.stderr(Stdio::inherit()); + // if cfg!(target_os = "macos") && cfg!(target_pointer_width = "64") { + // // RUSTFLAGS='-C link-args=-pagezero_size 10000 -image_base 100000000' + // } +} - let mut child = buildcmd.spawn().expect("failed to run msvcbuild.bat"); +#[cfg(target_env = "msvc")] +fn build_luajit(luajit_dir: &str, out_dir: &str, src_dir: &str) -> &'static str { + const LIB_NAME: &'static str = "lua51"; + let lib_path = format!("{}/{}.lib", &src_dir, LIB_NAME); + dbg!(&lib_path); + if !std::fs::metadata(&lib_path).is_ok() { + let target = env::var("TARGET").unwrap(); + let cl_exe: cc::Tool = + cc::windows_registry::find_tool(&target, "cl.exe").expect("cl.exe not found"); + let msvcbuild_bat = format!("{}/msvcbuild.bat", &src_dir); + dbg!(&msvcbuild_bat); - if !child - .wait() - .map(|status| status.success()) - .map_err(|_| false) - .unwrap_or(false) - { - panic!("Failed to build luajit"); - } + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; + dir::copy(&luajit_dir, &out_dir, ©_options) + .expect("failed to copy luajit source to out dir"); + + let mut buildcmd = Command::new(msvcbuild_bat); + for (name, value) in cl_exe.env() { + eprintln!("{:?} = {:?}", name, value); + buildcmd.env(name, value); } - println!("cargo:rustc-link-search=native={}", src_dir); - println!("cargo:rustc-link-lib=static=lua51"); - } else { - let lib_path = format!("{}/libluajit.a", &src_dir); - dbg!(&lib_path); - if !std::fs::metadata(&lib_path).is_ok() { - let mut copy_options = CopyOptions::new(); - copy_options.overwrite = true; - dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); - fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); - let mut buildcmd = Command::new("make"); - buildcmd.current_dir(&src_dir); - buildcmd.stderr(Stdio::inherit()); + buildcmd.env("Configuration", "Release"); + buildcmd.args(&["static"]); + buildcmd.current_dir(&src_dir); + buildcmd.stderr(Stdio::inherit()); - if cfg!(target_pointer_width = "32") { - buildcmd.env("HOST_CC", "gcc -m32"); - buildcmd.arg("-e"); - } + let mut child = buildcmd.spawn().expect("failed to run msvcbuild.bat"); - let mut child = buildcmd.spawn().expect("failed to run make"); - - if !child - .wait() - .map(|status| status.success()) - .map_err(|_| false) - .unwrap_or(false) - { - panic!("Failed to build luajit"); - } + if !child + .wait() + .map(|status| status.success()) + .map_err(|_| false) + .unwrap_or(false) + { + panic!("Failed to build luajit"); } - println!("cargo:rustc-link-search=native={}", src_dir); - println!("cargo:rustc-link-lib=static=luajit"); } - // if cfg!(target_os = "macos") && cfg!(target_pointer_width = "64") { - // // RUSTFLAGS='-C link-args=-pagezero_size 10000 -image_base 100000000' - // } + LIB_NAME +} + +#[cfg(not(target_env = "msvc"))] +fn build_luajit(luajit_dir: &str, out_dir: &str, src_dir: &str) -> &'static str { + const LIB_NAME: &'static str = "luajit"; + let lib_path = format!("{}/lib{}.a", &src_dir, LIB_NAME); + dbg!(&lib_path); + if !std::fs::metadata(&lib_path).is_ok() { + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; + dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); + std::fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); + + let mut buildcmd = Command::new("make"); + buildcmd.current_dir(&src_dir); + buildcmd.stderr(Stdio::inherit()); + + if cfg!(target_pointer_width = "32") { + buildcmd.env("HOST_CC", "gcc -m32"); + buildcmd.arg("-e"); + } + + let mut child = buildcmd.spawn().expect("failed to run make"); + + if !child + .wait() + .map(|status| status.success()) + .map_err(|_| false) + .unwrap_or(false) + { + panic!("Failed to build luajit"); + } + } + LIB_NAME } From 56c586ecbf4a79c0d2a8cb0f88512864919d2e3e Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 15:20:31 -0500 Subject: [PATCH 019/154] Update README --- Cargo.toml | 4 +++- README.md | 46 +++++++++++++++++++++++++++++++++++++++++++++- 2 files changed, 48 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 9dd5807..9920e43 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,12 +1,14 @@ [package] name = "luajit2-sys" -description = "LuaJIT-2.1 FFI Bindings" version = "0.0.1" +description = "LuaJIT-2.1 FFI Bindings" authors = ["Aaron Loucks "] edition = "2018" keywords = ["lua", "luajit", "script"] license = "MIT OR Apache-2.0" +readme = "README.md" repository = "https://github.com/aloucks/luajit2-sys" +documentation = "https://docs.rs/luajit2-sys" links = "luajit" [dependencies] diff --git a/README.md b/README.md index 6d5e744..7636366 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,47 @@ # Rust LuaJIT 2 Bindings -[![Build Status](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit2-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=3&branchName=master) +[![crates.io](https://img.shields.io/crates/v/luajit2-sys.svg)](https://crates.io/crates/luajit2-sys) +[![docs.rs](https://docs.rs/luajit2-sys/badge.svg)](https://docs.rs/luajit2-sys) +[![build](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit2-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=3&branchName=master) + +```toml +[dependencies] +luajit2-sys = "0.0.1" +``` + +## Exported Cargo Environment Variables + +||| +| -- | -- | +| `DEP_LUAJIT_INCLUDE` | Path to the LuaJIT source and headers | +| `DEP_LUAJIT_LIB_NAME` | Platform specfic lib name (`lua51` on Windows and `luajit` everywhere else) | + +## Example + +```rust +use luajit2_sys as sys; +use std::ffi::CStr; + +fn main() { + unsafe { + let lua = sys::luaL_newstate(); + sys::luaL_openlibs(lua); + let script_data = b"return 1 + 2"; + let script_name = b"run_script\0"; + sys::luaL_loadbuffer( + lua, + script_data.as_ptr() as _, + script_data.len() as _, + script_name.as_ptr() as _, + ); + sys::lua_pcall(lua, 0, 1, 0); + let idx = sys::lua_gettop(lua); + let s = sys::lua_tostring(lua, idx); + let result = CStr::from_ptr(s).to_string_lossy().to_string(); + sys::lua_close(lua); + + println!("result: {}", result); + } +} +``` + From 32f67222d7006a8cf2086299f1cd431916768e32 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 15:29:09 -0500 Subject: [PATCH 020/154] Add weekly build to CI --- .azure-pipelines.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.azure-pipelines.yml b/.azure-pipelines.yml index c6d683b..2445ee1 100644 --- a/.azure-pipelines.yml +++ b/.azure-pipelines.yml @@ -6,6 +6,14 @@ pr: include: - master +schedules: + - cron: "0 12 * * 0" + displayName: Weekly Sunday build + branches: + include: + - master + always: true + jobs: - job: Windows pool: From 972f1022ee3add5e5f6128994a34c62bc6ef948f Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 15:31:07 -0500 Subject: [PATCH 021/154] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 7636366..b6b8fc6 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Rust LuaJIT 2 Bindings +# Rust LuaJIT Bindings [![crates.io](https://img.shields.io/crates/v/luajit2-sys.svg)](https://crates.io/crates/luajit2-sys) [![docs.rs](https://docs.rs/luajit2-sys/badge.svg)](https://docs.rs/luajit2-sys) From f308e7ba665f3dbf9762c11a248cf556cb663865 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 16:24:01 -0500 Subject: [PATCH 022/154] Version 0.0.2 --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 9920e43..248c937 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "luajit2-sys" -version = "0.0.1" +version = "0.0.2" description = "LuaJIT-2.1 FFI Bindings" authors = ["Aaron Loucks "] edition = "2018" From 2aa8038854e046bd332578a017b2205a8ee48623 Mon Sep 17 00:00:00 2001 From: Aaron Loucks Date: Sun, 19 Jan 2020 16:31:41 -0500 Subject: [PATCH 023/154] Update README --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b6b8fc6..873b88e 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ```toml [dependencies] -luajit2-sys = "0.0.1" +luajit2-sys = "0.0.2" ``` ## Exported Cargo Environment Variables From 86757089b42e2d268f35d564e54f04ba50fd9089 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 2 Mar 2023 15:11:50 +0100 Subject: [PATCH 024/154] chore: Update LuaJIT --- luajit | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/luajit b/luajit index f0e865d..505e2c0 160000 --- a/luajit +++ b/luajit @@ -1 +1 @@ -Subproject commit f0e865dd4861520258299d0f2a56491bd9d602e1 +Subproject commit 505e2c03de35e2718eef0d2d3660712e06dadf1f From 089acdbc28c778db64df40d6c4e2655a6f5ddbf9 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 21 Mar 2023 11:04:21 +0100 Subject: [PATCH 025/154] feat: Implement MSVC cross compilation --- build.rs | 123 +++++++++++++++++-------------------------------------- 1 file changed, 37 insertions(+), 86 deletions(-) diff --git a/build.rs b/build.rs index 08e2bbe..28fe052 100644 --- a/build.rs +++ b/build.rs @@ -3,103 +3,54 @@ use fs_extra::dir::CopyOptions; use std::env; use std::process::{Command, Stdio}; +const LIB_NAME: &str = "luajit"; + fn main() { let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); let out_dir = env::var("OUT_DIR").unwrap(); let src_dir = format!("{}/luajit/src", out_dir); + let lib_path = format!("{}/lib{}.a", &src_dir, LIB_NAME); dbg!(&luajit_dir); dbg!(&out_dir); dbg!(&src_dir); + dbg!(&lib_path); - // DEP_LUAJIT_INCLUDE - // DEB_LUAJIT_LIB_NAME + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; - let lib_name = build_luajit(&luajit_dir, &out_dir, &src_dir); + dir::copy(&luajit_dir, &out_dir, ©_options).expect("Failed to copy LuaJIT source"); - println!("cargo:lib-name={}", lib_name); + let mut buildcmd = Command::new("make"); + buildcmd.current_dir(&src_dir); + buildcmd.stderr(Stdio::inherit()); + buildcmd.arg("BUILDMODE=static"); + + if env::var("CARGO_CFG_WINDOWS").is_ok() { + buildcmd.arg("TARGET_SYS=Windows"); + buildcmd.arg("CROSS=x86_64-w64-mingw32-"); + } + + if cfg!(target_pointer_width = "32") { + buildcmd.env("HOST_CC", "gcc -m32"); + buildcmd.arg("-e"); + } else { + buildcmd.env("HOST_CC", "gcc"); + } + + let mut child = buildcmd.spawn().expect("failed to run make"); + + if !child + .wait() + .map(|status| status.success()) + .map_err(|_| false) + .unwrap_or(false) + { + panic!("Failed to build luajit"); + } + + println!("cargo:lib-name={}", LIB_NAME); println!("cargo:include={}", src_dir); println!("cargo:rustc-link-search=native={}", src_dir); - println!("cargo:rustc-link-lib=static={}", lib_name); - - // if cfg!(target_os = "macos") && cfg!(target_pointer_width = "64") { - // // RUSTFLAGS='-C link-args=-pagezero_size 10000 -image_base 100000000' - // } -} - -#[cfg(target_env = "msvc")] -fn build_luajit(luajit_dir: &str, out_dir: &str, src_dir: &str) -> &'static str { - const LIB_NAME: &'static str = "lua51"; - let lib_path = format!("{}/{}.lib", &src_dir, LIB_NAME); - dbg!(&lib_path); - if !std::fs::metadata(&lib_path).is_ok() { - let target = env::var("TARGET").unwrap(); - let cl_exe: cc::Tool = - cc::windows_registry::find_tool(&target, "cl.exe").expect("cl.exe not found"); - let msvcbuild_bat = format!("{}/msvcbuild.bat", &src_dir); - dbg!(&msvcbuild_bat); - - let mut copy_options = CopyOptions::new(); - copy_options.overwrite = true; - dir::copy(&luajit_dir, &out_dir, ©_options) - .expect("failed to copy luajit source to out dir"); - - let mut buildcmd = Command::new(msvcbuild_bat); - for (name, value) in cl_exe.env() { - eprintln!("{:?} = {:?}", name, value); - buildcmd.env(name, value); - } - - buildcmd.env("Configuration", "Release"); - buildcmd.args(&["static"]); - buildcmd.current_dir(&src_dir); - buildcmd.stderr(Stdio::inherit()); - - let mut child = buildcmd.spawn().expect("failed to run msvcbuild.bat"); - - if !child - .wait() - .map(|status| status.success()) - .map_err(|_| false) - .unwrap_or(false) - { - panic!("Failed to build luajit"); - } - } - - LIB_NAME -} - -#[cfg(not(target_env = "msvc"))] -fn build_luajit(luajit_dir: &str, out_dir: &str, src_dir: &str) -> &'static str { - const LIB_NAME: &'static str = "luajit"; - let lib_path = format!("{}/lib{}.a", &src_dir, LIB_NAME); - dbg!(&lib_path); - if !std::fs::metadata(&lib_path).is_ok() { - let mut copy_options = CopyOptions::new(); - copy_options.overwrite = true; - dir::copy(&luajit_dir, &out_dir, ©_options).unwrap(); - std::fs::copy(format!("etc/Makefile"), format!("{}/Makefile", &src_dir)).unwrap(); - - let mut buildcmd = Command::new("make"); - buildcmd.current_dir(&src_dir); - buildcmd.stderr(Stdio::inherit()); - - if cfg!(target_pointer_width = "32") { - buildcmd.env("HOST_CC", "gcc -m32"); - buildcmd.arg("-e"); - } - - let mut child = buildcmd.spawn().expect("failed to run make"); - - if !child - .wait() - .map(|status| status.success()) - .map_err(|_| false) - .unwrap_or(false) - { - panic!("Failed to build luajit"); - } - } - LIB_NAME + println!("cargo:rustc-link-lib=static={}", LIB_NAME); } From 206f7884e32837532bf02b9712fd145a92032f35 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 21 Mar 2023 11:55:46 +0100 Subject: [PATCH 026/154] Move bindgen to build script --- Cargo.toml | 1 + bindgen.sh | 26 -- build.rs | 34 ++ ffi.h | 4 - src/ffi.rs | 1113 ---------------------------------------------------- src/lib.rs | 8 +- 6 files changed, 41 insertions(+), 1145 deletions(-) delete mode 100644 bindgen.sh delete mode 100644 ffi.h delete mode 100644 src/ffi.rs diff --git a/Cargo.toml b/Cargo.toml index 248c937..8758afc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,5 +15,6 @@ links = "luajit" libc = "0.2" [build-dependencies] +bindgen = "0.64.0" cc = "1.0.40" fs_extra = "1.1.0" diff --git a/bindgen.sh b/bindgen.sh deleted file mode 100644 index 27e7b9e..0000000 --- a/bindgen.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/bash - -BINDGEN_VERSION=$(bindgen --version | grep -v -e '^cargo') - -bindgen -o src/ffi.rs \ - --raw-line "/// Generated with: ${BINDGEN_VERSION}" \ - --whitelist-var "LUA.*" \ - --whitelist-var "LUAJIT.*" \ - --whitelist-type "lua_.*" \ - --whitelist-type "luaL_.*" \ - --whitelist-function "lua_.*" \ - --whitelist-function "luaL_.*" \ - --whitelist-function "luaJIT.*" \ - --ctypes-prefix "libc" \ - --use-core \ - --impl-debug \ - ffi.h -- -I luajit/src - -sed -i -e 's/pub fn \(luaJIT_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs -sed -i -e 's/pub fn \(lua_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs -sed -i -e 's/pub fn \(luaL_[^\(]*\)/\/\/\/ \n pub fn \1/' src/ffi.rs -sed -i -e 's/pub type \(lua_[^\=]*\)/\/\/\/ \n pub type \1/' src/ffi.rs -sed -i -e 's/pub struct \(lua_[^\{]*\)/\/\/\/ \n pub struct \1/' src/ffi.rs -sed -i -e 's/pub struct \(luaL_[^\{]*\)/\/\/\/ \n pub struct \1/' src/ffi.rs - -cargo +stable fmt \ No newline at end of file diff --git a/build.rs b/build.rs index 28fe052..bbafb9a 100644 --- a/build.rs +++ b/build.rs @@ -1,9 +1,11 @@ use fs_extra::dir; use fs_extra::dir::CopyOptions; use std::env; +use std::path::PathBuf; use std::process::{Command, Stdio}; const LIB_NAME: &str = "luajit"; +const LUAJIT_HEADERS: [&str; 4] = ["lua.h", "lualib.h", "lauxlib.h", "luajit.h"]; fn main() { let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); @@ -53,4 +55,36 @@ fn main() { println!("cargo:include={}", src_dir); println!("cargo:rustc-link-search=native={}", src_dir); println!("cargo:rustc-link-lib=static={}", LIB_NAME); + + let mut bindings = bindgen::Builder::default(); + + for header in LUAJIT_HEADERS { + println!("cargo:rerun-if-changed={}/src/{}", luajit_dir, header); + bindings = bindings.header(format!("{}/src/{}", luajit_dir, header)); + } + + let bindings = bindings + .allowlist_var("LUA.*") + .allowlist_var("LUAJIT.*") + .allowlist_type("lua_.*") + .allowlist_type("luaL_.*") + .allowlist_function("lua_.*") + .allowlist_function("luaL_.*") + .allowlist_function("luaJIT.*") + .ctypes_prefix("libc") + .impl_debug(true) + .use_core() + .clang_arg("-Iluajit/src") + // Make it pretty + .rustfmt_bindings(true) + .sort_semantically(true) + .merge_extern_blocks(true) + .parse_callbacks(Box::new(bindgen::CargoCallbacks)) + .generate() + .expect("Failed to generate bindings"); + + let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); + bindings + .write_to_file(out_path.join("bindings.rs")) + .expect("Failed to write bindings"); } diff --git a/ffi.h b/ffi.h deleted file mode 100644 index a9fe40a..0000000 --- a/ffi.h +++ /dev/null @@ -1,4 +0,0 @@ -#include "lua.h" -#include "lualib.h" -#include "lauxlib.h" -#include "luajit.h" \ No newline at end of file diff --git a/src/ffi.rs b/src/ffi.rs deleted file mode 100644 index a33ac54..0000000 --- a/src/ffi.rs +++ /dev/null @@ -1,1113 +0,0 @@ -/* automatically generated by rust-bindgen */ - -// Generated with: bindgen 0.52.0 - -pub const LUA_LDIR: &'static [u8; 7usize] = b"!\\lua\\\0"; -pub const LUA_CDIR: &'static [u8; 3usize] = b"!\\\0"; -pub const LUA_PATH_DEFAULT: &'static [u8; 38usize] = - b".\\?.lua;!\\lua\\?.lua;!\\lua\\?\\init.lua;\0"; -pub const LUA_CPATH_DEFAULT: &'static [u8; 30usize] = b".\\?.dll;!\\?.dll;!\\loadall.dll\0"; -pub const LUA_PATH: &'static [u8; 9usize] = b"LUA_PATH\0"; -pub const LUA_CPATH: &'static [u8; 10usize] = b"LUA_CPATH\0"; -pub const LUA_INIT: &'static [u8; 9usize] = b"LUA_INIT\0"; -pub const LUA_DIRSEP: &'static [u8; 2usize] = b"\\\0"; -pub const LUA_PATHSEP: &'static [u8; 2usize] = b";\0"; -pub const LUA_PATH_MARK: &'static [u8; 2usize] = b"?\0"; -pub const LUA_EXECDIR: &'static [u8; 2usize] = b"!\0"; -pub const LUA_IGMARK: &'static [u8; 2usize] = b"-\0"; -pub const LUA_PATH_CONFIG: &'static [u8; 11usize] = b"\\\n;\n?\n!\n-\n\0"; -pub const LUAI_MAXSTACK: u32 = 65500; -pub const LUAI_MAXCSTACK: u32 = 8000; -pub const LUAI_GCPAUSE: u32 = 200; -pub const LUAI_GCMUL: u32 = 200; -pub const LUA_MAXCAPTURES: u32 = 32; -pub const LUA_IDSIZE: u32 = 60; -pub const LUA_NUMBER_SCAN: &'static [u8; 4usize] = b"%lf\0"; -pub const LUA_NUMBER_FMT: &'static [u8; 6usize] = b"%.14g\0"; -pub const LUAI_MAXNUMBER2STR: u32 = 32; -pub const LUA_INTFRMLEN: &'static [u8; 2usize] = b"l\0"; -pub const LUA_VERSION: &'static [u8; 8usize] = b"Lua 5.1\0"; -pub const LUA_RELEASE: &'static [u8; 10usize] = b"Lua 5.1.4\0"; -pub const LUA_VERSION_NUM: u32 = 501; -pub const LUA_COPYRIGHT: &'static [u8; 41usize] = b"Copyright (C) 1994-2008 Lua.org, PUC-Rio\0"; -pub const LUA_AUTHORS: &'static [u8; 49usize] = - b"R. Ierusalimschy, L. H. de Figueiredo & W. Celes\0"; -pub const LUA_SIGNATURE: &'static [u8; 5usize] = b"\x1BLua\0"; -pub const LUA_MULTRET: i32 = -1; -pub const LUA_REGISTRYINDEX: i32 = -10000; -pub const LUA_ENVIRONINDEX: i32 = -10001; -pub const LUA_GLOBALSINDEX: i32 = -10002; -pub const LUA_OK: u32 = 0; -pub const LUA_YIELD: u32 = 1; -pub const LUA_ERRRUN: u32 = 2; -pub const LUA_ERRSYNTAX: u32 = 3; -pub const LUA_ERRMEM: u32 = 4; -pub const LUA_ERRERR: u32 = 5; -pub const LUA_TNONE: i32 = -1; -pub const LUA_TNIL: u32 = 0; -pub const LUA_TBOOLEAN: u32 = 1; -pub const LUA_TLIGHTUSERDATA: u32 = 2; -pub const LUA_TNUMBER: u32 = 3; -pub const LUA_TSTRING: u32 = 4; -pub const LUA_TTABLE: u32 = 5; -pub const LUA_TFUNCTION: u32 = 6; -pub const LUA_TUSERDATA: u32 = 7; -pub const LUA_TTHREAD: u32 = 8; -pub const LUA_MINSTACK: u32 = 20; -pub const LUA_GCSTOP: u32 = 0; -pub const LUA_GCRESTART: u32 = 1; -pub const LUA_GCCOLLECT: u32 = 2; -pub const LUA_GCCOUNT: u32 = 3; -pub const LUA_GCCOUNTB: u32 = 4; -pub const LUA_GCSTEP: u32 = 5; -pub const LUA_GCSETPAUSE: u32 = 6; -pub const LUA_GCSETSTEPMUL: u32 = 7; -pub const LUA_GCISRUNNING: u32 = 9; -pub const LUA_HOOKCALL: u32 = 0; -pub const LUA_HOOKRET: u32 = 1; -pub const LUA_HOOKLINE: u32 = 2; -pub const LUA_HOOKCOUNT: u32 = 3; -pub const LUA_HOOKTAILRET: u32 = 4; -pub const LUA_MASKCALL: u32 = 1; -pub const LUA_MASKRET: u32 = 2; -pub const LUA_MASKLINE: u32 = 4; -pub const LUA_MASKCOUNT: u32 = 8; -pub const LUA_FILEHANDLE: &'static [u8; 6usize] = b"FILE*\0"; -pub const LUA_COLIBNAME: &'static [u8; 10usize] = b"coroutine\0"; -pub const LUA_MATHLIBNAME: &'static [u8; 5usize] = b"math\0"; -pub const LUA_STRLIBNAME: &'static [u8; 7usize] = b"string\0"; -pub const LUA_TABLIBNAME: &'static [u8; 6usize] = b"table\0"; -pub const LUA_IOLIBNAME: &'static [u8; 3usize] = b"io\0"; -pub const LUA_OSLIBNAME: &'static [u8; 3usize] = b"os\0"; -pub const LUA_LOADLIBNAME: &'static [u8; 8usize] = b"package\0"; -pub const LUA_DBLIBNAME: &'static [u8; 6usize] = b"debug\0"; -pub const LUA_BITLIBNAME: &'static [u8; 4usize] = b"bit\0"; -pub const LUA_JITLIBNAME: &'static [u8; 4usize] = b"jit\0"; -pub const LUA_FFILIBNAME: &'static [u8; 4usize] = b"ffi\0"; -pub const LUA_ERRFILE: u32 = 6; -pub const LUA_NOREF: i32 = -2; -pub const LUA_REFNIL: i32 = -1; -pub const LUAJIT_VERSION: &'static [u8; 19usize] = b"LuaJIT 2.1.0-beta3\0"; -pub const LUAJIT_VERSION_NUM: u32 = 20100; -pub const LUAJIT_COPYRIGHT: &'static [u8; 34usize] = b"Copyright (C) 2005-2017 Mike Pall\0"; -pub const LUAJIT_URL: &'static [u8; 19usize] = b"http://luajit.org/\0"; -pub const LUAJIT_MODE_MASK: u32 = 255; -pub const LUAJIT_MODE_OFF: u32 = 0; -pub const LUAJIT_MODE_ON: u32 = 256; -pub const LUAJIT_MODE_FLUSH: u32 = 512; -pub type va_list = __builtin_va_list; -#[repr(C)] -#[derive(Debug, Copy, Clone)] -/// -pub struct lua_State { - _unused: [u8; 0], -} -/// -pub type lua_CFunction = - ::core::option::Option libc::c_int>; -/// -pub type lua_Reader = ::core::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - ud: *mut libc::c_void, - sz: *mut usize, - ) -> *const libc::c_char, ->; -/// -pub type lua_Writer = ::core::option::Option< - unsafe extern "C" fn( - L: *mut lua_State, - p: *const libc::c_void, - sz: usize, - ud: *mut libc::c_void, - ) -> libc::c_int, ->; -/// -pub type lua_Alloc = ::core::option::Option< - unsafe extern "C" fn( - ud: *mut libc::c_void, - ptr: *mut libc::c_void, - osize: usize, - nsize: usize, - ) -> *mut libc::c_void, ->; -/// -pub type lua_Number = f64; -/// -pub type lua_Integer = isize; -extern "C" { - /// - pub fn lua_newstate(f: lua_Alloc, ud: *mut libc::c_void) -> *mut lua_State; -} -extern "C" { - /// - pub fn lua_close(L: *mut lua_State); -} -extern "C" { - /// - pub fn lua_newthread(L: *mut lua_State) -> *mut lua_State; -} -extern "C" { - /// - pub fn lua_atpanic(L: *mut lua_State, panicf: lua_CFunction) -> lua_CFunction; -} -extern "C" { - /// - pub fn lua_gettop(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_settop(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_pushvalue(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_remove(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_insert(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_replace(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_checkstack(L: *mut lua_State, sz: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_xmove(from: *mut lua_State, to: *mut lua_State, n: libc::c_int); -} -extern "C" { - /// - pub fn lua_isnumber(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_isstring(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_iscfunction(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_isuserdata(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_type(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_typename(L: *mut lua_State, tp: libc::c_int) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_equal(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_rawequal(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_lessthan(L: *mut lua_State, idx1: libc::c_int, idx2: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_tonumber(L: *mut lua_State, idx: libc::c_int) -> lua_Number; -} -extern "C" { - /// - pub fn lua_tointeger(L: *mut lua_State, idx: libc::c_int) -> lua_Integer; -} -extern "C" { - /// - pub fn lua_toboolean(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_tolstring( - L: *mut lua_State, - idx: libc::c_int, - len: *mut usize, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_objlen(L: *mut lua_State, idx: libc::c_int) -> usize; -} -extern "C" { - /// - pub fn lua_tocfunction(L: *mut lua_State, idx: libc::c_int) -> lua_CFunction; -} -extern "C" { - /// - pub fn lua_touserdata(L: *mut lua_State, idx: libc::c_int) -> *mut libc::c_void; -} -extern "C" { - /// - pub fn lua_tothread(L: *mut lua_State, idx: libc::c_int) -> *mut lua_State; -} -extern "C" { - /// - pub fn lua_topointer(L: *mut lua_State, idx: libc::c_int) -> *const libc::c_void; -} -extern "C" { - /// - pub fn lua_pushnil(L: *mut lua_State); -} -extern "C" { - /// - pub fn lua_pushnumber(L: *mut lua_State, n: lua_Number); -} -extern "C" { - /// - pub fn lua_pushinteger(L: *mut lua_State, n: lua_Integer); -} -extern "C" { - /// - pub fn lua_pushlstring(L: *mut lua_State, s: *const libc::c_char, l: usize); -} -extern "C" { - /// - pub fn lua_pushstring(L: *mut lua_State, s: *const libc::c_char); -} -extern "C" { - /// - pub fn lua_pushvfstring( - L: *mut lua_State, - fmt: *const libc::c_char, - argp: va_list, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_pushfstring(L: *mut lua_State, fmt: *const libc::c_char, ...) - -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_pushcclosure(L: *mut lua_State, fn_: lua_CFunction, n: libc::c_int); -} -extern "C" { - /// - pub fn lua_pushboolean(L: *mut lua_State, b: libc::c_int); -} -extern "C" { - /// - pub fn lua_pushlightuserdata(L: *mut lua_State, p: *mut libc::c_void); -} -extern "C" { - /// - pub fn lua_pushthread(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_gettable(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_getfield(L: *mut lua_State, idx: libc::c_int, k: *const libc::c_char); -} -extern "C" { - /// - pub fn lua_rawget(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_rawgeti(L: *mut lua_State, idx: libc::c_int, n: libc::c_int); -} -extern "C" { - /// - pub fn lua_createtable(L: *mut lua_State, narr: libc::c_int, nrec: libc::c_int); -} -extern "C" { - /// - pub fn lua_newuserdata(L: *mut lua_State, sz: usize) -> *mut libc::c_void; -} -extern "C" { - /// - pub fn lua_getmetatable(L: *mut lua_State, objindex: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_getfenv(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_settable(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_setfield(L: *mut lua_State, idx: libc::c_int, k: *const libc::c_char); -} -extern "C" { - /// - pub fn lua_rawset(L: *mut lua_State, idx: libc::c_int); -} -extern "C" { - /// - pub fn lua_rawseti(L: *mut lua_State, idx: libc::c_int, n: libc::c_int); -} -extern "C" { - /// - pub fn lua_setmetatable(L: *mut lua_State, objindex: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_setfenv(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_call(L: *mut lua_State, nargs: libc::c_int, nresults: libc::c_int); -} -extern "C" { - /// - pub fn lua_pcall( - L: *mut lua_State, - nargs: libc::c_int, - nresults: libc::c_int, - errfunc: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_cpcall(L: *mut lua_State, func: lua_CFunction, ud: *mut libc::c_void) - -> libc::c_int; -} -extern "C" { - /// - pub fn lua_load( - L: *mut lua_State, - reader: lua_Reader, - dt: *mut libc::c_void, - chunkname: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_dump(L: *mut lua_State, writer: lua_Writer, data: *mut libc::c_void) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_yield(L: *mut lua_State, nresults: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_resume(L: *mut lua_State, narg: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_status(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_gc(L: *mut lua_State, what: libc::c_int, data: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_error(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_next(L: *mut lua_State, idx: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_concat(L: *mut lua_State, n: libc::c_int); -} -extern "C" { - /// - pub fn lua_getallocf(L: *mut lua_State, ud: *mut *mut libc::c_void) -> lua_Alloc; -} -extern "C" { - /// - pub fn lua_setallocf(L: *mut lua_State, f: lua_Alloc, ud: *mut libc::c_void); -} -extern "C" { - /// - pub fn lua_setlevel(from: *mut lua_State, to: *mut lua_State); -} -/// -pub type lua_Hook = - ::core::option::Option; -extern "C" { - /// - pub fn lua_getstack(L: *mut lua_State, level: libc::c_int, ar: *mut lua_Debug) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_getinfo( - L: *mut lua_State, - what: *const libc::c_char, - ar: *mut lua_Debug, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_getlocal( - L: *mut lua_State, - ar: *const lua_Debug, - n: libc::c_int, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_setlocal( - L: *mut lua_State, - ar: *const lua_Debug, - n: libc::c_int, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_getupvalue( - L: *mut lua_State, - funcindex: libc::c_int, - n: libc::c_int, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_setupvalue( - L: *mut lua_State, - funcindex: libc::c_int, - n: libc::c_int, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn lua_sethook( - L: *mut lua_State, - func: lua_Hook, - mask: libc::c_int, - count: libc::c_int, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_gethook(L: *mut lua_State) -> lua_Hook; -} -extern "C" { - /// - pub fn lua_gethookmask(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_gethookcount(L: *mut lua_State) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_upvalueid(L: *mut lua_State, idx: libc::c_int, n: libc::c_int) -> *mut libc::c_void; -} -extern "C" { - /// - pub fn lua_upvaluejoin( - L: *mut lua_State, - idx1: libc::c_int, - n1: libc::c_int, - idx2: libc::c_int, - n2: libc::c_int, - ); -} -extern "C" { - /// - pub fn lua_loadx( - L: *mut lua_State, - reader: lua_Reader, - dt: *mut libc::c_void, - chunkname: *const libc::c_char, - mode: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn lua_version(L: *mut lua_State) -> *const lua_Number; -} -extern "C" { - /// - pub fn lua_copy(L: *mut lua_State, fromidx: libc::c_int, toidx: libc::c_int); -} -extern "C" { - /// - pub fn lua_tonumberx( - L: *mut lua_State, - idx: libc::c_int, - isnum: *mut libc::c_int, - ) -> lua_Number; -} -extern "C" { - /// - pub fn lua_tointegerx( - L: *mut lua_State, - idx: libc::c_int, - isnum: *mut libc::c_int, - ) -> lua_Integer; -} -extern "C" { - /// - pub fn lua_isyieldable(L: *mut lua_State) -> libc::c_int; -} -#[repr(C)] -#[derive(Copy, Clone)] -/// -pub struct lua_Debug { - pub event: libc::c_int, - pub name: *const libc::c_char, - pub namewhat: *const libc::c_char, - pub what: *const libc::c_char, - pub source: *const libc::c_char, - pub currentline: libc::c_int, - pub nups: libc::c_int, - pub linedefined: libc::c_int, - pub lastlinedefined: libc::c_int, - pub short_src: [libc::c_char; 60usize], - pub i_ci: libc::c_int, -} -#[test] -fn bindgen_test_layout_lua_Debug() { - assert_eq!( - ::core::mem::size_of::(), - 120usize, - concat!("Size of: ", stringify!(lua_Debug)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(lua_Debug)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).event as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(event) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).namewhat as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(namewhat) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).what as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(what) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).source as *const _ as usize }, - 32usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(source) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).currentline as *const _ as usize }, - 40usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(currentline) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).nups as *const _ as usize }, - 44usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(nups) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).linedefined as *const _ as usize }, - 48usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(linedefined) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lastlinedefined as *const _ as usize }, - 52usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(lastlinedefined) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).short_src as *const _ as usize }, - 56usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(short_src) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).i_ci as *const _ as usize }, - 116usize, - concat!( - "Offset of field: ", - stringify!(lua_Debug), - "::", - stringify!(i_ci) - ) - ); -} -impl ::core::fmt::Debug for lua_Debug { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write ! ( f , "lua_Debug {{ event: {:?}, name: {:?}, namewhat: {:?}, what: {:?}, source: {:?}, currentline: {:?}, nups: {:?}, linedefined: {:?}, lastlinedefined: {:?}, short_src: [...], i_ci: {:?} }}" , self . event , self . name , self . namewhat , self . what , self . source , self . currentline , self . nups , self . linedefined , self . lastlinedefined , self . i_ci ) - } -} -extern "C" { - /// - pub fn luaL_openlibs(L: *mut lua_State); -} -#[repr(C)] -#[derive(Debug, Copy, Clone)] -/// -pub struct luaL_Reg { - pub name: *const libc::c_char, - pub func: lua_CFunction, -} -#[test] -fn bindgen_test_layout_luaL_Reg() { - assert_eq!( - ::core::mem::size_of::(), - 16usize, - concat!("Size of: ", stringify!(luaL_Reg)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Reg)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).name as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(name) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).func as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Reg), - "::", - stringify!(func) - ) - ); -} -extern "C" { - /// - pub fn luaL_openlib( - L: *mut lua_State, - libname: *const libc::c_char, - l: *const luaL_Reg, - nup: libc::c_int, - ); -} -extern "C" { - /// - pub fn luaL_register(L: *mut lua_State, libname: *const libc::c_char, l: *const luaL_Reg); -} -extern "C" { - /// - pub fn luaL_getmetafield( - L: *mut lua_State, - obj: libc::c_int, - e: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_callmeta( - L: *mut lua_State, - obj: libc::c_int, - e: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_typerror( - L: *mut lua_State, - narg: libc::c_int, - tname: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_argerror( - L: *mut lua_State, - numarg: libc::c_int, - extramsg: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_checklstring( - L: *mut lua_State, - numArg: libc::c_int, - l: *mut usize, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn luaL_optlstring( - L: *mut lua_State, - numArg: libc::c_int, - def: *const libc::c_char, - l: *mut usize, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn luaL_checknumber(L: *mut lua_State, numArg: libc::c_int) -> lua_Number; -} -extern "C" { - /// - pub fn luaL_optnumber(L: *mut lua_State, nArg: libc::c_int, def: lua_Number) -> lua_Number; -} -extern "C" { - /// - pub fn luaL_checkinteger(L: *mut lua_State, numArg: libc::c_int) -> lua_Integer; -} -extern "C" { - /// - pub fn luaL_optinteger(L: *mut lua_State, nArg: libc::c_int, def: lua_Integer) -> lua_Integer; -} -extern "C" { - /// - pub fn luaL_checkstack(L: *mut lua_State, sz: libc::c_int, msg: *const libc::c_char); -} -extern "C" { - /// - pub fn luaL_checktype(L: *mut lua_State, narg: libc::c_int, t: libc::c_int); -} -extern "C" { - /// - pub fn luaL_checkany(L: *mut lua_State, narg: libc::c_int); -} -extern "C" { - /// - pub fn luaL_newmetatable(L: *mut lua_State, tname: *const libc::c_char) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_checkudata( - L: *mut lua_State, - ud: libc::c_int, - tname: *const libc::c_char, - ) -> *mut libc::c_void; -} -extern "C" { - /// - pub fn luaL_where(L: *mut lua_State, lvl: libc::c_int); -} -extern "C" { - /// - pub fn luaL_error(L: *mut lua_State, fmt: *const libc::c_char, ...) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_checkoption( - L: *mut lua_State, - narg: libc::c_int, - def: *const libc::c_char, - lst: *const *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_ref(L: *mut lua_State, t: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_unref(L: *mut lua_State, t: libc::c_int, ref_: libc::c_int); -} -extern "C" { - /// - pub fn luaL_loadfile(L: *mut lua_State, filename: *const libc::c_char) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_loadbuffer( - L: *mut lua_State, - buff: *const libc::c_char, - sz: usize, - name: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_loadstring(L: *mut lua_State, s: *const libc::c_char) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_newstate() -> *mut lua_State; -} -extern "C" { - /// - pub fn luaL_gsub( - L: *mut lua_State, - s: *const libc::c_char, - p: *const libc::c_char, - r: *const libc::c_char, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn luaL_findtable( - L: *mut lua_State, - idx: libc::c_int, - fname: *const libc::c_char, - szhint: libc::c_int, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn luaL_fileresult( - L: *mut lua_State, - stat: libc::c_int, - fname: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_execresult(L: *mut lua_State, stat: libc::c_int) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_loadfilex( - L: *mut lua_State, - filename: *const libc::c_char, - mode: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_loadbufferx( - L: *mut lua_State, - buff: *const libc::c_char, - sz: usize, - name: *const libc::c_char, - mode: *const libc::c_char, - ) -> libc::c_int; -} -extern "C" { - /// - pub fn luaL_traceback( - L: *mut lua_State, - L1: *mut lua_State, - msg: *const libc::c_char, - level: libc::c_int, - ); -} -extern "C" { - /// - pub fn luaL_setfuncs(L: *mut lua_State, l: *const luaL_Reg, nup: libc::c_int); -} -extern "C" { - /// - pub fn luaL_pushmodule(L: *mut lua_State, modname: *const libc::c_char, sizehint: libc::c_int); -} -extern "C" { - /// - pub fn luaL_testudata( - L: *mut lua_State, - ud: libc::c_int, - tname: *const libc::c_char, - ) -> *mut libc::c_void; -} -extern "C" { - /// - pub fn luaL_setmetatable(L: *mut lua_State, tname: *const libc::c_char); -} -#[repr(C)] -#[derive(Copy, Clone)] -/// -pub struct luaL_Buffer { - pub p: *mut libc::c_char, - pub lvl: libc::c_int, - pub L: *mut lua_State, - pub buffer: [libc::c_char; 512usize], -} -#[test] -fn bindgen_test_layout_luaL_Buffer() { - assert_eq!( - ::core::mem::size_of::(), - 536usize, - concat!("Size of: ", stringify!(luaL_Buffer)) - ); - assert_eq!( - ::core::mem::align_of::(), - 8usize, - concat!("Alignment of ", stringify!(luaL_Buffer)) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).p as *const _ as usize }, - 0usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(p) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).lvl as *const _ as usize }, - 8usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(lvl) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).L as *const _ as usize }, - 16usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(L) - ) - ); - assert_eq!( - unsafe { &(*(::core::ptr::null::())).buffer as *const _ as usize }, - 24usize, - concat!( - "Offset of field: ", - stringify!(luaL_Buffer), - "::", - stringify!(buffer) - ) - ); -} -impl ::core::fmt::Debug for luaL_Buffer { - fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result { - write!( - f, - "luaL_Buffer {{ p: {:?}, lvl: {:?}, L: {:?}, buffer: [...] }}", - self.p, self.lvl, self.L - ) - } -} -extern "C" { - /// - pub fn luaL_buffinit(L: *mut lua_State, B: *mut luaL_Buffer); -} -extern "C" { - /// - pub fn luaL_prepbuffer(B: *mut luaL_Buffer) -> *mut libc::c_char; -} -extern "C" { - /// - pub fn luaL_addlstring(B: *mut luaL_Buffer, s: *const libc::c_char, l: usize); -} -extern "C" { - /// - pub fn luaL_addstring(B: *mut luaL_Buffer, s: *const libc::c_char); -} -extern "C" { - /// - pub fn luaL_addvalue(B: *mut luaL_Buffer); -} -extern "C" { - /// - pub fn luaL_pushresult(B: *mut luaL_Buffer); -} -pub const LUAJIT_MODE_ENGINE: _bindgen_ty_1 = 0; -pub const LUAJIT_MODE_DEBUG: _bindgen_ty_1 = 1; -pub const LUAJIT_MODE_FUNC: _bindgen_ty_1 = 2; -pub const LUAJIT_MODE_ALLFUNC: _bindgen_ty_1 = 3; -pub const LUAJIT_MODE_ALLSUBFUNC: _bindgen_ty_1 = 4; -pub const LUAJIT_MODE_TRACE: _bindgen_ty_1 = 5; -pub const LUAJIT_MODE_WRAPCFUNC: _bindgen_ty_1 = 16; -pub const LUAJIT_MODE_MAX: _bindgen_ty_1 = 17; -pub type _bindgen_ty_1 = i32; -extern "C" { - /// - pub fn luaJIT_setmode(L: *mut lua_State, idx: libc::c_int, mode: libc::c_int) -> libc::c_int; -} -pub type luaJIT_profile_callback = ::core::option::Option< - unsafe extern "C" fn( - data: *mut libc::c_void, - L: *mut lua_State, - samples: libc::c_int, - vmstate: libc::c_int, - ), ->; -extern "C" { - /// - pub fn luaJIT_profile_start( - L: *mut lua_State, - mode: *const libc::c_char, - cb: luaJIT_profile_callback, - data: *mut libc::c_void, - ); -} -extern "C" { - /// - pub fn luaJIT_profile_stop(L: *mut lua_State); -} -extern "C" { - /// - pub fn luaJIT_profile_dumpstack( - L: *mut lua_State, - fmt: *const libc::c_char, - depth: libc::c_int, - len: *mut usize, - ) -> *const libc::c_char; -} -extern "C" { - /// - pub fn luaJIT_version_2_1_0_beta3(); -} -pub type __builtin_va_list = *mut libc::c_char; diff --git a/src/lib.rs b/src/lib.rs index e0d799f..c48ca06 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1,6 +1,8 @@ #![no_std] #![allow(non_snake_case)] #![allow(non_camel_case_types)] +#![allow(clippy::deprecated_semver)] +#![allow(clippy::missing_safety_doc)] //! # LuaJIT 2.1 //! @@ -15,7 +17,9 @@ //! //! -mod ffi; +mod ffi { + include!(concat!(env!("OUT_DIR"), "/bindings.rs")); +} pub use ffi::*; use core::ptr; @@ -92,7 +96,7 @@ pub unsafe fn lua_isthread(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { /// #[inline] pub unsafe fn lua_isnone(L: *mut lua_State, idx: libc::c_int) -> libc::c_int { - (lua_type(L, idx) == LUA_TNONE as i32) as i32 + (lua_type(L, idx) == LUA_TNONE) as i32 } /// From 9ab05ce18cc35b3235b0cc7665d6e860193c9b11 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 23 Mar 2023 13:35:56 +0100 Subject: [PATCH 027/154] feat: Implement cross compilation for MSVC toolchain --- Cargo.toml | 4 +- build.rs | 179 +++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 156 insertions(+), 27 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 8758afc..23f0cd3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -3,7 +3,7 @@ name = "luajit2-sys" version = "0.0.2" description = "LuaJIT-2.1 FFI Bindings" authors = ["Aaron Loucks "] -edition = "2018" +edition = "2021" keywords = ["lua", "luajit", "script"] license = "MIT OR Apache-2.0" readme = "README.md" @@ -16,5 +16,5 @@ libc = "0.2" [build-dependencies] bindgen = "0.64.0" -cc = "1.0.40" +cc = "1" fs_extra = "1.1.0" diff --git a/build.rs b/build.rs index bbafb9a..cfcebdd 100644 --- a/build.rs +++ b/build.rs @@ -1,3 +1,4 @@ +use cc::Build; use fs_extra::dir; use fs_extra::dir::CopyOptions; use std::env; @@ -6,38 +7,101 @@ use std::process::{Command, Stdio}; const LIB_NAME: &str = "luajit"; const LUAJIT_HEADERS: [&str; 4] = ["lua.h", "lualib.h", "lauxlib.h", "luajit.h"]; +const LUAJIT_SRC: [&str; 69] = [ + // LJCORE_O + // The MSVC toolchain cannot compile this assembler file, + // as it contains GNU-specific directives + // "lj_vm.S", + "lj_assert.c", + "lj_gc.c", + "lj_err.c", + "lj_char.c", + "lj_bc.c", + "lj_obj.c", + "lj_buf.c", + "lj_str.c", + "lj_tab.c", + "lj_func.c", + "lj_udata.c", + "lj_meta.c", + "lj_debug.c", + "lj_prng.c", + "lj_state.c", + "lj_dispatch.c", + "lj_vmevent.c", + "lj_vmmath.c", + "lj_strscan.c", + "lj_strfmt.c", + "lj_strfmt_num.c", + "lj_serialize.c", + "lj_api.c", + "lj_profile.c", + "lj_lex.c", + "lj_parse.c", + "lj_bcread.c", + "lj_bcwrite.c", + "lj_load.c", + "lj_ir.c", + "lj_opt_mem.c", + "lj_opt_fold.c", + "lj_opt_narrow.c", + "lj_opt_dce.c", + "lj_opt_loop.c", + "lj_opt_split.c", + "lj_opt_sink.c", + "lj_mcode.c", + "lj_snap.c", + "lj_record.c", + "lj_crecord.c", + "lj_ffrecord.c", + "lj_asm.c", + "lj_trace.c", + "lj_gdbjit.c", + "lj_ctype.c", + "lj_cdata.c", + "lj_cconv.c", + "lj_ccall.c", + "lj_ccallback.c", + "lj_carith.c", + "lj_clib.c", + "lj_cparse.c", + "lj_lib.c", + "lj_alloc.c", + // LJLIB_O + "lib_aux.c", + "lib_base.c", + "lib_math.c", + "lib_bit.c", + "lib_string.c", + "lib_table.c", + "lib_io.c", + "lib_os.c", + "lib_package.c", + "lib_debug.c", + "lib_jit.c", + "lib_ffi.c", + "lib_buffer.c", + "lib_init.c", +]; -fn main() { - let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); - let out_dir = env::var("OUT_DIR").unwrap(); - let src_dir = format!("{}/luajit/src", out_dir); - let lib_path = format!("{}/lib{}.a", &src_dir, LIB_NAME); - - dbg!(&luajit_dir); - dbg!(&out_dir); - dbg!(&src_dir); - dbg!(&lib_path); - - let mut copy_options = CopyOptions::new(); - copy_options.overwrite = true; - - dir::copy(&luajit_dir, &out_dir, ©_options).expect("Failed to copy LuaJIT source"); - +fn build_gcc(src_dir: &str) { let mut buildcmd = Command::new("make"); buildcmd.current_dir(&src_dir); buildcmd.stderr(Stdio::inherit()); - buildcmd.arg("BUILDMODE=static"); + buildcmd.arg("--no-silent"); + // We do need to cross-compile even here, so that `lj_vm.o` is created + // for the correct architecture. if env::var("CARGO_CFG_WINDOWS").is_ok() { buildcmd.arg("TARGET_SYS=Windows"); buildcmd.arg("CROSS=x86_64-w64-mingw32-"); } if cfg!(target_pointer_width = "32") { - buildcmd.env("HOST_CC", "gcc -m32"); + buildcmd.arg("HOST_CC='gcc -m32'"); buildcmd.arg("-e"); } else { - buildcmd.env("HOST_CC", "gcc"); + buildcmd.arg("HOST_CC='gcc'"); } let mut child = buildcmd.spawn().expect("failed to run make"); @@ -50,11 +114,66 @@ fn main() { { panic!("Failed to build luajit"); } +} + +fn build_msvc(src_dir: &str, out_dir: &str) { + let mut cc = Build::new(); + // cc can't handle many of the `cland-dl`-specific flags, so + // we need to port them manually from a `make -n` run. + cc.out_dir(out_dir) + // `llvm-as` (which the clang-based toolchain for MSVC would use to compile `lj_vm.S` + // assembler) doesn't support some of the GNU-specific directives. + // However, the previous host-targeted compilation already created the + // object, so we simply link that. + .object(format!("{src_dir}/lj_vm.o")) + .define("_FILE_OFFSET_BITS", "64") + .define("_LARGEFILE_SOURCE", None) + .define("LUA_MULTILIB", "\"lib\"") + .define("LUAJIT_UNWIND_EXTERNAL", None) + .flag("-fcolor-diagnostics") + // Disable warnings + .flag("/W0") + .flag("/U _FORTIFY_SOURCE") + // Link statically + .flag("/MT") + // Omit frame pointers + .flag("/Oy"); + + for f in LUAJIT_SRC { + cc.file(format!("{src_dir}/{f}")); + } + + cc.compile(LIB_NAME); +} + +fn main() { + let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); + let out_dir = env::var("OUT_DIR").unwrap(); + let src_dir = format!("{}/luajit/src", out_dir); + + dbg!(&luajit_dir); + dbg!(&out_dir); + dbg!(&src_dir); + + let mut copy_options = CopyOptions::new(); + copy_options.overwrite = true; + + dir::copy(&luajit_dir, &out_dir, ©_options).expect("Failed to copy LuaJIT source"); + + // The first run builds with and for the host architecture. + // This also creates all the tools and generated sources that a compilation needs. + build_gcc(&src_dir); + + // Then, for cross-compilation, we can utilize those generated + // sources to re-compile just the library. + if env::var("CARGO_CFG_WINDOWS").is_ok() { + build_msvc(&src_dir, &out_dir); + } println!("cargo:lib-name={}", LIB_NAME); println!("cargo:include={}", src_dir); - println!("cargo:rustc-link-search=native={}", src_dir); - println!("cargo:rustc-link-lib=static={}", LIB_NAME); + println!("cargo:rustc-link-search={}", out_dir); + println!("cargo:rustc-link-lib={}", LIB_NAME); let mut bindings = bindgen::Builder::default(); @@ -74,14 +193,24 @@ fn main() { .ctypes_prefix("libc") .impl_debug(true) .use_core() - .clang_arg("-Iluajit/src") + .detect_include_paths(true) // Make it pretty .rustfmt_bindings(true) .sort_semantically(true) .merge_extern_blocks(true) - .parse_callbacks(Box::new(bindgen::CargoCallbacks)) - .generate() - .expect("Failed to generate bindings"); + .parse_callbacks(Box::new(bindgen::CargoCallbacks)); + + let bindings = if env::var("CARGO_CFG_WINDOWS").is_ok() { + bindings + .clang_arg("-I/xwin/sdk/include/ucrt") + .clang_arg("-I/xwin/sdk/include/um") + .clang_arg("-I/xwin/sdk/include/shared") + .clang_arg("-I/xwin/crt/include") + .generate() + .expect("Failed to generate bindings") + } else { + bindings.generate().expect("Failed to generate bindings") + }; let out_path = PathBuf::from(env::var("OUT_DIR").unwrap()); bindings From 18797c4d2a53834210fd096dd39195ce7f2bce21 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 23 Mar 2023 15:18:31 +0100 Subject: [PATCH 028/154] fix: Fix linking on Linux --- build.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/build.rs b/build.rs index cfcebdd..d53448e 100644 --- a/build.rs +++ b/build.rs @@ -168,12 +168,14 @@ fn main() { // sources to re-compile just the library. if env::var("CARGO_CFG_WINDOWS").is_ok() { build_msvc(&src_dir, &out_dir); + println!("cargo:rustc-link-search={}", out_dir); + } else { + println!("cargo:rustc-link-search=native={}", src_dir); } println!("cargo:lib-name={}", LIB_NAME); println!("cargo:include={}", src_dir); - println!("cargo:rustc-link-search={}", out_dir); - println!("cargo:rustc-link-lib={}", LIB_NAME); + println!("cargo:rustc-link-lib=static={}", LIB_NAME); let mut bindings = bindgen::Builder::default(); From 11c4eddaa4667ea7fffad40b034cf3fcb19fbdd3 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 28 Mar 2023 20:49:15 +0200 Subject: [PATCH 029/154] chore: Fix lcippy warning --- build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.rs b/build.rs index d53448e..11b3984 100644 --- a/build.rs +++ b/build.rs @@ -86,7 +86,7 @@ const LUAJIT_SRC: [&str; 69] = [ fn build_gcc(src_dir: &str) { let mut buildcmd = Command::new("make"); - buildcmd.current_dir(&src_dir); + buildcmd.current_dir(src_dir); buildcmd.stderr(Stdio::inherit()); buildcmd.arg("--no-silent"); From 7395cf0d5360e78e511825b4b5a82b3cc50b4905 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 6 Apr 2023 11:16:14 +0200 Subject: [PATCH 030/154] fix: Disable 64bit GC --- build.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/build.rs b/build.rs index 11b3984..2f5fc48 100644 --- a/build.rs +++ b/build.rs @@ -90,6 +90,12 @@ fn build_gcc(src_dir: &str) { buildcmd.stderr(Stdio::inherit()); buildcmd.arg("--no-silent"); + // This became enabled by default in https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25 + // but changes the generated bytecode. Bitsquid does not have it currently. + // The documentation changes in the commit mention that the bytecode change might be "rectified" + // in the future, though. + buildcmd.arg("XCFLAGS=-DLUAJIT_DISABLE_GC64"); + // We do need to cross-compile even here, so that `lj_vm.o` is created // for the correct architecture. if env::var("CARGO_CFG_WINDOWS").is_ok() { From 24da35e631099e914d6fc1bcc863228c48e540ec Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 9 Apr 2023 12:21:29 +0200 Subject: [PATCH 031/154] fix: Fix LuaJIT on Windows It turned out that with disabling GC64, LuaJIT would immediately overflow the stack when opening a Lua state. For now, this reverts to a version from 2019 that works, but I highly doubt that LuaJIT woould have been broken on Windows for years. I'll have to investigate, or rather trial-and-error further. --- build.rs | 12 +----------- luajit | 2 +- 2 files changed, 2 insertions(+), 12 deletions(-) diff --git a/build.rs b/build.rs index 2f5fc48..6e7e5a4 100644 --- a/build.rs +++ b/build.rs @@ -7,12 +7,11 @@ use std::process::{Command, Stdio}; const LIB_NAME: &str = "luajit"; const LUAJIT_HEADERS: [&str; 4] = ["lua.h", "lualib.h", "lauxlib.h", "luajit.h"]; -const LUAJIT_SRC: [&str; 69] = [ +const LUAJIT_SRC: [&str; 65] = [ // LJCORE_O // The MSVC toolchain cannot compile this assembler file, // as it contains GNU-specific directives // "lj_vm.S", - "lj_assert.c", "lj_gc.c", "lj_err.c", "lj_char.c", @@ -25,7 +24,6 @@ const LUAJIT_SRC: [&str; 69] = [ "lj_udata.c", "lj_meta.c", "lj_debug.c", - "lj_prng.c", "lj_state.c", "lj_dispatch.c", "lj_vmevent.c", @@ -33,7 +31,6 @@ const LUAJIT_SRC: [&str; 69] = [ "lj_strscan.c", "lj_strfmt.c", "lj_strfmt_num.c", - "lj_serialize.c", "lj_api.c", "lj_profile.c", "lj_lex.c", @@ -80,7 +77,6 @@ const LUAJIT_SRC: [&str; 69] = [ "lib_debug.c", "lib_jit.c", "lib_ffi.c", - "lib_buffer.c", "lib_init.c", ]; @@ -90,12 +86,6 @@ fn build_gcc(src_dir: &str) { buildcmd.stderr(Stdio::inherit()); buildcmd.arg("--no-silent"); - // This became enabled by default in https://github.com/LuaJIT/LuaJIT/commit/bd00094c3b50e193fb32aad79b7ea8ea6b78ed25 - // but changes the generated bytecode. Bitsquid does not have it currently. - // The documentation changes in the commit mention that the bytecode change might be "rectified" - // in the future, though. - buildcmd.arg("XCFLAGS=-DLUAJIT_DISABLE_GC64"); - // We do need to cross-compile even here, so that `lj_vm.o` is created // for the correct architecture. if env::var("CARGO_CFG_WINDOWS").is_ok() { diff --git a/luajit b/luajit index 505e2c0..70f4b15 160000 --- a/luajit +++ b/luajit @@ -1 +1 @@ -Subproject commit 505e2c03de35e2718eef0d2d3660712e06dadf1f +Subproject commit 70f4b15ee45a6137fe6b48b941faea79d72f7159 From c7ff0b7a908806f2ef3045eb5f5b1bb7b78b762c Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 15 May 2024 21:57:04 +0200 Subject: [PATCH 032/154] Update bindgen --- Cargo.toml | 2 +- build.rs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 23f0cd3..1f48fa3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,6 @@ links = "luajit" libc = "0.2" [build-dependencies] -bindgen = "0.64.0" +bindgen = "0.69.4" cc = "1" fs_extra = "1.1.0" diff --git a/build.rs b/build.rs index 6e7e5a4..d291dd7 100644 --- a/build.rs +++ b/build.rs @@ -192,11 +192,10 @@ fn main() { .impl_debug(true) .use_core() .detect_include_paths(true) - // Make it pretty - .rustfmt_bindings(true) + .formatter(bindgen::Formatter::Rustfmt) .sort_semantically(true) .merge_extern_blocks(true) - .parse_callbacks(Box::new(bindgen::CargoCallbacks)); + .parse_callbacks(Box::new(bindgen::CargoCallbacks::new())); let bindings = if env::var("CARGO_CFG_WINDOWS").is_ok() { bindings From 2daff544a55c3c4f95f50b6cb715fc4bcb73d5c1 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 17 Jul 2024 09:18:56 +0200 Subject: [PATCH 033/154] Add subcommand for experimental operations These may be temporary ones that help during analyzing and developing file formats, or or long term experiments. --- crates/dtmt/src/cmd/experiment/mod.rs | 17 +++++++++++++++++ crates/dtmt/src/main.rs | 3 +++ 2 files changed, 20 insertions(+) create mode 100644 crates/dtmt/src/cmd/experiment/mod.rs diff --git a/crates/dtmt/src/cmd/experiment/mod.rs b/crates/dtmt/src/cmd/experiment/mod.rs new file mode 100644 index 0000000..b29f83a --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/mod.rs @@ -0,0 +1,17 @@ +use clap::{ArgMatches, Command}; +use color_eyre::Result; + +pub(crate) fn command_definition() -> Command { + Command::new("experiment") + .subcommand_required(true) + .about("A collection of utilities and experiments.") +} + +#[tracing::instrument(skip_all)] +pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + match matches.subcommand() { + _ => unreachable!( + "clap is configured to require a subcommand, and they're all handled above" + ), + } +} diff --git a/crates/dtmt/src/main.rs b/crates/dtmt/src/main.rs index 2e10b17..b01956a 100644 --- a/crates/dtmt/src/main.rs +++ b/crates/dtmt/src/main.rs @@ -21,6 +21,7 @@ mod cmd { pub mod build; pub mod bundle; pub mod dictionary; + pub mod experiment; pub mod migrate; pub mod murmur; pub mod new; @@ -56,6 +57,7 @@ async fn main() -> Result<()> { .subcommand(cmd::build::command_definition()) .subcommand(cmd::bundle::command_definition()) .subcommand(cmd::dictionary::command_definition()) + .subcommand(cmd::experiment::command_definition()) .subcommand(cmd::migrate::command_definition()) .subcommand(cmd::murmur::command_definition()) .subcommand(cmd::new::command_definition()) @@ -133,6 +135,7 @@ async fn main() -> Result<()> { Some(("build", sub_matches)) => cmd::build::run(ctx, sub_matches).await?, Some(("bundle", sub_matches)) => cmd::bundle::run(ctx, sub_matches).await?, Some(("dictionary", sub_matches)) => cmd::dictionary::run(ctx, sub_matches).await?, + Some(("experiment", sub_matches)) => cmd::experiment::run(ctx, sub_matches).await?, Some(("migrate", sub_matches)) => cmd::migrate::run(ctx, sub_matches).await?, Some(("murmur", sub_matches)) => cmd::murmur::run(ctx, sub_matches).await?, Some(("new", sub_matches)) => cmd::new::run(ctx, sub_matches).await?, From 94347d57f9790ff61188a64192e98b602d891afb Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sat, 16 Sep 2023 18:43:52 +0200 Subject: [PATCH 034/154] dtmt: Add command to extract words from file As part of trying to brute force values for the dictionary, this allows extracting candidate words from a file. --- .../dtmt/src/cmd/experiment/extract_words.rs | 182 ++++++++++++++++++ crates/dtmt/src/cmd/experiment/mod.rs | 4 + 2 files changed, 186 insertions(+) create mode 100644 crates/dtmt/src/cmd/experiment/extract_words.rs diff --git a/crates/dtmt/src/cmd/experiment/extract_words.rs b/crates/dtmt/src/cmd/experiment/extract_words.rs new file mode 100644 index 0000000..512038d --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/extract_words.rs @@ -0,0 +1,182 @@ +use std::collections::HashSet; +use std::path::PathBuf; + +use clap::{value_parser, Arg, ArgMatches, Command, ValueEnum}; +use color_eyre::eyre::Context; +use color_eyre::Result; +use tokio::fs; + +pub(crate) fn command_definition() -> Command { + Command::new("extract-words") + .about( + "Extract unique alphanumeric sequences that match common identifier rules from the given file. \ + Only ASCII is supported.", + ) + .arg( + Arg::new("file") + .required(true) + .value_parser(value_parser!(PathBuf)) + .help("Path to the file to extract words from."), + ) + .arg( + Arg::new("min-length") + .help("Minimum length to consider a word.") + .long("min-length") + .short('m') + .default_value("3") + .value_parser(value_parser!(usize)) + ) + .arg( + Arg::new("algorithm") + .help("The algorithm to determine matching words") + .long("algorithm") + .short('a') + .default_value("identifier") + .value_parser(value_parser!(Algorithm)) + ) +} + +#[derive(Copy, Clone, Debug, ValueEnum)] +#[value(rename_all = "snake_case")] +enum Algorithm { + Alphabetic, + Alphanumeric, + Identifier, + Number, + Hash32, + Hash64, +} + +impl Algorithm { + fn is_start(&self, c: char) -> bool { + match self { + Self::Alphabetic => c.is_ascii_alphabetic(), + Self::Alphanumeric => c.is_ascii_alphanumeric(), + Self::Identifier => c.is_ascii_alphabetic(), + Self::Number => c.is_numeric(), + Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + } + } + + fn is_body(&self, c: char) -> bool { + match self { + Self::Alphabetic => c.is_ascii_alphabetic(), + Self::Alphanumeric => c.is_ascii_alphanumeric(), + Self::Identifier => c.is_ascii_alphanumeric(), + Self::Number => c.is_numeric(), + Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + } + } + + fn is_length(&self, len: usize) -> bool { + match self { + Self::Alphabetic => true, + Self::Alphanumeric => true, + Self::Identifier => true, + Self::Number => true, + Self::Hash32 => len == 8, + Self::Hash64 => len == 16, + } + } +} + +impl std::fmt::Display for Algorithm { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!( + f, + "{}", + match self { + Algorithm::Alphabetic => "alphabetic", + Algorithm::Alphanumeric => "alphanumeric", + Algorithm::Identifier => "identifier", + Algorithm::Number => "number", + Algorithm::Hash32 => "hash32", + Algorithm::Hash64 => "hash64", + } + ) + } +} + +#[derive(Copy, Clone, Debug)] +enum State { + Begin, + NonWord, + Word, + End, +} + +#[tracing::instrument(skip_all)] +pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + let path = matches + .get_one::("file") + .expect("missing required parameter"); + + let algorithm = matches + .get_one::("algorithm") + .expect("parameter has default"); + + let min_length = matches + .get_one::("min-length") + .copied() + .expect("paramter has default"); + + let content = fs::read_to_string(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + let mut chars = content.chars(); + + let mut state = State::Begin; + let mut word = String::new(); + let mut visited = HashSet::new(); + + 'machine: loop { + state = match state { + State::Begin => match chars.next() { + None => State::End, + Some(c) if algorithm.is_start(c) => { + word.push(c); + State::Word + } + Some(_) => State::NonWord, + }, + State::End => break 'machine, + State::NonWord => match chars.next() { + None => State::End, + Some(c) if algorithm.is_body(c) => { + word.push(c); + State::Word + } + Some(_) => State::NonWord, + }, + State::Word => match chars.next() { + None => { + if word.len() >= min_length + && algorithm.is_length(word.len()) + && !visited.contains(&word) + { + println!("{}", &word); + visited.insert(word.clone()); + } + State::End + } + Some(c) if algorithm.is_body(c) => { + word.push(c); + State::Word + } + Some(_) => { + if word.len() >= min_length + && algorithm.is_length(word.len()) + && !visited.contains(&word) + { + println!("{}", &word); + visited.insert(word.clone()); + } + word.clear(); + State::NonWord + } + }, + } + } + + Ok(()) +} diff --git a/crates/dtmt/src/cmd/experiment/mod.rs b/crates/dtmt/src/cmd/experiment/mod.rs index b29f83a..51e5fc7 100644 --- a/crates/dtmt/src/cmd/experiment/mod.rs +++ b/crates/dtmt/src/cmd/experiment/mod.rs @@ -1,15 +1,19 @@ use clap::{ArgMatches, Command}; use color_eyre::Result; +mod extract_words; + pub(crate) fn command_definition() -> Command { Command::new("experiment") .subcommand_required(true) .about("A collection of utilities and experiments.") + .subcommand(extract_words::command_definition()) } #[tracing::instrument(skip_all)] pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match matches.subcommand() { + Some(("extract-words", sub_matches)) => extract_words::run(ctx, sub_matches).await, _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" ), From 6485dae27bc152a6eef7533d548e2c8f871b6563 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sat, 16 Sep 2023 19:03:04 +0200 Subject: [PATCH 035/154] experiment: Add command to create word permutations This creates candidate values to brute force dictionary entries with, by building combinations from a word list and delimiters. --- Cargo.lock | 35 ++- crates/dtmt/Cargo.toml | 2 + .../src/cmd/experiment/brute_force_words.rs | 239 ++++++++++++++++++ crates/dtmt/src/cmd/experiment/mod.rs | 3 + 4 files changed, 277 insertions(+), 2 deletions(-) create mode 100644 crates/dtmt/src/cmd/experiment/brute_force_words.rs diff --git a/Cargo.lock b/Cargo.lock index a251de9..dac07e9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -161,6 +161,17 @@ dependencies = [ "system-deps", ] +[[package]] +name = "atty" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" +dependencies = [ + "hermit-abi 0.1.19", + "libc", + "winapi", +] + [[package]] name = "autocfg" version = "1.3.0" @@ -212,7 +223,7 @@ dependencies = [ "bitflags 2.5.0", "cexpr", "clang-sys", - "itertools", + "itertools 0.12.1", "lazy_static", "lazycell", "log", @@ -927,6 +938,7 @@ name = "dtmt" version = "0.3.0" dependencies = [ "async-recursion", + "atty", "clap", "cli-table", "color-eyre", @@ -936,6 +948,7 @@ dependencies = [ "futures", "futures-util", "glob", + "itertools 0.11.0", "luajit2-sys", "nanorand", "notify", @@ -1598,6 +1611,15 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" +[[package]] +name = "hermit-abi" +version = "0.1.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62b467343b94ba476dcb2500d242dadbb39557df889310ac77c5d99100aaac33" +dependencies = [ + "libc", +] + [[package]] name = "hermit-abi" version = "0.3.9" @@ -1858,6 +1880,15 @@ version = "1.70.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +[[package]] +name = "itertools" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1c173a5686ce8bfa551b3563d0c2170bf24ca44da99c7ca4bfdab5418c3fe57" +dependencies = [ + "either", +] + [[package]] name = "itertools" version = "0.12.1" @@ -2267,7 +2298,7 @@ version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi", + "hermit-abi 0.3.9", "libc", ] diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index d836a50..8018a8b 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -33,6 +33,8 @@ async-recursion = "1.0.2" notify = "6.1.1" luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } shlex = { version = "1.2.0", optional = true } +atty = "0.2.14" +itertools = "0.11.0" [dev-dependencies] tempfile = "3.3.0" diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs new file mode 100644 index 0000000..6bf81bb --- /dev/null +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -0,0 +1,239 @@ +use std::path::PathBuf; + +use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; +use color_eyre::eyre::{self, Context}; +use color_eyre::Result; +use itertools::Itertools; +use tokio::fs; + +pub(crate) fn command_definition() -> Command { + Command::new("brute-force-words") + .about( + "Given a list of words and a set of delimiters, iteratevily creates permutations \ + of growing length.\n\ + Delimiters are placed between every word in the result.\n\n\ + Example: \ + Given the words ['packages', 'boot'], the delimiters ['/', '_'] and a length of 2, the resulting \ + words will be\n\ + - packages\n\ + - boot\n\ + - packages/packages\n\ + - packages_packages\n\ + - packages/boot\n\ + - packages_boot\n\ + - boot/packages\n\ + - boot_packages\n\ + - boot/boot\n\ + - boot_boot", + ) + .arg( + Arg::new("delimiter") + .help( + "The delimiters to put between the words. \ + All permutations of this list will be tried for every string of words.\n\ + Specify multiple times to set multiple values.\n\ + Defaults to ['/', '_'].", + ) + .short('d') + .long("delimiter") + .action(ArgAction::Append), + ) + .arg( + Arg::new("max-length") + .help("The maximum number of words up to which to build strings.") + .long("max") + .long("max-length") + .short('m') + .default_value("5") + .value_parser(value_parser!(usize)), + ) + .arg( + Arg::new("continue") + .help("Can be used to continue a previous operation where it stopped. Word list and delimiters must match.") + .short('c') + .long("continue") + ) + .arg( + Arg::new("words") + .help("Path to a file containing words line by line.") + .required(true) + .value_parser(value_parser!(PathBuf)), + ) +} + +#[tracing::instrument(skip_all)] +#[allow(clippy::mut_range_bound)] +pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + let max_length: usize = matches + .get_one::("max-length") + .copied() + .expect("parameter has default"); + + let words: Vec = { + let path = matches + .get_one::("words") + .expect("missing required parameter"); + + let file = fs::read_to_string(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + + file.lines().map(str::to_string).collect() + }; + + if words.is_empty() { + eyre::bail!("Word list must not be empty"); + } + + let mut delimiters: Vec = matches + .get_many::("delimiter") + .unwrap_or_default() + .cloned() + .collect(); + + if delimiters.is_empty() { + delimiters.push(String::from("/")); + delimiters.push(String::from("_")); + } + + let delimiters_len = delimiters.len(); + + let word_count = words.len(); + tracing::info!("{} words to try", word_count); + + // To be able to easily combine the permutations of words and delimiters, + // we turn the latter into a pre-defined list of all permutations of delimiters + // that are possible at the given amount of words. + // Combining `Iterator::cycle` with `Itertools::permutations` works, but + // with a high `max_length`, it runs OOM. + // So we basically have to implement a smaller version of the iterative algorithm we use later on + // to build permutations of the actual words. + let delimiter_lists = { + let mut indices = vec![0; max_length - 1]; + let mut list = Vec::new(); + + for _ in 0..delimiters_len.pow(max_length as u32 - 1) { + list.push(indices.iter().map(|i| &delimiters[*i]).collect::>()); + + for v in indices.iter_mut() { + if *v >= delimiters_len - 1 { + *v = 0; + break; + } else { + *v += 1; + } + } + } + + list + }; + + tracing::debug!("{:?}", delimiter_lists); + + let mut count = 0u64; + + let mut indices = if let Some(cont) = matches.get_one::("continue").cloned() { + let mut splits = vec![cont.clone()]; + + for delim in delimiters.iter() { + splits = splits + .iter() + .flat_map(|s| s.split(delim)) + .map(|s| s.to_string()) + .collect(); + } + + let indices = splits + .into_iter() + .map(|s| { + words + .iter() + .enumerate() + .find(|(_, v)| s == **v) + .map(|(i, _)| i) + .ok_or_else(|| eyre::eyre!("'{}' is not in the word list", s)) + }) + .collect::>()?; + + tracing::info!("Continuing from '{}' -> '{:?}'", cont, &indices); + + indices + } else { + vec![0] + }; + let mut indices_len = indices.len(); + let mut sequence = indices + .iter() + .map(|index| words[*index].as_str()) + .collect::>(); + + // Prevent re-allocation by reserving as much as we need upfront + indices.reserve(max_length); + sequence.reserve(max_length); + + 'outer: loop { + // We only want delimiters between words, so we keep that iterator shorter by + // one. + let delimiter_count = sequence.len() as u32 - 1; + + tracing::trace!( + "{} | {:?} -> {:?}", + delimiters_len.pow(delimiter_count), + indices, + sequence + ); + + for delims in delimiter_lists + .iter() + .take(delimiters_len.pow(delimiter_count)) + { + let delims = delims + .iter() + .map(|s| s.as_str()) + .take(delimiter_count as usize); + let s: String = sequence + .iter() + .copied() + .interleave(delims) + .flat_map(|word| word.chars()) + .collect(); + + count = count.wrapping_add(1); + + if count % 500000 == 0 { + tracing::info!("{} words generated", count); + } + + println!("{}", s); + } + + for i in 0..indices_len { + let index = indices.get_mut(i).unwrap(); + let word = sequence.get_mut(i).unwrap(); + + if *index >= word_count - 1 { + *index = 0; + *word = words[*index].as_str(); + + if indices.get(i + 1).is_none() { + indices.push(0); + sequence.push(words[0].as_str()); + + indices_len += 1; + + if indices_len > max_length { + break 'outer; + } + + break; + } + } else { + *index += 1; + *word = words[*index].as_str(); + break; + } + } + } + + Ok(()) +} diff --git a/crates/dtmt/src/cmd/experiment/mod.rs b/crates/dtmt/src/cmd/experiment/mod.rs index 51e5fc7..9ceb3b9 100644 --- a/crates/dtmt/src/cmd/experiment/mod.rs +++ b/crates/dtmt/src/cmd/experiment/mod.rs @@ -1,18 +1,21 @@ use clap::{ArgMatches, Command}; use color_eyre::Result; +mod brute_force_words; mod extract_words; pub(crate) fn command_definition() -> Command { Command::new("experiment") .subcommand_required(true) .about("A collection of utilities and experiments.") + .subcommand(brute_force_words::command_definition()) .subcommand(extract_words::command_definition()) } #[tracing::instrument(skip_all)] pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match matches.subcommand() { + Some(("brute-force-words", sub_matches)) => brute_force_words::run(ctx, sub_matches).await, Some(("extract-words", sub_matches)) => extract_words::run(ctx, sub_matches).await, _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" From 0d1193a12688567fc30b963b3d79c20d96bf55c4 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 18 Sep 2023 10:26:58 +0200 Subject: [PATCH 036/154] sdk: Improve word generation throughput It seems that the simple `println!()` is really bad when the goal is to write a lot of data to stdout. Presumably because it's unbuffered, but also because it required the preceding code to do a lot of allocations. This was replaced with a buffered writer on stdout, as well as an extra `Vec` that I can write everything to directly from the word and delimiter iterators, without allocating a single new structure. --- .../src/cmd/experiment/brute_force_words.rs | 76 ++++++++++++++++--- 1 file changed, 67 insertions(+), 9 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index 6bf81bb..d2891f9 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -5,6 +5,7 @@ use color_eyre::eyre::{self, Context}; use color_eyre::Result; use itertools::Itertools; use tokio::fs; +use tokio::io::{AsyncWriteExt, BufWriter}; pub(crate) fn command_definition() -> Command { Command::new("brute-force-words") @@ -98,6 +99,38 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> let delimiters_len = delimiters.len(); + let prefixes = [ + "", + "content/characters/", + "content/debug/", + "content/decals/", + "content/environment/", + "content/fx/", + "content/gizmos/", + "content/items/", + "content/levels/", + "content/liquid_area/", + "content/localization/", + "content/materials/", + "content/minion_impact_assets/", + "content/pickups/", + "content/shading_environments/", + "content/textures/", + "content/ui/", + "content/videos/", + "content/vo/", + "content/volume_types/", + "content/weapons/", + "packages/boot_assets/", + "packages/content/", + "packages/game_scripts/", + "packages/strings/", + "packages/ui/", + "wwise/events/", + "wwise/packages/", + "wwise/world_sound_fx/", + ]; + let word_count = words.len(); tracing::info!("{} words to try", word_count); @@ -171,6 +204,13 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> indices.reserve(max_length); sequence.reserve(max_length); + let mut writer = BufWriter::new(tokio::io::stdout()); + let mut buf = Vec::with_capacity(1024); + + const LINE_FEED: u8 = 0x0A; + const UNDERSCORE: u8 = 0x5F; + const ZERO: u8 = 0x30; + 'outer: loop { // We only want delimiters between words, so we keep that iterator shorter by // one. @@ -191,20 +231,38 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> .iter() .map(|s| s.as_str()) .take(delimiter_count as usize); - let s: String = sequence - .iter() - .copied() - .interleave(delims) - .flat_map(|word| word.chars()) - .collect(); + let s = sequence.iter().copied().interleave(delims.clone()); count = count.wrapping_add(1); - if count % 500000 == 0 { - tracing::info!("{} words generated", count); + buf.clear(); + + for prefix in prefixes.iter() { + buf.extend_from_slice(prefix.as_bytes()); + s.clone() + .for_each(|word| buf.extend_from_slice(word.as_bytes())); + // buf.extend_from_slice(s.as_bytes()); + buf.push(LINE_FEED); + + for i in 0..=9 { + buf.extend_from_slice(prefix.as_bytes()); + s.clone() + .for_each(|word| buf.extend_from_slice(word.as_bytes())); + buf.push(UNDERSCORE); + buf.push(ZERO + i); + buf.push(LINE_FEED); + + buf.extend_from_slice(prefix.as_bytes()); + s.clone() + .for_each(|word| buf.extend_from_slice(word.as_bytes())); + buf.push(UNDERSCORE); + buf.push(ZERO); + buf.push(ZERO + i); + buf.push(LINE_FEED); + } } - println!("{}", s); + writer.write_all(&buf).await?; } for i in 0..indices_len { From 4480144d92db48f1f1515ef046984f941f14a89f Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 18 Sep 2023 13:29:42 +0200 Subject: [PATCH 037/154] sdk: Implement guessing a list of hashes While the approach to generate and store a list of strings does allow for this list to be re-used in the future, the I/O involved turned out to be quite costly. While the generation can run at up to 500 MiB/s, even compressing that on the fly doesn't reach fast enough write speeds on a HDD. And compression is also necessary to store this amount of data (generation reached two TB of raw data with a word length of just three, which is still 600 GB compressed). But compression also makes working with that data a lot harder. So this instead combines both the generation and search into a single step. The intermediate result of the generation is therefore lost, but the overall pipeline is much faster. --- .../src/cmd/experiment/brute_force_words.rs | 120 +++++++++++++++--- 1 file changed, 102 insertions(+), 18 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index d2891f9..bb3aa9e 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -1,11 +1,14 @@ +use std::collections::HashSet; use std::path::PathBuf; use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; use color_eyre::eyre::{self, Context}; use color_eyre::Result; use itertools::Itertools; +use sdk::murmur::Murmur64; use tokio::fs; -use tokio::io::{AsyncWriteExt, BufWriter}; +use tokio::io::AsyncWriteExt; +use tokio::time::Instant; pub(crate) fn command_definition() -> Command { Command::new("brute-force-words") @@ -60,6 +63,15 @@ pub(crate) fn command_definition() -> Command { .required(true) .value_parser(value_parser!(PathBuf)), ) + .arg( + Arg::new("hashes") + .help( + "Path to a file containing the hashes to attempt to brute force. \ + Hashes are expected in hexadecimal notiation. \ + Only 64-bit hashes are supported." + ) + .value_parser(value_parser!(PathBuf)), + ) } #[tracing::instrument(skip_all)] @@ -86,6 +98,25 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> eyre::bail!("Word list must not be empty"); } + let hashes = if let Some(path) = matches.get_one::("hashes") { + let content = fs::read_to_string(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + + let hashes: Result, _> = content + .lines() + .map(|s| u64::from_str_radix(s, 16).map(Murmur64::from)) + .collect(); + + let hashes = hashes?; + + tracing::trace!("{:?}", hashes); + + Some(hashes) + } else { + None + }; + let mut delimiters: Vec = matches .get_many::("delimiter") .unwrap_or_default() @@ -163,8 +194,6 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> tracing::debug!("{:?}", delimiter_lists); - let mut count = 0u64; - let mut indices = if let Some(cont) = matches.get_one::("continue").cloned() { let mut splits = vec![cont.clone()]; @@ -204,7 +233,12 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> indices.reserve(max_length); sequence.reserve(max_length); - let mut writer = BufWriter::new(tokio::io::stdout()); + let mut count: usize = 0; + let mut found: usize = 0; + let mut start = Instant::now(); + + // let mut writer = BufWriter::new(tokio::io::stdout()); + let mut writer = tokio::io::stdout(); let mut buf = Vec::with_capacity(1024); const LINE_FEED: u8 = 0x0A; @@ -216,13 +250,6 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> // one. let delimiter_count = sequence.len() as u32 - 1; - tracing::trace!( - "{} | {:?} -> {:?}", - delimiters_len.pow(delimiter_count), - indices, - sequence - ); - for delims in delimiter_lists .iter() .take(delimiters_len.pow(delimiter_count)) @@ -233,16 +260,25 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> .take(delimiter_count as usize); let s = sequence.iter().copied().interleave(delims.clone()); - count = count.wrapping_add(1); - buf.clear(); for prefix in prefixes.iter() { buf.extend_from_slice(prefix.as_bytes()); s.clone() .for_each(|word| buf.extend_from_slice(word.as_bytes())); - // buf.extend_from_slice(s.as_bytes()); - buf.push(LINE_FEED); + + if let Some(hashes) = &hashes { + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + buf.push(LINE_FEED); + writer.write_all(&buf).await?; + } + + buf.clear(); + } else { + buf.push(LINE_FEED); + } for i in 0..=9 { buf.extend_from_slice(prefix.as_bytes()); @@ -250,7 +286,19 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> .for_each(|word| buf.extend_from_slice(word.as_bytes())); buf.push(UNDERSCORE); buf.push(ZERO + i); - buf.push(LINE_FEED); + + if let Some(hashes) = &hashes { + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + buf.push(LINE_FEED); + writer.write_all(&buf).await?; + } + + buf.clear(); + } else { + buf.push(LINE_FEED); + } buf.extend_from_slice(prefix.as_bytes()); s.clone() @@ -258,11 +306,47 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> buf.push(UNDERSCORE); buf.push(ZERO); buf.push(ZERO + i); - buf.push(LINE_FEED); + + if let Some(hashes) = &hashes { + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + buf.push(LINE_FEED); + writer.write_all(&buf).await?; + } + + buf.clear(); + } else { + buf.push(LINE_FEED); + } } } - writer.write_all(&buf).await?; + if let Some(hashes) = &hashes { + count += prefixes.len() * 20; + + let dur = Instant::now() - start; + if dur.as_secs() >= 1 { + let hashes_len = hashes.len(); + // Don't care when it finishes, don't care if it fails. + tokio::spawn(async move { + let _ = tokio::io::stderr() + .write_all( + format!( + "\r{} hashes per second, {}/{} found", + count, found, hashes_len + ) + .as_bytes(), + ) + .await; + }); + + start = Instant::now(); + count = 0; + } + } else { + writer.write_all(&buf).await?; + } } for i in 0..indices_len { From 951a7f82c0a2f1532df9a14ff622504a03bc20a7 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 19 Sep 2023 15:28:40 +0200 Subject: [PATCH 038/154] sdk: Improve word generation --- .../src/cmd/experiment/brute_force_words.rs | 164 +++++++++--------- 1 file changed, 79 insertions(+), 85 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index bb3aa9e..7e93dcc 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -70,6 +70,7 @@ pub(crate) fn command_definition() -> Command { Hashes are expected in hexadecimal notiation. \ Only 64-bit hashes are supported." ) + .required(true) .value_parser(value_parser!(PathBuf)), ) } @@ -98,7 +99,10 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> eyre::bail!("Word list must not be empty"); } - let hashes = if let Some(path) = matches.get_one::("hashes") { + let hashes = { + let path = matches + .get_one::("hashes") + .expect("missing required argument"); let content = fs::read_to_string(&path) .await .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; @@ -112,9 +116,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> tracing::trace!("{:?}", hashes); - Some(hashes) - } else { - None + hashes }; let mut delimiters: Vec = matches @@ -250,103 +252,95 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> // one. let delimiter_count = sequence.len() as u32 - 1; - for delims in delimiter_lists - .iter() - .take(delimiters_len.pow(delimiter_count)) - { - let delims = delims - .iter() - .map(|s| s.as_str()) - .take(delimiter_count as usize); - let s = sequence.iter().copied().interleave(delims.clone()); - + for prefix in prefixes.iter().map(|p| p.as_bytes()) { buf.clear(); - for prefix in prefixes.iter() { - buf.extend_from_slice(prefix.as_bytes()); - s.clone() + // We can keep the prefix at the front of the buffer and only + // replace the parts after that. + let prefix_len = prefix.len(); + buf.extend_from_slice(prefix); + + for delims in delimiter_lists + .iter() + .take(delimiters_len.pow(delimiter_count)) + { + buf.truncate(prefix_len); + + let delims = delims + .iter() + .map(|s| s.as_str()) + .take(delimiter_count as usize); + sequence + .iter() + .copied() + .interleave(delims.clone()) .for_each(|word| buf.extend_from_slice(word.as_bytes())); - if let Some(hashes) = &hashes { - let hash = Murmur64::hash(&buf); - if hashes.contains(&hash) { - found += 1; - buf.push(LINE_FEED); - writer.write_all(&buf).await?; - } + count += 1; - buf.clear(); - } else { + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; buf.push(LINE_FEED); - } + writer.write_all(&buf).await?; + } else { + let word_len = buf.len(); - for i in 0..=9 { - buf.extend_from_slice(prefix.as_bytes()); - s.clone() - .for_each(|word| buf.extend_from_slice(word.as_bytes())); - buf.push(UNDERSCORE); - buf.push(ZERO + i); + // If the regular word itself didn't match, we check + // for numbered suffixes. + // For now, we only check up to `09` to avoid more complex logic + // writing into the buffer. + // Packages that contain files with higher numbers than this + // should hopefully become easier to spot once a good number of + // hashes is found. + for i in 1..=9 { + buf.truncate(word_len); + buf.push(UNDERSCORE); + buf.push(ZERO); + buf.push(ZERO + i); + + count += 1; - if let Some(hashes) = &hashes { let hash = Murmur64::hash(&buf); if hashes.contains(&hash) { found += 1; buf.push(LINE_FEED); writer.write_all(&buf).await?; + } else { + break; } - - buf.clear(); - } else { - buf.push(LINE_FEED); - } - - buf.extend_from_slice(prefix.as_bytes()); - s.clone() - .for_each(|word| buf.extend_from_slice(word.as_bytes())); - buf.push(UNDERSCORE); - buf.push(ZERO); - buf.push(ZERO + i); - - if let Some(hashes) = &hashes { - let hash = Murmur64::hash(&buf); - if hashes.contains(&hash) { - found += 1; - buf.push(LINE_FEED); - writer.write_all(&buf).await?; - } - - buf.clear(); - } else { - buf.push(LINE_FEED); } } } + } - if let Some(hashes) = &hashes { - count += prefixes.len() * 20; + let dur = Instant::now() - start; + if dur.as_secs() >= 1 { + let hashes_len = hashes.len(); + let s = String::from_utf8_lossy(&buf); + // The last prefix in the set is the one that will stay in the buffer + // when we're about to print here. + // So we strip that, to show just the generated part. + // We also restrict the length to stay on a single line. + let prefix_len = prefixes[28].len(); + let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] + .trim_end() + .to_string(); + // Don't care when it finishes, don't care if it fails. + tokio::spawn(async move { + let _ = tokio::io::stderr() + .write_all( + format!( + "\r{:8} hashes per second | {:6}/{} found | {:<60}", + count, found, hashes_len, s + ) + .as_bytes(), + ) + .await; + }); - let dur = Instant::now() - start; - if dur.as_secs() >= 1 { - let hashes_len = hashes.len(); - // Don't care when it finishes, don't care if it fails. - tokio::spawn(async move { - let _ = tokio::io::stderr() - .write_all( - format!( - "\r{} hashes per second, {}/{} found", - count, found, hashes_len - ) - .as_bytes(), - ) - .await; - }); - - start = Instant::now(); - count = 0; - } - } else { - writer.write_all(&buf).await?; - } + start = Instant::now(); + count = 0; } for i in 0..indices_len { @@ -358,15 +352,15 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> *word = words[*index].as_str(); if indices.get(i + 1).is_none() { - indices.push(0); - sequence.push(words[0].as_str()); - indices_len += 1; if indices_len > max_length { break 'outer; } + indices.push(0); + sequence.push(words[0].as_str()); + break; } } else { From b366185a63f8182b1c9d8e32b16f738a42f7a912 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 19 Sep 2023 15:29:40 +0200 Subject: [PATCH 039/154] sdk: Implement worker pool for word generation Massive speed improvement. The index generation is really fast, and it appears that even worker numbers way higher than the core/thread count still increase the throughput slightly. The only missing part is the info output. That's broken, currently. --- Cargo.lock | 49 ++ crates/dtmt/Cargo.toml | 1 + .../src/cmd/experiment/brute_force_words.rs | 544 +++++++++++------- crates/dtmt/src/cmd/experiment/mod.rs | 4 +- 4 files changed, 401 insertions(+), 197 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index dac07e9..3a02b55 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -658,6 +658,20 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "crossbeam" +version = "0.8.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2801af0d36612ae591caa9568261fddce32ce6e08a7275ea334a06a4ad021a2c" +dependencies = [ + "cfg-if", + "crossbeam-channel", + "crossbeam-deque", + "crossbeam-epoch", + "crossbeam-queue", + "crossbeam-utils", +] + [[package]] name = "crossbeam-channel" version = "0.5.12" @@ -667,6 +681,40 @@ dependencies = [ "crossbeam-utils", ] +[[package]] +name = "crossbeam-deque" +version = "0.8.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce6fd6f855243022dcecf8702fef0c297d4338e226845fe067f6341ad9fa0cef" +dependencies = [ + "cfg-if", + "crossbeam-epoch", + "crossbeam-utils", +] + +[[package]] +name = "crossbeam-epoch" +version = "0.9.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae211234986c545741a7dc064309f67ee1e5ad243d0e48335adc0484d960bcc7" +dependencies = [ + "autocfg", + "cfg-if", + "crossbeam-utils", + "memoffset 0.9.1", + "scopeguard", +] + +[[package]] +name = "crossbeam-queue" +version = "0.3.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1cfb3ea8a53f37c40dea2c7bedcbd88bdfae54f5e2175d6ecaff1c988353add" +dependencies = [ + "cfg-if", + "crossbeam-utils", +] + [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -943,6 +991,7 @@ dependencies = [ "cli-table", "color-eyre", "confy", + "crossbeam", "csv-async", "dtmt-shared", "futures", diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index 8018a8b..e80feaa 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -35,6 +35,7 @@ luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } shlex = { version = "1.2.0", optional = true } atty = "0.2.14" itertools = "0.11.0" +crossbeam = { version = "0.8.2", features = ["crossbeam-deque"] } [dev-dependencies] tempfile = "3.3.0" diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index 7e93dcc..aa15003 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -1,13 +1,16 @@ use std::collections::HashSet; +use std::fs; +use std::io::Write; use std::path::PathBuf; +use std::sync::Arc; +use std::thread::JoinHandle; use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; use color_eyre::eyre::{self, Context}; use color_eyre::Result; +use crossbeam::channel::{bounded, unbounded, Receiver, Sender}; use itertools::Itertools; use sdk::murmur::Murmur64; -use tokio::fs; -use tokio::io::AsyncWriteExt; use tokio::time::Instant; pub(crate) fn command_definition() -> Command { @@ -57,6 +60,14 @@ pub(crate) fn command_definition() -> Command { .short('c') .long("continue") ) + .arg( + Arg::new("threads") + .help("The number of workers to run in parallel.") + .long("threads") + .short('n') + .default_value("6") + .value_parser(value_parser!(usize)) + ) .arg( Arg::new("words") .help("Path to a file containing words line by line.") @@ -75,36 +86,307 @@ pub(crate) fn command_definition() -> Command { ) } +const LINE_FEED: u8 = 0x0A; +const UNDERSCORE: u8 = 0x5F; +const ZERO: u8 = 0x30; + +const PREFIXES: [&str; 29] = [ + "", + "content/characters/", + "content/debug/", + "content/decals/", + "content/environment/", + "content/fx/", + "content/gizmos/", + "content/items/", + "content/levels/", + "content/liquid_area/", + "content/localization/", + "content/materials/", + "content/minion_impact_assets/", + "content/pickups/", + "content/shading_environments/", + "content/textures/", + "content/ui/", + "content/videos/", + "content/vo/", + "content/volume_types/", + "content/weapons/", + "packages/boot_assets/", + "packages/content/", + "packages/game_scripts/", + "packages/strings/", + "packages/ui/", + "wwise/events/", + "wwise/packages/", + "wwise/world_sound_fx/", +]; + +fn make_info_printer(rx: Receiver<(usize, usize)>, hash_count: usize) -> JoinHandle<()> { + std::thread::spawn(move || { + let mut writer = std::io::stderr(); + let mut total_count = 0; + let mut total_found = 0; + + let start = Instant::now(); + + while let Ok((count, found)) = rx.recv() { + total_count += count; + total_found += found; + + let dur = Instant::now() - start; + if dur.as_secs() > 1 { + let s = format!("\r{total_count} per second | {total_found:6}/{hash_count} found",); + + // let s = String::from_utf8_lossy(&buf); + // // The last prefix in the set is the one that will stay in the buffer + // // when we're about to print here. + // // So we strip that, to show just the generated part. + // // We also restrict the length to stay on a single line. + // let prefix_len = prefixes[28].len(); + // let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] + // .trim_end() + // .to_string(); + + writer.write_all(s.as_bytes()).unwrap(); + + total_count = 0; + } + } + }) +} + +fn make_stdout_printer(rx: Receiver>) -> JoinHandle<()> { + std::thread::spawn(move || { + let mut writer = std::io::stdout(); + + while let Ok(buf) = rx.recv() { + writer.write_all(&buf).unwrap(); + } + }) +} + +struct State { + delimiter_lists: Arc>>, + hashes: Arc>, + words: Arc>, + delimiters_len: usize, + stdout_tx: Sender>, + info_tx: Sender<(usize, usize)>, +} + +fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { + std::thread::spawn(move || { + let delimiter_lists = &state.delimiter_lists; + let hashes = &state.hashes; + let words = &state.words; + let delimiters_len = state.delimiters_len; + + let mut count = 0; + let mut found = 0; + let mut buf = Vec::with_capacity(1024); + + // while let Some(indices) = find_task(local, global, &[]) { + while let Ok(indices) = rx.recv() { + let sequence = indices.iter().map(|i| words[*i].as_str()); + + // We only want delimiters between words, so we keep that iterator shorter by + // one. + let delimiter_count = sequence.len() as u32 - 1; + + for prefix in PREFIXES.iter().map(|p| p.as_bytes()) { + buf.clear(); + + // We can keep the prefix at the front of the buffer and only + // replace the parts after that. + let prefix_len = prefix.len(); + buf.extend_from_slice(prefix); + + for delims in delimiter_lists + .iter() + .take(delimiters_len.pow(delimiter_count)) + { + buf.truncate(prefix_len); + + let delims = delims + .iter() + .map(|s| s.as_str()) + .take(delimiter_count as usize); + sequence + .clone() + .interleave(delims.clone()) + .for_each(|word| buf.extend_from_slice(word.as_bytes())); + + count += 1; + + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + + buf.push(LINE_FEED); + if let Err(_) = state.stdout_tx.send(buf.clone()) { + return; + } + } else { + let word_len = buf.len(); + + // If the regular word itself didn't match, we check + // for numbered suffixes. + // For now, we only check up to `09` to avoid more complex logic + // writing into the buffer. + // Packages that contain files with higher numbers than this + // should hopefully become easier to spot once a good number of + // hashes is found. + for i in 1..=9 { + buf.truncate(word_len); + buf.push(UNDERSCORE); + buf.push(ZERO); + buf.push(ZERO + i); + + count += 1; + + let hash = Murmur64::hash(&buf); + if hashes.contains(&hash) { + found += 1; + + buf.push(LINE_FEED); + if let Err(_) = state.stdout_tx.send(buf.clone()) { + return; + } + } else { + break; + } + } + } + } + } + + if count >= 1024 * 1024 { + let _ = state.info_tx.send((count, found)); + } + + // let dur = Instant::now() - start; + // if dur.as_secs() >= 1 { + // let hashes_len = hashes.len(); + // let s = String::from_utf8_lossy(&buf); + // // The last prefix in the set is the one that will stay in the buffer + // // when we're about to print here. + // // So we strip that, to show just the generated part. + // // We also restrict the length to stay on a single line. + // let prefix_len = prefixes[28].len(); + // let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] + // .trim_end() + // .to_string(); + // info_tx.send(format!( + // "\r{:8} hashes per second | {:6}/{} found | {:<60}", + // count, found, hashes_len, s + // )); + + // start = Instant::now(); + // count = 0; + // } + } + }) +} + +fn build_delimiter_lists(delimiters: impl AsRef<[String]>, max_length: usize) -> Vec> { + let delimiters = delimiters.as_ref(); + let mut indices = vec![0; max_length]; + let mut list = Vec::new(); + + for _ in 0..delimiters.len().pow(max_length as u32) { + list.push( + indices + .iter() + .map(|i| delimiters[*i].clone()) + .collect::>(), + ); + + for v in indices.iter_mut() { + if *v >= delimiters.len() - 1 { + *v = 0; + break; + } else { + *v += 1; + } + } + } + + list +} + +fn build_initial_indices( + cont: Option<&String>, + delimiters: impl AsRef<[String]>, + words: impl AsRef<[String]>, +) -> Result> { + if let Some(cont) = cont { + let mut splits = vec![cont.clone()]; + + for delim in delimiters.as_ref().iter() { + splits = splits + .iter() + .flat_map(|s| s.split(delim)) + .map(|s| s.to_string()) + .collect(); + } + + let indices = splits + .into_iter() + .map(|s| { + words + .as_ref() + .iter() + .enumerate() + .find(|(_, v)| s == **v) + .map(|(i, _)| i) + .ok_or_else(|| eyre::eyre!("'{}' is not in the word list", s)) + }) + .collect::>()?; + + tracing::info!("Continuing from '{}' -> '{:?}'", cont, &indices); + + Ok(indices) + } else { + Ok(vec![0]) + } +} + #[tracing::instrument(skip_all)] #[allow(clippy::mut_range_bound)] -pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { +pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { let max_length: usize = matches .get_one::("max-length") .copied() .expect("parameter has default"); - let words: Vec = { + let num_threads: usize = matches + .get_one::("threads") + .copied() + .expect("parameter has default"); + + let words = { let path = matches .get_one::("words") .expect("missing required parameter"); - let file = fs::read_to_string(&path) - .await + let file = fs::read_to_string(path) .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; - file.lines().map(str::to_string).collect() - }; + let words: Vec<_> = file.lines().map(str::to_string).collect(); - if words.is_empty() { - eyre::bail!("Word list must not be empty"); - } + if words.is_empty() { + eyre::bail!("Word list must not be empty"); + } + + Arc::new(words) + }; let hashes = { let path = matches .get_one::("hashes") .expect("missing required argument"); - let content = fs::read_to_string(&path) - .await + let content = fs::read_to_string(path) .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; let hashes: Result, _> = content @@ -116,7 +398,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> tracing::trace!("{:?}", hashes); - hashes + Arc::new(hashes) }; let mut delimiters: Vec = matches @@ -132,38 +414,6 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> let delimiters_len = delimiters.len(); - let prefixes = [ - "", - "content/characters/", - "content/debug/", - "content/decals/", - "content/environment/", - "content/fx/", - "content/gizmos/", - "content/items/", - "content/levels/", - "content/liquid_area/", - "content/localization/", - "content/materials/", - "content/minion_impact_assets/", - "content/pickups/", - "content/shading_environments/", - "content/textures/", - "content/ui/", - "content/videos/", - "content/vo/", - "content/volume_types/", - "content/weapons/", - "packages/boot_assets/", - "packages/content/", - "packages/game_scripts/", - "packages/strings/", - "packages/ui/", - "wwise/events/", - "wwise/packages/", - "wwise/world_sound_fx/", - ]; - let word_count = words.len(); tracing::info!("{} words to try", word_count); @@ -175,56 +425,43 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> // So we basically have to implement a smaller version of the iterative algorithm we use later on // to build permutations of the actual words. let delimiter_lists = { - let mut indices = vec![0; max_length - 1]; - let mut list = Vec::new(); - - for _ in 0..delimiters_len.pow(max_length as u32 - 1) { - list.push(indices.iter().map(|i| &delimiters[*i]).collect::>()); - - for v in indices.iter_mut() { - if *v >= delimiters_len - 1 { - *v = 0; - break; - } else { - *v += 1; - } - } - } - - list + let lists = build_delimiter_lists(&delimiters, max_length - 1); + Arc::new(lists) }; - tracing::debug!("{:?}", delimiter_lists); - let mut indices = if let Some(cont) = matches.get_one::("continue").cloned() { - let mut splits = vec![cont.clone()]; + let (info_tx, info_rx) = unbounded(); + let (stdout_tx, stdout_rx) = unbounded::>(); + let (task_tx, task_rx) = bounded::>(100); + let mut handles = Vec::new(); - for delim in delimiters.iter() { - splits = splits - .iter() - .flat_map(|s| s.split(delim)) - .map(|s| s.to_string()) - .collect(); - } + for _ in 0..num_threads { + let handle = make_worker( + task_rx.clone(), + State { + delimiter_lists: Arc::clone(&delimiter_lists), + hashes: Arc::clone(&hashes), + words: Arc::clone(&words), + delimiters_len, + stdout_tx: stdout_tx.clone(), + info_tx: info_tx.clone(), + }, + ); + handles.push(handle); + } + // These are only used inside the worker threads, but due to the loops above, we had to + // clone them one too many times. + // So we drop that extra reference immediately, to ensure that the channels can + // disconnect properly when the threads finish. + drop(stdout_tx); + drop(info_tx); - let indices = splits - .into_iter() - .map(|s| { - words - .iter() - .enumerate() - .find(|(_, v)| s == **v) - .map(|(i, _)| i) - .ok_or_else(|| eyre::eyre!("'{}' is not in the word list", s)) - }) - .collect::>()?; + // handles.push(make_info_printer(info_rx, hashes.len())); + handles.push(make_stdout_printer(stdout_rx)); - tracing::info!("Continuing from '{}' -> '{:?}'", cont, &indices); - - indices - } else { - vec![0] - }; + let mut indices = + build_initial_indices(matches.get_one::("continue"), &delimiters, &*words) + .wrap_err("Failed to build initial indices")?; let mut indices_len = indices.len(); let mut sequence = indices .iter() @@ -235,113 +472,8 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> indices.reserve(max_length); sequence.reserve(max_length); - let mut count: usize = 0; - let mut found: usize = 0; - let mut start = Instant::now(); - - // let mut writer = BufWriter::new(tokio::io::stdout()); - let mut writer = tokio::io::stdout(); - let mut buf = Vec::with_capacity(1024); - - const LINE_FEED: u8 = 0x0A; - const UNDERSCORE: u8 = 0x5F; - const ZERO: u8 = 0x30; - 'outer: loop { - // We only want delimiters between words, so we keep that iterator shorter by - // one. - let delimiter_count = sequence.len() as u32 - 1; - - for prefix in prefixes.iter().map(|p| p.as_bytes()) { - buf.clear(); - - // We can keep the prefix at the front of the buffer and only - // replace the parts after that. - let prefix_len = prefix.len(); - buf.extend_from_slice(prefix); - - for delims in delimiter_lists - .iter() - .take(delimiters_len.pow(delimiter_count)) - { - buf.truncate(prefix_len); - - let delims = delims - .iter() - .map(|s| s.as_str()) - .take(delimiter_count as usize); - sequence - .iter() - .copied() - .interleave(delims.clone()) - .for_each(|word| buf.extend_from_slice(word.as_bytes())); - - count += 1; - - let hash = Murmur64::hash(&buf); - if hashes.contains(&hash) { - found += 1; - buf.push(LINE_FEED); - writer.write_all(&buf).await?; - } else { - let word_len = buf.len(); - - // If the regular word itself didn't match, we check - // for numbered suffixes. - // For now, we only check up to `09` to avoid more complex logic - // writing into the buffer. - // Packages that contain files with higher numbers than this - // should hopefully become easier to spot once a good number of - // hashes is found. - for i in 1..=9 { - buf.truncate(word_len); - buf.push(UNDERSCORE); - buf.push(ZERO); - buf.push(ZERO + i); - - count += 1; - - let hash = Murmur64::hash(&buf); - if hashes.contains(&hash) { - found += 1; - buf.push(LINE_FEED); - writer.write_all(&buf).await?; - } else { - break; - } - } - } - } - } - - let dur = Instant::now() - start; - if dur.as_secs() >= 1 { - let hashes_len = hashes.len(); - let s = String::from_utf8_lossy(&buf); - // The last prefix in the set is the one that will stay in the buffer - // when we're about to print here. - // So we strip that, to show just the generated part. - // We also restrict the length to stay on a single line. - let prefix_len = prefixes[28].len(); - let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] - .trim_end() - .to_string(); - // Don't care when it finishes, don't care if it fails. - tokio::spawn(async move { - let _ = tokio::io::stderr() - .write_all( - format!( - "\r{:8} hashes per second | {:6}/{} found | {:<60}", - count, found, hashes_len, s - ) - .as_bytes(), - ) - .await; - }); - - start = Instant::now(); - count = 0; - } + task_tx.send(indices.clone())?; for i in 0..indices_len { let index = indices.get_mut(i).unwrap(); @@ -371,5 +503,25 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> } } + // Dropping the senders will disconnect the channel, + // so that the threads holding the other end will eventually + // complete as well. + drop(task_tx); + + tracing::debug!("Wainting for workers to finish."); + + for handle in handles { + match handle.join() { + Ok(_) => {} + Err(value) => { + if let Some(err) = value.downcast_ref::() { + eyre::bail!("Thread failed: {}", err); + } else { + eyre::bail!("Thread failed with unknown error: {:?}", value); + } + } + } + } + Ok(()) } diff --git a/crates/dtmt/src/cmd/experiment/mod.rs b/crates/dtmt/src/cmd/experiment/mod.rs index 9ceb3b9..c53d9b5 100644 --- a/crates/dtmt/src/cmd/experiment/mod.rs +++ b/crates/dtmt/src/cmd/experiment/mod.rs @@ -15,7 +15,9 @@ pub(crate) fn command_definition() -> Command { #[tracing::instrument(skip_all)] pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match matches.subcommand() { - Some(("brute-force-words", sub_matches)) => brute_force_words::run(ctx, sub_matches).await, + // It's fine to block here, as this is the only thing that's executing on the runtime. + // The other option with `spawn_blocking` would require setting up values to be Send+Sync. + Some(("brute-force-words", sub_matches)) => brute_force_words::run(ctx, sub_matches), Some(("extract-words", sub_matches)) => extract_words::run(ctx, sub_matches).await, _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" From 64493547143f43b90e405a9ef98fe31066de93a9 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 19 Sep 2023 16:15:22 +0200 Subject: [PATCH 040/154] sdk: Reimplement logging current word --- .../src/cmd/experiment/brute_force_words.rs | 86 ++++++++----------- 1 file changed, 36 insertions(+), 50 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index aa15003..4bf8556 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -1,6 +1,6 @@ use std::collections::HashSet; use std::fs; -use std::io::Write; +use std::io::{BufWriter, Write}; use std::path::PathBuf; use std::sync::Arc; use std::thread::JoinHandle; @@ -122,35 +122,30 @@ const PREFIXES: [&str; 29] = [ "wwise/world_sound_fx/", ]; -fn make_info_printer(rx: Receiver<(usize, usize)>, hash_count: usize) -> JoinHandle<()> { +fn make_info_printer(rx: Receiver<(usize, usize, String)>, hash_count: usize) -> JoinHandle<()> { std::thread::spawn(move || { let mut writer = std::io::stderr(); let mut total_count = 0; let mut total_found = 0; - let start = Instant::now(); + let mut start = Instant::now(); - while let Ok((count, found)) = rx.recv() { + while let Ok((count, found, last)) = rx.recv() { total_count += count; total_found += found; - let dur = Instant::now() - start; - if dur.as_secs() > 1 { - let s = format!("\r{total_count} per second | {total_found:6}/{hash_count} found",); - - // let s = String::from_utf8_lossy(&buf); - // // The last prefix in the set is the one that will stay in the buffer - // // when we're about to print here. - // // So we strip that, to show just the generated part. - // // We also restrict the length to stay on a single line. - // let prefix_len = prefixes[28].len(); - // let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] - // .trim_end() - // .to_string(); + let now = Instant::now(); + if (now - start).as_millis() > 250 { + let s = &last[0..std::cmp::min(last.len(), 60)]; + let s = format!( + "\r{:12} per second | {total_found:6}/{hash_count} found | {s:<60}", + total_count * 4 + ); writer.write_all(s.as_bytes()).unwrap(); total_count = 0; + start = now; } } }) @@ -158,7 +153,7 @@ fn make_info_printer(rx: Receiver<(usize, usize)>, hash_count: usize) -> JoinHan fn make_stdout_printer(rx: Receiver>) -> JoinHandle<()> { std::thread::spawn(move || { - let mut writer = std::io::stdout(); + let mut writer = BufWriter::new(std::io::stdout()); while let Ok(buf) = rx.recv() { writer.write_all(&buf).unwrap(); @@ -172,7 +167,7 @@ struct State { words: Arc>, delimiters_len: usize, stdout_tx: Sender>, - info_tx: Sender<(usize, usize)>, + info_tx: Sender<(usize, usize, String)>, } fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { @@ -186,7 +181,6 @@ fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { let mut found = 0; let mut buf = Vec::with_capacity(1024); - // while let Some(indices) = find_task(local, global, &[]) { while let Ok(indices) = rx.recv() { let sequence = indices.iter().map(|i| words[*i].as_str()); @@ -224,7 +218,7 @@ fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { found += 1; buf.push(LINE_FEED); - if let Err(_) = state.stdout_tx.send(buf.clone()) { + if state.stdout_tx.send(buf.clone()).is_err() { return; } } else { @@ -250,7 +244,7 @@ fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { found += 1; buf.push(LINE_FEED); - if let Err(_) = state.stdout_tx.send(buf.clone()) { + if state.stdout_tx.send(buf.clone()).is_err() { return; } } else { @@ -261,30 +255,22 @@ fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { } } - if count >= 1024 * 1024 { - let _ = state.info_tx.send((count, found)); + if count >= 2 * 1024 * 1024 { + // The last prefix in the set is the one that will stay in the buffer + // when we're about to print here. + // So we strip that, to show just the generated part. + // We also restrict the length to stay on a single line. + let prefix_len = PREFIXES[28].len(); + // No need to wait for this + let _ = state.info_tx.try_send(( + count, + found, + String::from_utf8_lossy(&buf[prefix_len..]).to_string(), + )); + + count = 0; + found = 0; } - - // let dur = Instant::now() - start; - // if dur.as_secs() >= 1 { - // let hashes_len = hashes.len(); - // let s = String::from_utf8_lossy(&buf); - // // The last prefix in the set is the one that will stay in the buffer - // // when we're about to print here. - // // So we strip that, to show just the generated part. - // // We also restrict the length to stay on a single line. - // let prefix_len = prefixes[28].len(); - // let s = s[prefix_len..std::cmp::min(s.len(), prefix_len + 60)] - // .trim_end() - // .to_string(); - // info_tx.send(format!( - // "\r{:8} hashes per second | {:6}/{} found | {:<60}", - // count, found, hashes_len, s - // )); - - // start = Instant::now(); - // count = 0; - // } } }) } @@ -430,9 +416,9 @@ pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { }; tracing::debug!("{:?}", delimiter_lists); - let (info_tx, info_rx) = unbounded(); + let (info_tx, info_rx) = bounded(100); let (stdout_tx, stdout_rx) = unbounded::>(); - let (task_tx, task_rx) = bounded::>(100); + let (task_tx, task_rx) = bounded::>(num_threads * 4); let mut handles = Vec::new(); for _ in 0..num_threads { @@ -456,7 +442,7 @@ pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { drop(stdout_tx); drop(info_tx); - // handles.push(make_info_printer(info_rx, hashes.len())); + handles.push(make_info_printer(info_rx, hashes.len())); handles.push(make_stdout_printer(stdout_rx)); let mut indices = @@ -508,8 +494,6 @@ pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { // complete as well. drop(task_tx); - tracing::debug!("Wainting for workers to finish."); - for handle in handles { match handle.join() { Ok(_) => {} @@ -523,5 +507,7 @@ pub(crate) fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { } } + let _ = std::io::stdout().write_all("\r".as_bytes()); + Ok(()) } From 6ada4c1c43298c11593422b0c0aa2330738ae5fe Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 20 Sep 2023 11:33:24 +0200 Subject: [PATCH 041/154] sdk: Add additional brute force prefixes --- crates/dtmt/src/cmd/experiment/brute_force_words.rs | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/brute_force_words.rs b/crates/dtmt/src/cmd/experiment/brute_force_words.rs index 4bf8556..26d887f 100644 --- a/crates/dtmt/src/cmd/experiment/brute_force_words.rs +++ b/crates/dtmt/src/cmd/experiment/brute_force_words.rs @@ -90,13 +90,14 @@ const LINE_FEED: u8 = 0x0A; const UNDERSCORE: u8 = 0x5F; const ZERO: u8 = 0x30; -const PREFIXES: [&str; 29] = [ +const PREFIXES: [&str; 36] = [ "", "content/characters/", "content/debug/", "content/decals/", "content/environment/", "content/fx/", + "content/fx/particles/", "content/gizmos/", "content/items/", "content/levels/", @@ -112,14 +113,20 @@ const PREFIXES: [&str; 29] = [ "content/vo/", "content/volume_types/", "content/weapons/", + "content/", + "core/", + "core/units/", "packages/boot_assets/", "packages/content/", "packages/game_scripts/", "packages/strings/", "packages/ui/", + "packages/", "wwise/events/", "wwise/packages/", "wwise/world_sound_fx/", + "wwise/events/weapons/", + "wwise/events/minions/", ]; fn make_info_printer(rx: Receiver<(usize, usize, String)>, hash_count: usize) -> JoinHandle<()> { @@ -153,7 +160,7 @@ fn make_info_printer(rx: Receiver<(usize, usize, String)>, hash_count: usize) -> fn make_stdout_printer(rx: Receiver>) -> JoinHandle<()> { std::thread::spawn(move || { - let mut writer = BufWriter::new(std::io::stdout()); + let mut writer = std::io::stdout(); while let Ok(buf) = rx.recv() { writer.write_all(&buf).unwrap(); @@ -260,7 +267,7 @@ fn make_worker(rx: Receiver>, state: State) -> JoinHandle<()> { // when we're about to print here. // So we strip that, to show just the generated part. // We also restrict the length to stay on a single line. - let prefix_len = PREFIXES[28].len(); + let prefix_len = PREFIXES[35].len(); // No need to wait for this let _ = state.info_tx.try_send(( count, From ae1e7e5aa6e8c0ca54da5a485cad9a2e0e64b869 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 22 Sep 2023 11:46:57 +0200 Subject: [PATCH 042/154] dtmt: Add word extraction algorithm for paths --- .../dtmt/src/cmd/experiment/extract_words.rs | 311 +++++++++++++++++- 1 file changed, 296 insertions(+), 15 deletions(-) diff --git a/crates/dtmt/src/cmd/experiment/extract_words.rs b/crates/dtmt/src/cmd/experiment/extract_words.rs index 512038d..1a8cda5 100644 --- a/crates/dtmt/src/cmd/experiment/extract_words.rs +++ b/crates/dtmt/src/cmd/experiment/extract_words.rs @@ -1,4 +1,4 @@ -use std::collections::HashSet; +use std::collections::HashMap; use std::path::PathBuf; use clap::{value_parser, Arg, ArgMatches, Command, ValueEnum}; @@ -36,7 +36,7 @@ pub(crate) fn command_definition() -> Command { ) } -#[derive(Copy, Clone, Debug, ValueEnum)] +#[derive(Copy, Clone, Debug, Eq, PartialEq, ValueEnum)] #[value(rename_all = "snake_case")] enum Algorithm { Alphabetic, @@ -45,6 +45,7 @@ enum Algorithm { Number, Hash32, Hash64, + Paths, } impl Algorithm { @@ -55,6 +56,8 @@ impl Algorithm { Self::Identifier => c.is_ascii_alphabetic(), Self::Number => c.is_numeric(), Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + // Supposed to be handled separately + Self::Paths => false, } } @@ -65,6 +68,8 @@ impl Algorithm { Self::Identifier => c.is_ascii_alphanumeric(), Self::Number => c.is_numeric(), Self::Hash32 | Self::Hash64 => matches!(c, '0'..='9' | 'a'..='f' | 'A'..='F'), + // Supposed to be handled separately + Self::Paths => false, } } @@ -76,6 +81,8 @@ impl Algorithm { Self::Number => true, Self::Hash32 => len == 8, Self::Hash64 => len == 16, + // Supposed to be handled separately + Self::Paths => false, } } } @@ -92,11 +99,274 @@ impl std::fmt::Display for Algorithm { Algorithm::Number => "number", Algorithm::Hash32 => "hash32", Algorithm::Hash64 => "hash64", + Algorithm::Paths => "paths", } ) } } +#[derive(Copy, Clone, Debug)] +enum PathState { + Begin, + PathComponent, + PathSeparator, + Boundary, + NonWord, + End, +} + +#[tracing::instrument(skip(chars))] +fn extract_paths(chars: impl Iterator) -> Vec> { + let mut chars = chars.peekable(); + + let mut state = PathState::Begin; + let mut list = Vec::new(); + let mut path = Vec::new(); + let mut word = String::new(); + + let is_boundary = |c: char| c == '\n' || c == ' ' || c == ',' || c == '\t' || c == '|'; + + 'machine: loop { + state = match state { + PathState::Begin => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some('/') => PathState::PathSeparator, + Some(_) => PathState::NonWord, + }, + PathState::PathComponent => match chars.next() { + None => { + path.push(word.clone()); + list.push(path.clone()); + + PathState::End + } + Some(c) if c.is_ascii_alphanumeric() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some('/') => { + path.push(word.clone()); + word.clear(); + + PathState::PathSeparator + } + Some(c) if is_boundary(c) => { + path.push(word.clone()); + list.push(path.clone()); + + path.clear(); + word.clear(); + + PathState::Boundary + } + Some(_) => { + list.push(path.clone()); + + path.clear(); + word.clear(); + + PathState::NonWord + } + }, + PathState::PathSeparator => match chars.next() { + None => { + list.push(path.clone()); + PathState::End + } + Some('/') => PathState::PathSeparator, + Some(c) if c.is_ascii_alphabetic() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => { + list.push(path.clone()); + path.clear(); + PathState::Boundary + } + Some(_) => { + list.push(path.clone()); + path.clear(); + PathState::NonWord + } + }, + PathState::Boundary => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::NonWord => match chars.next() { + None => PathState::End, + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::End => { + break 'machine; + } + } + } + + list +} + +#[tracing::instrument(skip(chars))] +fn algorithm_path_components(chars: impl Iterator, min_length: usize) { + let mut chars = chars.peekable(); + + let mut state = PathState::Begin; + let mut word = String::new(); + let mut lists = vec![HashMap::::new()]; + let mut index = 0; + + let is_boundary = |c: char| c == '\n' || c == ' ' || c == ',' || c == '\t'; + + 'machine: loop { + state = match state { + PathState::Begin => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + // Ignore leading path separators to not trigger the logic of advancing + // the component count + Some('/') => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::PathComponent => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphanumeric() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some('/') => PathState::PathSeparator, + Some(c) => { + if index > 0 && word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + word.clear(); + + index = 0; + + if is_boundary(c) { + PathState::Boundary + } else { + PathState::NonWord + } + } + }, + PathState::PathSeparator => { + if word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + word.clear(); + + index += 1; + if lists.get(index).is_none() { + lists.push(HashMap::new()); + } + + // Ignore multiple separators + while chars.next_if(|c| *c == '/').is_some() {} + + match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() || c == '_' => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => { + index = 0; + PathState::Boundary + } + Some(_) => { + index = 0; + PathState::NonWord + } + } + } + PathState::Boundary => match chars.next() { + None => PathState::End, + Some(c) if c.is_ascii_alphabetic() => { + word.push(c); + PathState::PathComponent + } + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::NonWord => match chars.next() { + None => PathState::End, + Some(c) if is_boundary(c) => PathState::Boundary, + Some(_) => PathState::NonWord, + }, + PathState::End => { + if word.len() >= min_length { + let list = &mut lists[index]; + list.entry(word.clone()) + .and_modify(|count| *count += 1) + .or_insert(1); + } + + break 'machine; + } + } + } + + for i in 0..lists.len() { + print!("Word {i}, Count {i},"); + } + println!(); + + let mut lines: Vec>> = Vec::new(); + + for (i, list) in lists.into_iter().enumerate() { + let mut entries = list.into_iter().collect::>(); + entries.sort_by(|(_, a), (_, b)| b.partial_cmp(a).unwrap()); + + for (j, (word, count)) in entries.into_iter().enumerate() { + if let Some(line) = lines.get_mut(j) { + while line.len() < i { + line.push(None); + } + line.push(Some((word, count))); + } else { + let mut line = Vec::new(); + while line.len() < i { + line.push(None); + } + line.push(Some((word, count))); + lines.push(line); + } + } + } + + for line in lines.iter() { + for cell in line.iter() { + if let Some((word, count)) = cell { + print!("{},{},", word, count); + } else { + print!(",,"); + } + } + println!(); + } +} + #[derive(Copy, Clone, Debug)] enum State { Begin, @@ -125,9 +395,14 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; let mut chars = content.chars(); + if *algorithm == Algorithm::Paths { + algorithm_path_components(chars, min_length); + return Ok(()); + } + let mut state = State::Begin; let mut word = String::new(); - let mut visited = HashSet::new(); + let mut visited = HashMap::new(); 'machine: loop { state = match state { @@ -150,12 +425,11 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> }, State::Word => match chars.next() { None => { - if word.len() >= min_length - && algorithm.is_length(word.len()) - && !visited.contains(&word) - { - println!("{}", &word); - visited.insert(word.clone()); + if word.len() >= min_length && algorithm.is_length(word.len()) { + visited + .entry(word.clone()) + .and_modify(|v| *v += 1) + .or_insert(1); } State::End } @@ -164,12 +438,11 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> State::Word } Some(_) => { - if word.len() >= min_length - && algorithm.is_length(word.len()) - && !visited.contains(&word) - { - println!("{}", &word); - visited.insert(word.clone()); + if word.len() >= min_length && algorithm.is_length(word.len()) { + visited + .entry(word.clone()) + .and_modify(|v| *v += 1) + .or_insert(1); } word.clear(); State::NonWord @@ -178,5 +451,13 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> } } + let mut entries: Vec<(String, usize)> = visited.into_iter().collect(); + // Reverse sides during comparison to get "highest to lowest" + entries.sort_by(|(_, a), (_, b)| b.partial_cmp(a).unwrap()); + + entries + .iter() + .for_each(|(word, count)| println!("{:016} {}", word, count)); + Ok(()) } From b7e26eee5754ac1272a297e5752d21f861e9e410 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 3 Mar 2023 15:32:41 +0100 Subject: [PATCH 043/154] refactor(sdk): Split BundleFileType into its own file --- lib/sdk/src/bundle/database.rs | 2 +- lib/sdk/src/bundle/file.rs | 397 +------------------------------ lib/sdk/src/bundle/filetype.rs | 400 ++++++++++++++++++++++++++++++++ lib/sdk/src/bundle/mod.rs | 4 +- lib/sdk/src/filetype/package.rs | 11 +- 5 files changed, 408 insertions(+), 406 deletions(-) create mode 100644 lib/sdk/src/bundle/filetype.rs diff --git a/lib/sdk/src/bundle/database.rs b/lib/sdk/src/bundle/database.rs index 6152ede..fce26ee 100644 --- a/lib/sdk/src/bundle/database.rs +++ b/lib/sdk/src/bundle/database.rs @@ -13,7 +13,7 @@ use crate::binary::ToBinary; use crate::murmur::Murmur64; use crate::Bundle; -use super::file::BundleFileType; +use super::filetype::BundleFileType; const DATABASE_VERSION: u32 = 0x6; const FILE_VERSION: u32 = 0x4; diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index 4d6c56e..1780a5d 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -5,407 +5,12 @@ use bitflags::bitflags; use color_eyre::eyre::Context; use color_eyre::{eyre, Result}; use futures::future::join_all; -use serde::Serialize; use crate::binary::sync::*; use crate::filetype::*; use crate::murmur::{HashGroup, IdString64, Murmur64}; -#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] -pub enum BundleFileType { - Animation, - AnimationCurves, - Apb, - BakedLighting, - Bik, - BlendSet, - Bones, - Chroma, - CommonPackage, - Config, - Crypto, - Data, - Entity, - Flow, - Font, - Ies, - Ini, - Input, - Ivf, - Keys, - Level, - Lua, - Material, - Mod, - MouseCursor, - NavData, - NetworkConfig, - OddleNet, - Package, - Particles, - PhysicsProperties, - RenderConfig, - RtPipeline, - Scene, - Shader, - ShaderLibrary, - ShaderLibraryGroup, - ShadingEnvionmentMapping, - ShadingEnvironment, - Slug, - SlugAlbum, - SoundEnvironment, - SpuJob, - StateMachine, - StaticPVS, - Strings, - SurfaceProperties, - Texture, - TimpaniBank, - TimpaniMaster, - Tome, - Ugg, - Unit, - Upb, - VectorField, - Wav, - WwiseBank, - WwiseDep, - WwiseEvent, - WwiseMetadata, - WwiseStream, - Xml, - - Unknown(Murmur64), -} - -impl BundleFileType { - pub fn ext_name(&self) -> String { - match self { - BundleFileType::AnimationCurves => String::from("animation_curves"), - BundleFileType::Animation => String::from("animation"), - BundleFileType::Apb => String::from("apb"), - BundleFileType::BakedLighting => String::from("baked_lighting"), - BundleFileType::Bik => String::from("bik"), - BundleFileType::BlendSet => String::from("blend_set"), - BundleFileType::Bones => String::from("bones"), - BundleFileType::Chroma => String::from("chroma"), - BundleFileType::CommonPackage => String::from("common_package"), - BundleFileType::Config => String::from("config"), - BundleFileType::Crypto => String::from("crypto"), - BundleFileType::Data => String::from("data"), - BundleFileType::Entity => String::from("entity"), - BundleFileType::Flow => String::from("flow"), - BundleFileType::Font => String::from("font"), - BundleFileType::Ies => String::from("ies"), - BundleFileType::Ini => String::from("ini"), - BundleFileType::Input => String::from("input"), - BundleFileType::Ivf => String::from("ivf"), - BundleFileType::Keys => String::from("keys"), - BundleFileType::Level => String::from("level"), - BundleFileType::Lua => String::from("lua"), - BundleFileType::Material => String::from("material"), - BundleFileType::Mod => String::from("mod"), - BundleFileType::MouseCursor => String::from("mouse_cursor"), - BundleFileType::NavData => String::from("nav_data"), - BundleFileType::NetworkConfig => String::from("network_config"), - BundleFileType::OddleNet => String::from("oodle_net"), - BundleFileType::Package => String::from("package"), - BundleFileType::Particles => String::from("particles"), - BundleFileType::PhysicsProperties => String::from("physics_properties"), - BundleFileType::RenderConfig => String::from("render_config"), - BundleFileType::RtPipeline => String::from("rt_pipeline"), - BundleFileType::Scene => String::from("scene"), - BundleFileType::ShaderLibraryGroup => String::from("shader_library_group"), - BundleFileType::ShaderLibrary => String::from("shader_library"), - BundleFileType::Shader => String::from("shader"), - BundleFileType::ShadingEnvionmentMapping => String::from("shading_environment_mapping"), - BundleFileType::ShadingEnvironment => String::from("shading_environment"), - BundleFileType::SlugAlbum => String::from("slug_album"), - BundleFileType::Slug => String::from("slug"), - BundleFileType::SoundEnvironment => String::from("sound_environment"), - BundleFileType::SpuJob => String::from("spu_job"), - BundleFileType::StateMachine => String::from("state_machine"), - BundleFileType::StaticPVS => String::from("static_pvs"), - BundleFileType::Strings => String::from("strings"), - BundleFileType::SurfaceProperties => String::from("surface_properties"), - BundleFileType::Texture => String::from("texture"), - BundleFileType::TimpaniBank => String::from("timpani_bank"), - BundleFileType::TimpaniMaster => String::from("timpani_master"), - BundleFileType::Tome => String::from("tome"), - BundleFileType::Ugg => String::from("ugg"), - BundleFileType::Unit => String::from("unit"), - BundleFileType::Upb => String::from("upb"), - BundleFileType::VectorField => String::from("vector_field"), - BundleFileType::Wav => String::from("wav"), - BundleFileType::WwiseBank => String::from("wwise_bank"), - BundleFileType::WwiseDep => String::from("wwise_dep"), - BundleFileType::WwiseEvent => String::from("wwise_event"), - BundleFileType::WwiseMetadata => String::from("wwise_metadata"), - BundleFileType::WwiseStream => String::from("wwise_stream"), - BundleFileType::Xml => String::from("xml"), - - BundleFileType::Unknown(s) => format!("{s:016X}"), - } - } - - pub fn decompiled_ext_name(&self) -> String { - match self { - BundleFileType::Texture => String::from("dds"), - BundleFileType::WwiseBank => String::from("bnk"), - BundleFileType::WwiseStream => String::from("ogg"), - _ => self.ext_name(), - } - } - - pub fn hash(&self) -> Murmur64 { - Murmur64::from(*self) - } -} - -impl std::str::FromStr for BundleFileType { - type Err = color_eyre::Report; - - fn from_str(s: &str) -> Result { - let val = match s { - "animation_curves" => BundleFileType::AnimationCurves, - "animation" => BundleFileType::Animation, - "apb" => BundleFileType::Apb, - "baked_lighting" => BundleFileType::BakedLighting, - "bik" => BundleFileType::Bik, - "blend_set" => BundleFileType::BlendSet, - "bones" => BundleFileType::Bones, - "chroma" => BundleFileType::Chroma, - "common_package" => BundleFileType::CommonPackage, - "config" => BundleFileType::Config, - "crypto" => BundleFileType::Crypto, - "data" => BundleFileType::Data, - "entity" => BundleFileType::Entity, - "flow" => BundleFileType::Flow, - "font" => BundleFileType::Font, - "ies" => BundleFileType::Ies, - "ini" => BundleFileType::Ini, - "input" => BundleFileType::Input, - "ivf" => BundleFileType::Ivf, - "keys" => BundleFileType::Keys, - "level" => BundleFileType::Level, - "lua" => BundleFileType::Lua, - "material" => BundleFileType::Material, - "mod" => BundleFileType::Mod, - "mouse_cursor" => BundleFileType::MouseCursor, - "nav_data" => BundleFileType::NavData, - "network_config" => BundleFileType::NetworkConfig, - "oodle_net" => BundleFileType::OddleNet, - "package" => BundleFileType::Package, - "particles" => BundleFileType::Particles, - "physics_properties" => BundleFileType::PhysicsProperties, - "render_config" => BundleFileType::RenderConfig, - "rt_pipeline" => BundleFileType::RtPipeline, - "scene" => BundleFileType::Scene, - "shader_library_group" => BundleFileType::ShaderLibraryGroup, - "shader_library" => BundleFileType::ShaderLibrary, - "shader" => BundleFileType::Shader, - "shading_environment_mapping" => BundleFileType::ShadingEnvionmentMapping, - "shading_environment" => BundleFileType::ShadingEnvironment, - "slug_album" => BundleFileType::SlugAlbum, - "slug" => BundleFileType::Slug, - "sound_environment" => BundleFileType::SoundEnvironment, - "spu_job" => BundleFileType::SpuJob, - "state_machine" => BundleFileType::StateMachine, - "static_pvs" => BundleFileType::StaticPVS, - "strings" => BundleFileType::Strings, - "surface_properties" => BundleFileType::SurfaceProperties, - "texture" => BundleFileType::Texture, - "timpani_bank" => BundleFileType::TimpaniBank, - "timpani_master" => BundleFileType::TimpaniMaster, - "tome" => BundleFileType::Tome, - "ugg" => BundleFileType::Ugg, - "unit" => BundleFileType::Unit, - "upb" => BundleFileType::Upb, - "vector_field" => BundleFileType::VectorField, - "wav" => BundleFileType::Wav, - "wwise_bank" => BundleFileType::WwiseBank, - "wwise_dep" => BundleFileType::WwiseDep, - "wwise_event" => BundleFileType::WwiseEvent, - "wwise_metadata" => BundleFileType::WwiseMetadata, - "wwise_stream" => BundleFileType::WwiseStream, - "xml" => BundleFileType::Xml, - s => eyre::bail!("Unknown type string '{}'", s), - }; - - Ok(val) - } -} - -impl Serialize for BundleFileType { - fn serialize(&self, serializer: S) -> Result - where - S: serde::Serializer, - { - let value = self.ext_name(); - value.serialize(serializer) - } -} - -impl From for BundleFileType { - fn from(value: Murmur64) -> Self { - Self::from(Into::::into(value)) - } -} - -impl From for BundleFileType { - fn from(hash: u64) -> BundleFileType { - match hash { - 0x931e336d7646cc26 => BundleFileType::Animation, - 0xdcfb9e18fff13984 => BundleFileType::AnimationCurves, - 0x3eed05ba83af5090 => BundleFileType::Apb, - 0x7ffdb779b04e4ed1 => BundleFileType::BakedLighting, - 0xaa5965f03029fa18 => BundleFileType::Bik, - 0xe301e8af94e3b5a3 => BundleFileType::BlendSet, - 0x18dead01056b72e9 => BundleFileType::Bones, - 0xb7893adf7567506a => BundleFileType::Chroma, - 0xfe9754bd19814a47 => BundleFileType::CommonPackage, - 0x82645835e6b73232 => BundleFileType::Config, - 0x69108ded1e3e634b => BundleFileType::Crypto, - 0x8fd0d44d20650b68 => BundleFileType::Data, - 0x9831ca893b0d087d => BundleFileType::Entity, - 0x92d3ee038eeb610d => BundleFileType::Flow, - 0x9efe0a916aae7880 => BundleFileType::Font, - 0x8f7d5a2c0f967655 => BundleFileType::Ies, - 0xd526a27da14f1dc5 => BundleFileType::Ini, - 0x2bbcabe5074ade9e => BundleFileType::Input, - 0xfa4a8e091a91201e => BundleFileType::Ivf, - 0xa62f9297dc969e85 => BundleFileType::Keys, - 0x2a690fd348fe9ac5 => BundleFileType::Level, - 0xa14e8dfa2cd117e2 => BundleFileType::Lua, - 0xeac0b497876adedf => BundleFileType::Material, - 0x3fcdd69156a46417 => BundleFileType::Mod, - 0xb277b11fe4a61d37 => BundleFileType::MouseCursor, - 0x169de9566953d264 => BundleFileType::NavData, - 0x3b1fa9e8f6bac374 => BundleFileType::NetworkConfig, - 0xb0f2c12eb107f4d8 => BundleFileType::OddleNet, - 0xad9c6d9ed1e5e77a => BundleFileType::Package, - 0xa8193123526fad64 => BundleFileType::Particles, - 0xbf21403a3ab0bbb1 => BundleFileType::PhysicsProperties, - 0x27862fe24795319c => BundleFileType::RenderConfig, - 0x9ca183c2d0e76dee => BundleFileType::RtPipeline, - 0x9d0a795bfe818d19 => BundleFileType::Scene, - 0xcce8d5b5f5ae333f => BundleFileType::Shader, - 0xe5ee32a477239a93 => BundleFileType::ShaderLibrary, - 0x9e5c3cc74575aeb5 => BundleFileType::ShaderLibraryGroup, - 0x250e0a11ac8e26f8 => BundleFileType::ShadingEnvionmentMapping, - 0xfe73c7dcff8a7ca5 => BundleFileType::ShadingEnvironment, - 0xa27b4d04a9ba6f9e => BundleFileType::Slug, - 0xe9fc9ea7042e5ec0 => BundleFileType::SlugAlbum, - 0xd8b27864a97ffdd7 => BundleFileType::SoundEnvironment, - 0xf97af9983c05b950 => BundleFileType::SpuJob, - 0xa486d4045106165c => BundleFileType::StateMachine, - 0xe3f0baa17d620321 => BundleFileType::StaticPVS, - 0x0d972bab10b40fd3 => BundleFileType::Strings, - 0xad2d3fa30d9ab394 => BundleFileType::SurfaceProperties, - 0xcd4238c6a0c69e32 => BundleFileType::Texture, - 0x99736be1fff739a4 => BundleFileType::TimpaniBank, - 0x00a3e6c59a2b9c6c => BundleFileType::TimpaniMaster, - 0x19c792357c99f49b => BundleFileType::Tome, - 0x712d6e3dd1024c9c => BundleFileType::Ugg, - 0xe0a48d0be9a7453f => BundleFileType::Unit, - 0xa99510c6e86dd3c2 => BundleFileType::Upb, - 0xf7505933166d6755 => BundleFileType::VectorField, - 0x786f65c00a816b19 => BundleFileType::Wav, - 0x535a7bd3e650d799 => BundleFileType::WwiseBank, - 0xaf32095c82f2b070 => BundleFileType::WwiseDep, - 0xaabdd317b58dfc8a => BundleFileType::WwiseEvent, - 0xd50a8b7e1c82b110 => BundleFileType::WwiseMetadata, - 0x504b55235d21440e => BundleFileType::WwiseStream, - 0x76015845a6003765 => BundleFileType::Xml, - - _ => BundleFileType::Unknown(Murmur64::from(hash)), - } - } -} - -impl From for u64 { - fn from(t: BundleFileType) -> u64 { - match t { - BundleFileType::Animation => 0x931e336d7646cc26, - BundleFileType::AnimationCurves => 0xdcfb9e18fff13984, - BundleFileType::Apb => 0x3eed05ba83af5090, - BundleFileType::BakedLighting => 0x7ffdb779b04e4ed1, - BundleFileType::Bik => 0xaa5965f03029fa18, - BundleFileType::BlendSet => 0xe301e8af94e3b5a3, - BundleFileType::Bones => 0x18dead01056b72e9, - BundleFileType::Chroma => 0xb7893adf7567506a, - BundleFileType::CommonPackage => 0xfe9754bd19814a47, - BundleFileType::Config => 0x82645835e6b73232, - BundleFileType::Crypto => 0x69108ded1e3e634b, - BundleFileType::Data => 0x8fd0d44d20650b68, - BundleFileType::Entity => 0x9831ca893b0d087d, - BundleFileType::Flow => 0x92d3ee038eeb610d, - BundleFileType::Font => 0x9efe0a916aae7880, - BundleFileType::Ies => 0x8f7d5a2c0f967655, - BundleFileType::Ini => 0xd526a27da14f1dc5, - BundleFileType::Input => 0x2bbcabe5074ade9e, - BundleFileType::Ivf => 0xfa4a8e091a91201e, - BundleFileType::Keys => 0xa62f9297dc969e85, - BundleFileType::Level => 0x2a690fd348fe9ac5, - BundleFileType::Lua => 0xa14e8dfa2cd117e2, - BundleFileType::Material => 0xeac0b497876adedf, - BundleFileType::Mod => 0x3fcdd69156a46417, - BundleFileType::MouseCursor => 0xb277b11fe4a61d37, - BundleFileType::NavData => 0x169de9566953d264, - BundleFileType::NetworkConfig => 0x3b1fa9e8f6bac374, - BundleFileType::OddleNet => 0xb0f2c12eb107f4d8, - BundleFileType::Package => 0xad9c6d9ed1e5e77a, - BundleFileType::Particles => 0xa8193123526fad64, - BundleFileType::PhysicsProperties => 0xbf21403a3ab0bbb1, - BundleFileType::RenderConfig => 0x27862fe24795319c, - BundleFileType::RtPipeline => 0x9ca183c2d0e76dee, - BundleFileType::Scene => 0x9d0a795bfe818d19, - BundleFileType::Shader => 0xcce8d5b5f5ae333f, - BundleFileType::ShaderLibrary => 0xe5ee32a477239a93, - BundleFileType::ShaderLibraryGroup => 0x9e5c3cc74575aeb5, - BundleFileType::ShadingEnvionmentMapping => 0x250e0a11ac8e26f8, - BundleFileType::ShadingEnvironment => 0xfe73c7dcff8a7ca5, - BundleFileType::Slug => 0xa27b4d04a9ba6f9e, - BundleFileType::SlugAlbum => 0xe9fc9ea7042e5ec0, - BundleFileType::SoundEnvironment => 0xd8b27864a97ffdd7, - BundleFileType::SpuJob => 0xf97af9983c05b950, - BundleFileType::StateMachine => 0xa486d4045106165c, - BundleFileType::StaticPVS => 0xe3f0baa17d620321, - BundleFileType::Strings => 0x0d972bab10b40fd3, - BundleFileType::SurfaceProperties => 0xad2d3fa30d9ab394, - BundleFileType::Texture => 0xcd4238c6a0c69e32, - BundleFileType::TimpaniBank => 0x99736be1fff739a4, - BundleFileType::TimpaniMaster => 0x00a3e6c59a2b9c6c, - BundleFileType::Tome => 0x19c792357c99f49b, - BundleFileType::Ugg => 0x712d6e3dd1024c9c, - BundleFileType::Unit => 0xe0a48d0be9a7453f, - BundleFileType::Upb => 0xa99510c6e86dd3c2, - BundleFileType::VectorField => 0xf7505933166d6755, - BundleFileType::Wav => 0x786f65c00a816b19, - BundleFileType::WwiseBank => 0x535a7bd3e650d799, - BundleFileType::WwiseDep => 0xaf32095c82f2b070, - BundleFileType::WwiseEvent => 0xaabdd317b58dfc8a, - BundleFileType::WwiseMetadata => 0xd50a8b7e1c82b110, - BundleFileType::WwiseStream => 0x504b55235d21440e, - BundleFileType::Xml => 0x76015845a6003765, - - BundleFileType::Unknown(hash) => hash.into(), - } - } -} -impl From for Murmur64 { - fn from(t: BundleFileType) -> Murmur64 { - let hash: u64 = t.into(); - Murmur64::from(hash) - } -} - -impl std::fmt::Display for BundleFileType { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - write!(f, "{}", self.ext_name()) - } -} +use super::filetype::BundleFileType; #[derive(Debug)] struct BundleFileHeader { diff --git a/lib/sdk/src/bundle/filetype.rs b/lib/sdk/src/bundle/filetype.rs new file mode 100644 index 0000000..0b4f292 --- /dev/null +++ b/lib/sdk/src/bundle/filetype.rs @@ -0,0 +1,400 @@ +use color_eyre::{eyre, Result}; +use serde::Serialize; + +use crate::murmur::Murmur64; + +#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] +pub enum BundleFileType { + Animation, + AnimationCurves, + Apb, + BakedLighting, + Bik, + BlendSet, + Bones, + Chroma, + CommonPackage, + Config, + Crypto, + Data, + Entity, + Flow, + Font, + Ies, + Ini, + Input, + Ivf, + Keys, + Level, + Lua, + Material, + Mod, + MouseCursor, + NavData, + NetworkConfig, + OddleNet, + Package, + Particles, + PhysicsProperties, + RenderConfig, + RtPipeline, + Scene, + Shader, + ShaderLibrary, + ShaderLibraryGroup, + ShadingEnvionmentMapping, + ShadingEnvironment, + Slug, + SlugAlbum, + SoundEnvironment, + SpuJob, + StateMachine, + StaticPVS, + Strings, + SurfaceProperties, + Texture, + TimpaniBank, + TimpaniMaster, + Tome, + Ugg, + Unit, + Upb, + VectorField, + Wav, + WwiseBank, + WwiseDep, + WwiseEvent, + WwiseMetadata, + WwiseStream, + Xml, + + Unknown(Murmur64), +} + +impl BundleFileType { + pub fn ext_name(&self) -> String { + match self { + BundleFileType::AnimationCurves => String::from("animation_curves"), + BundleFileType::Animation => String::from("animation"), + BundleFileType::Apb => String::from("apb"), + BundleFileType::BakedLighting => String::from("baked_lighting"), + BundleFileType::Bik => String::from("bik"), + BundleFileType::BlendSet => String::from("blend_set"), + BundleFileType::Bones => String::from("bones"), + BundleFileType::Chroma => String::from("chroma"), + BundleFileType::CommonPackage => String::from("common_package"), + BundleFileType::Config => String::from("config"), + BundleFileType::Crypto => String::from("crypto"), + BundleFileType::Data => String::from("data"), + BundleFileType::Entity => String::from("entity"), + BundleFileType::Flow => String::from("flow"), + BundleFileType::Font => String::from("font"), + BundleFileType::Ies => String::from("ies"), + BundleFileType::Ini => String::from("ini"), + BundleFileType::Input => String::from("input"), + BundleFileType::Ivf => String::from("ivf"), + BundleFileType::Keys => String::from("keys"), + BundleFileType::Level => String::from("level"), + BundleFileType::Lua => String::from("lua"), + BundleFileType::Material => String::from("material"), + BundleFileType::Mod => String::from("mod"), + BundleFileType::MouseCursor => String::from("mouse_cursor"), + BundleFileType::NavData => String::from("nav_data"), + BundleFileType::NetworkConfig => String::from("network_config"), + BundleFileType::OddleNet => String::from("oodle_net"), + BundleFileType::Package => String::from("package"), + BundleFileType::Particles => String::from("particles"), + BundleFileType::PhysicsProperties => String::from("physics_properties"), + BundleFileType::RenderConfig => String::from("render_config"), + BundleFileType::RtPipeline => String::from("rt_pipeline"), + BundleFileType::Scene => String::from("scene"), + BundleFileType::ShaderLibraryGroup => String::from("shader_library_group"), + BundleFileType::ShaderLibrary => String::from("shader_library"), + BundleFileType::Shader => String::from("shader"), + BundleFileType::ShadingEnvionmentMapping => String::from("shading_environment_mapping"), + BundleFileType::ShadingEnvironment => String::from("shading_environment"), + BundleFileType::SlugAlbum => String::from("slug_album"), + BundleFileType::Slug => String::from("slug"), + BundleFileType::SoundEnvironment => String::from("sound_environment"), + BundleFileType::SpuJob => String::from("spu_job"), + BundleFileType::StateMachine => String::from("state_machine"), + BundleFileType::StaticPVS => String::from("static_pvs"), + BundleFileType::Strings => String::from("strings"), + BundleFileType::SurfaceProperties => String::from("surface_properties"), + BundleFileType::Texture => String::from("texture"), + BundleFileType::TimpaniBank => String::from("timpani_bank"), + BundleFileType::TimpaniMaster => String::from("timpani_master"), + BundleFileType::Tome => String::from("tome"), + BundleFileType::Ugg => String::from("ugg"), + BundleFileType::Unit => String::from("unit"), + BundleFileType::Upb => String::from("upb"), + BundleFileType::VectorField => String::from("vector_field"), + BundleFileType::Wav => String::from("wav"), + BundleFileType::WwiseBank => String::from("wwise_bank"), + BundleFileType::WwiseDep => String::from("wwise_dep"), + BundleFileType::WwiseEvent => String::from("wwise_event"), + BundleFileType::WwiseMetadata => String::from("wwise_metadata"), + BundleFileType::WwiseStream => String::from("wwise_stream"), + BundleFileType::Xml => String::from("xml"), + + BundleFileType::Unknown(s) => format!("{s:016X}"), + } + } + + pub fn decompiled_ext_name(&self) -> String { + match self { + BundleFileType::Texture => String::from("dds"), + BundleFileType::WwiseBank => String::from("bnk"), + BundleFileType::WwiseStream => String::from("ogg"), + _ => self.ext_name(), + } + } + + pub fn hash(&self) -> Murmur64 { + Murmur64::from(*self) + } +} + +impl std::str::FromStr for BundleFileType { + type Err = color_eyre::Report; + + fn from_str(s: &str) -> Result { + let val = match s { + "animation_curves" => BundleFileType::AnimationCurves, + "animation" => BundleFileType::Animation, + "apb" => BundleFileType::Apb, + "baked_lighting" => BundleFileType::BakedLighting, + "bik" => BundleFileType::Bik, + "blend_set" => BundleFileType::BlendSet, + "bones" => BundleFileType::Bones, + "chroma" => BundleFileType::Chroma, + "common_package" => BundleFileType::CommonPackage, + "config" => BundleFileType::Config, + "crypto" => BundleFileType::Crypto, + "data" => BundleFileType::Data, + "entity" => BundleFileType::Entity, + "flow" => BundleFileType::Flow, + "font" => BundleFileType::Font, + "ies" => BundleFileType::Ies, + "ini" => BundleFileType::Ini, + "input" => BundleFileType::Input, + "ivf" => BundleFileType::Ivf, + "keys" => BundleFileType::Keys, + "level" => BundleFileType::Level, + "lua" => BundleFileType::Lua, + "material" => BundleFileType::Material, + "mod" => BundleFileType::Mod, + "mouse_cursor" => BundleFileType::MouseCursor, + "nav_data" => BundleFileType::NavData, + "network_config" => BundleFileType::NetworkConfig, + "oodle_net" => BundleFileType::OddleNet, + "package" => BundleFileType::Package, + "particles" => BundleFileType::Particles, + "physics_properties" => BundleFileType::PhysicsProperties, + "render_config" => BundleFileType::RenderConfig, + "rt_pipeline" => BundleFileType::RtPipeline, + "scene" => BundleFileType::Scene, + "shader_library_group" => BundleFileType::ShaderLibraryGroup, + "shader_library" => BundleFileType::ShaderLibrary, + "shader" => BundleFileType::Shader, + "shading_environment_mapping" => BundleFileType::ShadingEnvionmentMapping, + "shading_environment" => BundleFileType::ShadingEnvironment, + "slug_album" => BundleFileType::SlugAlbum, + "slug" => BundleFileType::Slug, + "sound_environment" => BundleFileType::SoundEnvironment, + "spu_job" => BundleFileType::SpuJob, + "state_machine" => BundleFileType::StateMachine, + "static_pvs" => BundleFileType::StaticPVS, + "strings" => BundleFileType::Strings, + "surface_properties" => BundleFileType::SurfaceProperties, + "texture" => BundleFileType::Texture, + "timpani_bank" => BundleFileType::TimpaniBank, + "timpani_master" => BundleFileType::TimpaniMaster, + "tome" => BundleFileType::Tome, + "ugg" => BundleFileType::Ugg, + "unit" => BundleFileType::Unit, + "upb" => BundleFileType::Upb, + "vector_field" => BundleFileType::VectorField, + "wav" => BundleFileType::Wav, + "wwise_bank" => BundleFileType::WwiseBank, + "wwise_dep" => BundleFileType::WwiseDep, + "wwise_event" => BundleFileType::WwiseEvent, + "wwise_metadata" => BundleFileType::WwiseMetadata, + "wwise_stream" => BundleFileType::WwiseStream, + "xml" => BundleFileType::Xml, + s => eyre::bail!("Unknown type string '{}'", s), + }; + + Ok(val) + } +} + +impl Serialize for BundleFileType { + fn serialize(&self, serializer: S) -> Result + where + S: serde::Serializer, + { + let value = self.ext_name(); + value.serialize(serializer) + } +} + +impl From for BundleFileType { + fn from(value: Murmur64) -> Self { + Self::from(Into::::into(value)) + } +} + +impl From for BundleFileType { + fn from(hash: u64) -> BundleFileType { + match hash { + 0x931e336d7646cc26 => BundleFileType::Animation, + 0xdcfb9e18fff13984 => BundleFileType::AnimationCurves, + 0x3eed05ba83af5090 => BundleFileType::Apb, + 0x7ffdb779b04e4ed1 => BundleFileType::BakedLighting, + 0xaa5965f03029fa18 => BundleFileType::Bik, + 0xe301e8af94e3b5a3 => BundleFileType::BlendSet, + 0x18dead01056b72e9 => BundleFileType::Bones, + 0xb7893adf7567506a => BundleFileType::Chroma, + 0xfe9754bd19814a47 => BundleFileType::CommonPackage, + 0x82645835e6b73232 => BundleFileType::Config, + 0x69108ded1e3e634b => BundleFileType::Crypto, + 0x8fd0d44d20650b68 => BundleFileType::Data, + 0x9831ca893b0d087d => BundleFileType::Entity, + 0x92d3ee038eeb610d => BundleFileType::Flow, + 0x9efe0a916aae7880 => BundleFileType::Font, + 0x8f7d5a2c0f967655 => BundleFileType::Ies, + 0xd526a27da14f1dc5 => BundleFileType::Ini, + 0x2bbcabe5074ade9e => BundleFileType::Input, + 0xfa4a8e091a91201e => BundleFileType::Ivf, + 0xa62f9297dc969e85 => BundleFileType::Keys, + 0x2a690fd348fe9ac5 => BundleFileType::Level, + 0xa14e8dfa2cd117e2 => BundleFileType::Lua, + 0xeac0b497876adedf => BundleFileType::Material, + 0x3fcdd69156a46417 => BundleFileType::Mod, + 0xb277b11fe4a61d37 => BundleFileType::MouseCursor, + 0x169de9566953d264 => BundleFileType::NavData, + 0x3b1fa9e8f6bac374 => BundleFileType::NetworkConfig, + 0xb0f2c12eb107f4d8 => BundleFileType::OddleNet, + 0xad9c6d9ed1e5e77a => BundleFileType::Package, + 0xa8193123526fad64 => BundleFileType::Particles, + 0xbf21403a3ab0bbb1 => BundleFileType::PhysicsProperties, + 0x27862fe24795319c => BundleFileType::RenderConfig, + 0x9ca183c2d0e76dee => BundleFileType::RtPipeline, + 0x9d0a795bfe818d19 => BundleFileType::Scene, + 0xcce8d5b5f5ae333f => BundleFileType::Shader, + 0xe5ee32a477239a93 => BundleFileType::ShaderLibrary, + 0x9e5c3cc74575aeb5 => BundleFileType::ShaderLibraryGroup, + 0x250e0a11ac8e26f8 => BundleFileType::ShadingEnvionmentMapping, + 0xfe73c7dcff8a7ca5 => BundleFileType::ShadingEnvironment, + 0xa27b4d04a9ba6f9e => BundleFileType::Slug, + 0xe9fc9ea7042e5ec0 => BundleFileType::SlugAlbum, + 0xd8b27864a97ffdd7 => BundleFileType::SoundEnvironment, + 0xf97af9983c05b950 => BundleFileType::SpuJob, + 0xa486d4045106165c => BundleFileType::StateMachine, + 0xe3f0baa17d620321 => BundleFileType::StaticPVS, + 0x0d972bab10b40fd3 => BundleFileType::Strings, + 0xad2d3fa30d9ab394 => BundleFileType::SurfaceProperties, + 0xcd4238c6a0c69e32 => BundleFileType::Texture, + 0x99736be1fff739a4 => BundleFileType::TimpaniBank, + 0x00a3e6c59a2b9c6c => BundleFileType::TimpaniMaster, + 0x19c792357c99f49b => BundleFileType::Tome, + 0x712d6e3dd1024c9c => BundleFileType::Ugg, + 0xe0a48d0be9a7453f => BundleFileType::Unit, + 0xa99510c6e86dd3c2 => BundleFileType::Upb, + 0xf7505933166d6755 => BundleFileType::VectorField, + 0x786f65c00a816b19 => BundleFileType::Wav, + 0x535a7bd3e650d799 => BundleFileType::WwiseBank, + 0xaf32095c82f2b070 => BundleFileType::WwiseDep, + 0xaabdd317b58dfc8a => BundleFileType::WwiseEvent, + 0xd50a8b7e1c82b110 => BundleFileType::WwiseMetadata, + 0x504b55235d21440e => BundleFileType::WwiseStream, + 0x76015845a6003765 => BundleFileType::Xml, + + _ => BundleFileType::Unknown(Murmur64::from(hash)), + } + } +} + +impl From for u64 { + fn from(t: BundleFileType) -> u64 { + match t { + BundleFileType::Animation => 0x931e336d7646cc26, + BundleFileType::AnimationCurves => 0xdcfb9e18fff13984, + BundleFileType::Apb => 0x3eed05ba83af5090, + BundleFileType::BakedLighting => 0x7ffdb779b04e4ed1, + BundleFileType::Bik => 0xaa5965f03029fa18, + BundleFileType::BlendSet => 0xe301e8af94e3b5a3, + BundleFileType::Bones => 0x18dead01056b72e9, + BundleFileType::Chroma => 0xb7893adf7567506a, + BundleFileType::CommonPackage => 0xfe9754bd19814a47, + BundleFileType::Config => 0x82645835e6b73232, + BundleFileType::Crypto => 0x69108ded1e3e634b, + BundleFileType::Data => 0x8fd0d44d20650b68, + BundleFileType::Entity => 0x9831ca893b0d087d, + BundleFileType::Flow => 0x92d3ee038eeb610d, + BundleFileType::Font => 0x9efe0a916aae7880, + BundleFileType::Ies => 0x8f7d5a2c0f967655, + BundleFileType::Ini => 0xd526a27da14f1dc5, + BundleFileType::Input => 0x2bbcabe5074ade9e, + BundleFileType::Ivf => 0xfa4a8e091a91201e, + BundleFileType::Keys => 0xa62f9297dc969e85, + BundleFileType::Level => 0x2a690fd348fe9ac5, + BundleFileType::Lua => 0xa14e8dfa2cd117e2, + BundleFileType::Material => 0xeac0b497876adedf, + BundleFileType::Mod => 0x3fcdd69156a46417, + BundleFileType::MouseCursor => 0xb277b11fe4a61d37, + BundleFileType::NavData => 0x169de9566953d264, + BundleFileType::NetworkConfig => 0x3b1fa9e8f6bac374, + BundleFileType::OddleNet => 0xb0f2c12eb107f4d8, + BundleFileType::Package => 0xad9c6d9ed1e5e77a, + BundleFileType::Particles => 0xa8193123526fad64, + BundleFileType::PhysicsProperties => 0xbf21403a3ab0bbb1, + BundleFileType::RenderConfig => 0x27862fe24795319c, + BundleFileType::RtPipeline => 0x9ca183c2d0e76dee, + BundleFileType::Scene => 0x9d0a795bfe818d19, + BundleFileType::Shader => 0xcce8d5b5f5ae333f, + BundleFileType::ShaderLibrary => 0xe5ee32a477239a93, + BundleFileType::ShaderLibraryGroup => 0x9e5c3cc74575aeb5, + BundleFileType::ShadingEnvionmentMapping => 0x250e0a11ac8e26f8, + BundleFileType::ShadingEnvironment => 0xfe73c7dcff8a7ca5, + BundleFileType::Slug => 0xa27b4d04a9ba6f9e, + BundleFileType::SlugAlbum => 0xe9fc9ea7042e5ec0, + BundleFileType::SoundEnvironment => 0xd8b27864a97ffdd7, + BundleFileType::SpuJob => 0xf97af9983c05b950, + BundleFileType::StateMachine => 0xa486d4045106165c, + BundleFileType::StaticPVS => 0xe3f0baa17d620321, + BundleFileType::Strings => 0x0d972bab10b40fd3, + BundleFileType::SurfaceProperties => 0xad2d3fa30d9ab394, + BundleFileType::Texture => 0xcd4238c6a0c69e32, + BundleFileType::TimpaniBank => 0x99736be1fff739a4, + BundleFileType::TimpaniMaster => 0x00a3e6c59a2b9c6c, + BundleFileType::Tome => 0x19c792357c99f49b, + BundleFileType::Ugg => 0x712d6e3dd1024c9c, + BundleFileType::Unit => 0xe0a48d0be9a7453f, + BundleFileType::Upb => 0xa99510c6e86dd3c2, + BundleFileType::VectorField => 0xf7505933166d6755, + BundleFileType::Wav => 0x786f65c00a816b19, + BundleFileType::WwiseBank => 0x535a7bd3e650d799, + BundleFileType::WwiseDep => 0xaf32095c82f2b070, + BundleFileType::WwiseEvent => 0xaabdd317b58dfc8a, + BundleFileType::WwiseMetadata => 0xd50a8b7e1c82b110, + BundleFileType::WwiseStream => 0x504b55235d21440e, + BundleFileType::Xml => 0x76015845a6003765, + + BundleFileType::Unknown(hash) => hash.into(), + } + } +} +impl From for Murmur64 { + fn from(t: BundleFileType) -> Murmur64 { + let hash: u64 = t.into(); + Murmur64::from(hash) + } +} + +impl std::fmt::Display for BundleFileType { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + write!(f, "{}", self.ext_name()) + } +} diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index 813df06..ca36393 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -12,8 +12,10 @@ use crate::murmur::{HashGroup, IdString64, Murmur64}; pub(crate) mod database; pub(crate) mod file; +pub(crate) mod filetype; -pub use file::{BundleFile, BundleFileType, BundleFileVariant}; +pub use file::{BundleFile, BundleFileVariant}; +pub use filetype::BundleFileType; #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] enum BundleFormat { diff --git a/lib/sdk/src/filetype/package.rs b/lib/sdk/src/filetype/package.rs index 1f50f81..a36719e 100644 --- a/lib/sdk/src/filetype/package.rs +++ b/lib/sdk/src/filetype/package.rs @@ -11,7 +11,8 @@ use path_slash::PathBufExt; use tokio::fs; use crate::binary::sync::{ReadExt, WriteExt}; -use crate::bundle::file::{BundleFileType, UserFile}; +use crate::bundle::file::UserFile; +use crate::bundle::filetype::BundleFileType; use crate::murmur::{HashGroup, Murmur64}; #[tracing::instrument] @@ -280,17 +281,11 @@ where Ok(vec![UserFile::new(s.into_bytes())]) } -// #[tracing::instrument(skip_all)] -// pub fn compile(_ctx: &crate::Context, data: String) -> Result> { -// let pkg = Package::from_sjson(data)?; -// pkg.to_binary() -// } - #[cfg(test)] mod test { use std::path::PathBuf; - use crate::BundleFileType; + use crate::bundle::filetype::BundleFileType; use super::resolve_wildcard; use super::Package; From 95fc6c160b2176770ab54c4380f208bb664b76f4 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 4 Oct 2023 09:47:25 +0200 Subject: [PATCH 044/154] dtmt: Implement name overrides For most of the game files, we don't know the actual name, only the hash of that name. To still allow building bundles that contain files with that name (e.g. to override a game file with a custom one), there needs to be a way to tell DTMT to name a file such that its hash is the same as the one in the game. The initial idea was to just expect the file name on disk to be the hash, but that wouldn't allow for arbitrary folder structures anymore. So instead, there is now a new, optional setting in `dtmt.cfg`, where the modder can map a file path to an override name. --- crates/dtmm/src/controller/deploy.rs | 8 ++-- crates/dtmm/src/controller/import.rs | 1 + crates/dtmt/src/cmd/build.rs | 68 ++++++++++++++-------------- crates/dtmt/src/cmd/migrate.rs | 1 + crates/dtmt/src/cmd/watch.rs | 17 +++---- lib/dtmt-shared/src/lib.rs | 3 ++ lib/sdk/src/bundle/file.rs | 26 ++++------- lib/sdk/src/filetype/lua.rs | 13 ++---- lib/sdk/src/filetype/package.rs | 48 +++++++++++--------- lib/sdk/src/murmur/types.rs | 28 ++++++++++-- 10 files changed, 116 insertions(+), 97 deletions(-) diff --git a/crates/dtmm/src/controller/deploy.rs b/crates/dtmm/src/controller/deploy.rs index e2d9c0e..02b6860 100644 --- a/crates/dtmm/src/controller/deploy.rs +++ b/crates/dtmm/src/controller/deploy.rs @@ -324,11 +324,11 @@ async fn build_bundles(state: Arc) -> Result> { let mut bundles = Vec::new(); - let mut add_lua_asset = |name, data: &str| { + let mut add_lua_asset = |name: &str, data: &str| { let span = tracing::info_span!("Compiling Lua", name, data_len = data.len()); let _enter = span.enter(); - let file = lua::compile(name, data).wrap_err("Failed to compile Lua")?; + let file = lua::compile(name.to_string(), data).wrap_err("Failed to compile Lua")?; mod_bundle.add_file(file); @@ -517,8 +517,8 @@ async fn patch_boot_bundle( .wrap_err("Failed to render template `mod_main.lua`")?; tracing::trace!("Main script rendered:\n===========\n{}\n=============", lua); - let file = - lua::compile(MOD_BOOT_SCRIPT, lua).wrap_err("Failed to compile mod main Lua file")?; + let file = lua::compile(MOD_BOOT_SCRIPT.to_string(), lua) + .wrap_err("Failed to compile mod main Lua file")?; boot_bundle.add_file(file); } diff --git a/crates/dtmm/src/controller/import.rs b/crates/dtmm/src/controller/import.rs index 8e47d23..2f5f90b 100644 --- a/crates/dtmm/src/controller/import.rs +++ b/crates/dtmm/src/controller/import.rs @@ -297,6 +297,7 @@ fn extract_mod_config(archive: &mut ZipArchive) -> Result<(Mo packages: Vec::new(), resources, depends: Vec::new(), + name_overrides: Default::default(), }; Ok((cfg, root)) diff --git a/crates/dtmt/src/cmd/build.rs b/crates/dtmt/src/cmd/build.rs index 77ab629..fab072b 100644 --- a/crates/dtmt/src/cmd/build.rs +++ b/crates/dtmt/src/cmd/build.rs @@ -103,38 +103,41 @@ async fn find_project_config(dir: Option) -> Result { } #[tracing::instrument(skip_all)] -async fn compile_package_files

(pkg: &Package, root: P) -> Result> -where - P: AsRef + std::fmt::Debug, -{ - let root = Arc::new(root.as_ref()); +async fn compile_package_files(pkg: &Package, cfg: &ModConfig) -> Result> { + let root = Arc::new(&cfg.dir); + let name_overrides = &cfg.name_overrides; let tasks = pkg .iter() - .flat_map(|(file_type, paths)| { - paths.iter().map(|path| { + .flat_map(|(file_type, names)| { + names.iter().map(|name| { ( *file_type, - path, + name, // Cloning the `Arc` here solves the issue that in the next `.map`, I need to // `move` the closure parameters, but can't `move` `root` before it was cloned. root.clone(), ) }) }) - .map(|(file_type, path, root)| async move { - let sjson = fs::read_to_string(&path).await?; + .map(|(file_type, name, root)| async move { + let path = PathBuf::from(name); + let sjson = fs::read_to_string(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; - let mut path = path.clone(); - path.set_extension(""); - - BundleFile::from_sjson( - path.to_slash_lossy().to_string(), - file_type, - sjson, - root.as_ref(), - ) - .await + let name = path.with_extension("").to_slash_lossy().to_string(); + let name = if let Some(new_name) = name_overrides.get(&name) { + let new_name = match u64::from_str_radix(new_name, 16) { + Ok(hash) => IdString64::from(hash), + Err(_) => IdString64::from(new_name.clone()), + }; + tracing::info!("Overriding '{}' -> '{}'", name, new_name.display()); + new_name + } else { + IdString64::from(name.clone()) + }; + BundleFile::from_sjson(name, file_type, sjson, root.as_ref()).await }); let results = futures::stream::iter(tasks) @@ -146,12 +149,11 @@ where } #[tracing::instrument] -async fn build_package(package: P1, root: P2) -> Result -where - P1: AsRef + std::fmt::Debug, - P2: AsRef + std::fmt::Debug, -{ - let root = root.as_ref(); +async fn build_package( + cfg: &ModConfig, + package: impl AsRef + std::fmt::Debug, +) -> Result { + let root = &cfg.dir; let package = package.as_ref(); let mut path = root.join(package); @@ -165,7 +167,7 @@ where .await .wrap_err_with(|| format!("Invalid package file {}", &pkg_name))?; - let files = compile_package_files(&pkg, root).await?; + let files = compile_package_files(&pkg, cfg).await?; let mut bundle = Bundle::new(pkg_name); for file in files { bundle.add_file(file); @@ -254,14 +256,14 @@ pub(crate) async fn read_project_config(dir: Option) -> Result( +#[tracing::instrument] +pub(crate) async fn build

( cfg: &ModConfig, - out_path: P1, - game_dir: Arc>, + out_path: impl AsRef + std::fmt::Debug, + game_dir: Arc>, ) -> Result<()> where - P1: AsRef, - P2: AsRef, + P: AsRef + std::fmt::Debug, { let out_path = out_path.as_ref(); @@ -286,7 +288,7 @@ where ); } - let bundle = build_package(path, &cfg.dir).await.wrap_err_with(|| { + let bundle = build_package(&cfg, path).await.wrap_err_with(|| { format!( "Failed to build package '{}' at '{}'", path.display(), diff --git a/crates/dtmt/src/cmd/migrate.rs b/crates/dtmt/src/cmd/migrate.rs index 2eacded..d7bfa19 100644 --- a/crates/dtmt/src/cmd/migrate.rs +++ b/crates/dtmt/src/cmd/migrate.rs @@ -351,6 +351,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> }, depends: vec![ModDependency::ID(String::from("DMF"))], bundled: true, + name_overrides: HashMap::new(), }; tracing::debug!(?dtmt_cfg); diff --git a/crates/dtmt/src/cmd/watch.rs b/crates/dtmt/src/cmd/watch.rs index 79fab67..2abd0f7 100644 --- a/crates/dtmt/src/cmd/watch.rs +++ b/crates/dtmt/src/cmd/watch.rs @@ -77,17 +77,14 @@ pub(crate) fn command_definition() -> Command { ) } -async fn compile( +#[tracing::instrument] +async fn compile( cfg: &ModConfig, - out_path: P1, - archive_path: P2, - game_dir: Arc>, -) -> Result<()> -where - P1: AsRef + std::marker::Copy, - P2: AsRef, - P3: AsRef, -{ + out_path: impl AsRef + std::fmt::Debug, + archive_path: impl AsRef + std::fmt::Debug, + game_dir: Arc + std::fmt::Debug>>, +) -> Result<()> { + let out_path = out_path.as_ref(); build(cfg, out_path, game_dir) .await .wrap_err("Failed to build bundles")?; diff --git a/lib/dtmt-shared/src/lib.rs b/lib/dtmt-shared/src/lib.rs index 3c9530e..d1f69c7 100644 --- a/lib/dtmt-shared/src/lib.rs +++ b/lib/dtmt-shared/src/lib.rs @@ -1,3 +1,4 @@ +use std::collections::HashMap; use std::path::PathBuf; use color_eyre::eyre::{OptionExt as _, WrapErr as _}; @@ -67,6 +68,8 @@ pub struct ModConfig { pub depends: Vec, #[serde(default = "default_true", skip_serializing_if = "is_true")] pub bundled: bool, + #[serde(default)] + pub name_overrides: HashMap, } pub const STEAMAPP_ID: u32 = 1361210; diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index 1780a5d..f387409 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -120,7 +120,7 @@ pub struct BundleFile { } impl BundleFile { - pub fn new(name: String, file_type: BundleFileType) -> Self { + pub fn new(name: impl Into, file_type: BundleFileType) -> Self { Self { file_type, name: name.into(), @@ -252,20 +252,15 @@ impl BundleFile { Ok(w.into_inner()) } - #[tracing::instrument(name = "File::from_sjson", skip(sjson))] - pub async fn from_sjson( - name: String, + #[tracing::instrument("File::from_sjson", skip(sjson, name), fields(name = %name.display()))] + pub async fn from_sjson( + name: IdString64, file_type: BundleFileType, - sjson: S, - root: P, - ) -> Result - where - P: AsRef + std::fmt::Debug, - S: AsRef, - { + sjson: impl AsRef, + root: impl AsRef + std::fmt::Debug, + ) -> Result { match file_type { - BundleFileType::Lua => lua::compile(name.clone(), sjson) - .wrap_err_with(|| format!("Failed to compile Lua file '{}'", name)), + BundleFileType::Lua => lua::compile(name, sjson).wrap_err("Failed to compile Lua file"), BundleFileType::Unknown(_) => { eyre::bail!("Unknown file type. Cannot compile from SJSON"); } @@ -304,10 +299,7 @@ impl BundleFile { s } - pub fn matches_name(&self, name: S) -> bool - where - S: Into, - { + pub fn matches_name(&self, name: impl Into) -> bool { let name = name.into(); if self.name == name { return true; diff --git a/lib/sdk/src/filetype/lua.rs b/lib/sdk/src/filetype/lua.rs index bfe6de7..14f0d6b 100644 --- a/lib/sdk/src/filetype/lua.rs +++ b/lib/sdk/src/filetype/lua.rs @@ -15,6 +15,7 @@ use tokio::fs; use crate::binary::sync::ReadExt; use crate::binary::sync::WriteExt; use crate::bundle::file::{BundleFileVariant, UserFile}; +use crate::murmur::IdString64; use crate::{BundleFile, BundleFileType}; const BITSQUID_LUAJIT_HEADER: u32 = 0x8253461B; @@ -117,17 +118,13 @@ where } #[tracing::instrument(skip_all)] -pub fn compile(name: S, code: C) -> Result -where - S: Into, - C: AsRef, -{ +pub fn compile(name: impl Into, code: impl AsRef) -> Result { let name = name.into(); let code = code.as_ref(); tracing::trace!( "Compiling '{}', {} bytes of code", - name, + name.display(), code.as_bytes().len() ); @@ -135,8 +132,8 @@ where let state = lua::luaL_newstate(); lua::luaL_openlibs(state); - let name = CString::new(format!("@{name}").into_bytes()) - .wrap_err_with(|| format!("Cannot convert name into CString: {}", name))?; + let name = CString::new(format!("@{}", name.display()).into_bytes()) + .wrap_err_with(|| format!("Cannot convert name into CString: {}", name.display()))?; match lua::luaL_loadbuffer( state, code.as_ptr() as _, diff --git a/lib/sdk/src/filetype/package.rs b/lib/sdk/src/filetype/package.rs index a36719e..6394e42 100644 --- a/lib/sdk/src/filetype/package.rs +++ b/lib/sdk/src/filetype/package.rs @@ -7,13 +7,12 @@ use std::str::FromStr; use async_recursion::async_recursion; use color_eyre::eyre::{self, Context}; use color_eyre::Result; -use path_slash::PathBufExt; use tokio::fs; use crate::binary::sync::{ReadExt, WriteExt}; use crate::bundle::file::UserFile; use crate::bundle::filetype::BundleFileType; -use crate::murmur::{HashGroup, Murmur64}; +use crate::murmur::{HashGroup, IdString64, Murmur64}; #[tracing::instrument] #[async_recursion] @@ -91,12 +90,12 @@ where Ok(paths) } -type PackageType = HashMap>; +type PackageType = HashMap>; type PackageDefinition = HashMap>; #[derive(Default)] pub struct Package { - _name: String, + _name: IdString64, _root: PathBuf, inner: PackageType, flags: u8, @@ -117,9 +116,9 @@ impl DerefMut for Package { } impl Package { - pub fn new(name: String, root: PathBuf) -> Self { + pub fn new(name: impl Into, root: PathBuf) -> Self { Self { - _name: name, + _name: name.into(), _root: root, inner: Default::default(), flags: 1, @@ -130,17 +129,22 @@ impl Package { self.values().fold(0, |total, files| total + files.len()) } - pub fn add_file>(&mut self, file_type: BundleFileType, name: P) { + pub fn add_file(&mut self, file_type: BundleFileType, name: impl Into) { self.inner.entry(file_type).or_default().insert(name.into()); } #[tracing::instrument("Package::from_sjson", skip(sjson), fields(sjson_len = sjson.as_ref().len()))] - pub async fn from_sjson(sjson: S, name: String, root: P) -> Result + pub async fn from_sjson( + sjson: S, + name: impl Into + std::fmt::Debug, + root: P, + ) -> Result where P: AsRef + std::fmt::Debug, S: AsRef, { let root = root.as_ref(); + let name = name.into(); let definition: PackageDefinition = serde_sjson::from_str(sjson.as_ref())?; let mut inner: PackageType = Default::default(); @@ -174,7 +178,11 @@ impl Package { continue; }; - inner.entry(t).or_default().insert(path); + tracing::debug!("Adding file {}", path.display()); + inner + .entry(t) + .or_default() + .insert(path.display().to_string()); } } } @@ -193,11 +201,9 @@ impl Package { pub fn to_sjson(&self) -> Result { let mut map: PackageDefinition = Default::default(); - for (t, paths) in self.iter() { - for path in paths.iter() { - map.entry(t.ext_name()) - .or_default() - .insert(path.display().to_string()); + for (t, names) in self.iter() { + for name in names.iter() { + map.entry(t.ext_name()).or_default().insert(name.clone()); } } @@ -223,11 +229,11 @@ impl Package { for _ in 0..file_count { let t = BundleFileType::from(r.read_u64()?); let hash = Murmur64::from(r.read_u64()?); - let path = ctx.lookup_hash(hash, HashGroup::Filename); + let name = ctx.lookup_hash(hash, HashGroup::Filename); inner .entry(t) .or_default() - .insert(PathBuf::from(path.display().to_string())); + .insert(name.display().to_string()); } let flags = r.read_u8()?; @@ -240,7 +246,7 @@ impl Package { let pkg = Self { inner, - _name: name, + _name: name.into(), _root: PathBuf::new(), flags, }; @@ -256,12 +262,10 @@ impl Package { w.write_u32(0x2b)?; w.write_u32(self.values().flatten().count() as u32)?; - for (t, paths) in self.iter() { - for path in paths.iter() { + for (t, names) in self.iter() { + for name in names.iter() { w.write_u64(t.hash().into())?; - - let hash = Murmur64::hash(path.to_slash_lossy().as_bytes()); - w.write_u64(hash.into())?; + w.write_u64(Murmur64::hash(name.as_bytes()).into())?; } } diff --git a/lib/sdk/src/murmur/types.rs b/lib/sdk/src/murmur/types.rs index e96b992..20bf46a 100644 --- a/lib/sdk/src/murmur/types.rs +++ b/lib/sdk/src/murmur/types.rs @@ -1,3 +1,7 @@ +use std::path::Path; + +use path_slash::PathExt; + use self::util::{parse_hex32, parse_hex64}; use super::*; @@ -263,11 +267,23 @@ impl IdString64 { IdString64::String(_) => false, } } + + // Would love to have this as a proper `impl From`, but + // rustc will complain that it overlaps with the `impl From>`. + pub fn from_path(p: impl AsRef) -> Self { + Self::String(p.as_ref().to_slash_lossy().to_string()) + } } -impl> From for IdString64 { - fn from(value: S) -> Self { - Self::String(value.into()) +impl From for IdString64 { + fn from(value: String) -> Self { + Self::String(value) + } +} + +impl From for IdString64 { + fn from(value: u64) -> Self { + Self::Hash(value.into()) } } @@ -283,6 +299,12 @@ impl From for Murmur64 { } } +impl Default for IdString64 { + fn default() -> Self { + Self::Hash(0.into()) + } +} + impl PartialEq for IdString64 { fn eq(&self, other: &Self) -> bool { self.to_murmur64() == other.to_murmur64() From 74a7aaa6e5dacc758a7846ab720999756203bbc6 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sat, 16 Sep 2023 18:50:40 +0200 Subject: [PATCH 045/154] dtmt-shared: Write log lines to stderr Ideally, I would prefer the usual split per logging level, but that seems to be somewhat complex with `tracing_subscriber`, so this simply switches everything over to stderr, so that some of the experiment commands can write results to stdout. --- lib/dtmt-shared/src/log.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/dtmt-shared/src/log.rs b/lib/dtmt-shared/src/log.rs index ab0b7b5..9c95c63 100644 --- a/lib/dtmt-shared/src/log.rs +++ b/lib/dtmt-shared/src/log.rs @@ -84,7 +84,7 @@ pub fn create_tracing_subscriber() { EnvFilter::try_from_default_env().unwrap_or_else(|_| EnvFilter::try_new("info").unwrap()); let (dev_stdout_layer, prod_stdout_layer, filter_layer) = if cfg!(debug_assertions) { - let fmt_layer = fmt::layer().pretty(); + let fmt_layer = fmt::layer().pretty().with_writer(std::io::stderr); (Some(fmt_layer), None, None) } else { // Creates a layer that @@ -93,6 +93,7 @@ pub fn create_tracing_subscriber() { // - does not print spans/targets // - only prints time, not date let fmt_layer = fmt::layer() + .with_writer(std::io::stderr) .event_format(Formatter) .fmt_fields(debug_fn(format_fields)); From edad0d44930d306c5e6493db920ff97c7160e66c Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 30 Aug 2023 18:44:24 +0200 Subject: [PATCH 046/154] Improve file listing output Adds pretty printing for file size and always shows the bundle hash name --- crates/dtmt/src/cmd/bundle/list.rs | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/crates/dtmt/src/cmd/bundle/list.rs b/crates/dtmt/src/cmd/bundle/list.rs index dd72ad2..558126b 100644 --- a/crates/dtmt/src/cmd/bundle/list.rs +++ b/crates/dtmt/src/cmd/bundle/list.rs @@ -36,6 +36,18 @@ enum OutputFormat { Text, } +fn format_byte_size(size: usize) -> String { + if size < 1024 { + format!("{} Bytes", size) + } else if size < 1024 * 1024 { + format!("{} kB", size / 1024) + } else if size < 1024 * 1024 * 1024 { + format!("{} MB", size / (1024 * 1024)) + } else { + format!("{} GB", size / (1024 * 1024 * 1024)) + } +} + #[tracing::instrument(skip(ctx))] async fn print_bundle_contents

(ctx: &sdk::Context, path: P, fmt: OutputFormat) -> Result<()> where @@ -50,7 +62,11 @@ where match fmt { OutputFormat::Text => { - println!("Bundle: {}", bundle.name().display()); + println!( + "Bundle: {} ({:016x})", + bundle.name().display(), + bundle.name() + ); for f in bundle.files().iter() { if f.variants().len() != 1 { @@ -63,9 +79,10 @@ where let v = &f.variants()[0]; println!( - "\t{}.{}: {} bytes", + "\t{}.{}: {} ({})", f.base_name().display(), f.file_type().ext_name(), + format_byte_size(v.size()), v.size() ); } From 08219f05ba81b16bd34afa82ef37f99d32d65e3b Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Thu, 31 Aug 2023 17:14:54 +0200 Subject: [PATCH 047/154] sdk: Fix reading strings Fatshark has a few weird string fields, where they provide a length field, but then sometimes write a shorter, NUL-terminated string into that same field and adding padding up to the "advertised" length. To properly read those strings, we can't rely on just the length field anymore, but need to check for a NUL, too. --- lib/sdk/src/binary.rs | 35 +++++++++++++++++++++-------------- 1 file changed, 21 insertions(+), 14 deletions(-) diff --git a/lib/sdk/src/binary.rs b/lib/sdk/src/binary.rs index 1fcc90e..9348e1b 100644 --- a/lib/sdk/src/binary.rs +++ b/lib/sdk/src/binary.rs @@ -43,6 +43,7 @@ impl FromBinary for Vec { } pub mod sync { + use std::ffi::CStr; use std::io::{self, Read, Seek, SeekFrom}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; @@ -165,25 +166,13 @@ pub mod sync { } fn read_string_len(&mut self, len: usize) -> Result { - let mut buf = vec![0; len]; - let res = self - .read_exact(&mut buf) - .map_err(Report::new) - .and_then(|_| { - String::from_utf8(buf).map_err(|err| { - let ascii = String::from_utf8_lossy(err.as_bytes()).to_string(); - let bytes = format!("{:?}", err.as_bytes()); - Report::new(err) - .with_section(move || bytes.header("Bytes:")) - .with_section(move || ascii.header("ASCII:")) - }) - }); + let pos = self.stream_position(); + let res = read_string_len(self, len); if res.is_ok() { return res; } - let pos = self.stream_position(); if pos.is_ok() { res.with_section(|| { format!("{pos:#X} ({pos})", pos = pos.unwrap()).header("Position: ") @@ -243,4 +232,22 @@ pub mod sync { Err(err).with_section(|| format!("{pos:#X} ({pos})").header("Position: ")) } + + fn read_string_len(mut r: impl Read, len: usize) -> Result { + let mut buf = vec![0; len]; + r.read_exact(&mut buf) + .wrap_err_with(|| format!("Failed to read {} bytes", len))?; + + let res = match CStr::from_bytes_until_nul(&buf) { + Ok(s) => { + let s = s.to_str()?; + Ok(s.to_string()) + } + Err(_) => String::from_utf8(buf.clone()).map_err(Report::new), + }; + + res.wrap_err("Invalid binary for UTF8 string") + .with_section(|| format!("{}", String::from_utf8_lossy(&buf)).header("ASCI:")) + .with_section(|| format!("{:x?}", buf).header("Bytes:")) + } } From c997489e18de825300a9660f48973ff932663ddc Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 22 Sep 2023 15:35:39 +0200 Subject: [PATCH 048/154] Add some doc comments --- crates/dtmt/src/cmd/build.rs | 7 +++++++ lib/sdk/src/filetype/package.rs | 9 +++++++++ 2 files changed, 16 insertions(+) diff --git a/crates/dtmt/src/cmd/build.rs b/crates/dtmt/src/cmd/build.rs index fab072b..74a627d 100644 --- a/crates/dtmt/src/cmd/build.rs +++ b/crates/dtmt/src/cmd/build.rs @@ -55,6 +55,7 @@ pub(crate) fn command_definition() -> Command { ) } +/// Try to find a `dtmt.cfg` in the given directory or traverse up the parents. #[tracing::instrument] async fn find_project_config(dir: Option) -> Result { let (path, mut file) = if let Some(path) = dir { @@ -102,6 +103,8 @@ async fn find_project_config(dir: Option) -> Result { Ok(cfg) } +/// Iterate over the paths in the given `Package` and +/// compile each file by its file type. #[tracing::instrument(skip_all)] async fn compile_package_files(pkg: &Package, cfg: &ModConfig) -> Result> { let root = Arc::new(&cfg.dir); @@ -148,6 +151,8 @@ async fn compile_package_files(pkg: &Package, cfg: &ModConfig) -> Result>(path: P) -> Result { let path = path.as_ref(); diff --git a/lib/sdk/src/filetype/package.rs b/lib/sdk/src/filetype/package.rs index 6394e42..758f79f 100644 --- a/lib/sdk/src/filetype/package.rs +++ b/lib/sdk/src/filetype/package.rs @@ -14,6 +14,15 @@ use crate::bundle::file::UserFile; use crate::bundle::filetype::BundleFileType; use crate::murmur::{HashGroup, IdString64, Murmur64}; +/// Resolves a relative path that might contain wildcards into a list of +/// paths that exist on disk and match that wildcard. +/// This is similar to globbing in Unix shells, but with much less features. +/// +/// The only wilcard character allowed is `*`, and only at the end of the string, +/// where it matches all files recursively in that directory. +/// +/// `t` is an optional extension name, that may be used to force a wildcard +/// path to only match that file type `t`. #[tracing::instrument] #[async_recursion] async fn resolve_wildcard( From f1f9a818cc4dc006f2d8e8512564b4322d8ef1da Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 22 Sep 2023 15:37:37 +0200 Subject: [PATCH 049/154] sdk: Allow any byte stream for hashing dictionary entries --- lib/sdk/src/murmur/dictionary.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/sdk/src/murmur/dictionary.rs b/lib/sdk/src/murmur/dictionary.rs index 2d51af1..267f0a4 100644 --- a/lib/sdk/src/murmur/dictionary.rs +++ b/lib/sdk/src/murmur/dictionary.rs @@ -147,14 +147,14 @@ impl Dictionary { Ok(()) } - pub fn add(&mut self, value: String, group: HashGroup) { - let long = Murmur64::from(murmurhash64::hash(value.as_bytes(), SEED as u64)); - let short = Murmur32::from(murmurhash64::hash32(value.as_bytes(), SEED)); + pub fn add(&mut self, value: impl AsRef<[u8]>, group: HashGroup) { + let long = Murmur64::from(murmurhash64::hash(value.as_ref(), SEED as u64)); + let short = Murmur32::from(murmurhash64::hash32(value.as_ref(), SEED)); let entry = Entry { long, short, - value, + value: String::from_utf8_lossy(value.as_ref()).to_string(), group, }; From 3a6e954f9a45ac14df3ccb797ac86a797fb22ba4 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 19 Jul 2024 11:30:09 +0200 Subject: [PATCH 050/154] sdk: Refactor murmur modules and add IdString32 --- lib/sdk/src/murmur/idstring32.rs | 162 ++++++++++++++++++++++++++++ lib/sdk/src/murmur/idstring64.rs | 175 +++++++++++++++++++++++++++++++ lib/sdk/src/murmur/mod.rs | 4 + lib/sdk/src/murmur/types.rs | 173 ++---------------------------- 4 files changed, 347 insertions(+), 167 deletions(-) create mode 100644 lib/sdk/src/murmur/idstring32.rs create mode 100644 lib/sdk/src/murmur/idstring64.rs diff --git a/lib/sdk/src/murmur/idstring32.rs b/lib/sdk/src/murmur/idstring32.rs new file mode 100644 index 0000000..99ea7aa --- /dev/null +++ b/lib/sdk/src/murmur/idstring32.rs @@ -0,0 +1,162 @@ +use std::fmt; + +use serde::{Deserializer, Serializer}; + +use super::Murmur32; + +// This type encodes the fact that when reading in a bundle, we don't always have a dictionary +// entry for every hash in there. So we do want to have the real string available when needed, +// but at the same time retain the original hash information for when we don't. +// This is especially important when wanting to write back the read bundle, as the hashes need to +// stay the same. +// The previous system of always turning hashes into strings worked well for the purpose of +// displaying hashes, but would have made it very hard to turn a stringyfied hash back into +// an actual hash. +#[derive(Clone, Debug, Eq)] +pub enum IdString32 { + Hash(Murmur32), + String(String), +} + +impl IdString32 { + pub fn to_murmur32(&self) -> Murmur32 { + match self { + Self::Hash(hash) => *hash, + Self::String(s) => Murmur32::hash(s.as_bytes()), + } + } + + pub fn display(&self) -> IdString32Display { + let s = match self { + IdString32::Hash(hash) => hash.to_string(), + IdString32::String(s) => s.clone(), + }; + + IdString32Display(s) + } + + pub fn is_string(&self) -> bool { + match self { + IdString32::Hash(_) => false, + IdString32::String(_) => true, + } + } + + pub fn is_hash(&self) -> bool { + match self { + IdString32::Hash(_) => true, + IdString32::String(_) => false, + } + } +} + +impl From for IdString32 { + fn from(value: String) -> Self { + Self::String(value) + } +} + +impl From for IdString32 { + fn from(value: u32) -> Self { + Self::Hash(value.into()) + } +} + +impl From for u32 { + fn from(value: IdString32) -> Self { + value.to_murmur32().into() + } +} + +impl From for IdString32 { + fn from(value: Murmur32) -> Self { + Self::Hash(value) + } +} + +impl From for Murmur32 { + fn from(value: IdString32) -> Self { + value.to_murmur32() + } +} + +impl PartialEq for IdString32 { + fn eq(&self, other: &Self) -> bool { + self.to_murmur32() == other.to_murmur32() + } +} + +impl std::hash::Hash for IdString32 { + fn hash(&self, state: &mut H) { + state.write_u32(self.to_murmur32().into()); + } +} + +impl serde::Serialize for IdString32 { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_u32(self.to_murmur32().into()) + } +} + +struct IdString32Visitor; + +impl<'de> serde::de::Visitor<'de> for IdString32Visitor { + type Value = IdString32; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("an u32 or a string") + } + + fn visit_u32(self, value: u32) -> Result + where + E: serde::de::Error, + { + Ok(IdString32::Hash(value.into())) + } + + fn visit_str(self, v: &str) -> Result + where + E: serde::de::Error, + { + Ok(IdString32::String(v.to_string())) + } + + fn visit_string(self, v: String) -> Result + where + E: serde::de::Error, + { + Ok(IdString32::String(v)) + } +} + +impl<'de> serde::Deserialize<'de> for IdString32 { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_u32(IdString32Visitor) + } +} + +pub struct IdString32Display(String); + +impl std::fmt::Display for IdString32Display { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +impl std::fmt::UpperHex for IdString32 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::UpperHex::fmt(&self.to_murmur32(), f) + } +} + +impl std::fmt::LowerHex for IdString32 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::LowerHex::fmt(&self.to_murmur32(), f) + } +} diff --git a/lib/sdk/src/murmur/idstring64.rs b/lib/sdk/src/murmur/idstring64.rs new file mode 100644 index 0000000..781a0cd --- /dev/null +++ b/lib/sdk/src/murmur/idstring64.rs @@ -0,0 +1,175 @@ +use std::{fmt, path::Path}; + +use path_slash::PathExt as _; +use serde::{Deserializer, Serializer}; + +use super::Murmur64; + +// This type encodes the fact that when reading in a bundle, we don't always have a dictionary +// entry for every hash in there. So we do want to have the real string available when needed, +// but at the same time retain the original hash information for when we don't. +// This is especially important when wanting to write back the read bundle, as the hashes need to +// stay the same. +// The previous system of always turning hashes into strings worked well for the purpose of +// displaying hashes, but would have made it very hard to turn a stringyfied hash back into +// an actual hash. +#[derive(Clone, Debug, Eq)] +pub enum IdString64 { + Hash(Murmur64), + String(String), +} + +impl IdString64 { + pub fn to_murmur64(&self) -> Murmur64 { + match self { + Self::Hash(hash) => *hash, + Self::String(s) => Murmur64::hash(s.as_bytes()), + } + } + + pub fn display(&self) -> IdString64Display { + let s = match self { + IdString64::Hash(hash) => hash.to_string(), + IdString64::String(s) => s.clone(), + }; + + IdString64Display(s) + } + + pub fn is_string(&self) -> bool { + match self { + IdString64::Hash(_) => false, + IdString64::String(_) => true, + } + } + + pub fn is_hash(&self) -> bool { + match self { + IdString64::Hash(_) => true, + IdString64::String(_) => false, + } + } + + // Would love to have this as a proper `impl From`, but + // rustc will complain that it overlaps with the `impl From>`. + pub fn from_path(p: impl AsRef) -> Self { + Self::String(p.as_ref().to_slash_lossy().to_string()) + } +} + +impl From for IdString64 { + fn from(value: String) -> Self { + Self::String(value) + } +} + +impl From for IdString64 { + fn from(value: u64) -> Self { + Self::Hash(value.into()) + } +} + +impl From for IdString64 { + fn from(value: Murmur64) -> Self { + Self::Hash(value) + } +} + +impl From for Murmur64 { + fn from(value: IdString64) -> Self { + value.to_murmur64() + } +} + +impl From for u64 { + fn from(value: IdString64) -> Self { + value.to_murmur64().into() + } +} + +impl Default for IdString64 { + fn default() -> Self { + Self::Hash(0.into()) + } +} + +impl PartialEq for IdString64 { + fn eq(&self, other: &Self) -> bool { + self.to_murmur64() == other.to_murmur64() + } +} + +impl std::hash::Hash for IdString64 { + fn hash(&self, state: &mut H) { + state.write_u64(self.to_murmur64().into()); + } +} + +impl serde::Serialize for IdString64 { + fn serialize(&self, serializer: S) -> Result + where + S: Serializer, + { + serializer.serialize_u64(self.to_murmur64().into()) + } +} + +struct IdString64Visitor; + +impl<'de> serde::de::Visitor<'de> for IdString64Visitor { + type Value = IdString64; + + fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { + formatter.write_str("an u64 or a string") + } + + fn visit_u64(self, value: u64) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::Hash(value.into())) + } + + fn visit_str(self, v: &str) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::String(v.to_string())) + } + + fn visit_string(self, v: String) -> Result + where + E: serde::de::Error, + { + Ok(IdString64::String(v)) + } +} + +impl<'de> serde::Deserialize<'de> for IdString64 { + fn deserialize(deserializer: D) -> Result + where + D: Deserializer<'de>, + { + deserializer.deserialize_u64(IdString64Visitor) + } +} + +pub struct IdString64Display(String); + +impl std::fmt::Display for IdString64Display { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.0) + } +} + +impl std::fmt::UpperHex for IdString64 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::UpperHex::fmt(&self.to_murmur64(), f) + } +} + +impl std::fmt::LowerHex for IdString64 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + std::fmt::LowerHex::fmt(&self.to_murmur64(), f) + } +} diff --git a/lib/sdk/src/murmur/mod.rs b/lib/sdk/src/murmur/mod.rs index 87a8473..6449d38 100644 --- a/lib/sdk/src/murmur/mod.rs +++ b/lib/sdk/src/murmur/mod.rs @@ -8,6 +8,8 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; mod dictionary; // Currently unused // mod murmurhash32; +mod idstring32; +mod idstring64; mod murmurhash64; mod types; mod util; @@ -15,6 +17,8 @@ mod util; pub const SEED: u32 = 0; pub use dictionary::{Dictionary, Entry, HashGroup}; +pub use idstring32::*; +pub use idstring64::*; pub use murmurhash64::hash; pub use murmurhash64::hash32; pub use murmurhash64::hash_inverse as inverse; diff --git a/lib/sdk/src/murmur/types.rs b/lib/sdk/src/murmur/types.rs index 20bf46a..c66e2cf 100644 --- a/lib/sdk/src/murmur/types.rs +++ b/lib/sdk/src/murmur/types.rs @@ -1,7 +1,3 @@ -use std::path::Path; - -use path_slash::PathExt; - use self::util::{parse_hex32, parse_hex64}; use super::*; @@ -154,6 +150,12 @@ impl fmt::UpperHex for Murmur32 { } } +impl fmt::LowerHex for Murmur32 { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + fmt::LowerHex::fmt(&self.0, f) + } +} + impl fmt::Display for Murmur32 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:08X}", self) @@ -222,166 +224,3 @@ impl<'de> Deserialize<'de> for Murmur32 { deserializer.deserialize_any(Self(0)) } } - -// This type encodes the fact that when reading in a bundle, we don't always have a dictionary -// entry for every hash in there. So we do want to have the real string available when needed, -// but at the same time retain the original hash information for when we don't. -// This is especially important when wanting to write back the read bundle, as the hashes need to -// stay the same. -// The previous system of always turning hashes into strings worked well for the purpose of -// displaying hashes, but would have made it very hard to turn a stringyfied hash back into -// an actual hash. -#[derive(Clone, Debug, Eq)] -pub enum IdString64 { - Hash(Murmur64), - String(String), -} - -impl IdString64 { - pub fn to_murmur64(&self) -> Murmur64 { - match self { - Self::Hash(hash) => *hash, - Self::String(s) => Murmur64::hash(s.as_bytes()), - } - } - - pub fn display(&self) -> IdString64Display { - let s = match self { - IdString64::Hash(hash) => hash.to_string(), - IdString64::String(s) => s.clone(), - }; - - IdString64Display(s) - } - - pub fn is_string(&self) -> bool { - match self { - IdString64::Hash(_) => false, - IdString64::String(_) => true, - } - } - - pub fn is_hash(&self) -> bool { - match self { - IdString64::Hash(_) => true, - IdString64::String(_) => false, - } - } - - // Would love to have this as a proper `impl From`, but - // rustc will complain that it overlaps with the `impl From>`. - pub fn from_path(p: impl AsRef) -> Self { - Self::String(p.as_ref().to_slash_lossy().to_string()) - } -} - -impl From for IdString64 { - fn from(value: String) -> Self { - Self::String(value) - } -} - -impl From for IdString64 { - fn from(value: u64) -> Self { - Self::Hash(value.into()) - } -} - -impl From for IdString64 { - fn from(value: Murmur64) -> Self { - Self::Hash(value) - } -} - -impl From for Murmur64 { - fn from(value: IdString64) -> Self { - value.to_murmur64() - } -} - -impl Default for IdString64 { - fn default() -> Self { - Self::Hash(0.into()) - } -} - -impl PartialEq for IdString64 { - fn eq(&self, other: &Self) -> bool { - self.to_murmur64() == other.to_murmur64() - } -} - -impl std::hash::Hash for IdString64 { - fn hash(&self, state: &mut H) { - state.write_u64(self.to_murmur64().into()); - } -} - -impl serde::Serialize for IdString64 { - fn serialize(&self, serializer: S) -> Result - where - S: Serializer, - { - serializer.serialize_u64(self.to_murmur64().into()) - } -} - -struct IdString64Visitor; - -impl<'de> serde::de::Visitor<'de> for IdString64Visitor { - type Value = IdString64; - - fn expecting(&self, formatter: &mut fmt::Formatter) -> fmt::Result { - formatter.write_str("an u64 or a string") - } - - fn visit_u64(self, value: u64) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::Hash(value.into())) - } - - fn visit_str(self, v: &str) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::String(v.to_string())) - } - - fn visit_string(self, v: String) -> Result - where - E: serde::de::Error, - { - Ok(IdString64::String(v)) - } -} - -impl<'de> serde::Deserialize<'de> for IdString64 { - fn deserialize(deserializer: D) -> Result - where - D: Deserializer<'de>, - { - deserializer.deserialize_u64(IdString64Visitor) - } -} - -pub struct IdString64Display(String); - -impl std::fmt::Display for IdString64Display { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{}", self.0) - } -} - -impl std::fmt::UpperHex for IdString64 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::UpperHex::fmt(&self.to_murmur64(), f) - } -} - -impl std::fmt::LowerHex for IdString64 { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - std::fmt::LowerHex::fmt(&self.to_murmur64(), f) - } -} From dbf060032b015a9211f475339b8fbfcae234c3d4 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 28 Jul 2024 14:46:10 +0200 Subject: [PATCH 051/154] sdk: Implement bundle database resource hashes Algorithm reverse engineered by WhiteGoat. --- lib/sdk/src/bundle/database.rs | 41 +++++++++++++++++++++++++++------- 1 file changed, 33 insertions(+), 8 deletions(-) diff --git a/lib/sdk/src/bundle/database.rs b/lib/sdk/src/bundle/database.rs index fce26ee..d9e0f03 100644 --- a/lib/sdk/src/bundle/database.rs +++ b/lib/sdk/src/bundle/database.rs @@ -36,6 +36,25 @@ pub struct BundleDatabase { bundle_contents: HashMap>, } +// Implements the partial Murmur that's used by the engine to compute bundle resource hashes, +// but in a way that the loop can be done outside the function. +#[inline(always)] +fn add_to_resource_hash(mut k: u64, name: impl Into) -> u64 { + const M: u64 = 0xc6a4a7935bd1e995; + const R: u64 = 47; + + let mut h: u64 = name.into(); + + k = k.wrapping_mul(M); + k ^= k >> R; + k = k.wrapping_mul(M); + + h ^= k; + k = M.wrapping_mul(h); + + k +} + impl BundleDatabase { pub fn add_bundle(&mut self, bundle: &Bundle) { let hash = bundle.name().to_murmur64(); @@ -69,20 +88,26 @@ impl BundleDatabase { } } + let mut resource_hash = 0; + for f in bundle.files() { + let name = f.base_name().to_murmur64(); let file_name = FileName { extension: f.file_type(), - name: f.base_name().to_murmur64(), + name, }; - // TODO: Compute actual resource hash - self.resource_hashes.insert(hash, 0); + resource_hash = add_to_resource_hash(resource_hash, name); + // TODO: Make sure each file name only exists once. Probably best to turn + // the `Vec` into a sorted `HashSet`. self.bundle_contents .entry(hash) .or_default() .push(file_name); } + + self.resource_hashes.insert(hash, resource_hash); } } @@ -103,7 +128,7 @@ impl FromBinary for BundleDatabase { let mut stored_files = HashMap::with_capacity(num_entries); for _ in 0..num_entries { - let hash = Murmur64::from(r.read_u64()?); + let hash = r.read_u64().map(Murmur64::from)?; let num_files = r.read_u32()? as usize; let mut files = Vec::with_capacity(num_files); @@ -161,7 +186,7 @@ impl FromBinary for BundleDatabase { let mut resource_hashes = HashMap::with_capacity(num_hashes); for _ in 0..num_hashes { - let name = Murmur64::from(r.read_u64()?); + let name = r.read_u64().map(Murmur64::from)?; let hash = r.read_u64()?; resource_hashes.insert(name, hash); @@ -171,14 +196,14 @@ impl FromBinary for BundleDatabase { let mut bundle_contents = HashMap::with_capacity(num_contents); for _ in 0..num_contents { - let hash = Murmur64::from(r.read_u64()?); + let hash = r.read_u64().map(Murmur64::from)?; let num_files = r.read_u32()? as usize; let mut files = Vec::with_capacity(num_files); for _ in 0..num_files { - let extension = BundleFileType::from(r.read_u64()?); - let name = Murmur64::from(r.read_u64()?); + let extension = r.read_u64().map(BundleFileType::from)?; + let name = r.read_u64().map(Murmur64::from)?; files.push(FileName { extension, name }); } From 7fa08c2efd10ae87f9bcf588d508bf1631eea845 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 28 Jul 2024 17:55:10 +0200 Subject: [PATCH 052/154] dtmt: Implement listing bundle database contents --- CHANGELOG.adoc | 1 + crates/dtmt/src/cmd/bundle/db.rs | 129 ++++++++++++++++++++++++++++++ crates/dtmt/src/cmd/bundle/mod.rs | 3 + lib/sdk/src/bundle/database.rs | 20 +++-- 4 files changed, 147 insertions(+), 6 deletions(-) create mode 100644 crates/dtmt/src/cmd/bundle/db.rs diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index db30865..c5ba065 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -20,6 +20,7 @@ - dtmm: fetch file version for Nexus mods - dtmm: handle `nxm://` URIs via IPC and import the corresponding mod - dtmm: Add button to open mod on nexusmods.com +- dtmt: Implement commands to list bundles and contents === Fixed diff --git a/crates/dtmt/src/cmd/bundle/db.rs b/crates/dtmt/src/cmd/bundle/db.rs new file mode 100644 index 0000000..6d4da59 --- /dev/null +++ b/crates/dtmt/src/cmd/bundle/db.rs @@ -0,0 +1,129 @@ +use std::{io::Cursor, path::PathBuf}; + +use clap::{value_parser, Arg, ArgMatches, Command}; +use color_eyre::{eyre::Context as _, Result}; +use sdk::murmur::{HashGroup, IdString64, Murmur64}; +use sdk::{BundleDatabase, FromBinary as _}; +use tokio::fs; + +pub(crate) fn command_definition() -> Command { + Command::new("db") + .about("Various operations regarding `bundle_database.data`.") + .subcommand_required(true) + .subcommand( + Command::new("list-files") + .about("List bundle contents") + .arg( + Arg::new("database") + .required(true) + .help("Path to the bundle database") + .value_parser(value_parser!(PathBuf)), + ) + .arg( + Arg::new("bundle") + .help("The bundle name. If omitted, all bundles will be listed.") + .required(false), + ), + ) + .subcommand( + Command::new("list-bundles").about("List bundles").arg( + Arg::new("database") + .required(true) + .help("Path to the bundle database") + .value_parser(value_parser!(PathBuf)), + ), + ) +} + +#[tracing::instrument(skip_all)] +pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { + let Some((op, sub_matches)) = matches.subcommand() else { + unreachable!("clap is configured to require a subcommand"); + }; + + let database = { + let path = sub_matches + .get_one::("database") + .expect("argument is required"); + + let binary = fs::read(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + + let mut r = Cursor::new(binary); + + BundleDatabase::from_binary(&mut r).wrap_err("Failed to parse bundle database")? + }; + + match op { + "list-files" => { + let index = database.files(); + + if let Some(bundle) = sub_matches.get_one::("bundle") { + let hash = u64::from_str_radix(bundle, 16) + .map(Murmur64::from) + .wrap_err("Invalid hex sequence")?; + + if let Some(files) = index.get(&hash) { + for file in files { + let name = ctx.lookup_hash(file.name, HashGroup::Filename); + let extension = file.extension.ext_name(); + println!("{}.{}", name.display(), extension); + } + } else { + tracing::info!("Bundle {} not found in the database", bundle); + } + } else { + for (bundle_hash, files) in index.iter() { + let bundle_name = ctx.lookup_hash(*bundle_hash, HashGroup::Filename); + + match bundle_name { + IdString64::String(name) => { + println!("{:016X} {}", bundle_hash, name); + } + IdString64::Hash(hash) => { + println!("{:016X}", hash); + } + } + + for file in files { + let name = ctx.lookup_hash(file.name, HashGroup::Filename); + let extension = file.extension.ext_name(); + + match name { + IdString64::String(name) => { + println!("\t{:016X}.{:<12} {}", file.name, extension, name); + } + IdString64::Hash(hash) => { + println!("\t{:016X}.{}", hash, extension); + } + } + } + + println!(); + } + } + + Ok(()) + } + "list-bundles" => { + for bundle_hash in database.bundles().keys() { + let bundle_name = ctx.lookup_hash(*bundle_hash, HashGroup::Filename); + + match bundle_name { + IdString64::String(name) => { + println!("{:016X} {}", bundle_hash, name); + } + IdString64::Hash(hash) => { + println!("{:016X}", hash); + } + } + } + + Ok(()) + } + _ => unreachable!( + "clap is configured to require a subcommand, and they're all handled above" + ), + } +} diff --git a/crates/dtmt/src/cmd/bundle/mod.rs b/crates/dtmt/src/cmd/bundle/mod.rs index 0e7c9f7..c5145e4 100644 --- a/crates/dtmt/src/cmd/bundle/mod.rs +++ b/crates/dtmt/src/cmd/bundle/mod.rs @@ -1,6 +1,7 @@ use clap::{ArgMatches, Command}; use color_eyre::eyre::Result; +mod db; mod decompress; mod extract; mod inject; @@ -14,6 +15,7 @@ pub(crate) fn command_definition() -> Command { .subcommand(extract::command_definition()) .subcommand(inject::command_definition()) .subcommand(list::command_definition()) + .subcommand(db::command_definition()) } #[tracing::instrument(skip_all)] @@ -23,6 +25,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { Some(("extract", sub_matches)) => extract::run(ctx, sub_matches).await, Some(("inject", sub_matches)) => inject::run(ctx, sub_matches).await, Some(("list", sub_matches)) => list::run(ctx, sub_matches).await, + Some(("db", sub_matches)) => db::run(ctx, sub_matches).await, _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" ), diff --git a/lib/sdk/src/bundle/database.rs b/lib/sdk/src/bundle/database.rs index d9e0f03..185c62f 100644 --- a/lib/sdk/src/bundle/database.rs +++ b/lib/sdk/src/bundle/database.rs @@ -19,15 +19,15 @@ const DATABASE_VERSION: u32 = 0x6; const FILE_VERSION: u32 = 0x4; pub struct BundleFile { - name: String, - stream: String, - platform_specific: bool, - file_time: u64, + pub name: String, + pub stream: String, + pub platform_specific: bool, + pub file_time: u64, } pub struct FileName { - extension: BundleFileType, - name: Murmur64, + pub extension: BundleFileType, + pub name: Murmur64, } pub struct BundleDatabase { @@ -56,6 +56,14 @@ fn add_to_resource_hash(mut k: u64, name: impl Into) -> u64 { } impl BundleDatabase { + pub fn bundles(&self) -> &HashMap> { + &self.stored_files + } + + pub fn files(&self) -> &HashMap> { + &self.bundle_contents + } + pub fn add_bundle(&mut self, bundle: &Bundle) { let hash = bundle.name().to_murmur64(); let name = hash.to_string(); From d931e6b9cada6fdce92595a27a96b7e7428f7356 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Sun, 28 Jul 2024 22:02:01 +0200 Subject: [PATCH 053/154] dtmt: Add command to search for files Not really of much use at the moment, but inspired by the HD2 community. --- CHANGELOG.adoc | 1 + crates/dtmt/src/cmd/bundle/db.rs | 57 ++++++++++++++++++++++++++++---- 2 files changed, 52 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.adoc b/CHANGELOG.adoc index c5ba065..1bfb0dd 100644 --- a/CHANGELOG.adoc +++ b/CHANGELOG.adoc @@ -21,6 +21,7 @@ - dtmm: handle `nxm://` URIs via IPC and import the corresponding mod - dtmm: Add button to open mod on nexusmods.com - dtmt: Implement commands to list bundles and contents +- dtmt: Implement command to search for files === Fixed diff --git a/crates/dtmt/src/cmd/bundle/db.rs b/crates/dtmt/src/cmd/bundle/db.rs index 6d4da59..b537991 100644 --- a/crates/dtmt/src/cmd/bundle/db.rs +++ b/crates/dtmt/src/cmd/bundle/db.rs @@ -33,6 +33,21 @@ pub(crate) fn command_definition() -> Command { .value_parser(value_parser!(PathBuf)), ), ) + .subcommand( + Command::new("find-file") + .about("Find the bundle a file belongs to") + .arg( + Arg::new("database") + .required(true) + .help("Path to the bundle database") + .value_parser(value_parser!(PathBuf)), + ) + .arg( + Arg::new("file-name") + .required(true) + .help("Name of the file. May be a hash in hex representation or a string"), + ), + ) } #[tracing::instrument(skip_all)] @@ -79,10 +94,10 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match bundle_name { IdString64::String(name) => { - println!("{:016X} {}", bundle_hash, name); + println!("{:016x} {}", bundle_hash, name); } IdString64::Hash(hash) => { - println!("{:016X}", hash); + println!("{:016x}", hash); } } @@ -92,10 +107,10 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match name { IdString64::String(name) => { - println!("\t{:016X}.{:<12} {}", file.name, extension, name); + println!("\t{:016x}.{:<12} {}", file.name, extension, name); } IdString64::Hash(hash) => { - println!("\t{:016X}.{}", hash, extension); + println!("\t{:016x}.{}", hash, extension); } } } @@ -112,16 +127,46 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match bundle_name { IdString64::String(name) => { - println!("{:016X} {}", bundle_hash, name); + println!("{:016x} {}", bundle_hash, name); } IdString64::Hash(hash) => { - println!("{:016X}", hash); + println!("{:016x}", hash); } } } Ok(()) } + "find-file" => { + let name = sub_matches + .get_one::("file-name") + .expect("required argument"); + let name = match u64::from_str_radix(name, 16).map(Murmur64::from) { + Ok(hash) => hash, + Err(_) => Murmur64::hash(name), + }; + + let bundles = database.files().iter().filter_map(|(bundle_hash, files)| { + if files.iter().any(|file| file.name == name) { + Some(bundle_hash) + } else { + None + } + }); + + let mut found = false; + + for bundle in bundles { + found = true; + println!("{:016x}", bundle); + } + + if !found { + std::process::exit(1); + } + + Ok(()) + } _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" ), From 2a1d8d815f3af3cde183183636f55698b8cc5ee2 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 14 Aug 2024 09:22:24 +0200 Subject: [PATCH 054/154] Add tests for hash inversion Just a quick round trip test, and an additional assert to demonstrate that byte order does matter. --- lib/sdk/src/murmur/murmurhash64.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/sdk/src/murmur/murmurhash64.rs b/lib/sdk/src/murmur/murmurhash64.rs index f15248c..ca69852 100644 --- a/lib/sdk/src/murmur/murmurhash64.rs +++ b/lib/sdk/src/murmur/murmurhash64.rs @@ -119,4 +119,9 @@ fn test_hash() { } #[test] -fn test_inverse() {} +fn test_inverse() { + let h = hash("lua".as_bytes(), crate::murmur::SEED as u64); + let inv = hash_inverse(h, crate::murmur::SEED as u64); + assert_eq!(h, hash(&inv.to_le_bytes(), crate::murmur::SEED as u64)); + assert_ne!(h, hash(&inv.to_be_bytes(), crate::murmur::SEED as u64)); +} From e3362400943a318db323cf46a8fe9981e8501b99 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 20 Aug 2024 16:28:08 +0200 Subject: [PATCH 055/154] Consilidate template libraries Remove last uses of `string_template` in favor of `minijinja`. Closes #124. --- Cargo.lock | 11 +------- Cargo.toml | 1 + crates/dtmm/Cargo.toml | 2 +- crates/dtmt/Cargo.toml | 2 +- crates/dtmt/src/cmd/new.rs | 54 ++++++++++++++++++++++---------------- 5 files changed, 36 insertions(+), 34 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a251de9..ce13303 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -937,6 +937,7 @@ dependencies = [ "futures-util", "glob", "luajit2-sys", + "minijinja", "nanorand", "notify", "oodle", @@ -948,7 +949,6 @@ dependencies = [ "serde", "serde_sjson", "shlex", - "string_template", "tempfile", "tokio", "tokio-stream", @@ -3307,15 +3307,6 @@ dependencies = [ "float-cmp", ] -[[package]] -name = "string_template" -version = "0.2.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc6f2c6b2c3fa950895c9aeb0c3cb9271d7eb580662af9af2b711b593f446320" -dependencies = [ - "regex", -] - [[package]] name = "strip-ansi-escapes" version = "0.2.0" diff --git a/Cargo.toml b/Cargo.toml index f38ac22..62d1fd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -14,6 +14,7 @@ exclude = ["lib/color-eyre"] [workspace.dependencies] zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } +minijinja = { version = "2.0.1", default-features = false } [patch.crates-io] color-eyre = { path = "lib/color-eyre" } diff --git a/crates/dtmm/Cargo.toml b/crates/dtmm/Cargo.toml index f947fc6..b7bee49 100644 --- a/crates/dtmm/Cargo.toml +++ b/crates/dtmm/Cargo.toml @@ -27,7 +27,7 @@ futures = "0.3.25" interprocess = "2.1.0" lazy_static = "1.4.0" luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } -minijinja = { version = "2.0.1", default-features = false } +minijinja = { workspace = true } nexusmods = { path = "../../lib/nexusmods", version = "*" } oodle = { path = "../../lib/oodle", version = "*" } open = "5.0.1" diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index d836a50..e2e3fb9 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -20,7 +20,7 @@ promptly = "0.3.1" sdk = { path = "../../lib/sdk", version = "*" } serde_sjson = { path = "../../lib/serde_sjson", version = "*" } serde = { version = "1.0.147", features = ["derive"] } -string_template = "0.2.1" +minijinja = { workspace = true } tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } tracing-error = "0.2.0" diff --git a/crates/dtmt/src/cmd/new.rs b/crates/dtmt/src/cmd/new.rs index eb6a4f9..1993ea2 100644 --- a/crates/dtmt/src/cmd/new.rs +++ b/crates/dtmt/src/cmd/new.rs @@ -1,11 +1,10 @@ -use std::collections::HashMap; use std::path::PathBuf; use clap::{Arg, ArgMatches, Command}; use color_eyre::eyre::{self, Context, Result}; use color_eyre::Help; use futures::{StreamExt, TryStreamExt}; -use string_template::Template; +use minijinja::Environment; use tokio::fs::{self, DirBuilder}; const TEMPLATES: [(&str, &str); 5] = [ @@ -137,34 +136,45 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> tracing::debug!(root = %root.display(), name, id); - let mut data = HashMap::new(); - data.insert("name", name.as_str()); - data.insert("id", id.as_str()); + let render_ctx = minijinja::context!(name => name.as_str(), id => id.as_str()); + let env = Environment::new(); let templates = TEMPLATES .iter() .map(|(path_tmpl, content_tmpl)| { - let path = Template::new(path_tmpl).render(&data); - let content = Template::new(content_tmpl).render(&data); - - (root.join(path), content) + env.render_str(path_tmpl, &render_ctx) + .wrap_err_with(|| format!("Failed to render template: {}", path_tmpl)) + .and_then(|path| { + env.render_named_str(&path, content_tmpl, &render_ctx) + .wrap_err_with(|| format!("Failed to render template '{}'", &path)) + .map(|content| (root.join(path), content)) + }) }) - .map(|(path, content)| async move { - let dir = path - .parent() - .ok_or_else(|| eyre::eyre!("invalid root path"))?; + .map(|res| async move { + match res { + Ok((path, content)) => { + let dir = path + .parent() + .ok_or_else(|| eyre::eyre!("invalid root path"))?; - DirBuilder::new() - .recursive(true) - .create(&dir) - .await - .wrap_err_with(|| format!("Failed to create directory {}", dir.display()))?; + DirBuilder::new() + .recursive(true) + .create(&dir) + .await + .wrap_err_with(|| { + format!("Failed to create directory {}", dir.display()) + })?; - tracing::trace!("Writing file {}", path.display()); + tracing::trace!("Writing file {}", path.display()); - fs::write(&path, content.as_bytes()) - .await - .wrap_err_with(|| format!("Failed to write content to path {}", path.display())) + fs::write(&path, content.as_bytes()) + .await + .wrap_err_with(|| { + format!("Failed to write content to path {}", path.display()) + }) + } + Err(e) => Err(e), + } }); futures::stream::iter(templates) From df2992a4768e7c6f582049e45089141cd69ec7bd Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 20 Aug 2024 16:28:56 +0200 Subject: [PATCH 056/154] Improve mod template comments --- crates/dtmt/src/cmd/new.rs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/crates/dtmt/src/cmd/new.rs b/crates/dtmt/src/cmd/new.rs index 1993ea2..571b0cb 100644 --- a/crates/dtmt/src/cmd/new.rs +++ b/crates/dtmt/src/cmd/new.rs @@ -10,8 +10,21 @@ use tokio::fs::{self, DirBuilder}; const TEMPLATES: [(&str, &str); 5] = [ ( "dtmt.cfg", - r#"id = "{{id}}" + r#"// +// This is your mod's main configuration file. It tells DTMT how to build the mod, +// and DTMM what to display to your users. +// Certain files have been pre-filled by the template, the ones commented out (`//`) +// are optional. +// +// A unique identifier (preferably lower case, alphanumeric) +id = "{{id}}" +// The display name that your users will see. +// This doesn't have to be unique, but you still want to avoid being confused with other +// mods. name = "{{name}}" +// It's good practice to increase this number whenever you publish changes. +// It's up to you if you use SemVer or something simpler like `1970-12-24`. It should sort and +// compare well, though. version = "0.1.0" // author = "" @@ -31,16 +44,25 @@ categories = [ // A list of mod IDs that this mod depends on. You can find // those IDs by downloading the mod and extracting their `dtmt.cfg`. +// To make your fellow modders' lives easier, publish your own mods' IDs +// somewhere visible, such as the Nexusmods page. depends = [ DMF ] +// The primary resources that serve as the entry point to your +// mod's code. Unless for very specific use cases, the generated +// values shouldn't be changed. resources = { init = "scripts/mods/{{id}}/init" data = "scripts/mods/{{id}}/data" localization = "scripts/mods/{{id}}/localization" } +// The list of packages, or bundles, to build. +// Each one corresponds to a package definition in the named folder. +// For mods that contain only code and/or a few small assets, a single +// package will suffice. packages = [ "packages/mods/{{id}}" ] @@ -58,7 +80,6 @@ packages = [ r#"local mod = get_mod("{{id}}") -- Your mod code goes here. --- https://vmf-docs.verminti.de "#, ), ( From 6d94a4dd2c296bf1f044ee4c70fb10dca4c1c241 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 21 Aug 2024 14:33:15 +0200 Subject: [PATCH 057/154] Update bindgen --- Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Cargo.toml b/Cargo.toml index 1f48fa3..69e935b 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,6 +15,6 @@ links = "luajit" libc = "0.2" [build-dependencies] -bindgen = "0.69.4" +bindgen = "0.70.1" cc = "1" fs_extra = "1.1.0" From a2bbab1398e6f2caecd14a10efc564d0ef95d7c4 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 21 Aug 2024 14:25:41 +0200 Subject: [PATCH 058/154] Update dependencies --- Cargo.lock | 870 +++++++++++++++++++++---------------- Cargo.toml | 49 ++- crates/dtmm/Cargo.toml | 60 +-- crates/dtmt/Cargo.toml | 54 +-- lib/color-eyre | 2 +- lib/dtmt-shared/Cargo.toml | 16 +- lib/luajit2-sys | 2 +- lib/oodle/Cargo.toml | 6 +- lib/oodle/src/lib.rs | 1 + lib/sdk/Cargo.toml | 40 +- 10 files changed, 639 insertions(+), 461 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ce13303..26ccff7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4,9 +4,9 @@ version = 3 [[package]] name = "addr2line" -version = "0.21.0" +version = "0.22.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a30b2e23b9e17a9f90641c7ab1549cd9b44f296d3ccbf309d2863cfe398a0cb" +checksum = "6e4503c46a5c0c7844e948c9a4d6acd9f50cccb4de1c48eb9e291ea17470c678" dependencies = [ "gimli", ] @@ -17,6 +17,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + [[package]] name = "aho-corasick" version = "1.1.3" @@ -29,7 +35,8 @@ dependencies = [ [[package]] name = "ansi-parser" version = "0.9.1" -source = "git+https://gitlab.com/lschwiderski/ansi-parser.git?branch=issue/outdated-heapless#bfcd2689677fa93ce72c55833e891af36c65b2aa" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c43e7fd8284f025d0bd143c2855618ecdf697db55bde39211e5c9faec7669173" dependencies = [ "heapless", "nom", @@ -46,9 +53,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.14" +version = "0.6.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "418c75fa768af9c03be99d17643f93f79bbba589895012a80e3452a19ddda15b" +checksum = "64e15c1ab1f89faffbf04a634d5e1962e9074f2741eef6d97f3c4e322426d526" dependencies = [ "anstyle", "anstyle-parse", @@ -61,33 +68,33 @@ dependencies = [ [[package]] name = "anstyle" -version = "1.0.7" +version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "038dfcf04a5feb68e9c60b21c9625a54c2c0616e79b72b0fd87075a056ae1d1b" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" [[package]] name = "anstyle-parse" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c03a11a9034d92058ceb6ee011ce58af4a9bf61491aa7e1e59ecd24bd40d22d4" +checksum = "eb47de1e80c2b463c735db5b217a0ddc39d612e7ac9e2e96a5aed1f57616c1cb" dependencies = [ "utf8parse", ] [[package]] name = "anstyle-query" -version = "1.0.3" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a64c907d4e79225ac72e2a354c9ce84d50ebb4586dee56c82b3ee73004f537f5" +checksum = "6d36fc52c7f6c869915e99412912f22093507da8d9e942ceaf66fe4b7c14422a" dependencies = [ "windows-sys 0.52.0", ] [[package]] name = "anstyle-wincon" -version = "3.0.3" +version = "3.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a38449feb7068f52bb06c12759005cf459ee52bb4adc1d5a7c4322d716fb19" +checksum = "5bf74e1b6e971609db8ca7a9ce79fd5768ab6ae46441c572e46cf596f59e57f8" dependencies = [ "anstyle", "windows-sys 0.52.0", @@ -95,9 +102,9 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.83" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25bdb32cbbdce2b519a9cd7df3a678443100e265d5e25ca763b7572a5104f5f3" +checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" @@ -110,15 +117,15 @@ dependencies = [ [[package]] name = "arrayref" -version = "0.3.7" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6b4930d2cb77ce62f89ee5d5289b4ac049559b1c45539271f5ed4fdc7db34545" +checksum = "9d151e35f61089500b617991b791fc8bfd237ae50cd5950803758a179b41e67a" [[package]] name = "arrayvec" -version = "0.7.4" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" [[package]] name = "associative-cache" @@ -134,7 +141,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -161,6 +168,12 @@ dependencies = [ "system-deps", ] +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + [[package]] name = "autocfg" version = "1.3.0" @@ -169,15 +182,15 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "backtrace" -version = "0.3.71" +version = "0.3.73" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b05800d2e817c8b3b4b54abd461726265fa9789ae34330622f2db9ee696f9d" +checksum = "5cc23269a4f8976d0a4d2e7109211a419fe30e8d88d677cd60b6bc79c5732e0a" dependencies = [ "addr2line", "cc", "cfg-if", "libc", - "miniz_oxide", + "miniz_oxide 0.7.4", "object", "rustc-demangle", ] @@ -205,16 +218,14 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.69.4" +version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a00dc851838a2120612785d195287475a3ac45514741da670b735818822129a0" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cexpr", "clang-sys", "itertools", - "lazy_static", - "lazycell", "log", "prettyplease", "proc-macro2", @@ -222,8 +233,7 @@ dependencies = [ "regex", "rustc-hash", "shlex", - "syn 2.0.63", - "which", + "syn 2.0.75", ] [[package]] @@ -234,9 +244,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.5.0" +version = "2.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cf4b9d6a944f767f8e5e0db018570623c85f3d925ac718db4e06d0187adb21c1" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" [[package]] name = "bitmaps" @@ -276,9 +286,9 @@ checksum = "5ce89b21cab1437276d2650d57e971f9d548a2d9037cc231abdc0562b97498ce" [[package]] name = "bytemuck" -version = "1.16.0" +version = "1.17.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78834c15cb5d5efe3452d58b1e8ba890dd62d21907f867f383358198e56ebca5" +checksum = "6fd4c6dcc3b0aea2f5c0b4b82c2b15fe39ddbc76041a310848f4706edf76bb31" [[package]] name = "byteorder" @@ -288,9 +298,9 @@ checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" [[package]] name = "bytes" -version = "1.6.0" +version = "1.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "514de17de45fdb8dc022b1a7975556c53c86f9f0aa5f534b98977b171857c2c9" +checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "bzip2" @@ -340,13 +350,13 @@ dependencies = [ [[package]] name = "cc" -version = "1.0.97" +version = "1.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "099a5357d84c4c61eb35fc8eafa9a79a902c2f76911e5747ced4e032edd8d9b4" +checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" dependencies = [ "jobserver", "libc", - "once_cell", + "shlex", ] [[package]] @@ -376,9 +386,9 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "clang-sys" -version = "1.7.0" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67523a3b4be3ce1989d607a828d036249522dd9c1c8de7f4dd2dae43a37369d1" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" dependencies = [ "glob", "libc", @@ -387,9 +397,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.4" +version = "4.5.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90bc066a67923782aa8515dbaea16946c5bcc5addbd668bb80af688e53e548a0" +checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" dependencies = [ "clap_builder", "clap_derive", @@ -397,9 +407,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.2" +version = "4.5.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae129e2e766ae0ec03484e609954119f123cc1fe650337e155d03b022f24f7b4" +checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" dependencies = [ "anstream", "anstyle", @@ -411,27 +421,27 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.4" +version = "4.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "528131438037fd55894f62d6e9f068b8f45ac57ffa77517819645d10aed04f64" +checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] name = "clap_lex" -version = "0.7.0" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98cc8fbded0c607b7ba9dd60cd98df59af97e84d24e49c8557331cfc26d301ce" +checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" [[package]] name = "cli-table" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adfbb116d9e2c4be7011360d0c0bee565712c11e969c9609b25b619366dc379d" +checksum = "b53f9241f288a7b12c56565f04aaeaeeab6b8923d42d99255d4ca428b4d97f89" dependencies = [ "cli-table-derive", "termcolor", @@ -440,9 +450,9 @@ dependencies = [ [[package]] name = "cli-table-derive" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2af3bfb9da627b0a6c467624fb7963921433774ed435493b5c08a3053e829ad4" +checksum = "3e83a93253aaae7c74eb7428ce4faa6e219ba94886908048888701819f82fb94" dependencies = [ "proc-macro2", "quote", @@ -530,9 +540,9 @@ checksum = "3d7b894f5411737b7867f4827955924d7c254fc9f4d91a6aad6b097804b1018b" [[package]] name = "colorchoice" -version = "1.0.1" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" [[package]] name = "colors-transform" @@ -549,7 +559,7 @@ dependencies = [ "directories", "serde", "thiserror", - "toml 0.8.13", + "toml 0.8.19", ] [[package]] @@ -574,9 +584,9 @@ dependencies = [ [[package]] name = "core-foundation-sys" -version = "0.8.6" +version = "0.8.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" [[package]] name = "core-graphics" @@ -616,9 +626,9 @@ dependencies = [ [[package]] name = "cpufeatures" -version = "0.2.12" +version = "0.2.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" +checksum = "51e852e6dc9a5bed1fae92dd2375037bf2b768725bf3be87811edee3249d09ad" dependencies = [ "libc", ] @@ -649,9 +659,9 @@ dependencies = [ [[package]] name = "crossbeam-channel" -version = "0.5.12" +version = "0.5.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab3db02a9c5b5121e1e42fbdb1aeb65f5e02624cc58c43f2884c6ccac0b82f95" +checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" dependencies = [ "crossbeam-utils", ] @@ -721,7 +731,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -793,15 +803,21 @@ dependencies = [ [[package]] name = "displaydoc" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "487585f4d0c6655fe74905e2504d8ad6908e4db67f744eb140876906c2f3175d" +checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] +[[package]] +name = "doctest-file" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aac81fa3e28d21450aa4d2ac065992ba96a1d7303efbce51a95f4fd175b67562" + [[package]] name = "druid" version = "0.8.3" @@ -890,7 +906,7 @@ dependencies = [ "ansi-parser", "async-recursion", "bincode", - "bitflags 2.5.0", + "bitflags 2.6.0", "clap", "color-eyre", "colors-transform", @@ -986,9 +1002,9 @@ dependencies = [ [[package]] name = "either" -version = "1.11.0" +version = "1.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a47c1c47d2f5964e29c61246e81db715514cd532db6b5116a25ea3c03d6780a2" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" [[package]] name = "encoding_rs" @@ -1079,24 +1095,24 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.23" +version = "0.2.24" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ee447700ac8aa0b2f2bd7bc4462ad686ba06baa6727ac149a2d6277f0d240fd" +checksum = "bf401df4a4e3872c4fe8151134cf483738e74b67fc934d6532c882b3d24a4550" dependencies = [ "cfg-if", "libc", - "redox_syscall", - "windows-sys 0.52.0", + "libredox", + "windows-sys 0.59.0", ] [[package]] name = "flate2" -version = "1.0.30" +version = "1.0.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f54427cfd1c7829e2a139fcefea601bf088ebca651d2bf53ebc600eac295dae" +checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" dependencies = [ "crc32fast", - "miniz_oxide", + "miniz_oxide 0.8.0", ] [[package]] @@ -1147,11 +1163,11 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "fontconfig-parser" -version = "0.5.6" +version = "0.5.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a595cb550439a117696039dfc69830492058211b771a2a165379f2a1a53d84d" +checksum = "c1fcfcd44ca6e90c921fee9fa665d530b21ef1327a4c1a6c5250ea44b776ada7" dependencies = [ - "roxmltree 0.19.0", + "roxmltree 0.20.0", ] [[package]] @@ -1261,7 +1277,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -1386,9 +1402,9 @@ dependencies = [ [[package]] name = "gimli" -version = "0.28.1" +version = "0.29.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4271d37baee1b8c7e4b708028c57d816cf9d2434acb33a549475f78c181f6253" +checksum = "40ecd4077b5ae9fd2e9e169b102c6c330d0605168eb0e8bf79952b256dbefffd" [[package]] name = "gio" @@ -1544,15 +1560,15 @@ dependencies = [ [[package]] name = "h2" -version = "0.4.4" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "816ec7294445779408f36fe57bc5b7fc1cf59664059096c65f905c1c61f58069" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" dependencies = [ + "atomic-waker", "bytes", "fnv", "futures-core", "futures-sink", - "futures-util", "http", "indexmap", "slab", @@ -1604,15 +1620,6 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" -[[package]] -name = "home" -version = "0.5.9" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" -dependencies = [ - "windows-sys 0.52.0", -] - [[package]] name = "http" version = "1.1.0" @@ -1626,9 +1633,9 @@ dependencies = [ [[package]] name = "http-body" -version = "1.0.0" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cac85db508abc24a2e48553ba12a996e87244a0395ce011e62b37158745d643" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" dependencies = [ "bytes", "http", @@ -1636,12 +1643,12 @@ dependencies = [ [[package]] name = "http-body-util" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0475f8b2ac86659c21b64320d5d653f9efe42acd2a4e560073ec61a155a34f1d" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" dependencies = [ "bytes", - "futures-core", + "futures-util", "http", "http-body", "pin-project-lite", @@ -1649,15 +1656,15 @@ dependencies = [ [[package]] name = "httparse" -version = "1.8.0" +version = "1.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d897f394bad6a705d5f4104762e116a75639e470d80901eed05a860a95cb1904" +checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "1.3.1" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe575dd17d0862a9a33781c8c4696a55c320909004a67a00fb286ba8b1bc496d" +checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" dependencies = [ "bytes", "futures-channel", @@ -1673,6 +1680,23 @@ dependencies = [ "want", ] +[[package]] +name = "hyper-rustls" +version = "0.27.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ee4be2c948921a1a5320b629c4193916ed787a7f7f293fd3f7f5a6c9de74155" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", +] + [[package]] name = "hyper-tls" version = "0.6.0" @@ -1691,9 +1715,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.3" +version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ca38ef113da30126bbff9cd1705f9273e15d45498615d138b0c20279ac7a76aa" +checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" dependencies = [ "bytes", "futures-channel", @@ -1756,9 +1780,9 @@ checksum = "ce23b50ad8242c51a442f3ff322d56b02f08852c77e4c0b4d3fd684abc89c683" [[package]] name = "indexmap" -version = "2.2.6" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "168fb715dda47215e360912c096649d23d58bf392ac62f73919e831745e40f26" +checksum = "93ead53efc7ea8ed3cfb0c79fc8023fbb782a5432b52830b6518941cebe6505c" dependencies = [ "equivalent", "hashbrown", @@ -1786,9 +1810,9 @@ dependencies = [ [[package]] name = "instant" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a5bbe824c507c5da5956355e86a746d82e0e1464f65d862cc5e71da70e94b2c" +checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222" dependencies = [ "cfg-if", "js-sys", @@ -1798,10 +1822,11 @@ dependencies = [ [[package]] name = "interprocess" -version = "2.1.0" +version = "2.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4d0250d41da118226e55b3d50ca3f0d9e0a0f6829b92f543ac0054aeea1572" +checksum = "d2f4e4a06d42fab3e85ab1b419ad32b09eab58b901d40c57935ff92db3287a13" dependencies = [ + "doctest-file", "libc", "recvmsg", "widestring", @@ -1854,15 +1879,15 @@ dependencies = [ [[package]] name = "is_terminal_polyfill" -version = "1.70.0" +version = "1.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8478577c03552c21db0e2724ffb8986a5ce7af88107e6be5d2ee6e158c12800" +checksum = "7943c866cc5cd64cbc25b2e01621d07fa8eb2a1a23160ee81ce38704e97b8ecf" [[package]] name = "itertools" -version = "0.12.1" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba291022dbbd398a455acf126c1e341954079855bc60dfdda641363bd6922569" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" dependencies = [ "either", ] @@ -1875,9 +1900,9 @@ checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" [[package]] name = "jobserver" -version = "0.1.31" +version = "0.1.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2b099aaa34a9751c5bf0878add70444e1ed2dd73f347be99003d4577277de6e" +checksum = "48d1dbcbbeb6a7fec7e059840aa538bd62aaccf972c7346c4d9d2059312853d0" dependencies = [ "libc", ] @@ -1890,9 +1915,9 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29c15563dc2726973df627357ce0c9ddddbea194836909d655df6a75d2cf296d" +checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" dependencies = [ "wasm-bindgen", ] @@ -1969,30 +1994,24 @@ dependencies = [ [[package]] name = "lazy_static" -version = "1.4.0" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" - -[[package]] -name = "lazycell" -version = "1.3.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "830d08ce1d1d941e6b30645f1a0eb5643013d835ce3779a5fc208261dbe10f55" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.154" +version = "0.2.158" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae743338b92ff9146ce83992f766a31066a91a8c84a45e0e9f21e7cf6de6d346" +checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" [[package]] name = "libloading" -version = "0.8.3" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c2a198fb6b0eada2a8df47933734e6d35d350665a33a3593d7164fa52c75c19" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.5", + "windows-targets 0.52.6", ] [[package]] @@ -2001,15 +2020,16 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "libc", + "redox_syscall", ] [[package]] name = "linux-raw-sys" -version = "0.4.13" +version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "01cda141df6706de531b6c46c3a33ecca755538219bd484262fa09410c13539c" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" [[package]] name = "lockfree-object-pool" @@ -2019,9 +2039,9 @@ checksum = "9374ef4228402d4b7e403e5838cb880d9ee663314b0a900d5a6aabf0c213552e" [[package]] name = "log" -version = "0.4.21" +version = "0.4.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90ed8c1e510134f979dbc4f070f87d4313098b704861a105fe34231c70a3901c" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" [[package]] name = "luajit2-sys" @@ -2059,9 +2079,9 @@ checksum = "2532096657941c2fea9c289d370a250971c689d4f143798ff67113ec042024a5" [[package]] name = "memchr" -version = "2.7.2" +version = "2.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6c8640c5d730cb13ebd907d8d04b52f55ac9a2eec55b440c8892f40d56c76c1d" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" [[package]] name = "memmap2" @@ -2097,10 +2117,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" [[package]] -name = "minijinja" -version = "2.0.1" +name = "minicov" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7165d0e94806d52ad5295e4b54a95176d831814840bc067298ca647e1c956338" +checksum = "5c71e683cd655513b99affab7d317deb690528255a0d5f717f1024093c12b169" +dependencies = [ + "cc", + "walkdir", +] + +[[package]] +name = "minijinja" +version = "2.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf369fce3289017a63e514dfca10a0a6f1a02216b21b588b79f6a1081eb999f5" dependencies = [ "serde", ] @@ -2113,14 +2143,23 @@ checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" [[package]] name = "miniz_oxide" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d811f3e15f28568be3407c8e7fdb6514c1cda3cb30683f15b6a1a1dc4ea14a7" +checksum = "b8a240ddb74feaf34a79a7add65a741f3167852fba007066dcac1ca548d89c08" dependencies = [ "adler", "simd-adler32", ] +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + [[package]] name = "mio" version = "0.8.11" @@ -2133,6 +2172,18 @@ dependencies = [ "windows-sys 0.48.0", ] +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", +] + [[package]] name = "nanorand" version = "0.7.0" @@ -2141,11 +2192,10 @@ checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" [[package]] name = "native-tls" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07226173c32f2926027b63cce4bcd8076c3552846cbe7925f3aaffeac0a3b92e" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" dependencies = [ - "lazy_static", "libc", "log", "openssl", @@ -2223,7 +2273,7 @@ version = "6.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "crossbeam-channel", "filetime", "fsevent-sys", @@ -2231,7 +2281,7 @@ dependencies = [ "kqueue", "libc", "log", - "mio", + "mio 0.8.11", "walkdir", "windows-sys 0.48.0", ] @@ -2261,16 +2311,6 @@ dependencies = [ "autocfg", ] -[[package]] -name = "num_cpus" -version = "1.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" -dependencies = [ - "hermit-abi", - "libc", -] - [[package]] name = "num_threads" version = "0.1.7" @@ -2291,9 +2331,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.2" +version = "0.36.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" +checksum = "27b64972346851a39438c60b341ebc01bba47464ae329e55cf343eb93964efd9" dependencies = [ "memchr", ] @@ -2315,9 +2355,9 @@ dependencies = [ [[package]] name = "open" -version = "5.1.2" +version = "5.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "449f0ff855d85ddbf1edd5b646d65249ead3f5e422aaa86b7d2d0b049b103e32" +checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" dependencies = [ "is-wsl", "libc", @@ -2326,11 +2366,11 @@ dependencies = [ [[package]] name = "openssl" -version = "0.10.64" +version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95a0481286a310808298130d22dd1fef0fa571e05a8f44ec801801e84b216b1f" +checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "cfg-if", "foreign-types", "libc", @@ -2347,7 +2387,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -2358,9 +2398,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.102" +version = "0.9.103" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c597637d56fbc83893a35eb0dd04b2b8e7a50c91e64e9493e398b5df4fb45fa2" +checksum = "7f9e8deee91df40a943c71b917e5874b951d32a802526c85721ce3b776c929d6" dependencies = [ "cc", "libc", @@ -2465,9 +2505,9 @@ checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" [[package]] name = "pest" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "560131c633294438da9f7c4b08189194b20946c8274c6b9e38881a7874dc8ee8" +checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", "thiserror", @@ -2476,9 +2516,9 @@ dependencies = [ [[package]] name = "pest_derive" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26293c9193fbca7b1a3bf9b79dc1e388e927e6cacaa78b4a3ab705a1d3d41459" +checksum = "2a548d2beca6773b1c244554d36fcf8548a8a58e74156968211567250e48e49a" dependencies = [ "pest", "pest_generator", @@ -2486,22 +2526,22 @@ dependencies = [ [[package]] name = "pest_generator" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ec22af7d3fb470a85dd2ca96b7c577a1eb4ef6f1683a9fe9a8c16e136c04687" +checksum = "3c93a82e8d145725dcbaf44e5ea887c8a869efdcc28706df2d08c69e17077183" dependencies = [ "pest", "pest_meta", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] name = "pest_meta" -version = "2.7.10" +version = "2.7.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d7a240022f37c361ec1878d646fc5b7d7c4d28d5946e1a80ad5a7a4f4ca0bdcd" +checksum = "a941429fea7e08bedec25e4f6785b6ffaacc6b755da98df5ef3e7dcf4a124c4f" dependencies = [ "once_cell", "pest", @@ -2618,7 +2658,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -2649,7 +2689,7 @@ dependencies = [ "crc32fast", "fdeflate", "flate2", - "miniz_oxide", + "miniz_oxide 0.7.4", ] [[package]] @@ -2675,7 +2715,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -2714,9 +2754,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.82" +version = "1.0.86" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8ad3d49ab951a01fbaafe34f2ec74122942fe18a3f9814c3268f1bb72042131b" +checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" dependencies = [ "unicode-ident", ] @@ -2778,18 +2818,18 @@ checksum = "d3edd4d5d42c92f0a659926464d4cce56b562761267ecf0f469d85b7de384175" [[package]] name = "redox_syscall" -version = "0.4.1" +version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4722d768eff46b75989dd134e5c353f0d6296e5aaa3132e776cbdb56be7731aa" +checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", ] [[package]] name = "redox_users" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bd283d9651eeda4b2a83a43c1c91b266c40fd76ecd39a50a8c630ae69dc72891" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", @@ -2798,14 +2838,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.4" +version = "1.10.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c117dbdfde9c8308975b6a18d71f3f385c89461f7b3fb054288ecf2a2058ba4c" +checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.6", - "regex-syntax 0.8.3", + "regex-automata 0.4.7", + "regex-syntax 0.8.4", ] [[package]] @@ -2819,13 +2859,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.6" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b83b8b9847f9bf95ef68afb0b8e6cdb80f498442f5179a29fad448fcc1eaea" +checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.3", + "regex-syntax 0.8.4", ] [[package]] @@ -2836,15 +2876,15 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.3" +version = "0.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "adad44e29e4c806119491a7f06f03de4d1af22c3a680dd47f1e6e179439d1f56" +checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.12.4" +version = "0.12.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "566cafdd92868e0939d3fb961bd0dc25fcfaaed179291093b3d43e6b3150ea10" +checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" dependencies = [ "base64 0.22.1", "bytes", @@ -2856,6 +2896,7 @@ dependencies = [ "http-body", "http-body-util", "hyper", + "hyper-rustls", "hyper-tls", "hyper-util", "ipnet", @@ -2879,7 +2920,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "winreg 0.52.0", + "windows-registry", ] [[package]] @@ -2902,13 +2943,28 @@ dependencies = [ [[package]] name = "rgb" -version = "0.8.37" +version = "0.8.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05aaa8004b64fd573fc9d002f4e632d51ad4f026c2b5ba95fcb6c2f32c2c47d8" +checksum = "0f86ae463694029097b846d8f99fd5536740602ae00022c0c50c5600720b2f71" dependencies = [ "bytemuck", ] +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + [[package]] name = "roxmltree" version = "0.15.1" @@ -2920,9 +2976,9 @@ dependencies = [ [[package]] name = "roxmltree" -version = "0.19.0" +version = "0.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cd14fd5e3b777a7422cca79358c57a8f6e3a703d9ac187448d0daf220c2407f" +checksum = "6c20b6793b5c2fa6553b250154b78d6d0db37e72700ae35fad9387a46f487c97" [[package]] name = "rustc-demangle" @@ -2951,7 +3007,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "errno", "libc", "linux-raw-sys", @@ -2959,10 +3015,23 @@ dependencies = [ ] [[package]] -name = "rustls-pemfile" -version = "2.1.2" +name = "rustls" +version = "0.23.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29993a25686778eb88d4189742cd713c9bce943bc54251a33509dc63cbacf73d" +checksum = "c58f8c84392efc0a126acce10fa59ff7b3d2ac06ab451a33f2741989b806b044" +dependencies = [ + "once_cell", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" dependencies = [ "base64 0.22.1", "rustls-pki-types", @@ -2970,9 +3039,20 @@ dependencies = [ [[package]] name = "rustls-pki-types" -version = "1.7.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "976295e77ce332211c0d24d92c0e83e50f5c5f046d11082cea19f3df13a3562d" +checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" + +[[package]] +name = "rustls-webpki" +version = "0.102.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e6b52d4fda176fd835fdc55a835d4a89b8499cad995885a21149d5ad62f852e" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] [[package]] name = "rustybuzz" @@ -3055,7 +3135,7 @@ name = "sdk" version = "0.3.0" dependencies = [ "async-recursion", - "bitflags 2.5.0", + "bitflags 2.6.0", "byteorder", "color-eyre", "csv-async", @@ -3078,11 +3158,11 @@ dependencies = [ [[package]] name = "security-framework" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c627723fd09706bacdb5cf41499e95098555af3c3c29d014dc3c458ef6be11c0" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.5.0", + "bitflags 2.6.0", "core-foundation", "core-foundation-sys", "libc", @@ -3091,9 +3171,9 @@ dependencies = [ [[package]] name = "security-framework-sys" -version = "2.11.0" +version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "317936bbbd05227752583946b9e66d7ce3b489f84e11a94a510b4437fef407d7" +checksum = "75da29fe9b9b08fe9d6b22b5b4bcbc75d8db3aa31e639aa56bb62e9d46bfceaf" dependencies = [ "core-foundation-sys", "libc", @@ -3122,31 +3202,32 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.202" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "226b61a0d411b2ba5ff6d7f73a476ac4f8bb900373459cd00fab8512828ba395" +checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.202" +version = "1.0.208" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6048858004bcff69094cd972ed40a32500f153bd3be9f716b2eed2e8217c4838" +checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] name = "serde_json" -version = "1.0.117" +version = "1.0.125" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "455182ea6142b14f93f4bc5320a2b31c1f266b66a4a5c858b013302a5d8cbfc3" +checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" dependencies = [ "itoa", + "memchr", "ryu", "serde", ] @@ -3162,9 +3243,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.6" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "79e674e01f999af37c49f70a6ede167a8a60b2503e56c5599532a65baa5969a0" +checksum = "eb5b1b31579f3811bf615c144393417496f152e12ac8b7663bf664f4a815306d" dependencies = [ "serde", ] @@ -3272,6 +3353,12 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + [[package]] name = "stable_deref_trait" version = "1.2.0" @@ -3289,7 +3376,7 @@ dependencies = [ "keyvalues-parser", "keyvalues-serde", "serde", - "winreg 0.51.0", + "winreg", ] [[package]] @@ -3322,6 +3409,12 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "7da8b5736845d9f2fcb837ea5d9e2628564b3b043a70948a3f0b778838c5fb4f" +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + [[package]] name = "svgfilters" version = "0.4.0" @@ -3354,9 +3447,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.63" +version = "2.0.75" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf5be731623ca1a1fb7d8be6f261a3be6d3e2337b8a1f97be944d020c8fcb704" +checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" dependencies = [ "proc-macro2", "quote", @@ -3365,26 +3458,29 @@ dependencies = [ [[package]] name = "sync_wrapper" -version = "0.1.2" +version = "1.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] [[package]] name = "system-configuration" -version = "0.5.1" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ba3a3adc5c275d719af8cb4272ea1c4a6d668a777f37e115f6d11ddbc1c8e0e7" +checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.6.0", "core-foundation", "system-configuration-sys", ] [[package]] name = "system-configuration-sys" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a75fb188eb626b924683e3b95e3a48e63551fcfb51949de2f06a9d91dbee93c9" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" dependencies = [ "core-foundation-sys", "libc", @@ -3399,26 +3495,27 @@ dependencies = [ "cfg-expr", "heck 0.5.0", "pkg-config", - "toml 0.8.13", + "toml 0.8.19", "version-compare", ] [[package]] name = "target-lexicon" -version = "0.12.14" +version = "0.12.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e1fc403891a21bcfb7c37834ba66a547a8f402146eba7265b5a6d88059c9ff2f" +checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.10.1" +version = "3.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "85b77fafb263dd9d05cbeac119526425676db3784113aa9295c88498cbf8bff1" +checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" dependencies = [ "cfg-if", "fastrand", + "once_cell", "rustix", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3432,22 +3529,22 @@ dependencies = [ [[package]] name = "thiserror" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c546c80d6be4bc6a00c0f01730c08df82eaa7a7a61f11d656526506112cc1709" +checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.61" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "46c3384250002a6d5af4d114f2845d37b57521033f30d5c3f46c4d70e1197533" +checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -3520,18 +3617,18 @@ dependencies = [ [[package]] name = "tinystr" -version = "0.7.5" +version = "0.7.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c02bf3c538ab32ba913408224323915f4ef9a6d61c0e85d493f355921c0ece" +checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", ] [[package]] name = "tinyvec" -version = "1.6.0" +version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87cc5ceb3875bb20c2890005a4e226a4651264a5c75edb2421b52861a0a0cb50" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" dependencies = [ "tinyvec_macros", ] @@ -3544,32 +3641,31 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.37.0" +version = "1.39.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1adbebffeca75fcfd058afa480fb6c0b81e165a0323f9c9d39c9697e37c46787" +checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" dependencies = [ "backtrace", "bytes", "libc", - "mio", - "num_cpus", + "mio 1.0.2", "pin-project-lite", "signal-hook-registry", "socket2", "tokio-macros", "tracing", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "tokio-macros" -version = "2.2.0" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -3582,6 +3678,17 @@ dependencies = [ "tokio", ] +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + [[package]] name = "tokio-stream" version = "0.1.15" @@ -3617,21 +3724,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.13" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4e43f8cc456c9704c851ae29c67e17ef65d2c30017c17a9765b89c382dc8bba" +checksum = "a1ed1f98e3fdc28d6d910e6737ae6ab1a93bf1985935a1193e68f93eeb68d24e" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.22.13", + "toml_edit 0.22.20", ] [[package]] name = "toml_datetime" -version = "0.6.6" +version = "0.6.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4badfd56924ae69bcc9039335b2e017639ce3f9b001c393c1b2d1ef846ce2cbf" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" dependencies = [ "serde", ] @@ -3649,15 +3756,15 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.22.13" +version = "0.22.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c127785850e8c20836d49732ae6abfa47616e60bf9d9f57c43c250361a9db96c" +checksum = "583c44c02ad26b0c3f3066fe629275e50627026c51ac2e595cca4c230ce1ce1d" dependencies = [ "indexmap", "serde", "serde_spanned", "toml_datetime", - "winnow 0.6.8", + "winnow 0.6.18", ] [[package]] @@ -3673,20 +3780,19 @@ dependencies = [ "tokio", "tower-layer", "tower-service", - "tracing", ] [[package]] name = "tower-layer" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c20c8dbed6283a09604c3e69b4b7eeb54e298b8a600d4d5ecb5ad39de609f1d0" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" [[package]] name = "tower-service" -version = "0.3.2" +version = "0.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bc1c9ce2b5135ac7f93c72918fc37feb872bdc6a5533a8b85eb4b86bfdae52" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" @@ -3694,7 +3800,6 @@ version = "0.1.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" dependencies = [ - "log", "pin-project-lite", "tracing-attributes", "tracing-core", @@ -3708,7 +3813,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] @@ -3941,15 +4046,21 @@ checksum = "b1d386ff53b415b7fe27b50bb44679e2cc4660272694b7b6f3326d8480823a94" [[package]] name = "unicode-width" -version = "0.1.12" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "68f5e5f3158ecfd4b8ff6fe086db7c8467a2dfdac97fe420f2b7c4aa97af66d6" +checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.0" +version = "2.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31e6302e3bb753d46e83516cae55ae196fc0c309407cf11ab35cc51a4c2a4633" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" dependencies = [ "form_urlencoded", "idna", @@ -3991,9 +4102,9 @@ checksum = "14706d2a800ee8ff38c1d3edb873cd616971ea59eb7c0d046bb44ef59b06a1ae" [[package]] name = "utf8parse" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "711b9620af191e0cdc7468a8d14e709c3dcdb115b36f838e601583af800a370a" +checksum = "06abde3611657adf66d383f00b093d7faecc7fa57071cce2578660c9f1010821" [[package]] name = "valuable" @@ -4015,9 +4126,9 @@ checksum = "852e951cb7832cb45cb1169900d19760cfa39b82bc0ea9c0e5a14ae88411c98b" [[package]] name = "version_check" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "49874b5167b65d7193b8aba1567f5c7d93d001cafc34600cee003eda787e483f" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vte" @@ -4031,9 +4142,9 @@ dependencies = [ [[package]] name = "vte_generate_state_changes" -version = "0.1.1" +version = "0.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d257817081c7dffcdbab24b9e62d2def62e2ff7d00b1c20062551e6cccc145ff" +checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" dependencies = [ "proc-macro2", "quote", @@ -4066,34 +4177,35 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4be2531df63900aeb2bca0daaaddec08491ee64ceecbee5076636a3b026795a8" +checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" dependencies = [ "cfg-if", + "once_cell", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "614d787b966d3989fa7bb98a654e369c762374fd3213d212cfc0251257e747da" +checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.42" +version = "0.4.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76bc14366121efc8dbb487ab05bcc9d346b3b5ec0eaa76e46594cabbe51762c0" +checksum = "61e9300f63a621e96ed275155c108eb6f843b6a26d053f122ab69724559dc8ed" dependencies = [ "cfg-if", "js-sys", @@ -4103,9 +4215,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a1f8823de937b71b9460c0c34e25f3da88250760bec0ebac694b49997550d726" +checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4113,31 +4225,32 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e94f17b526d0a461a191c78ea52bbce64071ed5c04c9ffe424dcb38f74171bb7" +checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.92" +version = "0.2.93" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af190c94f2773fdb3729c55b007a722abb5384da03bc0986df4c289bf5567e96" +checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" [[package]] name = "wasm-bindgen-test" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d9bf62a58e0780af3e852044583deee40983e5886da43a271dd772379987667b" +checksum = "68497a05fb21143a08a7d24fc81763384a3072ee43c44e86aad1744d6adef9d9" dependencies = [ "console_error_panic_hook", "js-sys", + "minicov", "scoped-tls", "wasm-bindgen", "wasm-bindgen-futures", @@ -4146,20 +4259,20 @@ dependencies = [ [[package]] name = "wasm-bindgen-test-macro" -version = "0.3.42" +version = "0.3.43" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7f89739351a2e03cb94beb799d47fb2cac01759b40ec441f7de39b00cbf7ef0" +checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.63", + "syn 2.0.75", ] [[package]] name = "web-sys" -version = "0.3.69" +version = "0.3.70" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "77afa9a11836342370f4817622a2f0f418b134426d91a82dfb48f532d2ec13ef" +checksum = "26fdeaafd9bd129f65e7c031593c24d62186301e0c72c8978fa1678be7d532c0" dependencies = [ "js-sys", "wasm-bindgen", @@ -4171,18 +4284,6 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "53a85b86a771b1c87058196170769dd264f66c0782acf1ae6cc51bfd64b39082" -[[package]] -name = "which" -version = "4.4.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87ba24419a2078cd2b0f2ede2691b6c66d8e47836da3b6db8265ebad47afbfc7" -dependencies = [ - "either", - "home", - "once_cell", - "rustix", -] - [[package]] name = "widestring" version = "1.1.0" @@ -4207,11 +4308,11 @@ checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" [[package]] name = "winapi-util" -version = "0.1.8" +version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d4cc384e1e73b93bafa6fb4f1df8c41695c8a91cf9c4c64358067d15a7b6c6b" +checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -4220,6 +4321,36 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + [[package]] name = "windows-sys" version = "0.48.0" @@ -4235,7 +4366,16 @@ version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" dependencies = [ - "windows-targets 0.52.5", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", ] [[package]] @@ -4255,18 +4395,18 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6f0713a46559409d202e70e28227288446bf7841d3211583a4b53e3f6d96e7eb" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" dependencies = [ - "windows_aarch64_gnullvm 0.52.5", - "windows_aarch64_msvc 0.52.5", - "windows_i686_gnu 0.52.5", + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", "windows_i686_gnullvm", - "windows_i686_msvc 0.52.5", - "windows_x86_64_gnu 0.52.5", - "windows_x86_64_gnullvm 0.52.5", - "windows_x86_64_msvc 0.52.5", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", ] [[package]] @@ -4277,9 +4417,9 @@ checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" [[package]] name = "windows_aarch64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7088eed71e8b8dda258ecc8bac5fb1153c5cffaf2578fc8ff5d61e23578d3263" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" [[package]] name = "windows_aarch64_msvc" @@ -4289,9 +4429,9 @@ checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" [[package]] name = "windows_aarch64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9985fd1504e250c615ca5f281c3f7a6da76213ebd5ccc9561496568a2752afb6" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" [[package]] name = "windows_i686_gnu" @@ -4301,15 +4441,15 @@ checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" [[package]] name = "windows_i686_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88ba073cf16d5372720ec942a8ccbf61626074c6d4dd2e745299726ce8b89670" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" [[package]] name = "windows_i686_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87f4261229030a858f36b459e748ae97545d6f1ec60e5e0d6a3d32e0dc232ee9" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" [[package]] name = "windows_i686_msvc" @@ -4319,9 +4459,9 @@ checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" [[package]] name = "windows_i686_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "db3c2bf3d13d5b658be73463284eaf12830ac9a26a90c717b7f771dfe97487bf" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" [[package]] name = "windows_x86_64_gnu" @@ -4331,9 +4471,9 @@ checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" [[package]] name = "windows_x86_64_gnu" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e4246f76bdeff09eb48875a0fd3e2af6aada79d409d33011886d3e1581517d9" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" [[package]] name = "windows_x86_64_gnullvm" @@ -4343,9 +4483,9 @@ checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" [[package]] name = "windows_x86_64_gnullvm" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "852298e482cd67c356ddd9570386e2862b5673c85bd5f88df9ab6802b334c596" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" [[package]] name = "windows_x86_64_msvc" @@ -4355,9 +4495,9 @@ checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" [[package]] name = "windows_x86_64_msvc" -version = "0.52.5" +version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bec47e5bfd1bff0eeaf6d8b485cc1074891a197ab4225d504cb7a1ab88b02bf0" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" [[package]] name = "winnow" @@ -4370,9 +4510,9 @@ dependencies = [ [[package]] name = "winnow" -version = "0.6.8" +version = "0.6.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c52e9c97a68071b23e836c9380edae937f17b9c4667bd021973efc689f618d" +checksum = "68a9bda4691f099d435ad181000724da8e5899daa10713c2d432552b9ccd3a6f" dependencies = [ "memchr", ] @@ -4387,16 +4527,6 @@ dependencies = [ "windows-sys 0.48.0", ] -[[package]] -name = "winreg" -version = "0.52.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a277a57398d4bfa075df44f501a17cfdf8542d224f0d36095a2adc7aee4ef0a5" -dependencies = [ - "cfg-if", - "windows-sys 0.48.0", -] - [[package]] name = "winres" version = "0.1.12" @@ -4440,10 +4570,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" [[package]] -name = "zip" -version = "2.1.3" +name = "zeroize" +version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "775a2b471036342aa69bc5a602bc889cb0a06cda00477d0c69566757d5553d39" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" + +[[package]] +name = "zip" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" dependencies = [ "arbitrary", "bzip2", @@ -4475,27 +4611,27 @@ dependencies = [ [[package]] name = "zstd" -version = "0.13.1" +version = "0.13.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2d789b1514203a1120ad2429eae43a7bd32b90976a7bb8a05f7ec02fa88cc23a" +checksum = "fcf2b778a664581e31e389454a7072dab1647606d44f7feea22cd5abb9c9f3f9" dependencies = [ "zstd-safe", ] [[package]] name = "zstd-safe" -version = "7.1.0" +version = "7.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1cd99b45c6bc03a018c8b8a86025678c87e55526064e38f9df301989dce7ec0a" +checksum = "54a3ab4db68cea366acc5c897c7b4d4d1b8994a9cd6e6f841f8964566a419059" dependencies = [ "zstd-sys", ] [[package]] name = "zstd-sys" -version = "2.0.10+zstd.1.5.6" +version = "2.0.13+zstd.1.5.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c253a4914af5bafc8fa8c86ee400827e83cf6ec01195ec1f1ed8441bf00d65aa" +checksum = "38ff0f21cfee8f97d94cef41359e0c89aa6113028ab0291aa8ca0038995a95aa" dependencies = [ "cc", "pkg-config", diff --git a/Cargo.toml b/Cargo.toml index 62d1fd8..9e08de5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,12 +13,51 @@ members = [ exclude = ["lib/color-eyre"] [workspace.dependencies] -zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } -minijinja = { version = "2.0.1", default-features = false } - -[patch.crates-io] +ansi-parser = "0.9.1" +ansi_term = "0.12.1" +async-recursion = "1.0.5" +bincode = "1.3.3" +bitflags = "2.5.0" +byteorder = "1.4.3" +clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } +cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } color-eyre = { path = "lib/color-eyre" } -ansi-parser = { git = "https://gitlab.com/lschwiderski/ansi-parser.git", branch = "issue/outdated-heapless", version = "0.9.1" } +colors-transform = "0.2.11" +confy = "0.6.1" +csv-async = { version = "1.2.4", features = ["tokio", "serde"] } +druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "bmp", "webp", "svg"] } +druid-widget-nursery = "0.1" +dtmt-shared = { path = "lib/dtmt-shared" } +fastrand = "2.1.0" +futures = "0.3.25" +futures-util = "0.3.24" +glob = "0.3.0" +interprocess = "2.1.0" +lazy_static = "1.4.0" +luajit2-sys = { path = "lib/luajit2-sys" } +minijinja = { version = "2.0.1", default-features = false } +nanorand = "0.7.0" +nexusmods = { path = "lib/nexusmods" } +notify = "6.1.1" +oodle = { path = "lib/oodle" } +open = "5.0.1" +path-clean = "1.0.1" +path-slash = "0.2.1" +pin-project-lite = "0.2.9" +promptly = "0.3.1" +sdk = { path = "lib/sdk" } +serde = { version = "1.0.152", features = ["derive", "rc"] } +serde_sjson = { path = "lib/serde_sjson" } +steamlocate = "2.0.0-beta.2" +strip-ansi-escapes = "0.2.0" +time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset", "formatting", "macros"] } +tokio = { version = "1.23.0", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } +tokio-stream = { version = "0.1.12", features = ["fs", "io-util"] } +tracing = { version = "0.1.37", features = ["async-await"] } +tracing-error = "0.2.0" +tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } +usvg = "0.25.0" +zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } [profile.dev.package.backtrace] opt-level = 3 diff --git a/crates/dtmm/Cargo.toml b/crates/dtmm/Cargo.toml index b7bee49..52c0522 100644 --- a/crates/dtmm/Cargo.toml +++ b/crates/dtmm/Cargo.toml @@ -12,37 +12,37 @@ license-file = "LICENSE" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ansi-parser = "0.9.0" -async-recursion = "1.0.5" -bincode = "1.3.3" -bitflags = "2.5.0" -clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } -color-eyre = "0.6.2" -colors-transform = "0.2.11" -confy = "0.6.1" -druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "bmp", "webp", "svg"] } -druid-widget-nursery = "0.1" -dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } -futures = "0.3.25" -interprocess = "2.1.0" -lazy_static = "1.4.0" -luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } +ansi-parser = { workspace = true } +async-recursion = { workspace = true } +bincode = { workspace = true } +bitflags = { workspace = true } +clap = { workspace = true } +color-eyre = { workspace = true } +colors-transform = { workspace = true } +confy = { workspace = true } +druid = { workspace = true } +druid-widget-nursery = { workspace = true } +dtmt-shared = { workspace = true } +futures = { workspace = true } +interprocess = { workspace = true } +lazy_static = { workspace = true } +luajit2-sys = { workspace = true } minijinja = { workspace = true } -nexusmods = { path = "../../lib/nexusmods", version = "*" } -oodle = { path = "../../lib/oodle", version = "*" } -open = "5.0.1" -path-slash = "0.2.1" -sdk = { path = "../../lib/sdk", version = "*" } -serde = { version = "1.0.152", features = ["derive", "rc"] } -serde_sjson = { path = "../../lib/serde_sjson", version = "*" } -strip-ansi-escapes = "0.2.0" -time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset"] } -tokio = { version = "1.23.0", features = ["rt", "fs", "tracing", "sync"] } -tokio-stream = { version = "0.1.12", features = ["fs"] } -tracing = "0.1.37" -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -usvg = "0.25.0" +nexusmods = { workspace = true } +oodle = { workspace = true } +open = { workspace = true } +path-slash = { workspace = true } +sdk = { workspace = true } +serde = { workspace = true } +serde_sjson = { workspace = true } +strip-ansi-escapes = { workspace = true } +time = { workspace = true } +tokio = { workspace = true } +tokio-stream = { workspace = true } +tracing = { workspace = true } +tracing-error = { workspace = true } +tracing-subscriber = { workspace = true } +usvg = { workspace = true } zip = { workspace = true } [build-dependencies] diff --git a/crates/dtmt/Cargo.toml b/crates/dtmt/Cargo.toml index e2e3fb9..183d6a5 100644 --- a/crates/dtmt/Cargo.toml +++ b/crates/dtmt/Cargo.toml @@ -4,34 +4,36 @@ version = "0.3.0" edition = "2021" [dependencies] -clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "unicode"] } -cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } -color-eyre = "0.6.2" -confy = "0.6.1" -csv-async = { version = "1.2.4", features = ["tokio", "serde"] } -dtmt-shared = { path = "../../lib/dtmt-shared", version = "*" } -futures = "0.3.25" -futures-util = "0.3.24" -glob = "0.3.0" -nanorand = "0.7.0" -oodle = { path = "../../lib/oodle", version = "*" } -pin-project-lite = "0.2.9" -promptly = "0.3.1" -sdk = { path = "../../lib/sdk", version = "*" } -serde_sjson = { path = "../../lib/serde_sjson", version = "*" } -serde = { version = "1.0.147", features = ["derive"] } +async-recursion = { workspace = true } +clap = { workspace = true } +cli-table = { workspace = true } +color-eyre = { workspace = true } +confy = { workspace = true } +csv-async = { workspace = true } +dtmt-shared = { workspace = true } +futures = { workspace = true } +futures-util = { workspace = true } +glob = { workspace = true } +luajit2-sys = { workspace = true } minijinja = { workspace = true } -tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } -tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } -tracing-error = "0.2.0" -tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } -tracing = { version = "0.1.37", features = ["async-await"] } +nanorand = { workspace = true } +notify = { workspace = true } +oodle = { workspace = true } +path-clean = { workspace = true } +path-slash = { workspace = true } +pin-project-lite = { workspace = true } +promptly = { workspace = true } +sdk = { workspace = true } +serde = { workspace = true } +serde_sjson = { workspace = true } +tokio = { workspace = true } +tokio-stream = { workspace = true } +tracing = { workspace = true } +tracing-error = { workspace = true } +tracing-subscriber = { workspace = true } zip = { workspace = true } -path-clean = "1.0.1" -path-slash = "0.2.1" -async-recursion = "1.0.2" -notify = "6.1.1" -luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } + +# Cannot be a workspace dependencies when it's optional shlex = { version = "1.2.0", optional = true } [dev-dependencies] diff --git a/lib/color-eyre b/lib/color-eyre index b40962a..228b8ca 160000 --- a/lib/color-eyre +++ b/lib/color-eyre @@ -1 +1 @@ -Subproject commit b40962a61c748756d7da293d9fff26aca019603e +Subproject commit 228b8ca37ee79ab9afa45c40da415e4dcb029751 diff --git a/lib/dtmt-shared/Cargo.toml b/lib/dtmt-shared/Cargo.toml index b547dbe..26e1b6a 100644 --- a/lib/dtmt-shared/Cargo.toml +++ b/lib/dtmt-shared/Cargo.toml @@ -6,11 +6,11 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -ansi_term = "0.12.1" -color-eyre = "0.6.2" -serde = "1.0.152" -steamlocate = "2.0.0-beta.2" -time = { version = "0.3.19", features = ["formatting", "local-offset", "macros"] } -tracing = "0.1.37" -tracing-error = "0.2.0" -tracing-subscriber = "0.3.16" +ansi_term = { workspace = true } +color-eyre = { workspace = true } +serde = { workspace = true } +steamlocate = { workspace = true } +time = { workspace = true } +tracing = { workspace = true } +tracing-error = { workspace = true } +tracing-subscriber = { workspace = true } diff --git a/lib/luajit2-sys b/lib/luajit2-sys index 5d1a075..6d94a4d 160000 --- a/lib/luajit2-sys +++ b/lib/luajit2-sys @@ -1 +1 @@ -Subproject commit 5d1a075742395f767c79d9c0d7466c6fb442f106 +Subproject commit 6d94a4dd2c296bf1f044ee4c70fb10dca4c1c241 diff --git a/lib/oodle/Cargo.toml b/lib/oodle/Cargo.toml index 6fc5039..feb9951 100644 --- a/lib/oodle/Cargo.toml +++ b/lib/oodle/Cargo.toml @@ -6,8 +6,8 @@ edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -color-eyre = "0.6.2" -tracing = "0.1.37" +color-eyre = { workspace = true } +tracing = { workspace = true } [build-dependencies] -bindgen = "0.69.4" +bindgen = "0.70.1" diff --git a/lib/oodle/src/lib.rs b/lib/oodle/src/lib.rs index 76b1d16..871daab 100644 --- a/lib/oodle/src/lib.rs +++ b/lib/oodle/src/lib.rs @@ -7,6 +7,7 @@ use std::ptr; use color_eyre::{eyre, Result}; #[allow(dead_code)] +#[allow(clippy::identity_op)] mod bindings { include!(concat!(env!("OUT_DIR"), "/bindings.rs")); } diff --git a/lib/sdk/Cargo.toml b/lib/sdk/Cargo.toml index b164d47..4667a1c 100644 --- a/lib/sdk/Cargo.toml +++ b/lib/sdk/Cargo.toml @@ -4,23 +4,23 @@ version = "0.3.0" edition = "2021" [dependencies] -bitflags = "2.5.0" -byteorder = "1.4.3" -color-eyre = "0.6.2" -csv-async = { version = "1.2.4", features = ["tokio", "serde"] } -fastrand = "2.1.0" -futures = "0.3.25" -futures-util = "0.3.24" -glob = "0.3.0" -nanorand = "0.7.0" -pin-project-lite = "0.2.9" -serde = { version = "1.0.147", features = ["derive"] } -serde_sjson = { path = "../../lib/serde_sjson", version = "*" } -oodle = { path = "../../lib/oodle", version = "*" } -tokio = { version = "1.21.2", features = ["rt-multi-thread", "fs", "process", "macros", "tracing", "io-util", "io-std"] } -tokio-stream = { version = "0.1.11", features = ["fs", "io-util"] } -tracing = { version = "0.1.37", features = ["async-await"] } -tracing-error = "0.2.0" -luajit2-sys = { path = "../../lib/luajit2-sys", version = "*" } -async-recursion = "1.0.2" -path-slash = "0.2.1" +async-recursion = { workspace = true } +bitflags = { workspace = true } +byteorder = { workspace = true } +color-eyre = { workspace = true } +csv-async = { workspace = true } +fastrand = { workspace = true } +futures = { workspace = true } +futures-util = { workspace = true } +glob = { workspace = true } +luajit2-sys = { workspace = true } +nanorand = { workspace = true } +oodle = { workspace = true } +path-slash = { workspace = true } +pin-project-lite = { workspace = true } +serde = { workspace = true } +serde_sjson = { workspace = true } +tokio = { workspace = true } +tokio-stream = { workspace = true } +tracing = { workspace = true } +tracing-error = { workspace = true } From 7cb44532b23582e3e37969f1d8337c25ce45b1ae Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 21 Aug 2024 12:31:14 +0000 Subject: [PATCH 059/154] Add .renovaterc --- .renovaterc | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 .renovaterc diff --git a/.renovaterc b/.renovaterc new file mode 100644 index 0000000..b36f3b4 --- /dev/null +++ b/.renovaterc @@ -0,0 +1,11 @@ +{ + "$schema": "https://docs.renovatebot.com/renovate-schema.json", + "extends": [ + "config:recommended", + ":combinePatchMinorReleases", + ":enableVulnerabilityAlerts", + ":rebaseStalePrs" + ], + "prConcurrentLimit": 10, + "branchPrefix": "renovate/" +} From 4d665200fa36905fe453c3e312f5abf50633f903 Mon Sep 17 00:00:00 2001 From: Renovate Date: Fri, 23 Aug 2024 21:30:32 +0000 Subject: [PATCH 060/154] fix(deps): update rust crate serde_json to v1.0.127 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 26ccff7..5b85e79 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3222,9 +3222,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.125" +version = "1.0.127" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "83c8e735a073ccf5be70aa8066aa984eaf2fa000db6c8d0100ae605b366d31ed" +checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" dependencies = [ "itoa", "memchr", From ffd4927d27140365948cddc00cbda2ba398bb022 Mon Sep 17 00:00:00 2001 From: Renovate Date: Sat, 24 Aug 2024 10:02:43 +0000 Subject: [PATCH 061/154] chore(deps): update rust crate fastrand to v2.1.1 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b85e79..4789666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1059,9 +1059,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.0" +version = "2.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fc0510504f03c51ada170672ac806f1f105a88aa97a5281117e1ddc3368e51a" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" [[package]] name = "fd-lock" From 67c64bb3579b31073f38a57d4cd4208d665bb378 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 26 Aug 2024 20:45:40 +0000 Subject: [PATCH 062/154] chore(deps): update rust crate minijinja to v2.2.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4789666..4add151 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2128,9 +2128,9 @@ dependencies = [ [[package]] name = "minijinja" -version = "2.1.2" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bf369fce3289017a63e514dfca10a0a6f1a02216b21b588b79f6a1081eb999f5" +checksum = "6d7d3e3a3eece1fa4618237ad41e1de855ced47eab705cec1c9a920e1d1c5aad" dependencies = [ "serde", ] From 659b63bfe998da90fcab4e88d4a94c7b8653bd1b Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 27 Aug 2024 06:30:39 +0000 Subject: [PATCH 063/154] fix(deps): update rust crate serde to v1.0.209 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4add151..e187021 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3202,18 +3202,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.208" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cff085d2cb684faa248efb494c39b68e522822ac0de72ccf08109abde717cfb2" +checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.208" +version = "1.0.209" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24008e81ff7613ed8e5ba0cfaf24e2c2f1e5b8a0495711e44fcd4882fca62bcf" +checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", From 72ce06b0e5dbe695842340604941bc69b00c8437 Mon Sep 17 00:00:00 2001 From: Renovate Date: Fri, 25 Oct 2024 17:32:26 +0000 Subject: [PATCH 064/154] chore(deps): update rust crate notify to v7 --- Cargo.lock | 47 ++++++++++++++++++----------------------------- Cargo.toml | 2 +- 2 files changed, 19 insertions(+), 30 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index e187021..7e460c7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -657,15 +657,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-channel" -version = "0.5.13" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "33480d6946193aa8033910124896ca395333cae7e2d1113d1fef6c3272217df2" -dependencies = [ - "crossbeam-utils", -] - [[package]] name = "crossbeam-utils" version = "0.8.20" @@ -1790,9 +1781,9 @@ dependencies = [ [[package]] name = "inotify" -version = "0.9.6" +version = "0.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8069d3ec154eb856955c1c0fbffefbf5f3c40a104ec912d4797314c1801abff" +checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" dependencies = [ "bitflags 1.3.2", "inotify-sys", @@ -2160,18 +2151,6 @@ dependencies = [ "adler2", ] -[[package]] -name = "mio" -version = "0.8.11" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a650543ca06a924e8b371db273b2756685faae30f8487da1b56505a8f78b0c" -dependencies = [ - "libc", - "log", - "wasi", - "windows-sys 0.48.0", -] - [[package]] name = "mio" version = "1.0.2" @@ -2180,6 +2159,7 @@ checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" dependencies = [ "hermit-abi", "libc", + "log", "wasi", "windows-sys 0.52.0", ] @@ -2269,21 +2249,30 @@ dependencies = [ [[package]] name = "notify" -version = "6.1.1" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6205bd8bb1e454ad2e27422015fb5e4f2bcc7e08fa8f27058670d208324a4d2d" +checksum = "c533b4c39709f9ba5005d8002048266593c1cfaf3c5f0739d5b8ab0c6c504009" dependencies = [ "bitflags 2.6.0", - "crossbeam-channel", "filetime", "fsevent-sys", "inotify", "kqueue", "libc", "log", - "mio 0.8.11", + "mio", + "notify-types", "walkdir", - "windows-sys 0.48.0", + "windows-sys 0.52.0", +] + +[[package]] +name = "notify-types" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7393c226621f817964ffb3dc5704f9509e107a8b024b489cc2c1b217378785df" +dependencies = [ + "instant", ] [[package]] @@ -3648,7 +3637,7 @@ dependencies = [ "backtrace", "bytes", "libc", - "mio 1.0.2", + "mio", "pin-project-lite", "signal-hook-registry", "socket2", diff --git a/Cargo.toml b/Cargo.toml index 9e08de5..0ff601e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ luajit2-sys = { path = "lib/luajit2-sys" } minijinja = { version = "2.0.1", default-features = false } nanorand = "0.7.0" nexusmods = { path = "lib/nexusmods" } -notify = "6.1.1" +notify = "7.0.0" oodle = { path = "lib/oodle" } open = "5.0.1" path-clean = "1.0.1" From b219e20f3adb62f0dc8f4717484af6bdbd723416 Mon Sep 17 00:00:00 2001 From: Renovate Date: Fri, 6 Dec 2024 20:32:37 +0000 Subject: [PATCH 065/154] chore(deps): update rust crate bindgen to 0.71.0 --- Cargo.lock | 38 ++++++++++++++++++++++++++++++++------ lib/oodle/Cargo.toml | 2 +- 2 files changed, 33 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7e460c7..6f6bc4f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1,6 +1,6 @@ # This file is automatically @generated by Cargo. # It is not intended for manual editing. -version = 3 +version = 4 [[package]] name = "addr2line" @@ -231,7 +231,27 @@ dependencies = [ "proc-macro2", "quote", "regex", - "rustc-hash", + "rustc-hash 1.1.0", + "shlex", + "syn 2.0.75", +] + +[[package]] +name = "bindgen" +version = "0.71.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "360897d4f2fdeea5d32f6dac9287952ae5babdc2aad42ad787c9470a4a6e3fee" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools", + "log", + "prettyplease", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.0", "shlex", "syn 2.0.75", ] @@ -1122,7 +1142,7 @@ dependencies = [ "fluent-syntax", "intl-memoizer", "intl_pluralrules", - "rustc-hash", + "rustc-hash 1.1.0", "self_cell 0.10.3", "smallvec", "unic-langid", @@ -2038,7 +2058,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" name = "luajit2-sys" version = "0.0.2" dependencies = [ - "bindgen", + "bindgen 0.70.1", "cc", "fs_extra", "libc", @@ -2337,7 +2357,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" name = "oodle" version = "0.1.0" dependencies = [ - "bindgen", + "bindgen 0.71.0", "color-eyre", "tracing", ] @@ -2981,6 +3001,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" +[[package]] +name = "rustc-hash" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7fb8039b3032c191086b10f11f319a6e99e1e82889c5cc6046f515c9db1d497" + [[package]] name = "rustc_version" version = "0.4.0" @@ -3883,7 +3909,7 @@ version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "deb68604048ff8fa93347f02441e4487594adc20bb8a084f9e564d2b827a0a9f" dependencies = [ - "rustc-hash", + "rustc-hash 1.1.0", ] [[package]] diff --git a/lib/oodle/Cargo.toml b/lib/oodle/Cargo.toml index feb9951..e679b5f 100644 --- a/lib/oodle/Cargo.toml +++ b/lib/oodle/Cargo.toml @@ -10,4 +10,4 @@ color-eyre = { workspace = true } tracing = { workspace = true } [build-dependencies] -bindgen = "0.70.1" +bindgen = "0.71.0" From adf9610eccb6d277fd962f4850de78d273502d00 Mon Sep 17 00:00:00 2001 From: Renovate Date: Fri, 10 Jan 2025 14:48:31 +0000 Subject: [PATCH 066/154] chore(deps): update rust crate notify to v8 --- Cargo.lock | 45 +++++++++++++++++++++------------------------ Cargo.toml | 2 +- 2 files changed, 22 insertions(+), 25 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f6bc4f..67e6323 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,7 +222,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cexpr", "clang-sys", "itertools", @@ -242,7 +242,7 @@ version = "0.71.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "360897d4f2fdeea5d32f6dac9287952ae5babdc2aad42ad787c9470a4a6e3fee" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cexpr", "clang-sys", "itertools", @@ -264,9 +264,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.6.0" +version = "2.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" [[package]] name = "bitmaps" @@ -917,7 +917,7 @@ dependencies = [ "ansi-parser", "async-recursion", "bincode", - "bitflags 2.6.0", + "bitflags 2.7.0", "clap", "color-eyre", "colors-transform", @@ -1801,11 +1801,11 @@ dependencies = [ [[package]] name = "inotify" -version = "0.10.2" +version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdd168d97690d0b8c412d6b6c10360277f4d7ee495c5d0d5d5fe0854923255cc" +checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 1.3.2", + "bitflags 2.7.0", "inotify-sys", "libc", ] @@ -2031,7 +2031,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "libc", "redox_syscall", ] @@ -2269,11 +2269,11 @@ dependencies = [ [[package]] name = "notify" -version = "7.0.0" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c533b4c39709f9ba5005d8002048266593c1cfaf3c5f0739d5b8ab0c6c504009" +checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "filetime", "fsevent-sys", "inotify", @@ -2283,17 +2283,14 @@ dependencies = [ "mio", "notify-types", "walkdir", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] name = "notify-types" -version = "1.0.0" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7393c226621f817964ffb3dc5704f9509e107a8b024b489cc2c1b217378785df" -dependencies = [ - "instant", -] +checksum = "5e0826a989adedc2a244799e823aece04662b66609d96af8dff7ac6df9a8925d" [[package]] name = "nu-ansi-term" @@ -2379,7 +2376,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "cfg-if", "foreign-types", "libc", @@ -2831,7 +2828,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", ] [[package]] @@ -3022,7 +3019,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "errno", "libc", "linux-raw-sys", @@ -3150,7 +3147,7 @@ name = "sdk" version = "0.3.0" dependencies = [ "async-recursion", - "bitflags 2.6.0", + "bitflags 2.7.0", "byteorder", "color-eyre", "csv-async", @@ -3177,7 +3174,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation", "core-foundation-sys", "libc", @@ -3486,7 +3483,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 2.6.0", + "bitflags 2.7.0", "core-foundation", "system-configuration-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 0ff601e..3f00fe6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -38,7 +38,7 @@ luajit2-sys = { path = "lib/luajit2-sys" } minijinja = { version = "2.0.1", default-features = false } nanorand = "0.7.0" nexusmods = { path = "lib/nexusmods" } -notify = "7.0.0" +notify = "8.0.0" oodle = { path = "lib/oodle" } open = "5.0.1" path-clean = "1.0.1" From a3583b4485196e3446ccd51da401b0ebe5860811 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 10 Dec 2024 10:18:35 +0000 Subject: [PATCH 067/154] fix(deps): update rust crate thiserror to v2 --- Cargo.lock | 90 ++++++++++++++++++++++++---------------- lib/nexusmods/Cargo.toml | 2 +- lib/nexusmods/src/lib.rs | 4 +- 3 files changed, 58 insertions(+), 38 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 6f6bc4f..ccb479f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,7 +141,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -233,7 +233,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -253,7 +253,7 @@ dependencies = [ "regex", "rustc-hash 2.1.0", "shlex", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -354,7 +354,7 @@ dependencies = [ "glib", "libc", "once_cell", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -448,7 +448,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -532,7 +532,7 @@ dependencies = [ "once_cell", "owo-colors", "pretty_assertions", - "thiserror", + "thiserror 1.0.63", "tracing", "tracing-error", "tracing-subscriber", @@ -578,7 +578,7 @@ checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0" dependencies = [ "directories", "serde", - "thiserror", + "thiserror 1.0.63", "toml 0.8.19", ] @@ -742,7 +742,7 @@ checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -820,7 +820,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -1163,7 +1163,7 @@ version = "0.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a530c4694a6a8d528794ee9bbd8ba0122e779629ac908d15ad5a7ae7763a33d" dependencies = [ - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -1288,7 +1288,7 @@ checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -1434,7 +1434,7 @@ dependencies = [ "once_cell", "pin-project-lite", "smallvec", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -1469,7 +1469,7 @@ dependencies = [ "libc", "once_cell", "smallvec", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -1950,7 +1950,7 @@ checksum = "7e4c8354918309196302015ac9cae43362f1a13d0d5c5539a33b4c2fd2cd6d25" dependencies = [ "pest", "pest_derive", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -1961,7 +1961,7 @@ checksum = "0447866c47c00f8bd1949618e8f63017cf93e985b4684dc28d784527e2882390" dependencies = [ "keyvalues-parser", "serde", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -2217,7 +2217,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror", + "thiserror 2.0.6", "time", "tokio", "tracing", @@ -2396,7 +2396,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -2519,7 +2519,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd53dff83f26735fdc1ca837098ccf133605d794cdae66acfc2bfac3ec809d95" dependencies = [ "memchr", - "thiserror", + "thiserror 1.0.63", "ucd-trie", ] @@ -2543,7 +2543,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -2667,7 +2667,7 @@ checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -2724,7 +2724,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -2763,9 +2763,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.86" +version = "1.0.92" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5e719e8df665df0d1c8fbfd238015744736151d4445ec0836b8e628aae103b77" +checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" dependencies = [ "unicode-ident", ] @@ -2842,7 +2842,7 @@ checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ "getrandom", "libredox", - "thiserror", + "thiserror 1.0.63", ] [[package]] @@ -3232,7 +3232,7 @@ checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -3462,9 +3462,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.75" +version = "2.0.90" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f6af063034fc1935ede7be0122941bafa9bacb949334d090b77ca98b5817c7d9" +checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" dependencies = [ "proc-macro2", "quote", @@ -3548,7 +3548,16 @@ version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0342370b38b6a11b6cc11d6a805569958d54cfa061a29969c3b5ce2ea405724" dependencies = [ - "thiserror-impl", + "thiserror-impl 1.0.63", +] + +[[package]] +name = "thiserror" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +dependencies = [ + "thiserror-impl 2.0.6", ] [[package]] @@ -3559,7 +3568,18 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", +] + +[[package]] +name = "thiserror-impl" +version = "2.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", ] [[package]] @@ -3680,7 +3700,7 @@ checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -3828,7 +3848,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -4212,7 +4232,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", "wasm-bindgen-shared", ] @@ -4246,7 +4266,7 @@ checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4280,7 +4300,7 @@ checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.75", + "syn 2.0.90", ] [[package]] @@ -4604,7 +4624,7 @@ dependencies = [ "flate2", "indexmap", "memchr", - "thiserror", + "thiserror 1.0.63", "time", "zopfli", "zstd", diff --git a/lib/nexusmods/Cargo.toml b/lib/nexusmods/Cargo.toml index 2f90a46..b9cc879 100644 --- a/lib/nexusmods/Cargo.toml +++ b/lib/nexusmods/Cargo.toml @@ -12,7 +12,7 @@ regex = "1.7.1" reqwest = { version = "0.12.4" } serde = { version = "1.0.152", features = ["derive"] } serde_json = "1.0.94" -thiserror = "1.0.39" +thiserror = "2.0.0" time = { version = "0.3.20", features = ["serde"] } tracing = "0.1.37" url = { version = "2.3.1", features = ["serde"] } diff --git a/lib/nexusmods/src/lib.rs b/lib/nexusmods/src/lib.rs index 314acb1..cddf6a0 100644 --- a/lib/nexusmods/src/lib.rs +++ b/lib/nexusmods/src/lib.rs @@ -28,7 +28,7 @@ pub enum Error { HTTP(#[from] reqwest::Error), #[error("invalid URL: {0:?}")] URLParseError(#[from] url::ParseError), - #[error("failed to deserialize '{error}': {json}")] + #[error("failed to deserialize due to {error}: {json}")] Deserialize { json: String, error: serde_json::Error, @@ -37,7 +37,7 @@ pub enum Error { InvalidHeaderValue(#[from] InvalidHeaderValue), #[error("this error cannot happen")] Infallible(#[from] Infallible), - #[error("invalid NXM URL '{}': {0}", .1.as_str())] + #[error("invalid NXM URL '{url}': {0}", url = .1.as_str())] InvalidNXM(&'static str, Url), #[error("{0}")] Custom(String), From 5612e271fbde6b8808cc8d4c318099bec124f7b1 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 12 Mar 2025 11:26:24 +0100 Subject: [PATCH 068/154] Improve version name for CI artifacts built off master The name from `git describe --tags` is rather confusing to people that aren't familiar with it. Especially in the current situation, where there are no proper versioned releases. A name like `master-123456` should be much clearer. Closes #205. --- .ci/tasks/build.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index bb96775..11b0300 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -25,7 +25,8 @@ if [ -n "$PR" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" else - ref=$(git describe --tags) + ref=$(cat .git/ref || echo "HEAD") + ref=$(git rev-parse --abbrev-ref $ref)-$(git rev-parse --short $ref) fi title "Version: '$ref'" From beba47f340ea5f1990458029752ca0b138f226a6 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 12 Mar 2025 11:33:48 +0100 Subject: [PATCH 069/154] Push a packaged with a fixed version for master To provide something that can easily be linked to, also push packages built from `master` to a version that doesn't contain the SHA. --- .ci/pipelines/base.yml | 38 +++++++++++++++++++++++++++++++------- .ci/tasks/build.yml | 1 - 2 files changed, 31 insertions(+), 8 deletions(-) diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index 474c090..8d3cc77 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -125,8 +125,6 @@ jobs: vars: pr: "" target: msvc - gitea_url: http://forgejo:3000 - gitea_api_key: ((gitea_api_key)) - load_var: version_number reveal: true @@ -142,10 +140,21 @@ jobs: fail_fast: true override: true globs: - - artifact/dtmt - - artifact/dtmm - artifact/*.exe - - artifact/*.sha256 + - artifact/*.exe.sha256 + + - put: package + resource: gitea-package + no_get: true + inputs: + - artifact + params: + version: master + fail_fast: true + override: true + globs: + - artifact/*.exe + - artifact/*.exe.sha256 - name: build-linux on_success: @@ -202,5 +211,20 @@ jobs: globs: - artifact/dtmt - artifact/dtmm - - artifact/*.exe - - artifact/*.sha256 + - artifact/dtmm.sha256 + - artifact/dtmt.sha256 + + - put: package + resource: gitea-package + no_get: true + inputs: + - artifact + params: + version: master + fail_fast: true + override: true + globs: + - artifact/dtmt + - artifact/dtmm + - artifact/dtmm.sha256 + - artifact/dtmt.sha256 diff --git a/.ci/tasks/build.yml b/.ci/tasks/build.yml index dce44d0..a7f47b4 100644 --- a/.ci/tasks/build.yml +++ b/.ci/tasks/build.yml @@ -22,7 +22,6 @@ caches: params: CI: "true" TARGET: ((target)) - GITEA_API_KEY: ((gitea_api_key)) PR: ((pr)) OUTPUT: artifact From d15f533e19edbde4062eeb2161418b90fdb859b0 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 12 Mar 2025 11:52:53 +0100 Subject: [PATCH 070/154] Fix branch name in package version --- .ci/tasks/build.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index 11b0300..3cb9776 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -26,7 +26,11 @@ if [ -n "$PR" ]; then ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" else ref=$(cat .git/ref || echo "HEAD") - ref=$(git rev-parse --abbrev-ref $ref)-$(git rev-parse --short $ref) + branch=$(git rev-parse --abbrev-ref $ref) + if [ -z "$branch" ]; then + branch=$(cat .git/ref) + fi + ref=${branch}-$(git rev-parse --short $ref) fi title "Version: '$ref'" From 71f945a96c95742c4655c5b05ff4b7696905bf3c Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 12 Mar 2025 13:11:01 +0100 Subject: [PATCH 071/154] Explicitly define base branches Currently, the dependency dashboard lists a bunch of pending updates under a section called "Other branches". I'm not sure, but this sounds like one of the configs I extend from enables base branches other than only the default. To test, and make it explicit, set only the branches I really want checked. I'm adding the `release/.*` regex for now, even though I don't have any release process yet. --- .renovaterc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.renovaterc b/.renovaterc index b36f3b4..4a2fbf4 100644 --- a/.renovaterc +++ b/.renovaterc @@ -7,5 +7,9 @@ ":rebaseStalePrs" ], "prConcurrentLimit": 10, - "branchPrefix": "renovate/" + "branchPrefix": "renovate/", + "baseBranches": [ + "$default", + "/^release\\/.*/" + ] } From 6ba13ac1ec06c0334cccfda1fd022d7cfd291b7c Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 12 Mar 2025 13:24:03 +0100 Subject: [PATCH 072/154] Fix using branch for version number --- .ci/tasks/build.sh | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index 3cb9776..0b4f2aa 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -24,13 +24,10 @@ PR=${PR:-} if [ -n "$PR" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" +elif [ -f ".git/branch"]; then + ref=$(cat .git/branch)-$(git rev-parse --short $ref) else - ref=$(cat .git/ref || echo "HEAD") - branch=$(git rev-parse --abbrev-ref $ref) - if [ -z "$branch" ]; then - branch=$(cat .git/ref) - fi - ref=${branch}-$(git rev-parse --short $ref) + ref=$(git rev-parse --short "$(cat .git/ref || echo "HEAD")") fi title "Version: '$ref'" From e61a252ee643d958d4e7eac93aa098e99fce7118 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 15:18:19 +0200 Subject: [PATCH 073/154] Remove internal URLs from CI Due to using internal URLs, the pipelines demanded a very specific network setup to work. By changing everything to their public-facing URLs, they now become agnostic to internal topology. --- .ci/pipelines/base.yml | 24 ++++++++++++++++-------- .ci/pipelines/pr.yml | 22 +++++++++++++--------- Justfile | 4 +++- 3 files changed, 32 insertions(+), 18 deletions(-) diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index 8d3cc77..79c1e51 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -6,24 +6,30 @@ resource_types: - name: gitea-package type: registry-image source: - repository: registry.local:5000/gitea-package + repository: registry.sclu1034.dev/gitea-package + username: ((registry_user)) + password: ((registry_password)) - name: gitea-status type: registry-image source: - repository: registry.local:5000/gitea-status + repository: registry.sclu1034.dev/gitea-status + username: ((registry_user)) + password: ((registry_password)) - name: gitea-pr type: registry-image source: - repository: registry.local:5000/gitea-pr + repository: registry.sclu1034.dev/gitea-pr + username: ((registry_user)) + password: ((registry_password)) resources: - name: repo type: git source: - uri: http://forgejo:3000/bitsquid_dt/dtmt + uri: http://git.sclu1034.dev/bitsquid_dt/dtmt branch: master - name: repo-pr @@ -38,7 +44,7 @@ resources: type: gitea-package source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt type: generic name: dtmt @@ -48,7 +54,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/msvc @@ -58,7 +64,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/linux @@ -85,6 +91,8 @@ jobs: vars: pr: ((.:pr)) gitea_api_key: ((gitea_api_key)) + registry_user: ((registry_user)) + registry_password: ((registry_password)) instance_vars: number: ((.:pr.number)) @@ -192,7 +200,7 @@ jobs: vars: pr: "" target: linux - gitea_url: http://forgejo:3000 + gitea_url: http://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number diff --git a/.ci/pipelines/pr.yml b/.ci/pipelines/pr.yml index bca0ebb..b2f514a 100644 --- a/.ci/pipelines/pr.yml +++ b/.ci/pipelines/pr.yml @@ -6,26 +6,30 @@ resource_types: - name: gitea-package type: registry-image source: - repository: registry.local:5000/gitea-package + repository: registry.sclu1034.dev/gitea-package + username: ((registry_user)) + password: ((registry_password)) - name: gitea-status type: registry-image source: - repository: registry.local:5000/gitea-status + repository: registry.sclu1034.dev/gitea-status + username: ((registry_user)) + password: ((registry_password)) resources: - name: repo type: git source: - uri: http://forgejo:3000/bitsquid_dt/dtmt + uri: http://git.sclu1034.dev/bitsquid_dt/dtmt branch: ((pr.head.ref)) - name: gitea-package type: gitea-package source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt type: generic name: dtmt @@ -34,7 +38,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: lint/clippy @@ -44,7 +48,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/msvc @@ -54,7 +58,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://forgejo:3000 + url: http://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/linux @@ -135,7 +139,7 @@ jobs: vars: target: msvc pr: ((pr)) - gitea_url: http://forgejo:3000 + gitea_url: http://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number @@ -193,7 +197,7 @@ jobs: vars: target: linux pr: ((pr)) - gitea_url: http://forgejo:3000 + gitea_url: http://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number diff --git a/Justfile b/Justfile index dbecc22..697bdcc 100644 --- a/Justfile +++ b/Justfile @@ -40,6 +40,8 @@ set-base-pipeline: --pipeline dtmt \ --config .ci/pipelines/base.yml \ -v gitea_api_key=${GITEA_API_KEY} \ + -v registry_user=${REGISTRY_USER} \ + -v registry_password=${REGISTRY_PASSWORD} \ -v owner=bitsquid_dt \ -v repo=dtmt @@ -48,7 +50,7 @@ set-pr-pipeline pr: -H "Authorization: ${GITEA_API_KEY}" \ -H 'Accept: application/json' \ 'https://git.sclu1034.dev/api/v1/repos/bitsquid_dt/dtmt/pulls/{{pr}}' \ - | yq -y '.' - > 'pr-{{pr}}.yaml' + | yq -y '.' - > 'pr-{{pr}}.yaml' fly -t main set-pipeline \ --pipeline dtmt-pr \ --config .ci/pipelines/pr.yml \ From 5aa8421f7dcc702f4fdfaef814056ce51c34a201 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 15:28:27 +0200 Subject: [PATCH 074/154] Fix incorrect URLs --- .ci/pipelines/base.yml | 10 +++++----- .ci/pipelines/pr.yml | 14 +++++++------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index 79c1e51..ce2682c 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -29,7 +29,7 @@ resources: - name: repo type: git source: - uri: http://git.sclu1034.dev/bitsquid_dt/dtmt + uri: https://git.sclu1034.dev/bitsquid_dt/dtmt branch: master - name: repo-pr @@ -44,7 +44,7 @@ resources: type: gitea-package source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt type: generic name: dtmt @@ -54,7 +54,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/msvc @@ -64,7 +64,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/linux @@ -200,7 +200,7 @@ jobs: vars: pr: "" target: linux - gitea_url: http://git.sclu1034.dev + gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number diff --git a/.ci/pipelines/pr.yml b/.ci/pipelines/pr.yml index b2f514a..3198410 100644 --- a/.ci/pipelines/pr.yml +++ b/.ci/pipelines/pr.yml @@ -22,14 +22,14 @@ resources: - name: repo type: git source: - uri: http://git.sclu1034.dev/bitsquid_dt/dtmt + uri: https://git.sclu1034.dev/bitsquid_dt/dtmt branch: ((pr.head.ref)) - name: gitea-package type: gitea-package source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt type: generic name: dtmt @@ -38,7 +38,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: lint/clippy @@ -48,7 +48,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/msvc @@ -58,7 +58,7 @@ resources: type: gitea-status source: access_token: ((gitea_api_key)) - url: http://git.sclu1034.dev + url: https://git.sclu1034.dev owner: bitsquid_dt repo: dtmt context: build/linux @@ -139,7 +139,7 @@ jobs: vars: target: msvc pr: ((pr)) - gitea_url: http://git.sclu1034.dev + gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number @@ -197,7 +197,7 @@ jobs: vars: target: linux pr: ((pr)) - gitea_url: http://git.sclu1034.dev + gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) - load_var: version_number From c2207c22ef3c6ea384ab617b4f516e79009cc1b5 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 15:33:33 +0200 Subject: [PATCH 075/154] Fix more URLs in CI pipelines --- .ci/pipelines/base.yml | 4 ++++ .ci/pipelines/check.yml | 4 ++++ .ci/pipelines/pr.yml | 6 ++++++ .ci/tasks/build.yml | 4 +++- .ci/tasks/clippy.yml | 4 +++- 5 files changed, 20 insertions(+), 2 deletions(-) diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index ce2682c..a5b0b6e 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -133,6 +133,8 @@ jobs: vars: pr: "" target: msvc + registry_user: ((registry_user)) + registry_password: ((registry_password)) - load_var: version_number reveal: true @@ -202,6 +204,8 @@ jobs: target: linux gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) + registry_user: ((registry_user)) + registry_password: ((registry_password)) - load_var: version_number reveal: true diff --git a/.ci/pipelines/check.yml b/.ci/pipelines/check.yml index 4d350ac..c8d5d47 100644 --- a/.ci/pipelines/check.yml +++ b/.ci/pipelines/check.yml @@ -18,6 +18,8 @@ jobs: file: repo/.ci/tasks/build.yml vars: target: msvc + registry_user: ((registry_user)) + registry_password: ((registry_password)) - name: build-linux plan: - get: repo @@ -26,3 +28,5 @@ jobs: file: repo/.ci/tasks/build.yml vars: target: linux + registry_user: ((registry_user)) + registry_password: ((registry_password)) diff --git a/.ci/pipelines/pr.yml b/.ci/pipelines/pr.yml index 3198410..5c8d7cd 100644 --- a/.ci/pipelines/pr.yml +++ b/.ci/pipelines/pr.yml @@ -101,6 +101,8 @@ jobs: file: repo/.ci/tasks/clippy.yml vars: gitea_api_key: ((gitea_api_key)) + registry_user: ((registry_user)) + registry_password: ((registry_password)) - name: build-msvc @@ -141,6 +143,8 @@ jobs: pr: ((pr)) gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) + registry_user: ((registry_user)) + registry_password: ((registry_password)) - load_var: version_number reveal: true @@ -199,6 +203,8 @@ jobs: pr: ((pr)) gitea_url: https://git.sclu1034.dev gitea_api_key: ((gitea_api_key)) + registry_user: ((registry_user)) + registry_password: ((registry_password)) - load_var: version_number reveal: true diff --git a/.ci/tasks/build.yml b/.ci/tasks/build.yml index a7f47b4..9b9c094 100644 --- a/.ci/tasks/build.yml +++ b/.ci/tasks/build.yml @@ -6,7 +6,9 @@ image_resource: name: ctmt-bi-base-((target)) type: registry-image source: - repository: registry.local:5000/dtmt-ci-base-((target)) + repository: registry.sclu1034.dev/dtmt-ci-base-((target)) + username: ((registry_user)) + password: ((registry_password)) tag: latest inputs: diff --git a/.ci/tasks/clippy.yml b/.ci/tasks/clippy.yml index 483cb30..806dfd4 100644 --- a/.ci/tasks/clippy.yml +++ b/.ci/tasks/clippy.yml @@ -6,7 +6,9 @@ image_resource: name: dtmt-ci-base-linux type: registry-image source: - repository: registry.local:5000/dtmt-ci-base-linux + repository: registry.sclu1034.dev/dtmt-ci-base-linux + username: ((registry_user)) + password: ((registry_password)) tag: latest inputs: From 1b56acfd6328dc96e74365cd16c838bf95e5f45b Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:19 +0000 Subject: [PATCH 076/154] chore(deps): update rust crate bindgen to v0.71.1 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..6fe2e80 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -238,9 +238,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.71.0" +version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "360897d4f2fdeea5d32f6dac9287952ae5babdc2aad42ad787c9470a4a6e3fee" +checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ "bitflags 2.7.0", "cexpr", @@ -2022,7 +2022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -2354,7 +2354,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" name = "oodle" version = "0.1.0" dependencies = [ - "bindgen 0.71.0", + "bindgen 0.71.1", "color-eyre", "tracing", ] From 96c0953cf9e1a6610859806e680c3993526e0a5a Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:24 +0000 Subject: [PATCH 077/154] chore(deps): update rust crate clap to v4.5.37 --- Cargo.lock | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..516a0e1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -417,9 +417,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.16" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed6719fffa43d0d87e5fd8caeab59be1554fb028cd30edc88fc4369b17971019" +checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" dependencies = [ "clap_builder", "clap_derive", @@ -427,23 +427,23 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.15" +version = "4.5.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "216aec2b177652e3846684cbfe25c9964d18ec45234f0f5da5157b207ed1aab6" +checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" dependencies = [ "anstream", "anstyle", "clap_lex", "strsim", "unicase", - "unicode-width", + "unicode-width 0.2.0", ] [[package]] name = "clap_derive" -version = "4.5.13" +version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "501d359d5f3dcaf6ecdeee48833ae73ec6e42723a1e52419c79abf9507eec0a0" +checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ "heck 0.5.0", "proc-macro2", @@ -453,9 +453,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1462739cb27611015575c0c11df5df7601141071f07518d56fcc1be504cbec97" +checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cli-table" @@ -465,7 +465,7 @@ checksum = "b53f9241f288a7b12c56565f04aaeaeeab6b8923d42d99255d4ca428b4d97f89" dependencies = [ "cli-table-derive", "termcolor", - "unicode-width", + "unicode-width 0.1.13", ] [[package]] @@ -2022,7 +2022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3101,7 +3101,7 @@ dependencies = [ "scopeguard", "smallvec", "unicode-segmentation", - "unicode-width", + "unicode-width 0.1.13", "utf8parse", "winapi", ] @@ -4082,6 +4082,12 @@ version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0336d538f7abc86d282a4189614dfaa90810dfc2c6f6427eaf88e16311dd225d" +[[package]] +name = "unicode-width" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fc81956842c57dac11422a97c3b8195a1ff727f06e85c84ed2e8aa277c9a0fd" + [[package]] name = "untrusted" version = "0.9.0" From 5fa6ecfd0d0faea187fed641b8da2a8225f5170b Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:33 +0000 Subject: [PATCH 078/154] chore(deps): update rust crate interprocess to v2.2.3 --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..0def154 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1833,9 +1833,9 @@ dependencies = [ [[package]] name = "interprocess" -version = "2.2.1" +version = "2.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2f4e4a06d42fab3e85ab1b419ad32b09eab58b901d40c57935ff92db3287a13" +checksum = "d941b405bd2322993887859a8ee6ac9134945a24ec5ec763a8a962fc64dfec2d" dependencies = [ "doctest-file", "libc", @@ -2022,7 +2022,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] From 9e209add0c46e6f1cc4d33d96a05ae6b8bd23ac0 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:36 +0000 Subject: [PATCH 079/154] chore(deps): update rust crate open to v5.3.2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..2d95ba6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2361,9 +2361,9 @@ dependencies = [ [[package]] name = "open" -version = "5.3.0" +version = "5.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61a877bf6abd716642a53ef1b89fb498923a4afca5c754f9050b4d081c05c4b3" +checksum = "e2483562e62ea94312f3576a7aca397306df7990b8d89033e18766744377ef95" dependencies = [ "is-wsl", "libc", From f1291bdf33cb609ac72f6dec7e88a00dcea87442 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:40 +0000 Subject: [PATCH 080/154] chore(deps): update rust crate pin-project-lite to v0.2.16 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..a2c61f1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2669,9 +2669,9 @@ dependencies = [ [[package]] name = "pin-project-lite" -version = "0.2.14" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bda66fc9667c18cb2758a2ac84d1167245054bcf85d5d1aaa6923f45801bdd02" +checksum = "3b3cff922bd51709b605d9ead9aa71031d81447142d828eb4a6eba76fe619f9b" [[package]] name = "pin-utils" From b19225c75a4b647b9a58f8282c3197a5a4109fbd Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 13:42:48 +0000 Subject: [PATCH 081/154] chore(deps): update rust crate strip-ansi-escapes to v0.2.1 --- Cargo.lock | 21 +++++---------------- 1 file changed, 5 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8a9af3f..695fa27 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3408,9 +3408,9 @@ dependencies = [ [[package]] name = "strip-ansi-escapes" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "55ff8ef943b384c414f54aefa961dd2bd853add74ec75e7ac74cf91dba62bcfa" +checksum = "2a8f8038e7e7969abb3f1b7c2a811225e9296da208539e0f79c5251d6cac0025" dependencies = [ "vte", ] @@ -4164,22 +4164,11 @@ checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" [[package]] name = "vte" -version = "0.11.1" +version = "0.14.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f5022b5fbf9407086c180e9557be968742d839e68346af7792b8592489732197" +checksum = "231fdcd7ef3037e8330d8e17e61011a2c244126acc0a982f4040ac3f9f0bc077" dependencies = [ - "utf8parse", - "vte_generate_state_changes", -] - -[[package]] -name = "vte_generate_state_changes" -version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2e369bee1b05d510a7b4ed645f5faa90619e05437111783ea5848f28d97d3c2e" -dependencies = [ - "proc-macro2", - "quote", + "memchr", ] [[package]] From 86b8f9e40ff19b9510023c36774c2a24262b09fc Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:16:06 +0000 Subject: [PATCH 082/154] chore(deps): update rust crate glob to v0.3.2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b29c8f..ffd7666 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1499,9 +1499,9 @@ dependencies = [ [[package]] name = "glob" -version = "0.3.1" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" +checksum = "a8d1add55171497b4705a648c6b583acafb01d58050a51727785f0b2c8e0a2b2" [[package]] name = "gobject-sys" From 64d9aa12aac1bb5594cc93ebd03174875dfe1486 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:16:16 +0000 Subject: [PATCH 083/154] chore(deps): update rust crate tokio-stream to v0.1.17 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b29c8f..93832be 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3723,9 +3723,9 @@ dependencies = [ [[package]] name = "tokio-stream" -version = "0.1.15" +version = "0.1.17" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "267ac89e0bec6e691e5813911606935d77c476ff49024f98abcea3e7b15e37af" +checksum = "eca58d7bba4a75707817a2c44174253f9236b2d5fbd055602e9d5c07c139a047" dependencies = [ "futures-core", "pin-project-lite", From f2bf1493e528e887df4545cb0f66f29087b3ad67 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:16:28 +0000 Subject: [PATCH 084/154] fix(deps): update rust crate reqwest to v0.12.15 --- Cargo.lock | 180 +++++++++++++++++++++++++++++++++++------------------ 1 file changed, 120 insertions(+), 60 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 8b29c8f..6f34a57 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1673,9 +1673,9 @@ checksum = "0fcc0b4a115bf80b728eb8ea024ad5bd707b615bfed49e0665b6e0f86fd082d9" [[package]] name = "hyper" -version = "1.4.1" +version = "1.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50dfd22e0e76d0f662d429a5f80fcaf3855009297eab6a0a9f8543834744ba05" +checksum = "cc2b571658e38e0c01b1fdca3bbbe93c00d3d71693ff2770043f8c29bc7d6f80" dependencies = [ "bytes", "futures-channel", @@ -1726,9 +1726,9 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.7" +version = "0.1.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cde7055719c54e36e95e8719f95883f22072a48ede39db7fc17a4e1d5281e9b9" +checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" dependencies = [ "bytes", "futures-channel", @@ -1736,10 +1736,10 @@ dependencies = [ "http", "http-body", "hyper", + "libc", "pin-project-lite", "socket2", "tokio", - "tower", "tower-service", "tracing", ] @@ -1926,10 +1926,11 @@ checksum = "f5d4a7da358eff58addd2877a45865158f0d78c911d43a5784ceb7bbf52833b0" [[package]] name = "js-sys" -version = "0.3.70" +version = "0.3.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1868808506b929d7b0cfa8f75951347aa71bb21144b7791bae35d9bccfcfe37a" +checksum = "1cfaf33c695fc6e08064efbc1f72ec937429614f25eef83af942d0e227c3a28f" dependencies = [ + "once_cell", "wasm-bindgen", ] @@ -2011,9 +2012,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.158" +version = "0.2.172" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8adc4bb1803a324070e64a98ae98f38934d91957a99cfb3a43dcbc01bc56439" +checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" [[package]] name = "libloading" @@ -2647,26 +2648,6 @@ dependencies = [ "xi-unicode", ] -[[package]] -name = "pin-project" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b6bf43b791c5b9e34c3d182969b4abb522f9343702850a2e57f460d00d09b4b3" -dependencies = [ - "pin-project-internal", -] - -[[package]] -name = "pin-project-internal" -version = "1.1.5" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f38a4412a78282e09a2cf38d195ea5420d15ba0602cb375210efbc877243965" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.90", -] - [[package]] name = "pin-project-lite" version = "0.2.16" @@ -2888,9 +2869,9 @@ checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" [[package]] name = "reqwest" -version = "0.12.7" +version = "0.12.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f8f4955649ef5c38cc7f9e8aa41761d48fb9677197daea9984dc54f56aad5e63" +checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" dependencies = [ "base64 0.22.1", "bytes", @@ -2921,6 +2902,7 @@ dependencies = [ "system-configuration", "tokio", "tokio-native-tls", + "tower", "tower-service", "url", "wasm-bindgen", @@ -3066,6 +3048,12 @@ dependencies = [ "untrusted", ] +[[package]] +name = "rustversion" +version = "1.0.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eded382c5f5f786b989652c49544c4877d9f015cc22e145a5ea8ea66c2921cd2" + [[package]] name = "rustybuzz" version = "0.6.0" @@ -3357,9 +3345,9 @@ checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" [[package]] name = "socket2" -version = "0.5.7" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +checksum = "4f5fd57c80058a56cf5c777ab8a126398ece8e442983605d280a44ce79d0edef" dependencies = [ "libc", "windows-sys 0.52.0", @@ -3801,14 +3789,14 @@ dependencies = [ [[package]] name = "tower" -version = "0.4.13" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b8fa9be0de6cf49e536ce1851f987bd21a43b771b09473c3549a6c853db37c1c" +checksum = "d039ad9159c98b70ecfd540b2573b97f7f52c3e8d9f8ad57a24b916a536975f9" dependencies = [ "futures-core", "futures-util", - "pin-project", "pin-project-lite", + "sync_wrapper", "tokio", "tower-layer", "tower-service", @@ -4204,24 +4192,24 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a82edfc16a6c469f5f44dc7b571814045d60404b55a0ee849f9bcfa2e63dd9b5" +checksum = "1edc8929d7499fc4e8f0be2262a241556cfc54a0bea223790e71446f2aab1ef5" dependencies = [ "cfg-if", "once_cell", + "rustversion", "wasm-bindgen-macro", ] [[package]] name = "wasm-bindgen-backend" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9de396da306523044d3302746f1208fa71d7532227f15e347e2d93e4145dd77b" +checksum = "2f0a0651a5c2bc21487bde11ee802ccaf4c51935d0d3d42a6101f98161700bc6" dependencies = [ "bumpalo", "log", - "once_cell", "proc-macro2", "quote", "syn 2.0.90", @@ -4242,9 +4230,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "585c4c91a46b072c92e908d99cb1dcdf95c5218eeb6f3bf1efa991ee7a68cccf" +checksum = "7fe63fc6d09ed3792bd0897b314f53de8e16568c2b3f7982f468c0bf9bd0b407" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -4252,9 +4240,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "afc340c74d9005395cf9dd098506f7f44e38f2b4a21c6aaacf9a105ea5e1e836" +checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", @@ -4265,9 +4253,12 @@ dependencies = [ [[package]] name = "wasm-bindgen-shared" -version = "0.2.93" +version = "0.2.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c62a0a307cb4a311d3a07867860911ca130c3494e8c2719593806c08bc5d0484" +checksum = "1a05d73b933a847d6cccdda8f838a22ff101ad9bf93e33684f39c1f5f0eece3d" +dependencies = [ + "unicode-ident", +] [[package]] name = "wasm-bindgen-test" @@ -4339,7 +4330,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] @@ -4349,33 +4340,38 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] -name = "windows-registry" -version = "0.2.0" +name = "windows-link" +version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +checksum = "76840935b766e1b0a05c0066835fb9ec80071d4c09a16f6bd5f7e655e3c14c38" + +[[package]] +name = "windows-registry" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4286ad90ddb45071efd1a66dfa43eb02dd0dfbae1545ad6cc3c51cf34d7e8ba3" dependencies = [ "windows-result", "windows-strings", - "windows-targets 0.52.6", + "windows-targets 0.53.0", ] [[package]] name = "windows-result" -version = "0.2.0" +version = "0.3.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +checksum = "c64fd11a4fd95df68efcfee5f44a294fe71b8bc6a91993e2791938abcc712252" dependencies = [ - "windows-targets 0.52.6", + "windows-link", ] [[package]] name = "windows-strings" -version = "0.1.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +checksum = "87fa48cc5d406560701792be122a10132491cff9d0aeb23583cc2dcafc847319" dependencies = [ - "windows-result", - "windows-targets 0.52.6", + "windows-link", ] [[package]] @@ -4429,13 +4425,29 @@ dependencies = [ "windows_aarch64_gnullvm 0.52.6", "windows_aarch64_msvc 0.52.6", "windows_i686_gnu 0.52.6", - "windows_i686_gnullvm", + "windows_i686_gnullvm 0.52.6", "windows_i686_msvc 0.52.6", "windows_x86_64_gnu 0.52.6", "windows_x86_64_gnullvm 0.52.6", "windows_x86_64_msvc 0.52.6", ] +[[package]] +name = "windows-targets" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1e4c7e8ceaaf9cb7d7507c974735728ab453b67ef8f18febdd7c11fe59dca8b" +dependencies = [ + "windows_aarch64_gnullvm 0.53.0", + "windows_aarch64_msvc 0.53.0", + "windows_i686_gnu 0.53.0", + "windows_i686_gnullvm 0.53.0", + "windows_i686_msvc 0.53.0", + "windows_x86_64_gnu 0.53.0", + "windows_x86_64_gnullvm 0.53.0", + "windows_x86_64_msvc 0.53.0", +] + [[package]] name = "windows_aarch64_gnullvm" version = "0.48.5" @@ -4448,6 +4460,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "86b8d5f90ddd19cb4a147a5fa63ca848db3df085e25fee3cc10b39b6eebae764" + [[package]] name = "windows_aarch64_msvc" version = "0.48.5" @@ -4460,6 +4478,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" +[[package]] +name = "windows_aarch64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c7651a1f62a11b8cbd5e0d42526e55f2c99886c77e007179efff86c2b137e66c" + [[package]] name = "windows_i686_gnu" version = "0.48.5" @@ -4472,12 +4496,24 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" +[[package]] +name = "windows_i686_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c1dc67659d35f387f5f6c479dc4e28f1d4bb90ddd1a5d3da2e5d97b42d6272c3" + [[package]] name = "windows_i686_gnullvm" version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" +[[package]] +name = "windows_i686_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ce6ccbdedbf6d6354471319e781c0dfef054c81fbc7cf83f338a4296c0cae11" + [[package]] name = "windows_i686_msvc" version = "0.48.5" @@ -4490,6 +4526,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" +[[package]] +name = "windows_i686_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "581fee95406bb13382d2f65cd4a908ca7b1e4c2f1917f143ba16efe98a589b5d" + [[package]] name = "windows_x86_64_gnu" version = "0.48.5" @@ -4502,6 +4544,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" +[[package]] +name = "windows_x86_64_gnu" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e55b5ac9ea33f2fc1716d1742db15574fd6fc8dadc51caab1c16a3d3b4190ba" + [[package]] name = "windows_x86_64_gnullvm" version = "0.48.5" @@ -4514,6 +4562,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0a6e035dd0599267ce1ee132e51c27dd29437f63325753051e71dd9e42406c57" + [[package]] name = "windows_x86_64_msvc" version = "0.48.5" @@ -4526,6 +4580,12 @@ version = "0.52.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" +[[package]] +name = "windows_x86_64_msvc" +version = "0.53.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "271414315aff87387382ec3d271b52d7ae78726f5d44ac98b4f4030c91880486" + [[package]] name = "winnow" version = "0.5.40" From e6744404a948f211a0dbba2eb8528cfcfc6c6cd8 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 17:35:58 +0200 Subject: [PATCH 085/154] Make PR pipelines public --- .ci/pipelines/base.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.ci/pipelines/base.yml b/.ci/pipelines/base.yml index a5b0b6e..4e7ed14 100644 --- a/.ci/pipelines/base.yml +++ b/.ci/pipelines/base.yml @@ -88,6 +88,7 @@ jobs: values: ((.:prs)) set_pipeline: dtmt-pr file: repo/.ci/pipelines/pr.yml + public: true vars: pr: ((.:pr)) gitea_api_key: ((gitea_api_key)) From bbb701176ffe1d2a54978fb77570dba7dfb354c8 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:46:05 +0000 Subject: [PATCH 086/154] fix(deps): update rust crate serde to v1.0.219 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..4273331 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3202,18 +3202,18 @@ checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" [[package]] name = "serde" -version = "1.0.209" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "99fce0ffe7310761ca6bf9faf5115afbc19688edd00171d81b1bb1b116c63e09" +checksum = "5f0e2c6ed6606019b4e29e69dbaba95b11854410e5347d525002456dbbb786b6" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.209" +version = "1.0.219" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a5831b979fd7b5439637af1752d535ff49f4860c0f341d1baeb6faf0f4242170" +checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", From b119b0d38da4048561f6f3c84a6f1ac22a1f5888 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:46:14 +0000 Subject: [PATCH 087/154] fix(deps): update rust crate serde_json to v1.0.140 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..c81ed9b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3222,9 +3222,9 @@ dependencies = [ [[package]] name = "serde_json" -version = "1.0.127" +version = "1.0.140" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8043c06d9f82bd7271361ed64f415fe5e12a77fdb52e573e7f06a516dea329ad" +checksum = "20068b6e96dc6c9bd23e01df8827e6c7e1f2fddd43c21810382803c136b99373" dependencies = [ "itoa", "memchr", From ccac8e3859f1e0d634fd5f27928882fb2fdd6e8d Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:46:21 +0000 Subject: [PATCH 088/154] fix(deps): update rust crate thiserror to v2.0.12 --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..03da545 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2218,7 +2218,7 @@ dependencies = [ "reqwest", "serde", "serde_json", - "thiserror 2.0.6", + "thiserror 2.0.12", "time", "tokio", "tracing", @@ -3538,11 +3538,11 @@ dependencies = [ [[package]] name = "thiserror" -version = "2.0.6" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fec2a1820ebd077e2b90c4df007bebf344cd394098a13c563957d0afc83ea47" +checksum = "567b8a2dae586314f7be2a752ec7474332959c6460e02bde30d702a66d488708" dependencies = [ - "thiserror-impl 2.0.6", + "thiserror-impl 2.0.12", ] [[package]] @@ -3558,9 +3558,9 @@ dependencies = [ [[package]] name = "thiserror-impl" -version = "2.0.6" +version = "2.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d65750cab40f4ff1929fb1ba509e9914eb756131cef4210da8d5d700d26f6312" +checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", From 36fba192c0a2bae82509d4ee454265b6ec806db0 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:46:46 +0000 Subject: [PATCH 089/154] fix(deps): update rust-futures monorepo to v0.3.31 --- Cargo.lock | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..1eb170d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1234,9 +1234,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" +checksum = "65bc07b1a8bc7c85c5f2e110c476c7389b4554ba72af57d8445ea63a576b0876" dependencies = [ "futures-channel", "futures-core", @@ -1249,9 +1249,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" dependencies = [ "futures-core", "futures-sink", @@ -1259,15 +1259,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" [[package]] name = "futures-executor" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" +checksum = "1e28d1d997f585e54aebc3f97d39e72338912123a67330d723fdbb564d646c9f" dependencies = [ "futures-core", "futures-task", @@ -1276,15 +1276,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" [[package]] name = "futures-macro" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", @@ -1293,21 +1293,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" [[package]] name = "futures-task" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" [[package]] name = "futures-util" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" dependencies = [ "futures-channel", "futures-core", From bcab6e697f4c3955f96875e7270dbee5bf0b98bd Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:46:56 +0000 Subject: [PATCH 090/154] fix(deps): update tokio-tracing monorepo --- Cargo.lock | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..65cb15a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3816,9 +3816,9 @@ checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" [[package]] name = "tracing" -version = "0.1.40" +version = "0.1.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +checksum = "784e0ac535deb450455cbfa28a6f0df145ea1bb7ae51b821cf5e7927fdcfbdd0" dependencies = [ "pin-project-lite", "tracing-attributes", @@ -3827,9 +3827,9 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.27" +version = "0.1.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", @@ -3838,9 +3838,9 @@ dependencies = [ [[package]] name = "tracing-core" -version = "0.1.32" +version = "0.1.33" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +checksum = "e672c95779cf947c5311f83787af4fa8fffd12fb27e4993211a84bdfd9610f9c" dependencies = [ "once_cell", "valuable", @@ -3848,9 +3848,9 @@ dependencies = [ [[package]] name = "tracing-error" -version = "0.2.0" +version = "0.2.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d686ec1c0f384b1277f097b2f279a2ecc11afe8c133c1aabf036a27cb4cd206e" +checksum = "8b1581020d7a273442f5b45074a6a57d5757ad0a47dac0e9f0bd57b81936f3db" dependencies = [ "tracing", "tracing-subscriber", @@ -3869,9 +3869,9 @@ dependencies = [ [[package]] name = "tracing-subscriber" -version = "0.3.18" +version = "0.3.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +checksum = "e8189decb5ac0fa7bc8b96b7cb9b2701d60d48805aca84a238004d665fcc4008" dependencies = [ "matchers", "nu-ansi-term", From be28b7045cdeefe7f35e17f5935d332cef52acef Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:03 +0000 Subject: [PATCH 091/154] chore(deps): update rust crate bitflags to v2.9.0 --- Cargo.lock | 28 ++++++++++++++-------------- 1 file changed, 14 insertions(+), 14 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..fa94879 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -222,7 +222,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "cexpr", "clang-sys", "itertools", @@ -242,7 +242,7 @@ version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "cexpr", "clang-sys", "itertools", @@ -264,9 +264,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.7.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1be3f42a67d6d345ecd59f675f3f012d6974981560836e938c22b424b85ce1be" +checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" [[package]] name = "bitmaps" @@ -917,7 +917,7 @@ dependencies = [ "ansi-parser", "async-recursion", "bincode", - "bitflags 2.7.0", + "bitflags 2.9.0", "clap", "color-eyre", "colors-transform", @@ -1805,7 +1805,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "inotify-sys", "libc", ] @@ -2032,7 +2032,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "libc", "redox_syscall", ] @@ -2274,7 +2274,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "filetime", "fsevent-sys", "inotify", @@ -2377,7 +2377,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "cfg-if", "foreign-types", "libc", @@ -2809,7 +2809,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", ] [[package]] @@ -3001,7 +3001,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys", @@ -3135,7 +3135,7 @@ name = "sdk" version = "0.3.0" dependencies = [ "async-recursion", - "bitflags 2.7.0", + "bitflags 2.9.0", "byteorder", "color-eyre", "csv-async", @@ -3162,7 +3162,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "core-foundation", "core-foundation-sys", "libc", @@ -3471,7 +3471,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "core-foundation", "system-configuration-sys", ] From c2f02e7ce67fad873db7f09cf86816d4228a0fe7 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:13 +0000 Subject: [PATCH 092/154] chore(deps): update rust crate fastrand to v2.3.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..b475485 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1070,9 +1070,9 @@ dependencies = [ [[package]] name = "fastrand" -version = "2.1.1" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" +checksum = "37909eebbb50d72f9059c3b6d82c0463f2ff062c9e95845c43a6c9c0355411be" [[package]] name = "fd-lock" From 3f3c4aa3210120448115bdae046e434e10d45a73 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:20 +0000 Subject: [PATCH 093/154] chore(deps): update rust crate minijinja to v2.9.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..198c53c 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2140,9 +2140,9 @@ dependencies = [ [[package]] name = "minijinja" -version = "2.2.0" +version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6d7d3e3a3eece1fa4618237ad41e1de855ced47eab705cec1c9a920e1d1c5aad" +checksum = "98642a6dfca91122779a307b77cd07a4aa951fbe32232aaf5bad9febc66be754" dependencies = [ "serde", ] From 221a6b8485508ee758bbb26b63bb0008e3ec898e Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:28 +0000 Subject: [PATCH 094/154] chore(deps): update rust crate tempfile to v3.19.1 --- Cargo.lock | 81 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 68 insertions(+), 13 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..5d27dfd 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1040,12 +1040,12 @@ checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" [[package]] name = "errno" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -1081,7 +1081,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ef033ed5e9bad94e55838ca0ca906db0e043f517adda0c8b79c7a8c66c93c1b5" dependencies = [ "cfg-if", - "rustix", + "rustix 0.38.34", "windows-sys 0.48.0", ] @@ -1398,7 +1398,19 @@ checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" dependencies = [ "cfg-if", "libc", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", +] + +[[package]] +name = "getrandom" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73fea8450eea4bac3940448fb7ae50d91f034f941199fcd9d909a5a07aa455f0" +dependencies = [ + "cfg-if", + "libc", + "r-efi", + "wasi 0.14.2+wasi-0.2.4", ] [[package]] @@ -2043,6 +2055,12 @@ version = "0.4.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" +[[package]] +name = "linux-raw-sys" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" + [[package]] name = "lockfree-object-pool" version = "0.1.6" @@ -2181,7 +2199,7 @@ dependencies = [ "hermit-abi", "libc", "log", - "wasi", + "wasi 0.11.0+wasi-snapshot-preview1", "windows-sys 0.52.0", ] @@ -2766,6 +2784,12 @@ dependencies = [ "proc-macro2", ] +[[package]] +name = "r-efi" +version = "5.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "74765f6d916ee2faa39bc8e68e4f3ed8949b48cccdac59983d287a7cb71ce9c5" + [[package]] name = "radix_trie" version = "0.2.1" @@ -2818,7 +2842,7 @@ version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" dependencies = [ - "getrandom", + "getrandom 0.2.15", "libredox", "thiserror 1.0.63", ] @@ -2946,7 +2970,7 @@ checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" dependencies = [ "cc", "cfg-if", - "getrandom", + "getrandom 0.2.15", "libc", "spin", "untrusted", @@ -3004,10 +3028,23 @@ dependencies = [ "bitflags 2.7.0", "errno", "libc", - "linux-raw-sys", + "linux-raw-sys 0.4.14", "windows-sys 0.52.0", ] +[[package]] +name = "rustix" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" +dependencies = [ + "bitflags 2.7.0", + "errno", + "libc", + "linux-raw-sys 0.9.4", + "windows-sys 0.59.0", +] + [[package]] name = "rustls" version = "0.23.12" @@ -3507,14 +3544,14 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.12.0" +version = "3.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "04cbcdd0c794ebb0d4cf35e88edd2f7d2c4c3e9a5a6dab322839b321c6a87a64" +checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" dependencies = [ - "cfg-if", "fastrand", + "getrandom 0.3.2", "once_cell", - "rustix", + "rustix 1.0.5", "windows-sys 0.59.0", ] @@ -4190,6 +4227,15 @@ version = "0.11.0+wasi-snapshot-preview1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" +[[package]] +name = "wasi" +version = "0.14.2+wasi-0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9683f9a5a998d873c0d21fcbe3c083009670149a8fab228644b8bd36b2c48cb3" +dependencies = [ + "wit-bindgen-rt", +] + [[package]] name = "wasm-bindgen" version = "0.2.100" @@ -4632,6 +4678,15 @@ dependencies = [ "winapi", ] +[[package]] +name = "wit-bindgen-rt" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" +dependencies = [ + "bitflags 2.7.0", +] + [[package]] name = "xi-unicode" version = "0.3.0" From 42e2eb7cc12fbf5192c95e5c846b241580644d54 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:37 +0000 Subject: [PATCH 095/154] chore(deps): update rust crate tokio to v1.44.2 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..e613ae1 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3661,9 +3661,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.39.3" +version = "1.44.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9babc99b9923bfa4804bd74722ff02c0381021eafa4db9949217e3be8e84fff5" +checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" dependencies = [ "backtrace", "bytes", @@ -3679,9 +3679,9 @@ dependencies = [ [[package]] name = "tokio-macros" -version = "2.4.0" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", From bdce3e7787ecef128c3ba329baaf9967673de976 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:48 +0000 Subject: [PATCH 096/154] chore(deps): update rust crate zip to v2.6.1 --- Cargo.lock | 44 ++++++++++++++++++++------------------------ 1 file changed, 20 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..9470462 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -108,9 +108,9 @@ checksum = "b3d1d046238990b9cf5bcde22a3fb3584ee5cf65fb2765f454ed428c7a0063da" [[package]] name = "arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7d5a26814d8dcb93b0e5a0ff3c6d80a8843bafb21b39e8e18a6f05471870e110" +checksum = "dde20b3d026af13f561bdd0f15edf01fc734f0dafcedbaf42bba506a9517f223" dependencies = [ "derive_arbitrary", ] @@ -324,22 +324,20 @@ checksum = "8318a53db07bb3f8dca91a600466bdb3f2eaadeedfdbcf02e1accbad9271ba50" [[package]] name = "bzip2" -version = "0.4.4" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bdb116a6ef3f6c3698828873ad02c3014b3c85cadb88496095628e3ef1e347f8" +checksum = "49ecfb22d906f800d4fe833b6282cf4dc1c298f5057ca0b5445e5c209735ca47" dependencies = [ "bzip2-sys", - "libc", ] [[package]] name = "bzip2-sys" -version = "0.1.11+1.0.8" +version = "0.1.13+1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "736a955f3fa7875102d57c82b8cac37ec45224a07fd32d58f9f7a186b6cd4cdc" +checksum = "225bff33b2141874fe80d71e07d6eec4f85c5c216453dd96388240f96e1acc14" dependencies = [ "cc", - "libc", "pkg-config", ] @@ -679,9 +677,9 @@ dependencies = [ [[package]] name = "crossbeam-utils" -version = "0.8.20" +version = "0.8.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22ec99545bb0ed0ea7bb9b8e1e9122ea386ff8a48c0922e43f36d45ab09e0e80" +checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" [[package]] name = "crypto-common" @@ -726,9 +724,9 @@ checksum = "8d7439c3735f405729d52c3fbbe4de140eaf938a1fe47d227c27f8254d4302a5" [[package]] name = "deranged" -version = "0.3.11" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +checksum = "9c9e6a11ca8224451684bc0d7d5a7adbf8f2fd6887261a1cfc3c0432f9d4068e" dependencies = [ "powerfmt", "serde", @@ -736,9 +734,9 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.3.2" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67e77553c4162a157adbf834ebae5b415acbecbeafc7a74b0e886657506a7611" +checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", @@ -3579,9 +3577,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.36" +version = "0.3.41" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +checksum = "8a7619e19bc266e0f9c5e6686659d394bc57973859340060a69221e57dbc0c40" dependencies = [ "deranged", "itoa", @@ -3596,15 +3594,15 @@ dependencies = [ [[package]] name = "time-core" -version = "0.1.2" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" +checksum = "c9e9a38711f559d9e3ce1cdb06dd7c5b8ea546bc90052da6d06bb76da74bb07c" [[package]] name = "time-macros" -version = "0.2.18" +version = "0.2.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +checksum = "3526739392ec93fd8b359c8e98514cb3e8e021beb4e5f597b00a0221f8ed8a49" dependencies = [ "num-conv", "time-core", @@ -4664,19 +4662,17 @@ checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" [[package]] name = "zip" -version = "2.2.0" +version = "2.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dc5e4288ea4057ae23afc69a4472434a87a2495cafce6632fd1c4ec9f5cf3494" +checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744" dependencies = [ "arbitrary", "bzip2", "crc32fast", "crossbeam-utils", - "displaydoc", "flate2", "indexmap", "memchr", - "thiserror 1.0.63", "time", "zopfli", "zstd", From be7b16c5ef2a88199b6a644313f2a01ada08402d Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 15:47:56 +0000 Subject: [PATCH 097/154] fix(deps): update rust crate regex to v1.11.1 --- Cargo.lock | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d693ce1..e3400e4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2825,14 +2825,14 @@ dependencies = [ [[package]] name = "regex" -version = "1.10.6" +version = "1.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4219d74c6b67a3654a9fbebc4b419e22126d13d2f3c4a07ee0cb61ff79a79619" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" dependencies = [ "aho-corasick", "memchr", - "regex-automata 0.4.7", - "regex-syntax 0.8.4", + "regex-automata 0.4.9", + "regex-syntax 0.8.5", ] [[package]] @@ -2846,13 +2846,13 @@ dependencies = [ [[package]] name = "regex-automata" -version = "0.4.7" +version = "0.4.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "38caf58cc5ef2fed281f89292ef23f6365465ed9a41b7a7754eb4e26496c92df" +checksum = "809e8dc61f6de73b46c85f4c96486310fe304c434cfa43669d7b40f711150908" dependencies = [ "aho-corasick", "memchr", - "regex-syntax 0.8.4", + "regex-syntax 0.8.5", ] [[package]] @@ -2863,9 +2863,9 @@ checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" [[package]] name = "regex-syntax" -version = "0.8.4" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a66a03ae7c801facd77a29370b4faec201768915ac14a721ba36f20bc9c209b" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" From 1a000371faad19de32863a2e7bca270a0db6104f Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 18:41:59 +0200 Subject: [PATCH 098/154] Treat lint warnings as errors in CI Warnings will not show up if they don't fail CI. --- .ci/tasks/clippy.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/tasks/clippy.sh b/.ci/tasks/clippy.sh index 33901a9..7c27b5f 100755 --- a/.ci/tasks/clippy.sh +++ b/.ci/tasks/clippy.sh @@ -10,6 +10,6 @@ title "Install clippy" rustup component add clippy title "Run clippy" -cargo clippy --color always --no-deps +cargo clippy --color always --no-deps -- -D warnings title "Done" From 9ac13834a1b1adceffdef3d1a9bcdda26b8fc121 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 18:45:18 +0200 Subject: [PATCH 099/154] Commit lock file changes Seems like Renovate missed this. --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index cbc1c09..7417133 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3036,7 +3036,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", "errno", "libc", "linux-raw-sys 0.9.4", @@ -4682,7 +4682,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.7.0", + "bitflags 2.9.0", ] [[package]] From 38a023bea638c4d2d555d68f9145db7139dcc0ed Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 22:52:54 +0200 Subject: [PATCH 100/154] Move serde_sjson to its own project --- .gitmodules | 3 --- Cargo.lock | 31 +++++++++++++++++++++---------- Cargo.toml | 3 +-- lib/serde_sjson | 1 - 4 files changed, 22 insertions(+), 16 deletions(-) delete mode 160000 lib/serde_sjson diff --git a/.gitmodules b/.gitmodules index a03eebf..e1964a8 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "lib/serde_sjson"] - path = lib/serde_sjson - url = https://git.sclu1034.dev/lucas/serde_sjson.git [submodule "lib/luajit2-sys"] path = lib/luajit2-sys url = https://github.com/sclu1034/luajit2-sys.git diff --git a/Cargo.lock b/Cargo.lock index 7417133..874331a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -39,7 +39,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c43e7fd8284f025d0bd143c2855618ecdf697db55bde39211e5c9faec7669173" dependencies = [ "heapless", - "nom", + "nom 7.1.3", ] [[package]] @@ -383,7 +383,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" dependencies = [ - "nom", + "nom 7.1.3", ] [[package]] @@ -2033,7 +2033,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2274,14 +2274,23 @@ dependencies = [ ] [[package]] -name = "nom_locate" -version = "4.2.0" +name = "nom" +version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e3c83c053b0713da60c5b8de47fe8e494fe3ece5267b2f23090a07a053ba8f3" +checksum = "df9761775871bdef83bee530e60050f7e54b1105350d6884eb0fb4f46c2f9405" +dependencies = [ + "memchr", +] + +[[package]] +name = "nom_locate" +version = "5.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b577e2d69827c4740cba2b52efaad1c4cc7c73042860b199710b3575c68438d" dependencies = [ "bytecount", "memchr", - "nom", + "nom 8.0.0", ] [[package]] @@ -3269,9 +3278,11 @@ dependencies = [ [[package]] name = "serde_sjson" -version = "1.0.0" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1c5b0d7af37492e99b8559436ee76b9ec8935c75449b1c2ef08c205a9e92ae6f" dependencies = [ - "nom", + "nom 8.0.0", "nom_locate", "serde", ] @@ -4374,7 +4385,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 3f00fe6..31130f4 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -6,7 +6,6 @@ members = [ "lib/dtmt-shared", "lib/oodle", "lib/sdk", - "lib/serde_sjson", "lib/luajit2-sys", "lib/color-eyre", ] @@ -47,7 +46,7 @@ pin-project-lite = "0.2.9" promptly = "0.3.1" sdk = { path = "lib/sdk" } serde = { version = "1.0.152", features = ["derive", "rc"] } -serde_sjson = { path = "lib/serde_sjson" } +serde_sjson = "1.2.1" steamlocate = "2.0.0-beta.2" strip-ansi-escapes = "0.2.0" time = { version = "0.3.20", features = ["serde", "serde-well-known", "local-offset", "formatting", "macros"] } diff --git a/lib/serde_sjson b/lib/serde_sjson deleted file mode 160000 index 73d2b23..0000000 --- a/lib/serde_sjson +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 73d2b23ce50e75b184f5092ad515e97a0adbe6da From 3d05a2395e005de0443afb82a8c90c434f597a83 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 23:13:36 +0200 Subject: [PATCH 101/154] Fix clippy warnings --- Cargo.toml | 2 +- crates/dtmm/src/controller/deploy.rs | 15 ++++----------- crates/dtmm/src/controller/game.rs | 6 +++--- crates/dtmm/src/controller/import.rs | 2 +- crates/dtmt/src/cmd/bundle/extract.rs | 2 +- crates/dtmt/src/shell_parse.rs | 14 ++++---------- lib/sdk/src/bundle/mod.rs | 2 +- lib/sdk/src/filetype/lua.rs | 8 ++++---- lib/sdk/src/filetype/strings.rs | 8 ++++++-- 9 files changed, 25 insertions(+), 34 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 31130f4..23e92ef 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -34,7 +34,7 @@ glob = "0.3.0" interprocess = "2.1.0" lazy_static = "1.4.0" luajit2-sys = { path = "lib/luajit2-sys" } -minijinja = { version = "2.0.1", default-features = false } +minijinja = { version = "2.0.1", default-features = false, features = ["serde"] } nanorand = "0.7.0" nexusmods = { path = "lib/nexusmods" } notify = "8.0.0" diff --git a/crates/dtmm/src/controller/deploy.rs b/crates/dtmm/src/controller/deploy.rs index 02b6860..481b07c 100644 --- a/crates/dtmm/src/controller/deploy.rs +++ b/crates/dtmm/src/controller/deploy.rs @@ -116,14 +116,14 @@ async fn patch_game_settings(state: Arc) -> Result<()> { eyre::bail!("couldn't find 'boot_script' field"); }; - f.write_all(settings[0..i].as_bytes()).await?; + f.write_all(&settings.as_bytes()[0..i]).await?; f.write_all(b"boot_script = \"scripts/mod_main\"").await?; let Some(j) = settings[i..].find('\n') else { eyre::bail!("couldn't find end of 'boot_script' field"); }; - f.write_all(settings[(i + j)..].as_bytes()).await?; + f.write_all(&settings.as_bytes()[(i + j)..]).await?; Ok(()) } @@ -453,10 +453,7 @@ async fn build_bundles(state: Arc) -> Result> { } #[tracing::instrument(skip_all)] -async fn patch_boot_bundle( - state: Arc, - deployment_info: &String, -) -> Result> { +async fn patch_boot_bundle(state: Arc, deployment_info: &str) -> Result> { let bundle_dir = Arc::new(state.game_dir.join("bundle")); let bundle_path = bundle_dir.join(format!("{:x}", Murmur64::hash(BOOT_BUNDLE_NAME.as_bytes()))); @@ -590,11 +587,7 @@ fn build_deployment_data( .map(|bundle| format!("{:x}", bundle.name().to_murmur64())) .collect(), // TODO: - mod_folders: mod_folders - .as_ref() - .iter() - .map(|folder| folder.clone()) - .collect(), + mod_folders: mod_folders.as_ref().to_vec(), }; serde_sjson::to_string(&info).wrap_err("Failed to serizalize deployment data") } diff --git a/crates/dtmm/src/controller/game.rs b/crates/dtmm/src/controller/game.rs index 6b91169..b93d985 100644 --- a/crates/dtmm/src/controller/game.rs +++ b/crates/dtmm/src/controller/game.rs @@ -91,14 +91,14 @@ async fn patch_game_settings(state: Arc) -> Result<()> { eyre::bail!("couldn't find 'boot_script' field"); }; - f.write_all(settings[0..i].as_bytes()).await?; + f.write_all(&settings.as_bytes()[0..i]).await?; f.write_all(b"boot_script = \"scripts/mod_main\"").await?; let Some(j) = settings[i..].find('\n') else { eyre::bail!("couldn't find end of 'boot_script' field"); }; - f.write_all(settings[(i + j)..].as_bytes()).await?; + f.write_all(&settings.as_bytes()[(i + j)..]).await?; Ok(()) } @@ -208,7 +208,7 @@ pub(crate) async fn reset_mod_deployment(state: ActionState) -> Result<()> { for p in paths { let path = bundle_dir.join(p); - let backup = bundle_dir.join(&format!("{}.bak", p)); + let backup = bundle_dir.join(format!("{}.bak", p)); let res = async { tracing::debug!( diff --git a/crates/dtmm/src/controller/import.rs b/crates/dtmm/src/controller/import.rs index 2f5f90b..6fc9693 100644 --- a/crates/dtmm/src/controller/import.rs +++ b/crates/dtmm/src/controller/import.rs @@ -397,7 +397,7 @@ fn extract_legacy_mod( tracing::trace!("Writing file '{}'", name.display()); let mut out = std::fs::OpenOptions::new() .write(true) - .create(true) + .truncate(true) .open(&name) .wrap_err_with(|| format!("Failed to open file '{}'", name.display()))?; diff --git a/crates/dtmt/src/cmd/bundle/extract.rs b/crates/dtmt/src/cmd/bundle/extract.rs index 9a0f1dd..75f1360 100644 --- a/crates/dtmt/src/cmd/bundle/extract.rs +++ b/crates/dtmt/src/cmd/bundle/extract.rs @@ -150,7 +150,7 @@ async fn parse_command_line_template(tmpl: &String) -> Result { String::from_utf8_unchecked(bytes.to_vec()) }); - while let Some(arg) = parsed.next() { + for arg in parsed.by_ref() { // Safety: See above. cmd.arg(unsafe { String::from_utf8_unchecked(arg.to_vec()) }); } diff --git a/crates/dtmt/src/shell_parse.rs b/crates/dtmt/src/shell_parse.rs index 6f35a5f..13b3c4d 100644 --- a/crates/dtmt/src/shell_parse.rs +++ b/crates/dtmt/src/shell_parse.rs @@ -54,17 +54,11 @@ impl<'a> ShellParser<'a> { } _ => {} }, - ParserState::SingleQuote => match c { - b'\'' => { - return Some(&self.bytes[start..(self.offset - 1)]); - } - _ => {} + ParserState::SingleQuote => if c == b'\'' { + return Some(&self.bytes[start..(self.offset - 1)]); }, - ParserState::DoubleQuote => match c { - b'"' => { - return Some(&self.bytes[start..(self.offset - 1)]); - } - _ => {} + ParserState::DoubleQuote => if c == b'"' { + return Some(&self.bytes[start..(self.offset - 1)]); }, } } diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index ca36393..075f4d2 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -237,7 +237,7 @@ impl Bundle { // Ceiling division (or division toward infinity) to calculate // the number of chunks required to fit the unpacked data. - let num_chunks = (unpacked_data.len() + CHUNK_SIZE - 1) / CHUNK_SIZE; + let num_chunks = unpacked_data.len().div_ceil(CHUNK_SIZE); tracing::trace!(num_chunks); w.write_u32(num_chunks as u32)?; diff --git a/lib/sdk/src/filetype/lua.rs b/lib/sdk/src/filetype/lua.rs index 14f0d6b..dd0494e 100644 --- a/lib/sdk/src/filetype/lua.rs +++ b/lib/sdk/src/filetype/lua.rs @@ -125,7 +125,7 @@ pub fn compile(name: impl Into, code: impl AsRef) -> Result, code: impl AsRef) -> Result unreachable!(), } - lua::lua_setglobal(state, b"fn\0".as_ptr() as _); + lua::lua_setglobal(state, c"fn".as_ptr()); - let run = b"return string.dump(fn, false)\0"; - match lua::luaL_loadstring(state, run.as_ptr() as _) as u32 { + let run = c"return string.dump(fn, false)"; + match lua::luaL_loadstring(state, run.as_ptr()) as u32 { lua::LUA_OK => {} lua::LUA_ERRSYNTAX => { let err = lua::lua_tostring(state, -1); diff --git a/lib/sdk/src/filetype/strings.rs b/lib/sdk/src/filetype/strings.rs index ca2ed8c..8643266 100644 --- a/lib/sdk/src/filetype/strings.rs +++ b/lib/sdk/src/filetype/strings.rs @@ -28,10 +28,14 @@ impl Language { #[derive(serde::Serialize)] pub struct Strings(HashMap>); +#[inline(always)] fn read_string(r: R) -> Result where R: Read, { + // We can safely ignore the warning here, as all data is already in memory, and no additional + // `BufReader` should be needed. + #[allow(clippy::unbuffered_bytes)] r.bytes() .take_while(|b| b.as_ref().map(|b| *b != 0).unwrap_or(false)) .map(|b| b.map_err(Report::new)) @@ -41,7 +45,7 @@ where impl Strings { #[tracing::instrument(skip_all, fields(languages = variants.len()))] - pub fn from_variants(ctx: &crate::Context, variants: &Vec) -> Result { + pub fn from_variants(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result { let mut map: HashMap> = HashMap::new(); for (i, variant) in variants.iter().enumerate() { @@ -76,7 +80,7 @@ impl Strings { } #[tracing::instrument(skip_all)] -pub fn decompile(ctx: &crate::Context, variants: &Vec) -> Result> { +pub fn decompile(ctx: &crate::Context, variants: &[BundleFileVariant]) -> Result> { let strings = Strings::from_variants(ctx, variants)?; let content = strings.to_sjson()?; From bb6396c9321291a70f90a15116edc3d229bdf5a7 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 23:15:08 +0200 Subject: [PATCH 102/154] Fix build script --- .ci/tasks/build.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index 0b4f2aa..68c61a0 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -24,7 +24,7 @@ PR=${PR:-} if [ -n "$PR" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" -elif [ -f ".git/branch"]; then +elif [ -f ".git/branch" ]; then ref=$(cat .git/branch)-$(git rev-parse --short $ref) else ref=$(git rev-parse --short "$(cat .git/ref || echo "HEAD")") From bf5c21dd03fb9e9ed74b1609399feb41ff05da12 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 21:46:09 +0000 Subject: [PATCH 103/154] chore(deps): update rust crate steamlocate to v2.0.1 --- Cargo.lock | 30 +++++++++++++++--------------- 1 file changed, 15 insertions(+), 15 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 874331a..f4ff703 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -768,15 +768,6 @@ dependencies = [ "dirs-sys", ] -[[package]] -name = "dirs" -version = "5.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" -dependencies = [ - "dirs-sys", -] - [[package]] name = "dirs-next" version = "2.0.0" @@ -1641,6 +1632,15 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" +[[package]] +name = "home" +version = "0.5.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589533453244b0995c858700322199b2becb13b627df2851f64a2775d024abcf" +dependencies = [ + "windows-sys 0.59.0", +] + [[package]] name = "http" version = "1.1.0" @@ -3413,12 +3413,12 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "steamlocate" -version = "2.0.0-beta.2" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3b6a4810c4e7fecb0123a9a8ba99b335c17d92e636c265ef99108ee4734c812" +checksum = "a13160bc6ea5cd80cde195ad4a4c629701db2bf397b62c139aa9e739016d2499" dependencies = [ "crc", - "dirs", + "home", "keyvalues-parser", "keyvalues-serde", "serde", @@ -4661,12 +4661,12 @@ dependencies = [ [[package]] name = "winreg" -version = "0.51.0" +version = "0.55.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "937f3df7948156640f46aacef17a70db0de5917bda9c92b0f751f3a955b588fc" +checksum = "cb5a765337c50e9ec252c2069be9bf91c7df47afb103b642ba3a53bf8101be97" dependencies = [ "cfg-if", - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] From 6e58449dac11edf43770971e3f5907e1d4623310 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 21:46:13 +0000 Subject: [PATCH 104/154] fix(deps): update rust crate url to v2.5.4 --- Cargo.lock | 276 +++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 245 insertions(+), 31 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 874331a..a788e09 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1755,13 +1755,142 @@ dependencies = [ ] [[package]] -name = "idna" -version = "0.5.0" +name = "icu_collections" +version = "1.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +checksum = "db2fa452206ebee18c4b5c2274dbf1de17008e874b4dc4f0aea9d01ca79e4526" dependencies = [ - "unicode-bidi", - "unicode-normalization", + "displaydoc", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_locid" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13acbb8371917fc971be86fc8057c41a64b521c184808a698c02acc242dbf637" +dependencies = [ + "displaydoc", + "litemap", + "tinystr", + "writeable", + "zerovec", +] + +[[package]] +name = "icu_locid_transform" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01d11ac35de8e40fdeda00d9e1e9d92525f3f9d887cdd7aa81d727596788b54e" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_locid_transform_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_locid_transform_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7515e6d781098bf9f7205ab3fc7e9709d34554ae0b21ddbcb5febfa4bc7df11d" + +[[package]] +name = "icu_normalizer" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "19ce3e0da2ec68599d193c93d088142efd7f9c5d6fc9b803774855747dc6a84f" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_normalizer_data", + "icu_properties", + "icu_provider", + "smallvec", + "utf16_iter", + "utf8_iter", + "write16", + "zerovec", +] + +[[package]] +name = "icu_normalizer_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c5e8338228bdc8ab83303f16b797e177953730f601a96c25d10cb3ab0daa0cb7" + +[[package]] +name = "icu_properties" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "93d6020766cfc6302c15dbbc9c8778c37e62c14427cb7f6e601d849e092aeef5" +dependencies = [ + "displaydoc", + "icu_collections", + "icu_locid_transform", + "icu_properties_data", + "icu_provider", + "tinystr", + "zerovec", +] + +[[package]] +name = "icu_properties_data" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85fb8799753b75aee8d2a21d7c14d9f38921b54b3dbda10f5a3c7a7b82dba5e2" + +[[package]] +name = "icu_provider" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ed421c8a8ef78d3e2dbc98a973be2f3770cb42b606e3ab18d6237c4dfde68d9" +dependencies = [ + "displaydoc", + "icu_locid", + "icu_provider_macros", + "stable_deref_trait", + "tinystr", + "writeable", + "yoke", + "zerofrom", + "zerovec", +] + +[[package]] +name = "icu_provider_macros" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + +[[package]] +name = "idna" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "686f825264d630750a544639377bae737628043f20d38bbc029e8f29ea968a7e" +dependencies = [ + "idna_adapter", + "smallvec", + "utf8_iter", +] + +[[package]] +name = "idna_adapter" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "daca1df1c957320b2cf139ac61e7bd64fed304c5040df000a745aa1de3b4ef71" +dependencies = [ + "icu_normalizer", + "icu_properties", ] [[package]] @@ -2059,6 +2188,12 @@ version = "0.9.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cd945864f07fe9f5371a27ad7b52a172b4b499999f1d97574c9fa68373937e12" +[[package]] +name = "litemap" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "23fb14cb19457329c82206317a5663005a4d404783dc74f4252769b0d5f42856" + [[package]] name = "lockfree-object-pool" version = "0.1.6" @@ -3511,6 +3646,17 @@ dependencies = [ "futures-core", ] +[[package]] +name = "synstructure" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "system-configuration" version = "0.6.0" @@ -3688,23 +3834,9 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9117f5d4db391c1cf6927e7bea3db74b9a1c1add8f7eda9ffd5364f40f57b82f" dependencies = [ "displaydoc", + "zerovec", ] -[[package]] -name = "tinyvec" -version = "1.8.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" -dependencies = [ - "tinyvec_macros", -] - -[[package]] -name = "tinyvec_macros" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" - [[package]] name = "tokio" version = "1.44.2" @@ -4083,15 +4215,6 @@ version = "1.0.12" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3354b9ac3fae1ff6755cb6db53683adb661634f67557942dea4facebec0fee4b" -[[package]] -name = "unicode-normalization" -version = "0.1.23" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a56d1686db2308d901306f92a263857ef59ea39678a5458e7cb17f01415101f5" -dependencies = [ - "tinyvec", -] - [[package]] name = "unicode-script" version = "0.5.6" @@ -4130,9 +4253,9 @@ checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" [[package]] name = "url" -version = "2.5.2" +version = "2.5.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +checksum = "32f8b686cadd1473f4bd0117a5d28d36b1ade384ea9b5069a1c40aefed7fda60" dependencies = [ "form_urlencoded", "idna", @@ -4166,12 +4289,24 @@ dependencies = [ "xmlwriter", ] +[[package]] +name = "utf16_iter" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c8232dd3cdaed5356e0f716d285e4b40b932ac434100fe9b7e0e8e935b9e6246" + [[package]] name = "utf16_lit" version = "2.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "14706d2a800ee8ff38c1d3edb873cd616971ea59eb7c0d046bb44ef59b06a1ae" +[[package]] +name = "utf8_iter" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c140620e7ffbb22c2dee59cafe6084a59b5ffc27a8859a5f0d494b5d52b6be" + [[package]] name = "utf8parse" version = "0.2.2" @@ -4696,6 +4831,18 @@ dependencies = [ "bitflags 2.9.0", ] +[[package]] +name = "write16" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d1890f4022759daae28ed4fe62859b1236caebfc61ede2f63ed4e695f3f6d936" + +[[package]] +name = "writeable" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e9df38ee2d2c3c5948ea468a8406ff0db0b29ae1ffde1bcf20ef305bcc95c51" + [[package]] name = "xi-unicode" version = "0.3.0" @@ -4720,12 +4867,79 @@ version = "0.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09041cd90cf85f7f8b2df60c646f853b7f535ce68f85244eb6731cf89fa498ec" +[[package]] +name = "yoke" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "120e6aef9aa629e3d4f52dc8cc43a015c7724194c97dfaf45180d2daf2b77f40" +dependencies = [ + "serde", + "stable_deref_trait", + "yoke-derive", + "zerofrom", +] + +[[package]] +name = "yoke-derive" +version = "0.7.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + +[[package]] +name = "zerofrom" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "50cc42e0333e05660c3587f3bf9d0478688e15d870fab3346451ce7f8c9fbea5" +dependencies = [ + "zerofrom-derive", +] + +[[package]] +name = "zerofrom-derive" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", + "synstructure", +] + [[package]] name = "zeroize" version = "1.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +[[package]] +name = "zerovec" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa2b893d79df23bfb12d5461018d408ea19dfafe76c2c7ef6d4eba614f8ff079" +dependencies = [ + "yoke", + "zerofrom", + "zerovec-derive", +] + +[[package]] +name = "zerovec-derive" +version = "0.10.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.90", +] + [[package]] name = "zip" version = "2.6.1" From 83de50409b9a31822508c4fe2b947f8d5443dcd9 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Mon, 21 Apr 2025 23:55:55 +0200 Subject: [PATCH 105/154] Fix locating Steam game path --- lib/dtmt-shared/src/lib.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/dtmt-shared/src/lib.rs b/lib/dtmt-shared/src/lib.rs index d1f69c7..db11579 100644 --- a/lib/dtmt-shared/src/lib.rs +++ b/lib/dtmt-shared/src/lib.rs @@ -87,7 +87,7 @@ pub fn collect_game_info() -> Result> { .find_app(STEAMAPP_ID) .wrap_err("Failed to look up game by Steam app ID")?; - let Some((app, _)) = found else { + let Some((app, library)) = found else { return Ok(None); }; @@ -96,7 +96,7 @@ pub fn collect_game_info() -> Result> { .ok_or_eyre("Missing field 'last_updated'")?; Ok(Some(GameInfo { - path: app.install_dir.into(), + path: library.path().join(app.install_dir), last_updated: last_updated.into(), })) } From ddc69112bc4f1985f06e8768eb04cd1ec2e22bf3 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 22:01:08 +0000 Subject: [PATCH 106/154] chore(deps): update rust crate cli-table to 0.5.0 --- Cargo.lock | 70 +++++++++++++++++++++++++++--------------------------- Cargo.toml | 2 +- 2 files changed, 36 insertions(+), 36 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a788e09..c69417f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -141,7 +141,7 @@ checksum = "3b43422f69d8ff38f95f1b2bb76517c91589a924d1559a0e935d7c8ce0274c11" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -233,7 +233,7 @@ dependencies = [ "regex", "rustc-hash 1.1.0", "shlex", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -253,7 +253,7 @@ dependencies = [ "regex", "rustc-hash 2.1.0", "shlex", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -446,7 +446,7 @@ dependencies = [ "heck 0.5.0", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -457,24 +457,24 @@ checksum = "f46ad14479a25103f283c0f10005961cf086d8dc42205bb44c46ac563475dca6" [[package]] name = "cli-table" -version = "0.4.9" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b53f9241f288a7b12c56565f04aaeaeeab6b8923d42d99255d4ca428b4d97f89" +checksum = "14da8d951cef7cc4f13ccc9b744d736963d57863c7e6fc33c070ea274546082c" dependencies = [ "cli-table-derive", "termcolor", - "unicode-width 0.1.13", + "unicode-width 0.2.0", ] [[package]] name = "cli-table-derive" -version = "0.4.6" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e83a93253aaae7c74eb7428ce4faa6e219ba94886908048888701819f82fb94" +checksum = "9f7c1b60bae2c3d45228dfb096046aa51ef6c300de70b658d7a13fcb0c4f832e" dependencies = [ "proc-macro2", "quote", - "syn 1.0.109", + "syn 2.0.100", ] [[package]] @@ -740,7 +740,7 @@ checksum = "30542c1ad912e0e3d22a1935c290e12e8a29d704a420177a31faad4a601a0800" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -818,7 +818,7 @@ checksum = "97369cbbc041bc366949bc74d34658d6cda5621039731c6310521892a3a20ae0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -1286,7 +1286,7 @@ checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -1869,7 +1869,7 @@ checksum = "1ec89e9337638ecdc08744df490b221a7399bf8d164eb52a665454e60e075ad6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -2554,7 +2554,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -2701,7 +2701,7 @@ dependencies = [ "pest_meta", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -2862,7 +2862,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f12335488a2f3b0a83b14edad48dca9879ce89b2edd10e80237e4e852dd645e" dependencies = [ "proc-macro2", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -2901,9 +2901,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.92" +version = "1.0.95" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37d3544b3f2748c54e147655edb5025752e2303145b5aefb3c3ea2c78b973bb0" +checksum = "02b3e5e68a3a1a02aad3ec490a98007cbc13c37cbe84a3cd7b8e406d76e7f778" dependencies = [ "unicode-ident", ] @@ -2919,9 +2919,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.36" +version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fa76aaf39101c457836aec0ce2316dbdc3ab723cdda1c6bd4e6ad4208acaca7" +checksum = "1885c039570dc00dcb4ff087a89e185fd56bae234ddc7f056a945bf36467248d" dependencies = [ "proc-macro2", ] @@ -3396,7 +3396,7 @@ checksum = "5b0276cf7f2c73365f7157c8123c21cd9a50fbbd844757af28ca1f5925fc2a00" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -3628,9 +3628,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.90" +version = "2.0.100" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "919d3b74a5dd0ccd15aeb8f93e7006bd9e14c295087c9896a110f490752bcf31" +checksum = "b09a44accad81e1ba1cd74a32461ba89dee89095ba17b32f5d03683b1b1fc2a0" dependencies = [ "proc-macro2", "quote", @@ -3654,7 +3654,7 @@ checksum = "c8af7666ab7b6390ab78131fb5b0fce11d6b7a6951602017c35fa82800708971" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -3745,7 +3745,7 @@ checksum = "a4558b58466b9ad7ca0f102865eccc95938dca1a74a856f2b57b6629050da261" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -3756,7 +3756,7 @@ checksum = "7f7cf42b4507d8ea322120659672cf1b9dbb93f8f2d4ecfd6e51350ff5b17a1d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -3863,7 +3863,7 @@ checksum = "6e06d43f1345a3bcd39f6a56dbb7dcab2ba47e68e8ac134855e7e2bdbaf8cab8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -4011,7 +4011,7 @@ checksum = "395ae124c09f9e6918a2310af6038fba074bcf474ac352496d5910dd59a2226d" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -4402,7 +4402,7 @@ dependencies = [ "log", "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", "wasm-bindgen-shared", ] @@ -4436,7 +4436,7 @@ checksum = "8ae87ea40c9f689fc23f209965b6fb8a99ad69aeeb0231408be24920604395de" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4473,7 +4473,7 @@ checksum = "4b8220be1fa9e4c889b30fd207d4906657e7e90b12e0e6b0c8b8d8709f5de021" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] @@ -4887,7 +4887,7 @@ checksum = "2380878cad4ac9aac1e2435f3eb4020e8374b5f13c296cb75b4620ff8e229154" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", "synstructure", ] @@ -4908,7 +4908,7 @@ checksum = "d71e5d6e06ab090c67b5e44993ec16b72dcbaabc526db883a360057678b48502" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", "synstructure", ] @@ -4937,7 +4937,7 @@ checksum = "6eafa6dfb17584ea3e2bd6e76e0cc15ad7af12b09abdd1ca55961bed9b1063c6" dependencies = [ "proc-macro2", "quote", - "syn 2.0.90", + "syn 2.0.100", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 23e92ef..b5fd830 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ bincode = "1.3.3" bitflags = "2.5.0" byteorder = "1.4.3" clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } -cli-table = { version = "0.4.7", default-features = false, features = ["derive"] } +cli-table = { version = "0.5.0", default-features = false, features = ["derive"] } color-eyre = { path = "lib/color-eyre" } colors-transform = "0.2.11" confy = "0.6.1" From afb5bc07954386e1c3bd0a8f2777cffd387220bb Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 21 Apr 2025 22:01:13 +0000 Subject: [PATCH 107/154] chore(deps): update rust crate bincode to v2 --- Cargo.lock | 27 +++++++++++++++++++++++++-- Cargo.toml | 2 +- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index a788e09..358c5a4 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -209,11 +209,22 @@ checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "bincode" -version = "1.3.3" +version = "2.0.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +checksum = "36eaf5d7b090263e8150820482d5d93cd964a81e4019913c972f4edcc6edb740" dependencies = [ + "bincode_derive", "serde", + "unty", +] + +[[package]] +name = "bincode_derive" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bf95709a440f45e986983918d0e8a1f30a9b1df04918fc828670606804ac3c09" +dependencies = [ + "virtue", ] [[package]] @@ -4251,6 +4262,12 @@ version = "0.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" +[[package]] +name = "unty" +version = "0.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6d49784317cd0d1ee7ec5c716dd598ec5b4483ea832a2dced265471cc0f690ae" + [[package]] name = "url" version = "2.5.4" @@ -4337,6 +4354,12 @@ version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" +[[package]] +name = "virtue" +version = "0.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "051eb1abcf10076295e815102942cc58f9d5e3b4560e46e53c21e8ff6f3af7b1" + [[package]] name = "vte" version = "0.14.1" diff --git a/Cargo.toml b/Cargo.toml index 23e92ef..a4667fb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -15,7 +15,7 @@ exclude = ["lib/color-eyre"] ansi-parser = "0.9.1" ansi_term = "0.12.1" async-recursion = "1.0.5" -bincode = "1.3.3" +bincode = "2.0.0" bitflags = "2.5.0" byteorder = "1.4.3" clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } From 72ab8811c34502fbcfd34db76dd253fd798ef119 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 22 Apr 2025 00:05:29 +0200 Subject: [PATCH 108/154] Ignore broken pipe error when printing dictionary stdout closing prematurely is normal behaviour, e.g. piping into `head`. --- crates/dtmt/src/cmd/dictionary.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/crates/dtmt/src/cmd/dictionary.rs b/crates/dtmt/src/cmd/dictionary.rs index 62a5295..4c54c34 100644 --- a/crates/dtmt/src/cmd/dictionary.rs +++ b/crates/dtmt/src/cmd/dictionary.rs @@ -227,9 +227,12 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<( let lookup = &ctx.lookup; let rows: Vec<_> = lookup.entries().iter().map(TableRow::from).collect(); - print_stdout(rows.with_title())?; - - Ok(()) + match print_stdout(rows.with_title()) { + Ok(_) => Ok(()), + // Closing stdout prematurely is normal behavior with things like piping into `head` + Err(err) if err.kind() == std::io::ErrorKind::BrokenPipe => Ok(()), + Err(err) => Err(err.into()), + } } _ => unreachable!( "clap is configured to require a subcommand, and they're all handled above" From cd4a953a63785cc9bd22fdc549bff11ea02b804c Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 22 Apr 2025 00:14:43 +0200 Subject: [PATCH 109/154] Update bincode --- crates/dtmm/src/main.rs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/crates/dtmm/src/main.rs b/crates/dtmm/src/main.rs index 6c0bb48..54e101a 100644 --- a/crates/dtmm/src/main.rs +++ b/crates/dtmm/src/main.rs @@ -52,10 +52,14 @@ fn notify_nxm_download( tracing::debug!("Connected to main process at '{}'", IPC_ADDRESS); - bincode::serialize_into(&mut stream, uri.as_ref()).wrap_err("Failed to send URI")?; + let bincode_config = bincode::config::standard(); + + bincode::encode_into_std_write(uri.as_ref(), &mut stream, bincode_config) + .wrap_err("Failed to send URI")?; // We don't really care what the message is, we just need an acknowledgement. - let _: String = bincode::deserialize_from(&mut stream).wrap_err("Failed to receive reply")?; + let _: String = bincode::decode_from_std_read(&mut stream, bincode_config) + .wrap_err("Failed to receive reply")?; tracing::info!( "Notified DTMM with uri '{}'. Check the main window.", @@ -160,22 +164,33 @@ fn main() -> Result<()> { match res { Ok(mut stream) => { - let res = bincode::deserialize_from(&mut stream) - .wrap_err("Failed to read message") - .and_then(|uri: String| { - tracing::trace!(uri, "Received NXM uri"); + let res = bincode::decode_from_std_read( + &mut stream, + bincode::config::standard(), + ) + .wrap_err("Failed to read message") + .and_then(|uri: String| { + tracing::trace!(uri, "Received NXM uri"); - event_sink - .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) - .wrap_err("Failed to start NXM download") - }); + event_sink + .submit_command(ACTION_HANDLE_NXM, uri, druid::Target::Auto) + .wrap_err("Failed to start NXM download") + }); match res { Ok(()) => { - let _ = bincode::serialize_into(&mut stream, "Ok"); + let _ = bincode::encode_into_std_write( + "Ok", + &mut stream, + bincode::config::standard(), + ); } Err(err) => { tracing::error!("{:?}", err); - let _ = bincode::serialize_into(&mut stream, "Error"); + let _ = bincode::encode_into_std_write( + "Error", + &mut stream, + bincode::config::standard(), + ); } } } From 5bb0f2acf561edca6e358d934c79c9d0a8c9cb44 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 22 Apr 2025 14:50:37 +0200 Subject: [PATCH 110/154] Fix build script --- .ci/tasks/build.sh | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.ci/tasks/build.sh b/.ci/tasks/build.sh index 68c61a0..b362266 100755 --- a/.ci/tasks/build.sh +++ b/.ci/tasks/build.sh @@ -20,14 +20,15 @@ install_artifact() { cd "repo" PR=${PR:-} +ref=$(cat .git/ref || echo "HEAD") if [ -n "$PR" ]; then title "PR: $(echo "$PR" | jq '.number') - $(echo "$PR" | jq '.title')" - ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$(cat .git/ref || echo "HEAD")" 2>/dev/null || echo 'manual')" + ref="pr-$(echo "$PR" | jq '.number')-$(git rev-parse --short "$ref" 2>/dev/null || echo 'manual')" elif [ -f ".git/branch" ]; then - ref=$(cat .git/branch)-$(git rev-parse --short $ref) + ref=$(cat .git/branch)-$(git rev-parse --short "$ref") else - ref=$(git rev-parse --short "$(cat .git/ref || echo "HEAD")") + ref=$(git rev-parse --short "$ref") fi title "Version: '$ref'" From 43e3bf7b60de613258f4da7fc116bebaefc9c1f1 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 26 Jul 2024 16:03:04 +0200 Subject: [PATCH 111/154] Add cmdline to tracing output Can come in handy when other people report problems and show the error message or full log, but not the command line. Setting that span to `level = "error"` ensures that it won't be disabled by level filters. --- crates/dtmt/src/main.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/crates/dtmt/src/main.rs b/crates/dtmt/src/main.rs index 2e10b17..e41e802 100644 --- a/crates/dtmt/src/main.rs +++ b/crates/dtmt/src/main.rs @@ -36,10 +36,21 @@ struct GlobalConfig { } #[tokio::main] -#[tracing::instrument] +#[tracing::instrument(level = "error", fields(cmd_line = tracing::field::Empty))] async fn main() -> Result<()> { color_eyre::install()?; + { + let span = tracing::Span::current(); + if !span.is_disabled() { + let cmdline: String = std::env::args_os().fold(String::new(), |mut s, arg| { + s.push_str(&arg.to_string_lossy()); + s + }); + span.record("cmd_line", cmdline); + } + } + let matches = command!() .subcommand_required(true) .arg( From 636279edfe376bd9d748347c7195d4e82af90015 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 21 Feb 2025 14:51:42 +0100 Subject: [PATCH 112/154] Use macro to generate file type enum and impls Due to the large amount of variants, and the different kind of values connected to each variant (hash, extension name) being scattered across the various `impl` blocks, the file became rather convoluted. While I don't generally like the indirection of macros or meta programming, it's not that bad with Rust, thanks to Rust Analyzer being able to attach diagnostics to the source inside the macro definition, and the ability to generate the macro's output for validation. Therefore, the new macro allows putting all data used for this enum definition into a single block. --- lib/sdk/src/bundle/filetype.rs | 490 +++++++++------------------------ 1 file changed, 132 insertions(+), 358 deletions(-) diff --git a/lib/sdk/src/bundle/filetype.rs b/lib/sdk/src/bundle/filetype.rs index 0b4f292..68ff6b5 100644 --- a/lib/sdk/src/bundle/filetype.rs +++ b/lib/sdk/src/bundle/filetype.rs @@ -3,232 +3,147 @@ use serde::Serialize; use crate::murmur::Murmur64; -#[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] -pub enum BundleFileType { - Animation, - AnimationCurves, - Apb, - BakedLighting, - Bik, - BlendSet, - Bones, - Chroma, - CommonPackage, - Config, - Crypto, - Data, - Entity, - Flow, - Font, - Ies, - Ini, - Input, - Ivf, - Keys, - Level, - Lua, - Material, - Mod, - MouseCursor, - NavData, - NetworkConfig, - OddleNet, - Package, - Particles, - PhysicsProperties, - RenderConfig, - RtPipeline, - Scene, - Shader, - ShaderLibrary, - ShaderLibraryGroup, - ShadingEnvionmentMapping, - ShadingEnvironment, - Slug, - SlugAlbum, - SoundEnvironment, - SpuJob, - StateMachine, - StaticPVS, - Strings, - SurfaceProperties, - Texture, - TimpaniBank, - TimpaniMaster, - Tome, - Ugg, - Unit, - Upb, - VectorField, - Wav, - WwiseBank, - WwiseDep, - WwiseEvent, - WwiseMetadata, - WwiseStream, - Xml, +macro_rules! make_enum { + ( + $( $variant:ident, $hash:expr, $ext:expr $(, $decompiled:expr)? ; )+ + ) => { + #[derive(Debug, Hash, PartialEq, Eq, Copy, Clone)] + pub enum BundleFileType { + $( + $variant, + )+ + Unknown(Murmur64), + } - Unknown(Murmur64), + impl BundleFileType { + pub fn ext_name(&self) -> String { + match self { + $( + Self::$variant => String::from($ext), + )+ + Self::Unknown(s) => format!("{s:016X}"), + } + } + + pub fn decompiled_ext_name(&self) -> String { + match self { + $( + $( Self::$variant => String::from($decompiled), )? + )+ + _ => self.ext_name(), + } + } + } + + impl std::str::FromStr for BundleFileType { + type Err = color_eyre::Report; + fn from_str(s: &str) -> Result { + match s { + $( + $ext => Ok(Self::$variant), + )+ + s => eyre::bail!("Unknown type string '{}'", s), + } + } + } + + impl From for BundleFileType { + fn from(h: u64) -> Self { + match h { + $( + $hash => Self::$variant, + )+ + hash => Self::Unknown(hash.into()), + } + } + } + + impl From for u64 { + fn from(t: BundleFileType) -> u64 { + match t { + $( + BundleFileType::$variant => $hash, + )+ + BundleFileType::Unknown(hash) => hash.into(), + } + } + } + } +} + +make_enum! { + AnimationCurves, 0xdcfb9e18fff13984, "animation_curves"; + Animation, 0x931e336d7646cc26, "animation"; + Apb, 0x3eed05ba83af5090, "apb"; + BakedLighting, 0x7ffdb779b04e4ed1, "baked_lighting"; + Bik, 0xaa5965f03029fa18, "bik"; + BlendSet, 0xe301e8af94e3b5a3, "blend_set"; + Bones, 0x18dead01056b72e9, "bones"; + Chroma, 0xb7893adf7567506a, "chroma"; + CommonPackage, 0xfe9754bd19814a47, "common_package"; + Config, 0x82645835e6b73232, "config"; + Crypto, 0x69108ded1e3e634b, "crypto"; + Data, 0x8fd0d44d20650b68, "data"; + Entity, 0x9831ca893b0d087d, "entity"; + Flow, 0x92d3ee038eeb610d, "flow"; + Font, 0x9efe0a916aae7880, "font"; + Ies, 0x8f7d5a2c0f967655, "ies"; + Ini, 0xd526a27da14f1dc5, "ini"; + Input, 0x2bbcabe5074ade9e, "input"; + Ivf, 0xfa4a8e091a91201e, "ivf"; + Keys, 0xa62f9297dc969e85, "keys"; + Level, 0x2a690fd348fe9ac5, "level"; + Lua, 0xa14e8dfa2cd117e2, "lua"; + Material, 0xeac0b497876adedf, "material"; + Mod, 0x3fcdd69156a46417, "mod"; + MouseCursor, 0xb277b11fe4a61d37, "mouse_cursor"; + NavData, 0x169de9566953d264, "nav_data"; + NetworkConfig, 0x3b1fa9e8f6bac374, "network_config"; + OddleNet, 0xb0f2c12eb107f4d8, "oodle_net"; + Package, 0xad9c6d9ed1e5e77a, "package"; + Particles, 0xa8193123526fad64, "particles"; + PhysicsProperties, 0xbf21403a3ab0bbb1, "physics_properties"; + RenderConfig, 0x27862fe24795319c, "render_config"; + RtPipeline, 0x9ca183c2d0e76dee, "rt_pipeline"; + Scene, 0x9d0a795bfe818d19, "scene"; + Shader, 0xcce8d5b5f5ae333f, "shader"; + ShaderLibrary, 0xe5ee32a477239a93, "shader_library"; + ShaderLibraryGroup, 0x9e5c3cc74575aeb5, "shader_library_group"; + ShadingEnvionmentMapping, 0x250e0a11ac8e26f8, "shading_envionment_mapping"; + ShadingEnvironment, 0xfe73c7dcff8a7ca5, "shading_environment"; + Slug, 0xa27b4d04a9ba6f9e, "slug"; + SlugAlbum, 0xe9fc9ea7042e5ec0, "slug_album"; + SoundEnvironment, 0xd8b27864a97ffdd7, "sound_environment"; + SpuJob, 0xf97af9983c05b950, "spu_job"; + StateMachine, 0xa486d4045106165c, "state_machine"; + StaticPVS, 0xe3f0baa17d620321, "static_pvs"; + Strings, 0x0d972bab10b40fd3, "strings"; + SurfaceProperties, 0xad2d3fa30d9ab394, "surface_properties"; + Texture, 0xcd4238c6a0c69e32, "texture", "dds"; + TimpaniBank, 0x99736be1fff739a4, "timpani_bank"; + TimpaniMaster, 0x00a3e6c59a2b9c6c, "timpani_master"; + Tome, 0x19c792357c99f49b, "tome"; + Ugg, 0x712d6e3dd1024c9c, "ugg"; + Unit, 0xe0a48d0be9a7453f, "unit"; + Upb, 0xa99510c6e86dd3c2, "upb"; + VectorField, 0xf7505933166d6755, "vector_field"; + Wav, 0x786f65c00a816b19, "wav"; + WwiseBank, 0x535a7bd3e650d799, "wwise_bank", "bnk"; + WwiseDep, 0xaf32095c82f2b070, "wwise_dep"; + WwiseEvent, 0xaabdd317b58dfc8a, "wwise_event"; + WwiseMetadata, 0xd50a8b7e1c82b110, "wwise_metadata"; + WwiseStream, 0x504b55235d21440e, "wwise_stream", "ogg"; + Xml, 0x76015845a6003765, "xml"; + Theme, 0x38BB9442048A7FBD, "theme"; + MissionThemes, 0x80F2DE893657F83A, "mission_themes"; } impl BundleFileType { - pub fn ext_name(&self) -> String { - match self { - BundleFileType::AnimationCurves => String::from("animation_curves"), - BundleFileType::Animation => String::from("animation"), - BundleFileType::Apb => String::from("apb"), - BundleFileType::BakedLighting => String::from("baked_lighting"), - BundleFileType::Bik => String::from("bik"), - BundleFileType::BlendSet => String::from("blend_set"), - BundleFileType::Bones => String::from("bones"), - BundleFileType::Chroma => String::from("chroma"), - BundleFileType::CommonPackage => String::from("common_package"), - BundleFileType::Config => String::from("config"), - BundleFileType::Crypto => String::from("crypto"), - BundleFileType::Data => String::from("data"), - BundleFileType::Entity => String::from("entity"), - BundleFileType::Flow => String::from("flow"), - BundleFileType::Font => String::from("font"), - BundleFileType::Ies => String::from("ies"), - BundleFileType::Ini => String::from("ini"), - BundleFileType::Input => String::from("input"), - BundleFileType::Ivf => String::from("ivf"), - BundleFileType::Keys => String::from("keys"), - BundleFileType::Level => String::from("level"), - BundleFileType::Lua => String::from("lua"), - BundleFileType::Material => String::from("material"), - BundleFileType::Mod => String::from("mod"), - BundleFileType::MouseCursor => String::from("mouse_cursor"), - BundleFileType::NavData => String::from("nav_data"), - BundleFileType::NetworkConfig => String::from("network_config"), - BundleFileType::OddleNet => String::from("oodle_net"), - BundleFileType::Package => String::from("package"), - BundleFileType::Particles => String::from("particles"), - BundleFileType::PhysicsProperties => String::from("physics_properties"), - BundleFileType::RenderConfig => String::from("render_config"), - BundleFileType::RtPipeline => String::from("rt_pipeline"), - BundleFileType::Scene => String::from("scene"), - BundleFileType::ShaderLibraryGroup => String::from("shader_library_group"), - BundleFileType::ShaderLibrary => String::from("shader_library"), - BundleFileType::Shader => String::from("shader"), - BundleFileType::ShadingEnvionmentMapping => String::from("shading_environment_mapping"), - BundleFileType::ShadingEnvironment => String::from("shading_environment"), - BundleFileType::SlugAlbum => String::from("slug_album"), - BundleFileType::Slug => String::from("slug"), - BundleFileType::SoundEnvironment => String::from("sound_environment"), - BundleFileType::SpuJob => String::from("spu_job"), - BundleFileType::StateMachine => String::from("state_machine"), - BundleFileType::StaticPVS => String::from("static_pvs"), - BundleFileType::Strings => String::from("strings"), - BundleFileType::SurfaceProperties => String::from("surface_properties"), - BundleFileType::Texture => String::from("texture"), - BundleFileType::TimpaniBank => String::from("timpani_bank"), - BundleFileType::TimpaniMaster => String::from("timpani_master"), - BundleFileType::Tome => String::from("tome"), - BundleFileType::Ugg => String::from("ugg"), - BundleFileType::Unit => String::from("unit"), - BundleFileType::Upb => String::from("upb"), - BundleFileType::VectorField => String::from("vector_field"), - BundleFileType::Wav => String::from("wav"), - BundleFileType::WwiseBank => String::from("wwise_bank"), - BundleFileType::WwiseDep => String::from("wwise_dep"), - BundleFileType::WwiseEvent => String::from("wwise_event"), - BundleFileType::WwiseMetadata => String::from("wwise_metadata"), - BundleFileType::WwiseStream => String::from("wwise_stream"), - BundleFileType::Xml => String::from("xml"), - - BundleFileType::Unknown(s) => format!("{s:016X}"), - } - } - - pub fn decompiled_ext_name(&self) -> String { - match self { - BundleFileType::Texture => String::from("dds"), - BundleFileType::WwiseBank => String::from("bnk"), - BundleFileType::WwiseStream => String::from("ogg"), - _ => self.ext_name(), - } - } - pub fn hash(&self) -> Murmur64 { Murmur64::from(*self) } } -impl std::str::FromStr for BundleFileType { - type Err = color_eyre::Report; - - fn from_str(s: &str) -> Result { - let val = match s { - "animation_curves" => BundleFileType::AnimationCurves, - "animation" => BundleFileType::Animation, - "apb" => BundleFileType::Apb, - "baked_lighting" => BundleFileType::BakedLighting, - "bik" => BundleFileType::Bik, - "blend_set" => BundleFileType::BlendSet, - "bones" => BundleFileType::Bones, - "chroma" => BundleFileType::Chroma, - "common_package" => BundleFileType::CommonPackage, - "config" => BundleFileType::Config, - "crypto" => BundleFileType::Crypto, - "data" => BundleFileType::Data, - "entity" => BundleFileType::Entity, - "flow" => BundleFileType::Flow, - "font" => BundleFileType::Font, - "ies" => BundleFileType::Ies, - "ini" => BundleFileType::Ini, - "input" => BundleFileType::Input, - "ivf" => BundleFileType::Ivf, - "keys" => BundleFileType::Keys, - "level" => BundleFileType::Level, - "lua" => BundleFileType::Lua, - "material" => BundleFileType::Material, - "mod" => BundleFileType::Mod, - "mouse_cursor" => BundleFileType::MouseCursor, - "nav_data" => BundleFileType::NavData, - "network_config" => BundleFileType::NetworkConfig, - "oodle_net" => BundleFileType::OddleNet, - "package" => BundleFileType::Package, - "particles" => BundleFileType::Particles, - "physics_properties" => BundleFileType::PhysicsProperties, - "render_config" => BundleFileType::RenderConfig, - "rt_pipeline" => BundleFileType::RtPipeline, - "scene" => BundleFileType::Scene, - "shader_library_group" => BundleFileType::ShaderLibraryGroup, - "shader_library" => BundleFileType::ShaderLibrary, - "shader" => BundleFileType::Shader, - "shading_environment_mapping" => BundleFileType::ShadingEnvionmentMapping, - "shading_environment" => BundleFileType::ShadingEnvironment, - "slug_album" => BundleFileType::SlugAlbum, - "slug" => BundleFileType::Slug, - "sound_environment" => BundleFileType::SoundEnvironment, - "spu_job" => BundleFileType::SpuJob, - "state_machine" => BundleFileType::StateMachine, - "static_pvs" => BundleFileType::StaticPVS, - "strings" => BundleFileType::Strings, - "surface_properties" => BundleFileType::SurfaceProperties, - "texture" => BundleFileType::Texture, - "timpani_bank" => BundleFileType::TimpaniBank, - "timpani_master" => BundleFileType::TimpaniMaster, - "tome" => BundleFileType::Tome, - "ugg" => BundleFileType::Ugg, - "unit" => BundleFileType::Unit, - "upb" => BundleFileType::Upb, - "vector_field" => BundleFileType::VectorField, - "wav" => BundleFileType::Wav, - "wwise_bank" => BundleFileType::WwiseBank, - "wwise_dep" => BundleFileType::WwiseDep, - "wwise_event" => BundleFileType::WwiseEvent, - "wwise_metadata" => BundleFileType::WwiseMetadata, - "wwise_stream" => BundleFileType::WwiseStream, - "xml" => BundleFileType::Xml, - s => eyre::bail!("Unknown type string '{}'", s), - }; - - Ok(val) - } -} - impl Serialize for BundleFileType { fn serialize(&self, serializer: S) -> Result where @@ -245,147 +160,6 @@ impl From for BundleFileType { } } -impl From for BundleFileType { - fn from(hash: u64) -> BundleFileType { - match hash { - 0x931e336d7646cc26 => BundleFileType::Animation, - 0xdcfb9e18fff13984 => BundleFileType::AnimationCurves, - 0x3eed05ba83af5090 => BundleFileType::Apb, - 0x7ffdb779b04e4ed1 => BundleFileType::BakedLighting, - 0xaa5965f03029fa18 => BundleFileType::Bik, - 0xe301e8af94e3b5a3 => BundleFileType::BlendSet, - 0x18dead01056b72e9 => BundleFileType::Bones, - 0xb7893adf7567506a => BundleFileType::Chroma, - 0xfe9754bd19814a47 => BundleFileType::CommonPackage, - 0x82645835e6b73232 => BundleFileType::Config, - 0x69108ded1e3e634b => BundleFileType::Crypto, - 0x8fd0d44d20650b68 => BundleFileType::Data, - 0x9831ca893b0d087d => BundleFileType::Entity, - 0x92d3ee038eeb610d => BundleFileType::Flow, - 0x9efe0a916aae7880 => BundleFileType::Font, - 0x8f7d5a2c0f967655 => BundleFileType::Ies, - 0xd526a27da14f1dc5 => BundleFileType::Ini, - 0x2bbcabe5074ade9e => BundleFileType::Input, - 0xfa4a8e091a91201e => BundleFileType::Ivf, - 0xa62f9297dc969e85 => BundleFileType::Keys, - 0x2a690fd348fe9ac5 => BundleFileType::Level, - 0xa14e8dfa2cd117e2 => BundleFileType::Lua, - 0xeac0b497876adedf => BundleFileType::Material, - 0x3fcdd69156a46417 => BundleFileType::Mod, - 0xb277b11fe4a61d37 => BundleFileType::MouseCursor, - 0x169de9566953d264 => BundleFileType::NavData, - 0x3b1fa9e8f6bac374 => BundleFileType::NetworkConfig, - 0xb0f2c12eb107f4d8 => BundleFileType::OddleNet, - 0xad9c6d9ed1e5e77a => BundleFileType::Package, - 0xa8193123526fad64 => BundleFileType::Particles, - 0xbf21403a3ab0bbb1 => BundleFileType::PhysicsProperties, - 0x27862fe24795319c => BundleFileType::RenderConfig, - 0x9ca183c2d0e76dee => BundleFileType::RtPipeline, - 0x9d0a795bfe818d19 => BundleFileType::Scene, - 0xcce8d5b5f5ae333f => BundleFileType::Shader, - 0xe5ee32a477239a93 => BundleFileType::ShaderLibrary, - 0x9e5c3cc74575aeb5 => BundleFileType::ShaderLibraryGroup, - 0x250e0a11ac8e26f8 => BundleFileType::ShadingEnvionmentMapping, - 0xfe73c7dcff8a7ca5 => BundleFileType::ShadingEnvironment, - 0xa27b4d04a9ba6f9e => BundleFileType::Slug, - 0xe9fc9ea7042e5ec0 => BundleFileType::SlugAlbum, - 0xd8b27864a97ffdd7 => BundleFileType::SoundEnvironment, - 0xf97af9983c05b950 => BundleFileType::SpuJob, - 0xa486d4045106165c => BundleFileType::StateMachine, - 0xe3f0baa17d620321 => BundleFileType::StaticPVS, - 0x0d972bab10b40fd3 => BundleFileType::Strings, - 0xad2d3fa30d9ab394 => BundleFileType::SurfaceProperties, - 0xcd4238c6a0c69e32 => BundleFileType::Texture, - 0x99736be1fff739a4 => BundleFileType::TimpaniBank, - 0x00a3e6c59a2b9c6c => BundleFileType::TimpaniMaster, - 0x19c792357c99f49b => BundleFileType::Tome, - 0x712d6e3dd1024c9c => BundleFileType::Ugg, - 0xe0a48d0be9a7453f => BundleFileType::Unit, - 0xa99510c6e86dd3c2 => BundleFileType::Upb, - 0xf7505933166d6755 => BundleFileType::VectorField, - 0x786f65c00a816b19 => BundleFileType::Wav, - 0x535a7bd3e650d799 => BundleFileType::WwiseBank, - 0xaf32095c82f2b070 => BundleFileType::WwiseDep, - 0xaabdd317b58dfc8a => BundleFileType::WwiseEvent, - 0xd50a8b7e1c82b110 => BundleFileType::WwiseMetadata, - 0x504b55235d21440e => BundleFileType::WwiseStream, - 0x76015845a6003765 => BundleFileType::Xml, - - _ => BundleFileType::Unknown(Murmur64::from(hash)), - } - } -} - -impl From for u64 { - fn from(t: BundleFileType) -> u64 { - match t { - BundleFileType::Animation => 0x931e336d7646cc26, - BundleFileType::AnimationCurves => 0xdcfb9e18fff13984, - BundleFileType::Apb => 0x3eed05ba83af5090, - BundleFileType::BakedLighting => 0x7ffdb779b04e4ed1, - BundleFileType::Bik => 0xaa5965f03029fa18, - BundleFileType::BlendSet => 0xe301e8af94e3b5a3, - BundleFileType::Bones => 0x18dead01056b72e9, - BundleFileType::Chroma => 0xb7893adf7567506a, - BundleFileType::CommonPackage => 0xfe9754bd19814a47, - BundleFileType::Config => 0x82645835e6b73232, - BundleFileType::Crypto => 0x69108ded1e3e634b, - BundleFileType::Data => 0x8fd0d44d20650b68, - BundleFileType::Entity => 0x9831ca893b0d087d, - BundleFileType::Flow => 0x92d3ee038eeb610d, - BundleFileType::Font => 0x9efe0a916aae7880, - BundleFileType::Ies => 0x8f7d5a2c0f967655, - BundleFileType::Ini => 0xd526a27da14f1dc5, - BundleFileType::Input => 0x2bbcabe5074ade9e, - BundleFileType::Ivf => 0xfa4a8e091a91201e, - BundleFileType::Keys => 0xa62f9297dc969e85, - BundleFileType::Level => 0x2a690fd348fe9ac5, - BundleFileType::Lua => 0xa14e8dfa2cd117e2, - BundleFileType::Material => 0xeac0b497876adedf, - BundleFileType::Mod => 0x3fcdd69156a46417, - BundleFileType::MouseCursor => 0xb277b11fe4a61d37, - BundleFileType::NavData => 0x169de9566953d264, - BundleFileType::NetworkConfig => 0x3b1fa9e8f6bac374, - BundleFileType::OddleNet => 0xb0f2c12eb107f4d8, - BundleFileType::Package => 0xad9c6d9ed1e5e77a, - BundleFileType::Particles => 0xa8193123526fad64, - BundleFileType::PhysicsProperties => 0xbf21403a3ab0bbb1, - BundleFileType::RenderConfig => 0x27862fe24795319c, - BundleFileType::RtPipeline => 0x9ca183c2d0e76dee, - BundleFileType::Scene => 0x9d0a795bfe818d19, - BundleFileType::Shader => 0xcce8d5b5f5ae333f, - BundleFileType::ShaderLibrary => 0xe5ee32a477239a93, - BundleFileType::ShaderLibraryGroup => 0x9e5c3cc74575aeb5, - BundleFileType::ShadingEnvionmentMapping => 0x250e0a11ac8e26f8, - BundleFileType::ShadingEnvironment => 0xfe73c7dcff8a7ca5, - BundleFileType::Slug => 0xa27b4d04a9ba6f9e, - BundleFileType::SlugAlbum => 0xe9fc9ea7042e5ec0, - BundleFileType::SoundEnvironment => 0xd8b27864a97ffdd7, - BundleFileType::SpuJob => 0xf97af9983c05b950, - BundleFileType::StateMachine => 0xa486d4045106165c, - BundleFileType::StaticPVS => 0xe3f0baa17d620321, - BundleFileType::Strings => 0x0d972bab10b40fd3, - BundleFileType::SurfaceProperties => 0xad2d3fa30d9ab394, - BundleFileType::Texture => 0xcd4238c6a0c69e32, - BundleFileType::TimpaniBank => 0x99736be1fff739a4, - BundleFileType::TimpaniMaster => 0x00a3e6c59a2b9c6c, - BundleFileType::Tome => 0x19c792357c99f49b, - BundleFileType::Ugg => 0x712d6e3dd1024c9c, - BundleFileType::Unit => 0xe0a48d0be9a7453f, - BundleFileType::Upb => 0xa99510c6e86dd3c2, - BundleFileType::VectorField => 0xf7505933166d6755, - BundleFileType::Wav => 0x786f65c00a816b19, - BundleFileType::WwiseBank => 0x535a7bd3e650d799, - BundleFileType::WwiseDep => 0xaf32095c82f2b070, - BundleFileType::WwiseEvent => 0xaabdd317b58dfc8a, - BundleFileType::WwiseMetadata => 0xd50a8b7e1c82b110, - BundleFileType::WwiseStream => 0x504b55235d21440e, - BundleFileType::Xml => 0x76015845a6003765, - - BundleFileType::Unknown(hash) => hash.into(), - } - } -} impl From for Murmur64 { fn from(t: BundleFileType) -> Murmur64 { let hash: u64 = t.into(); From 7b95918000430088139af81b9aea2d540e25f98b Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 22 Sep 2023 15:42:16 +0200 Subject: [PATCH 113/154] Refactor code for file injection I ended up wrapping the raw data in a `BundleFile` twice. I also made '--compile' the default, as it should be much less often that raw data needs to be inserted. Even files that are essentially raw binary blobs, like `.wwise_event`, still have some custom fields that need to be accounted for. --- crates/dtmt/src/cmd/bundle/inject.rs | 327 +++++++++++++++++++++------ lib/sdk/src/bundle/file.rs | 23 +- lib/sdk/src/bundle/mod.rs | 3 +- lib/sdk/src/lib.rs | 2 +- 4 files changed, 277 insertions(+), 78 deletions(-) diff --git a/crates/dtmt/src/cmd/bundle/inject.rs b/crates/dtmt/src/cmd/bundle/inject.rs index 2b86691..21f4a91 100644 --- a/crates/dtmt/src/cmd/bundle/inject.rs +++ b/crates/dtmt/src/cmd/bundle/inject.rs @@ -1,112 +1,297 @@ -use std::path::PathBuf; +use std::path::{Path, PathBuf}; +use std::str::FromStr as _; -use clap::{value_parser, Arg, ArgMatches, Command}; -use color_eyre::eyre::{self, Context, Result}; +use clap::{value_parser, Arg, ArgAction, ArgMatches, Command}; +use color_eyre::eyre::{self, Context, OptionExt, Result}; use color_eyre::Help; -use sdk::Bundle; -use tokio::fs::{self, File}; -use tokio::io::AsyncReadExt; +use path_slash::PathBufExt as _; +use sdk::murmur::IdString64; +use sdk::{Bundle, BundleFile, BundleFileType}; +use tokio::fs; pub(crate) fn command_definition() -> Command { Command::new("inject") - .about("Inject a file into a bundle.") - .arg( - Arg::new("replace") - .help("The name of a file in the bundle whos content should be replaced.") - .short('r') - .long("replace"), - ) + .subcommand_required(true) + .about("Inject a file into a bundle.\n\ + Raw binary data can be used to directly replace the file's variant data blob without affecting the metadata.\n\ + Alternatively, a compiler format may be specified, and a complete bundle file is created.") .arg( Arg::new("output") .help( "The path to write the changed bundle to. \ - If omitted, the input bundle will be overwritten.", + If omitted, the input bundle will be overwritten.\n\ + Remember to add a `.patch_` suffix if you also use '--patch'.", ) .short('o') .long("output") .value_parser(value_parser!(PathBuf)), ) .arg( - Arg::new("bundle") - .help("Path to the bundle to inject the file into.") - .required(true) - .value_parser(value_parser!(PathBuf)), + Arg::new("patch") + .help("Create a patch bundle. Optionally, a patch NUMBER may be specified as \ + '--patch=123'.\nThe maximum number is 999, the default is 1.\n\ + If `--output` is not specified, the `.patch_` suffix is added to \ + the given bundle name.") + .short('p') + .long("patch") + .num_args(0..=1) + .require_equals(true) + .default_missing_value("1") + .value_name("NUMBER") + .value_parser(value_parser!(u16)) ) .arg( - Arg::new("file") - .help("Path to the file to inject.") - .required(true) - .value_parser(value_parser!(PathBuf)), + Arg::new("type") + .help("Compile the new file as the given TYPE. If omitted, the file type is \ + is guessed from the file extension.") + .value_name("TYPE") ) + .subcommand( + Command::new("replace") + .about("Replace an existing file in the bundle") + .arg( + Arg::new("variant") + .help("In combination with '--raw', specify the variant index to replace.") + .long("variant") + .default_value("0") + .value_parser(value_parser!(u8)) + ) + .arg( + Arg::new("raw") + .help("Insert the given file as raw binary data.\n\ + Cannot be used with '--patch'.") + .long("raw") + .action(ArgAction::SetTrue) + ) + .arg( + Arg::new("bundle") + .help("Path to the bundle to inject the file into.") + .required(true) + .value_parser(value_parser!(PathBuf)), + ) + .arg( + Arg::new("bundle-file") + .help("The name of a file in the bundle whose content should be replaced.") + .required(true), + ) + .arg( + Arg::new("new-file") + .help("Path to the file to inject.") + .required(true) + .value_parser(value_parser!(PathBuf)), + ), + ) + // .subcommand( + // Command::new("add") + // .about("Add a new file to the bundle") + // .arg( + // Arg::new("new-file") + // .help("Path to the file to inject.") + // .required(true) + // .value_parser(value_parser!(PathBuf)), + // ) + // .arg( + // Arg::new("bundle") + // .help("Path to the bundle to inject the file into.") + // .required(true) + // .value_parser(value_parser!(PathBuf)), + // ), + // ) } -#[tracing::instrument(skip_all)] +#[tracing::instrument] +async fn compile_file( + path: impl AsRef + std::fmt::Debug, + name: impl Into + std::fmt::Debug, + file_type: BundleFileType, +) -> Result { + let path = path.as_ref(); + + let file_data = fs::read(&path) + .await + .wrap_err_with(|| format!("Failed to read file '{}'", path.display()))?; + let _sjson = String::from_utf8(file_data) + .wrap_err_with(|| format!("Invalid UTF8 data in '{}'", path.display()))?; + + let _root = path.parent().ok_or_eyre("File path has no parent")?; + + eyre::bail!( + "Compilation for type '{}' is not implemented, yet", + file_type + ) +} + +#[tracing::instrument( + skip_all, + fields( + bundle_path = tracing::field::Empty, + in_file_path = tracing::field::Empty, + output_path = tracing::field::Empty, + target_name = tracing::field::Empty, + file_type = tracing::field::Empty, + raw = tracing::field::Empty, + ) +)] pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { - let bundle_path = matches + let Some((op, sub_matches)) = matches.subcommand() else { + unreachable!("clap is configured to require a subcommand, and they're all handled above"); + }; + + let bundle_path = sub_matches .get_one::("bundle") .expect("required parameter not found"); - let file_path = matches - .get_one::("file") + let in_file_path = sub_matches + .get_one::("new-file") .expect("required parameter not found"); - tracing::trace!(bundle_path = %bundle_path.display(), file_path = %file_path.display()); + let patch_number = matches + .get_one::("patch") + .map(|num| format!("{:03}", num)); - let mut bundle = { - let binary = fs::read(bundle_path).await?; - let name = Bundle::get_name_from_path(&ctx, bundle_path); - Bundle::from_binary(&ctx, name, binary).wrap_err("Failed to open bundle file")? + let output_path = matches + .get_one::("output") + .cloned() + .unwrap_or_else(|| { + let mut output_path = bundle_path.clone(); + + if let Some(patch_number) = patch_number.as_ref() { + output_path.set_extension(format!("patch_{:03}", patch_number)); + } + + output_path + }); + + let target_name = if op == "replace" { + sub_matches + .get_one::("bundle-file") + .map(|name| match u64::from_str_radix(name, 16) { + Ok(id) => IdString64::from(id), + Err(_) => IdString64::String(name.clone()), + }) + .expect("argument is required") + } else { + let mut path = PathBuf::from(in_file_path); + path.set_extension(""); + IdString64::from(path.to_slash_lossy().to_string()) }; - if let Some(name) = matches.get_one::("replace") { - let mut file = File::open(&file_path) - .await - .wrap_err_with(|| format!("Failed to open '{}'", file_path.display()))?; + let file_type = if let Some(forced_type) = matches.get_one::("type") { + BundleFileType::from_str(forced_type.as_str()).wrap_err("Unknown file type")? + } else { + in_file_path + .extension() + .and_then(|s| s.to_str()) + .ok_or_eyre("File extension missing") + .and_then(BundleFileType::from_str) + .wrap_err("Unknown file type") + .with_suggestion(|| "Use '--type TYPE' to specify the file type")? + }; - if let Some(variant) = bundle - .files_mut() - .filter(|file| file.matches_name(name.clone())) - // TODO: Handle file variants - .find_map(|file| file.variants_mut().next()) - { - let mut data = Vec::new(); - file.read_to_end(&mut data) - .await - .wrap_err("Failed to read input file")?; - variant.set_data(data); - } else { - let err = eyre::eyre!("No file '{}' in this bundle.", name) - .with_suggestion(|| { + { + let span = tracing::Span::current(); + if !span.is_disabled() { + span.record("bundle_path", bundle_path.display().to_string()); + span.record("in_file_path", in_file_path.display().to_string()); + span.record("output_path", output_path.display().to_string()); + span.record("raw", sub_matches.get_flag("raw")); + span.record("target_name", target_name.display().to_string()); + span.record("file_type", format!("{:?}", file_type)); + } + } + + let bundle_name = Bundle::get_name_from_path(&ctx, bundle_path); + let mut bundle = { + let binary = fs::read(bundle_path).await?; + Bundle::from_binary(&ctx, bundle_name.clone(), binary) + .wrap_err_with(|| format!("Failed to open bundle '{}'", bundle_path.display()))? + }; + + if op == "copy" { + unimplemented!("Implement copying a file from one bundle to the other."); + } + + let output_bundle = match op { + "replace" => { + let Some(file) = bundle + .files_mut() + .find(|file| *file.base_name() == target_name) + else { + let err = eyre::eyre!( + "No file with name '{}' in bundle '{}'", + target_name.display(), + bundle_path.display() + ); + + return Err(err).with_suggestion(|| { format!( - "Run '{} bundle list {}' to list the files in this bundle.", + "Run '{} bundle list \"{}\"' to list the files in this bundle.", clap::crate_name!(), bundle_path.display() ) - }) - .with_suggestion(|| { - format!( - "Use '{} bundle inject --add {} {} {}' to add it as a new file", - clap::crate_name!(), - name, - bundle_path.display(), - file_path.display() - ) }); + }; - return Err(err); + if sub_matches.get_flag("raw") { + let variant_index = sub_matches + .get_one::("variant") + .expect("argument with default missing"); + + let Some(variant) = file.variants_mut().nth(*variant_index as usize) else { + let err = eyre::eyre!( + "Variant index '{}' does not exist in '{}'", + variant_index, + target_name.display() + ); + + return Err(err).with_suggestion(|| { + format!( + "See '{} bundle inject add --help' if you want to add it as a new file", + clap::crate_name!(), + ) + }); + }; + + let data = tokio::fs::read(&in_file_path).await.wrap_err_with(|| { + format!("Failed to read file '{}'", in_file_path.display()) + })?; + variant.set_data(data); + file.set_modded(true); + bundle + } else { + let mut bundle_file = compile_file(in_file_path, target_name.clone(), file_type) + .await + .wrap_err("Failed to compile")?; + + bundle_file.set_modded(true); + + if patch_number.is_some() { + let mut output_bundle = Bundle::new(bundle_name); + output_bundle.add_file(bundle_file); + output_bundle + } else { + *file = bundle_file; + + dbg!(&file); + bundle + } + } } + "add" => { + unimplemented!("Implement adding a new file to the bundle."); + } + _ => unreachable!("no other operations exist"), + }; - let out_path = matches.get_one::("output").unwrap_or(bundle_path); - let data = bundle - .to_binary() - .wrap_err("Failed to write changed bundle to output")?; + let data = output_bundle + .to_binary() + .wrap_err("Failed to write changed bundle to output")?; - fs::write(out_path, &data) - .await - .wrap_err("Failed to write data to output file")?; + fs::write(&output_path, &data) + .await + .wrap_err_with(|| format!("Failed to write data to '{}'", output_path.display()))?; - Ok(()) - } else { - eyre::bail!("Currently, only the '--replace' operation is supported."); - } + tracing::info!("Modified bundle written to '{}'", output_path.display()); + + Ok(()) } diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index f387409..6d49821 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -20,6 +20,7 @@ struct BundleFileHeader { len_data_file_name: usize, } +#[derive(Clone, Debug)] pub struct BundleFileVariant { property: u32, data: Vec, @@ -109,9 +110,12 @@ bitflags! { #[derive(Default, Clone, Copy, Debug)] pub struct Properties: u32 { const DATA = 0b100; + // A custom flag used by DTMT to signify a file altered by mods. + const MODDED = 1 << 31; } } +#[derive(Clone, Debug)] pub struct BundleFile { file_type: BundleFileType, name: IdString64, @@ -133,6 +137,18 @@ impl BundleFile { self.variants.push(variant) } + pub fn set_variants(&mut self, variants: Vec) { + self.variants = variants; + } + + pub fn set_props(&mut self, props: Properties) { + self.props = props; + } + + pub fn set_modded(&mut self, is_modded: bool) { + self.props.set(Properties::MODDED, is_modded); + } + #[tracing::instrument(name = "File::read", skip(ctx, r))] pub fn from_reader(ctx: &crate::Context, r: &mut R, props: Properties) -> Result where @@ -299,14 +315,13 @@ impl BundleFile { s } - pub fn matches_name(&self, name: impl Into) -> bool { - let name = name.into(); - if self.name == name { + pub fn matches_name(&self, name: &IdString64) -> bool { + if self.name == *name { return true; } if let IdString64::String(name) = name { - self.name(false, None) == name || self.name(true, None) == name + self.name(false, None) == *name || self.name(true, None) == *name } else { false } diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index 075f4d2..edb71bb 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -7,14 +7,13 @@ use color_eyre::{Help, Report, SectionExt}; use oodle::{OodleLZ_CheckCRC, OodleLZ_FuzzSafe, CHUNK_SIZE}; use crate::binary::sync::*; -use crate::bundle::file::Properties; use crate::murmur::{HashGroup, IdString64, Murmur64}; pub(crate) mod database; pub(crate) mod file; pub(crate) mod filetype; -pub use file::{BundleFile, BundleFileVariant}; +pub use file::{BundleFile, BundleFileVariant, Properties}; pub use filetype::BundleFileType; #[derive(Clone, Copy, Debug, PartialEq, PartialOrd)] diff --git a/lib/sdk/src/lib.rs b/lib/sdk/src/lib.rs index a24b3bd..9b1806b 100644 --- a/lib/sdk/src/lib.rs +++ b/lib/sdk/src/lib.rs @@ -9,5 +9,5 @@ pub mod murmur; pub use binary::{FromBinary, ToBinary}; pub use bundle::database::BundleDatabase; pub use bundle::decompress; -pub use bundle::{Bundle, BundleFile, BundleFileType, BundleFileVariant}; +pub use bundle::{Bundle, BundleFile, BundleFileType, BundleFileVariant, Properties}; pub use context::{CmdLine, Context}; From f521e20f2b61aef35315081c7f6c78746acda679 Mon Sep 17 00:00:00 2001 From: Renovate Date: Thu, 15 May 2025 22:16:23 +0000 Subject: [PATCH 114/154] chore(deps): update rust crate csv-async to v1.3.1 --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index c4ec109..88a9bb9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -704,9 +704,9 @@ dependencies = [ [[package]] name = "csv-async" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d37fe5b0d07f4a8260ce1e9a81413e88f459af0f2dfc55c15e96868a2f99c0f0" +checksum = "888dbb0f640d2c4c04e50f933885c7e9c95995d93cec90aba8735b4c610f26f1" dependencies = [ "cfg-if", "csv-core", @@ -2173,7 +2173,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] From 164cb7bc131199a5089e9a2cb8dffe89fabbc9ff Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 20 May 2025 12:46:31 +0000 Subject: [PATCH 115/154] chore(deps): update rust crate tempfile to v3.20.0 --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 88a9bb9..bc37db3 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1045,7 +1045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3195,7 +3195,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -3710,15 +3710,15 @@ checksum = "61c41af27dd6d1e27b1b16b489db798443478cef1f06a660c96db617ba5de3b1" [[package]] name = "tempfile" -version = "3.19.1" +version = "3.20.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7437ac7763b9b123ccf33c338a5cc1bac6f69b45a136c19bdd8a65e3916435bf" +checksum = "e8a64e3985349f2441a1a9ef0b853f869006c3855f2cda6862a94d26ebb9d6a1" dependencies = [ "fastrand", "getrandom 0.3.2", "once_cell", "rustix 1.0.5", - "windows-sys 0.59.0", + "windows-sys 0.52.0", ] [[package]] @@ -4543,7 +4543,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] From ca677606fa25fd62466963e3e65efc7db82bb5f9 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 20 May 2025 13:16:25 +0000 Subject: [PATCH 116/154] chore(deps): update rust crate bitflags to v2.9.1 --- Cargo.lock | 32 ++++++++++++++++---------------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc37db3..aa01c87 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -233,7 +233,7 @@ version = "0.70.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cexpr", "clang-sys", "itertools", @@ -253,7 +253,7 @@ version = "0.71.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cexpr", "clang-sys", "itertools", @@ -275,9 +275,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.9.0" +version = "2.9.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5c8214115b7bf84099f1309324e63141d4c5d7cc26862f97a0a857dbefe165bd" +checksum = "1b8e56985ec62d17e9c1001dc89c88ecd7dc08e47eba5ec7c29c7b5eeecde967" [[package]] name = "bitmaps" @@ -917,7 +917,7 @@ dependencies = [ "ansi-parser", "async-recursion", "bincode", - "bitflags 2.9.0", + "bitflags 2.9.1", "clap", "color-eyre", "colors-transform", @@ -1955,7 +1955,7 @@ version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f37dccff2791ab604f9babef0ba14fbe0be30bd368dc541e2b08d07c8aa908f3" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "inotify-sys", "libc", ] @@ -2182,7 +2182,7 @@ version = "0.1.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "libc", "redox_syscall", ] @@ -2445,7 +2445,7 @@ version = "8.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2fee8403b3d66ac7b26aee6e40a897d85dc5ce26f44da36b8b73e987cc52e943" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "filetime", "fsevent-sys", "inotify", @@ -2548,7 +2548,7 @@ version = "0.10.66" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9529f4786b70a3e8c61e11179af17ab6188ad8d0ded78c5529441ed39d4bd9c1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "cfg-if", "foreign-types", "libc", @@ -2986,7 +2986,7 @@ version = "0.5.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a908a6e00f1fdd0dfd9c0eb08ce85126f6d8bbda50017e74bc4a4b7d4a926a4" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] @@ -3178,7 +3178,7 @@ version = "0.38.34" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "70dc5ec042f7a43c4a73241207cecc9873a06d45debb38b329f8541d85c2730f" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.4.14", @@ -3191,7 +3191,7 @@ version = "1.0.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d97817398dd4bb2e6da002002db259209759911da105da92bec29ccb12cf58bf" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "errno", "libc", "linux-raw-sys 0.9.4", @@ -3325,7 +3325,7 @@ name = "sdk" version = "0.3.0" dependencies = [ "async-recursion", - "bitflags 2.9.0", + "bitflags 2.9.1", "byteorder", "color-eyre", "csv-async", @@ -3352,7 +3352,7 @@ version = "2.11.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "core-foundation", "core-foundation-sys", "libc", @@ -3674,7 +3674,7 @@ version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", "core-foundation", "system-configuration-sys", ] @@ -4851,7 +4851,7 @@ version = "0.39.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6f42320e61fe2cfd34354ecb597f86f413484a798ba44a8ca1165c58d42da6c1" dependencies = [ - "bitflags 2.9.0", + "bitflags 2.9.1", ] [[package]] From 1975435805f5aded7a9eaf3cb9c0a6eefd1c9ff0 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 20 May 2025 13:16:29 +0000 Subject: [PATCH 117/154] chore(deps): update rust crate clap to v4.5.38 --- Cargo.lock | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc37db3..ed45902 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eccb054f56cbd38340b380d4a8e69ef1f02f1af43db2f0cc817a4774d80ae071" +checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" dependencies = [ "clap_builder", "clap_derive", @@ -436,9 +436,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.37" +version = "4.5.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd9466fac8543255d3b1fcad4762c5e116ffe808c8a3043d4263cd4fd4862a2" +checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" dependencies = [ "anstream", "anstyle", @@ -1045,7 +1045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3195,7 +3195,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3718,7 +3718,7 @@ dependencies = [ "getrandom 0.3.2", "once_cell", "rustix 1.0.5", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] From 1e9738c953051cd678000ab78e2cd01b2428e30c Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 20 May 2025 13:16:37 +0000 Subject: [PATCH 118/154] chore(deps): update rust crate tokio to v1.45.0 --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index bc37db3..29df0e2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1045,7 +1045,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "976dd42dc7e85965fe702eb8164f21f450704bdde31faefd6471dba214cb594e" dependencies = [ "libc", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3195,7 +3195,7 @@ dependencies = [ "errno", "libc", "linux-raw-sys 0.9.4", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3718,7 +3718,7 @@ dependencies = [ "getrandom 0.3.2", "once_cell", "rustix 1.0.5", - "windows-sys 0.52.0", + "windows-sys 0.59.0", ] [[package]] @@ -3850,9 +3850,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.44.2" +version = "1.45.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e6b88822cbe49de4185e3a4cbf8321dd487cf5fe0c5c65695fef6346371e9c48" +checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" dependencies = [ "backtrace", "bytes", From 5e1581b428f028ef637c05b2d10598d6bbb148fc Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 21 May 2025 08:31:36 +0000 Subject: [PATCH 119/154] chore(deps): update rust crate minijinja to v2.10.2 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3eb31bc..7fb7b22 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2302,9 +2302,9 @@ dependencies = [ [[package]] name = "minijinja" -version = "2.9.0" +version = "2.10.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "98642a6dfca91122779a307b77cd07a4aa951fbe32232aaf5bad9febc66be754" +checksum = "dd72e8b4e42274540edabec853f607c015c73436159b06c39c7af85a20433155" dependencies = [ "serde", ] From 14eded5b7e1d3b43bcbd6b5d04860fe69ee4ea42 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 21 May 2025 08:31:45 +0000 Subject: [PATCH 120/154] chore(deps): update rust crate zip to v3 --- Cargo.lock | 41 +++++++++++++++++++++++++---------------- Cargo.toml | 2 +- 2 files changed, 26 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 3eb31bc..212dc5d 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -686,12 +686,6 @@ dependencies = [ "cfg-if", ] -[[package]] -name = "crossbeam-utils" -version = "0.8.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d0a5c400df2834b80a4c3327b3aad3a4c4cd4de0629063962b03235697506a28" - [[package]] name = "crypto-common" version = "0.1.6" @@ -1118,12 +1112,13 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.32" +version = "1.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9c0596c1eac1f9e04ed902702e9878208b336edc9d6fddc8a48387349bab3666" +checksum = "7ced92e76e966ca2fd84c8f7aa01a4aea65b0eb6648d72f7c8f3e2764a67fece" dependencies = [ "crc32fast", - "miniz_oxide 0.8.0", + "libz-rs-sys", + "miniz_oxide 0.8.8", ] [[package]] @@ -2173,7 +2168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2187,6 +2182,15 @@ dependencies = [ "redox_syscall", ] +[[package]] +name = "libz-rs-sys" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6489ca9bd760fe9642d7644e827b0c9add07df89857b0416ee15c1cc1a3b8c5a" +dependencies = [ + "zlib-rs", +] + [[package]] name = "linux-raw-sys" version = "0.4.14" @@ -2327,9 +2331,9 @@ dependencies = [ [[package]] name = "miniz_oxide" -version = "0.8.0" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +checksum = "3be647b768db090acb35d5ec5db2b0e1f1de11133ca123b9eacf5137868f892a" dependencies = [ "adler2", ] @@ -4543,7 +4547,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] @@ -4965,14 +4969,13 @@ dependencies = [ [[package]] name = "zip" -version = "2.6.1" +version = "3.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1dcb24d0152526ae49b9b96c1dcf71850ca1e0b882e4e28ed898a93c41334744" +checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308" dependencies = [ "arbitrary", "bzip2", "crc32fast", - "crossbeam-utils", "flate2", "indexmap", "memchr", @@ -4981,6 +4984,12 @@ dependencies = [ "zstd", ] +[[package]] +name = "zlib-rs" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "868b928d7949e09af2f6086dfc1e01936064cc7a819253bce650d4e2a2d63ba8" + [[package]] name = "zopfli" version = "0.8.1" diff --git a/Cargo.toml b/Cargo.toml index 87d9ea6..4b083a9 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ tracing = { version = "0.1.37", features = ["async-await"] } tracing-error = "0.2.0" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } usvg = "0.25.0" -zip = { version = "2.1.3", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } +zip = { version = "3.0.0", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } [profile.dev.package.backtrace] opt-level = 3 From 6d576be4ae62d95e4e827cda3a1123430cf31120 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 21 May 2025 09:16:27 +0000 Subject: [PATCH 121/154] chore(deps): update rust crate confy to v1 --- Cargo.lock | 31 +++++++++++++++++++++---------- Cargo.toml | 2 +- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee85157..f4ee177 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -581,13 +581,13 @@ checksum = "9226dbc05df4fb986f48d730b001532580883c4c06c5d1c213f4b34c1c157178" [[package]] name = "confy" -version = "0.6.1" +version = "1.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "45b1f4c00870f07dc34adcac82bb6a72cc5aabca8536ba1797e01df51d2ce9a0" +checksum = "f29222b549d4e3ded127989d523da9e928918d0d0d7f7c1690b439d0d538bae9" dependencies = [ "directories", "serde", - "thiserror 1.0.63", + "thiserror 2.0.12", "toml 0.8.19", ] @@ -766,9 +766,9 @@ dependencies = [ [[package]] name = "directories" -version = "5.0.1" +version = "6.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9a49173b84e034382284f27f1af4dcbbd231ffa358c0fe316541a7337f376a35" +checksum = "16f5094c54661b38d03bd7e50df373292118db60b585c08a411c6d840017fe7d" dependencies = [ "dirs-sys", ] @@ -785,14 +785,14 @@ dependencies = [ [[package]] name = "dirs-sys" -version = "0.4.1" +version = "0.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +checksum = "e01a3366d27ee9890022452ee61b2b63a67e6f13f58900b651ff5665f0bb1fab" dependencies = [ "libc", "option-ext", - "redox_users", - "windows-sys 0.48.0", + "redox_users 0.5.0", + "windows-sys 0.59.0", ] [[package]] @@ -802,7 +802,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4ebda144c4fe02d1f7ea1a7d9641b6fc6b580adcfa024ae48797ecdeb6825b4d" dependencies = [ "libc", - "redox_users", + "redox_users 0.4.6", "winapi", ] @@ -3004,6 +3004,17 @@ dependencies = [ "thiserror 1.0.63", ] +[[package]] +name = "redox_users" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd6f9d3d47bdd2ad6945c5015a226ec6155d0bcdfd8f7cd29f86b71f8de99d2b" +dependencies = [ + "getrandom 0.2.15", + "libredox", + "thiserror 2.0.12", +] + [[package]] name = "regex" version = "1.11.1" diff --git a/Cargo.toml b/Cargo.toml index 4b083a9..3619e5f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,7 +22,7 @@ clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "str cli-table = { version = "0.5.0", default-features = false, features = ["derive"] } color-eyre = { path = "lib/color-eyre" } colors-transform = "0.2.11" -confy = "0.6.1" +confy = "1.0.0" csv-async = { version = "1.2.4", features = ["tokio", "serde"] } druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "bmp", "webp", "svg"] } druid-widget-nursery = "0.1" From 27062d22040199a00db630623f4e76d4c0b907e9 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 21 May 2025 22:01:36 +0000 Subject: [PATCH 122/154] chore(deps): update rust crate zip to v4 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee85157..831d598 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -4969,9 +4969,9 @@ dependencies = [ [[package]] name = "zip" -version = "3.0.0" +version = "4.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12598812502ed0105f607f941c386f43d441e00148fce9dec3ca5ffb0bde9308" +checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" dependencies = [ "arbitrary", "bzip2", diff --git a/Cargo.toml b/Cargo.toml index 4b083a9..eb0dceb 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -56,7 +56,7 @@ tracing = { version = "0.1.37", features = ["async-await"] } tracing-error = "0.2.0" tracing-subscriber = { version = "0.3.16", features = ["env-filter"] } usvg = "0.25.0" -zip = { version = "3.0.0", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } +zip = { version = "4.0.0", default-features = false, features = ["deflate", "bzip2", "zstd", "time"] } [profile.dev.package.backtrace] opt-level = 3 From 220f37c7288c16e84c7a24a0c985b0d73cf99dc1 Mon Sep 17 00:00:00 2001 From: Renovate Date: Sat, 24 May 2025 15:01:28 +0000 Subject: [PATCH 123/154] chore(deps): update rust crate tokio to v1.45.1 --- Cargo.lock | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee85157..555a11a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2168,7 +2168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3854,9 +3854,9 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.0" +version = "1.45.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2513ca694ef9ede0fb23fe71a4ee4107cb102b9dc1930f6d0fd77aae068ae165" +checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" dependencies = [ "backtrace", "bytes", From 3901355f9d89104d5c9f461609852702ba4462f7 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 27 May 2025 18:16:25 +0000 Subject: [PATCH 124/154] chore(deps): update rust crate clap to v4.5.39 --- Cargo.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee85157..09c09c8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.38" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed93b9805f8ba930df42c2590f05453d5ec36cbb85d018868a5b24d31f6ac000" +checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" dependencies = [ "clap_builder", "clap_derive", @@ -436,9 +436,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.38" +version = "4.5.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "379026ff283facf611b0ea629334361c4211d1b12ee01024eec1591133b04120" +checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" dependencies = [ "anstream", "anstyle", @@ -2168,7 +2168,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] From d66dcb5cfd9a83f376c389add3eca4d71a575fd6 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 28 May 2025 16:31:22 +0000 Subject: [PATCH 125/154] fix(deps): update rust crate reqwest to v0.12.18 --- Cargo.lock | 73 ++++++++++++++++++++++++++++++++++++------------------ 1 file changed, 49 insertions(+), 24 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index ee85157..e9263f9 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1742,22 +1742,28 @@ dependencies = [ [[package]] name = "hyper-util" -version = "0.1.11" +version = "0.1.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "497bbc33a26fdd4af9ed9c70d63f61cf56a938375fbb32df34db9b1cd6d643f2" +checksum = "b1c293b6b3d21eca78250dc7dbebd6b9210ec5530e038cbfe0661b5c47ab06e8" dependencies = [ + "base64 0.22.1", "bytes", "futures-channel", + "futures-core", "futures-util", "http", "http-body", "hyper", + "ipnet", "libc", + "percent-encoding", "pin-project-lite", "socket2", + "system-configuration", "tokio", "tower-service", "tracing", + "windows-registry", ] [[package]] @@ -2014,6 +2020,16 @@ version = "2.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" +[[package]] +name = "iri-string" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dbc5ebe9c3a1a7a5127f920a418f7585e9e758e911d0466ed004f393b0e380b2" +dependencies = [ + "memchr", + "serde", +] + [[package]] name = "is-docker" version = "0.2.0" @@ -2168,7 +2184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3050,15 +3066,14 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.15" +version = "0.12.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d19c46a6fdd48bc4dab94b6103fccc55d34c67cc0ad04653aad4ea2a07cd7bbb" +checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5" dependencies = [ "base64 0.22.1", "bytes", "encoding_rs", "futures-core", - "futures-util", "h2", "http", "http-body", @@ -3075,21 +3090,20 @@ dependencies = [ "once_cell", "percent-encoding", "pin-project-lite", - "rustls-pemfile", + "rustls-pki-types", "serde", "serde_json", "serde_urlencoded", "sync_wrapper", - "system-configuration", "tokio", "tokio-native-tls", "tower", + "tower-http", "tower-service", "url", "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "windows-registry", ] [[package]] @@ -3215,21 +3229,14 @@ dependencies = [ "zeroize", ] -[[package]] -name = "rustls-pemfile" -version = "2.1.3" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "196fe16b00e106300d3e45ecfcb764fa292a535d7326a29a5875c579c7417425" -dependencies = [ - "base64 0.22.1", - "rustls-pki-types", -] - [[package]] name = "rustls-pki-types" -version = "1.8.0" +version = "1.12.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc0a2ce646f8655401bb81e7927b812614bd5d91dbc968696be50603510fcaf0" +checksum = "229a4a4c221013e7e1f1a043678c5cc39fe5171437c88fb47151a21e6f5b5c79" +dependencies = [ + "zeroize", +] [[package]] name = "rustls-webpki" @@ -3674,9 +3681,9 @@ dependencies = [ [[package]] name = "system-configuration" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "658bc6ee10a9b4fcf576e9b0819d95ec16f4d2c02d39fd83ac1c8789785c4a42" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" dependencies = [ "bitflags 2.9.1", "core-foundation", @@ -3995,6 +4002,24 @@ dependencies = [ "tower-service", ] +[[package]] +name = "tower-http" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" +dependencies = [ + "bitflags 2.9.1", + "bytes", + "futures-util", + "http", + "http-body", + "iri-string", + "pin-project-lite", + "tower", + "tower-layer", + "tower-service", +] + [[package]] name = "tower-layer" version = "0.3.3" @@ -4547,7 +4572,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] From 138cb79ff6285b6ea504d287e2c4509275cdeaad Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 30 May 2025 11:52:44 +0200 Subject: [PATCH 126/154] Disable excessive rebase for Renovate --- .renovaterc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.renovaterc b/.renovaterc index 4a2fbf4..7ad59cd 100644 --- a/.renovaterc +++ b/.renovaterc @@ -3,8 +3,7 @@ "extends": [ "config:recommended", ":combinePatchMinorReleases", - ":enableVulnerabilityAlerts", - ":rebaseStalePrs" + ":enableVulnerabilityAlerts" ], "prConcurrentLimit": 10, "branchPrefix": "renovate/", From bb9223a43eaf2aba6cbfc38660bd9c5769e3dfe6 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 2 Jun 2025 12:16:19 +0000 Subject: [PATCH 127/154] fix(deps): update rust crate reqwest to v0.12.19 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4f1039a..87a86de 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3077,9 +3077,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.18" +version = "0.12.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e98ff6b0dbbe4d5a37318f433d4fc82babd21631f194d370409ceb2e40b2f0b5" +checksum = "a2f8e5513d63f2e5b386eb5106dc67eaf3f84e95258e210489136b8b92ad6119" dependencies = [ "base64 0.22.1", "bytes", @@ -4015,9 +4015,9 @@ dependencies = [ [[package]] name = "tower-http" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fdb0c213ca27a9f57ab69ddb290fd80d970922355b83ae380b395d3986b8a2e" +checksum = "5cc2d9e086a412a451384326f521c8123a99a466b329941a9403696bff9b0da2" dependencies = [ "bitflags 2.9.1", "bytes", From 8749d4e6be6974bf91050d702b759a32f5081516 Mon Sep 17 00:00:00 2001 From: Renovate Date: Sun, 8 Jun 2025 11:46:19 +0000 Subject: [PATCH 128/154] chore(deps): update rust crate bindgen to 0.72.0 --- Cargo.lock | 10 +++++----- lib/oodle/Cargo.toml | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87a86de..89bb171 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -249,9 +249,9 @@ dependencies = [ [[package]] name = "bindgen" -version = "0.71.1" +version = "0.72.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f58bf3d7db68cfbac37cfc485a8d711e87e064c3d0fe0435b92f7a407f9d6b3" +checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" dependencies = [ "bitflags 2.9.1", "cexpr", @@ -2184,7 +2184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -2546,7 +2546,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" name = "oodle" version = "0.1.0" dependencies = [ - "bindgen 0.71.1", + "bindgen 0.72.0", "color-eyre", "tracing", ] @@ -4583,7 +4583,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/lib/oodle/Cargo.toml b/lib/oodle/Cargo.toml index e679b5f..4a6fe2f 100644 --- a/lib/oodle/Cargo.toml +++ b/lib/oodle/Cargo.toml @@ -10,4 +10,4 @@ color-eyre = { workspace = true } tracing = { workspace = true } [build-dependencies] -bindgen = "0.71.0" +bindgen = "0.72.0" From 4fd17a2d0d42673c626b46bd378e53de2076d2ee Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 9 Jun 2025 18:16:20 +0000 Subject: [PATCH 129/154] chore(deps): update rust crate clap to v4.5.40 --- Cargo.lock | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87a86de..5e49e15 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -426,9 +426,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fd60e63e9be68e5fb56422e397cf9baddded06dae1d2e523401542383bc72a9f" +checksum = "40b6887a1d8685cebccf115538db5c0efe625ccac9696ad45c409d96566e910f" dependencies = [ "clap_builder", "clap_derive", @@ -436,9 +436,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.5.39" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89cc6392a1f72bbeb820d71f32108f61fdaf18bc526e1d23954168a67759ef51" +checksum = "e0c66c08ce9f0c698cbce5c0279d0bb6ac936d8674174fe48f736533b964f59e" dependencies = [ "anstream", "anstyle", @@ -450,9 +450,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "4.5.32" +version = "4.5.40" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" +checksum = "d2c7947ae4cc3d851207c1adb5b5e260ff0cca11446b1d6d1423788e442257ce" dependencies = [ "heck 0.5.0", "proc-macro2", From 6b7d5265ad64c76d5babf8fb33c7109a165c9b29 Mon Sep 17 00:00:00 2001 From: Renovate Date: Tue, 10 Jun 2025 19:01:29 +0000 Subject: [PATCH 130/154] fix(deps): update rust crate reqwest to v0.12.20 --- Cargo.lock | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 87a86de..4136148 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3077,9 +3077,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.19" +version = "0.12.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a2f8e5513d63f2e5b386eb5106dc67eaf3f84e95258e210489136b8b92ad6119" +checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" dependencies = [ "base64 0.22.1", "bytes", @@ -3093,12 +3093,10 @@ dependencies = [ "hyper-rustls", "hyper-tls", "hyper-util", - "ipnet", "js-sys", "log", "mime", "native-tls", - "once_cell", "percent-encoding", "pin-project-lite", "rustls-pki-types", From fb072e1fba9f5e21670628c0c01a21ff33826f4e Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 11 Jun 2025 09:31:38 +0000 Subject: [PATCH 131/154] chore(deps): update rust crate nanorand to 0.8.0 --- Cargo.lock | 4 ++-- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index fe6f1cd..44197f8 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2369,9 +2369,9 @@ dependencies = [ [[package]] name = "nanorand" -version = "0.7.0" +version = "0.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a51313c5820b0b02bd422f4b44776fbf47961755c74ce64afc73bfad10226c3" +checksum = "6e3d189da485332e96ba8a5ef646a311871abd7915bf06ac848a9117f19cf6e4" [[package]] name = "native-tls" diff --git a/Cargo.toml b/Cargo.toml index 8d51a45..99ce493 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -35,7 +35,7 @@ interprocess = "2.1.0" lazy_static = "1.4.0" luajit2-sys = { path = "lib/luajit2-sys" } minijinja = { version = "2.0.1", default-features = false, features = ["serde"] } -nanorand = "0.7.0" +nanorand = "0.8.0" nexusmods = { path = "lib/nexusmods" } notify = "8.0.0" oodle = { path = "lib/oodle" } From 03a11269a244f0d2b088d28daed5368f7ccb2a12 Mon Sep 17 00:00:00 2001 From: Renovate Date: Sun, 15 Jun 2025 04:01:33 +0000 Subject: [PATCH 132/154] chore(deps): update rust crate zip to v4.1.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 44197f8..609555e 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5003,9 +5003,9 @@ dependencies = [ [[package]] name = "zip" -version = "4.0.0" +version = "4.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "153a6fff49d264c4babdcfa6b4d534747f520e56e8f0f384f3b808c4b64cc1fd" +checksum = "af7dcdb4229c0e79c2531a24de7726a0e980417a74fb4d030a35f535665439a0" dependencies = [ "arbitrary", "bzip2", From 881434abea1065c6a3ed52a405caa577156d4dd9 Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 23 Jun 2025 04:46:23 +0000 Subject: [PATCH 133/154] chore(deps): update rust crate zip to v4.2.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 609555e..97d6524 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -5003,9 +5003,9 @@ dependencies = [ [[package]] name = "zip" -version = "4.1.0" +version = "4.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "af7dcdb4229c0e79c2531a24de7726a0e980417a74fb4d030a35f535665439a0" +checksum = "95ab361742de920c5535880f89bbd611ee62002bf11341d16a5f057bb8ba6899" dependencies = [ "arbitrary", "bzip2", From 28a3875f863ed11a3827ef83b281168aed238e9f Mon Sep 17 00:00:00 2001 From: Renovate Date: Sat, 28 Jun 2025 11:01:26 +0000 Subject: [PATCH 134/154] chore(deps): update rust crate minijinja to v2.11.0 --- Cargo.lock | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 609555e..5b0b6aa 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2322,9 +2322,9 @@ dependencies = [ [[package]] name = "minijinja" -version = "2.10.2" +version = "2.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd72e8b4e42274540edabec853f607c015c73436159b06c39c7af85a20433155" +checksum = "4e60ac08614cc09062820e51d5d94c2fce16b94ea4e5003bb81b99a95f84e876" dependencies = [ "serde", ] From 1fe8e6f1505c3698a78d002557aceba8d9c54a5b Mon Sep 17 00:00:00 2001 From: Renovate Date: Mon, 30 Jun 2025 19:31:32 +0000 Subject: [PATCH 135/154] fix(deps): update rust crate reqwest to v0.12.21 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 5b0b6aa..8eeff96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2184,7 +2184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3077,9 +3077,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.20" +version = "0.12.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eabf4c97d9130e2bf606614eb937e86edac8292eaa6f422f995d7e8de1eb1813" +checksum = "4c8cea6b35bcceb099f30173754403d2eba0a5dc18cea3630fccd88251909288" dependencies = [ "base64 0.22.1", "bytes", @@ -4581,7 +4581,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] From 98e0ea70e5c44ab23979c19b8059ffc67b74a524 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Fri, 30 May 2025 15:48:47 +0200 Subject: [PATCH 136/154] Improve file injection error handling --- crates/dtmt/src/cmd/bundle/inject.rs | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/crates/dtmt/src/cmd/bundle/inject.rs b/crates/dtmt/src/cmd/bundle/inject.rs index 21f4a91..23e3f8b 100644 --- a/crates/dtmt/src/cmd/bundle/inject.rs +++ b/crates/dtmt/src/cmd/bundle/inject.rs @@ -202,15 +202,13 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { let bundle_name = Bundle::get_name_from_path(&ctx, bundle_path); let mut bundle = { - let binary = fs::read(bundle_path).await?; - Bundle::from_binary(&ctx, bundle_name.clone(), binary) + fs::read(bundle_path) + .await + .map_err(From::from) + .and_then(|binary| Bundle::from_binary(&ctx, bundle_name.clone(), binary)) .wrap_err_with(|| format!("Failed to open bundle '{}'", bundle_path.display()))? }; - if op == "copy" { - unimplemented!("Implement copying a file from one bundle to the other."); - } - let output_bundle = match op { "replace" => { let Some(file) = bundle @@ -280,6 +278,9 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { "add" => { unimplemented!("Implement adding a new file to the bundle."); } + "copy" => { + unimplemented!("Implement copying a file from one bundle to the other."); + } _ => unreachable!("no other operations exist"), }; From 2c51ab1fcccc6e94635e0fa61af3c9581027dc67 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 10:49:42 +0200 Subject: [PATCH 137/154] sdk: Add name for unknown file header field --- lib/sdk/src/binary.rs | 25 ++++++++++++++++++------- lib/sdk/src/bundle/file.rs | 28 ++++++++++++++++++++-------- 2 files changed, 38 insertions(+), 15 deletions(-) diff --git a/lib/sdk/src/binary.rs b/lib/sdk/src/binary.rs index 9348e1b..9ce9d23 100644 --- a/lib/sdk/src/binary.rs +++ b/lib/sdk/src/binary.rs @@ -44,10 +44,10 @@ impl FromBinary for Vec { pub mod sync { use std::ffi::CStr; - use std::io::{self, Read, Seek, SeekFrom}; + use std::io::{self, Read, Seek, SeekFrom, Write}; use byteorder::{LittleEndian, ReadBytesExt, WriteBytesExt}; - use color_eyre::eyre::WrapErr; + use color_eyre::eyre::{self, WrapErr}; use color_eyre::{Help, Report, Result, SectionExt}; macro_rules! make_read { @@ -123,7 +123,7 @@ pub mod sync { }; } - pub trait ReadExt: ReadBytesExt + Seek { + pub trait ReadExt: Read + Seek { fn read_u8(&mut self) -> io::Result { ReadBytesExt::read_u8(self) } @@ -131,7 +131,6 @@ pub mod sync { make_read!(read_u32, read_u32_le, u32); make_read!(read_u64, read_u64_le, u64); - make_skip!(skip_u8, read_u8, u8); make_skip!(skip_u32, read_u32, u32); // Implementation based on https://en.wikipedia.com/wiki/LEB128 @@ -181,9 +180,17 @@ pub mod sync { res } } + + fn read_bool(&mut self) -> Result { + match ReadExt::read_u8(self)? { + 0 => Ok(false), + 1 => Ok(true), + v => eyre::bail!("Invalid value for boolean '{}'", v), + } + } } - pub trait WriteExt: WriteBytesExt + Seek { + pub trait WriteExt: Write + Seek { fn write_u8(&mut self, val: u8) -> io::Result<()> { WriteBytesExt::write_u8(self, val) } @@ -191,6 +198,10 @@ pub mod sync { make_write!(write_u32, write_u32_le, u32); make_write!(write_u64, write_u64_le, u64); + fn write_bool(&mut self, val: bool) -> io::Result<()> { + WriteBytesExt::write_u8(self, if val { 1 } else { 0 }) + } + fn write_padding(&mut self) -> io::Result { let pos = self.stream_position()?; let size = 16 - (pos % 16) as usize; @@ -207,8 +218,8 @@ pub mod sync { } } - impl ReadExt for R {} - impl WriteExt for W {} + impl ReadExt for R {} + impl WriteExt for W {} pub(crate) fn _read_up_to(r: &mut R, buf: &mut Vec) -> Result where diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index 6d49821..6442f98 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -15,17 +15,18 @@ use super::filetype::BundleFileType; #[derive(Debug)] struct BundleFileHeader { variant: u32, - unknown_1: u8, + external: bool, size: usize, + unknown_1: u8, len_data_file_name: usize, } -#[derive(Clone, Debug)] +#[derive(Clone)] pub struct BundleFileVariant { property: u32, data: Vec, data_file_name: Option, - // Seems to be related to whether there is a data path. + external: bool, unknown_1: u8, } @@ -39,6 +40,7 @@ impl BundleFileVariant { property: 0, data: Vec::new(), data_file_name: None, + external: false, unknown_1: 0, } } @@ -63,21 +65,30 @@ impl BundleFileVariant { self.data_file_name.as_ref() } + pub fn external(&self) -> bool { + self.external + } + + pub fn unknown_1(&self) -> u8 { + self.unknown_1 + } + #[tracing::instrument(skip_all)] fn read_header(r: &mut R) -> Result where R: Read + Seek, { let variant = r.read_u32()?; - let unknown_1 = r.read_u8()?; + let external = r.read_bool()?; let size = r.read_u32()? as usize; - r.skip_u8(1)?; + let unknown_1 = r.read_u8()?; let len_data_file_name = r.read_u32()? as usize; Ok(BundleFileHeader { size, - unknown_1, + external, variant, + unknown_1, len_data_file_name, }) } @@ -88,7 +99,7 @@ impl BundleFileVariant { W: Write + Seek, { w.write_u32(self.property)?; - w.write_u8(self.unknown_1)?; + w.write_bool(self.external)?; let len_data_file_name = self.data_file_name.as_ref().map(|s| s.len()).unwrap_or(0); @@ -216,6 +227,7 @@ impl BundleFile { property: header.variant, data, data_file_name, + external: header.external, unknown_1: header.unknown_1, }; @@ -243,7 +255,7 @@ impl BundleFile { for variant in self.variants.iter() { w.write_u32(variant.property())?; - w.write_u8(variant.unknown_1)?; + w.write_bool(variant.external)?; let len_data_file_name = variant.data_file_name().map(|s| s.len()).unwrap_or(0); From d0fefee6672ec222d5260c7a44d7e568df8edadf Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 10:37:19 +0200 Subject: [PATCH 138/154] dtmt: Optimize dictionary creation Improve the way the dictionary can read and write its config files, as well as improve the shared access during runtime. --- crates/dtmt/src/cmd/dictionary.rs | 11 +++++++---- crates/dtmt/src/main.rs | 6 ++++-- lib/sdk/src/context.rs | 9 ++++++--- lib/sdk/src/murmur/dictionary.rs | 12 ++++++++---- 4 files changed, 25 insertions(+), 13 deletions(-) diff --git a/crates/dtmt/src/cmd/dictionary.rs b/crates/dtmt/src/cmd/dictionary.rs index 4c54c34..8f0d32c 100644 --- a/crates/dtmt/src/cmd/dictionary.rs +++ b/crates/dtmt/src/cmd/dictionary.rs @@ -1,4 +1,5 @@ use std::path::PathBuf; +use std::sync::Arc; use clap::{value_parser, Arg, ArgAction, ArgMatches, Command, ValueEnum}; use cli_table::{print_stdout, WithTitle}; @@ -156,6 +157,8 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<( BufReader::new(Box::new(f)) }; + let lookup = Arc::make_mut(&mut ctx.lookup); + let group = sdk::murmur::HashGroup::from(*group); let mut added = 0; @@ -165,15 +168,15 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<( let total = { for line in lines.into_iter() { let value = line?; - if ctx.lookup.find(&value, group).is_some() { + if lookup.find(&value, group).is_some() { skipped += 1; } else { - ctx.lookup.add(value, group); + lookup.add(value, group); added += 1; } } - ctx.lookup.len() + lookup.len() }; let out_path = matches @@ -190,7 +193,7 @@ pub(crate) async fn run(mut ctx: sdk::Context, matches: &ArgMatches) -> Result<( }) .with_section(|| out_path.display().to_string().header("Path:"))?; - ctx.lookup + lookup .to_csv(f) .await .wrap_err("Failed to write dictionary to disk")?; diff --git a/crates/dtmt/src/main.rs b/crates/dtmt/src/main.rs index e41e802..ef3d36b 100644 --- a/crates/dtmt/src/main.rs +++ b/crates/dtmt/src/main.rs @@ -12,6 +12,7 @@ use clap::value_parser; use clap::{command, Arg}; use color_eyre::eyre; use color_eyre::eyre::{Context, Result}; +use sdk::murmur::Dictionary; use serde::{Deserialize, Serialize}; use tokio::fs::File; use tokio::io::BufReader; @@ -107,8 +108,9 @@ async fn main() -> Result<()> { let r = BufReader::new(f); let mut ctx = ctx.write().await; - if let Err(err) = ctx.lookup.from_csv(r).await { - tracing::error!("{:#}", err); + match Dictionary::from_csv(r).await { + Ok(lookup) => ctx.lookup = Arc::new(lookup), + Err(err) => tracing::error!("{:#}", err), } }) }; diff --git a/lib/sdk/src/context.rs b/lib/sdk/src/context.rs index 1500290..8c10b3c 100644 --- a/lib/sdk/src/context.rs +++ b/lib/sdk/src/context.rs @@ -1,8 +1,11 @@ +use std::ffi::OsString; +use std::path::PathBuf; use std::process::Command; -use std::{ffi::OsString, path::PathBuf}; +use std::sync::Arc; use crate::murmur::{Dictionary, HashGroup, IdString64, Murmur32, Murmur64}; +#[derive(Clone)] pub struct CmdLine { cmd: OsString, args: Vec, @@ -52,7 +55,7 @@ impl From<&CmdLine> for Command { } pub struct Context { - pub lookup: Dictionary, + pub lookup: Arc, pub ljd: Option, pub revorb: Option, pub ww2ogg: Option, @@ -62,7 +65,7 @@ pub struct Context { impl Context { pub fn new() -> Self { Self { - lookup: Dictionary::new(), + lookup: Arc::new(Dictionary::new()), ljd: None, revorb: None, ww2ogg: None, diff --git a/lib/sdk/src/murmur/dictionary.rs b/lib/sdk/src/murmur/dictionary.rs index 267f0a4..c1b5636 100644 --- a/lib/sdk/src/murmur/dictionary.rs +++ b/lib/sdk/src/murmur/dictionary.rs @@ -48,6 +48,7 @@ struct Row { group: HashGroup, } +#[derive(Clone)] pub struct Entry { value: String, long: Murmur64, @@ -73,6 +74,7 @@ impl Entry { } } +#[derive(Clone)] pub struct Dictionary { entries: Vec, } @@ -88,10 +90,12 @@ impl Dictionary { Self { entries: vec![] } } - pub async fn from_csv(&mut self, r: R) -> Result<()> + pub async fn from_csv(r: R) -> Result where R: AsyncRead + std::marker::Unpin + std::marker::Send, { + let mut entries = vec![]; + let r = AsyncDeserializer::from_reader(r); let mut records = r.into_deserialize::(); @@ -112,10 +116,10 @@ impl Dictionary { group: record.group, }; - self.entries.push(entry); + entries.push(entry); } - Ok(()) + Ok(Self { entries }) } pub async fn to_csv(&self, w: W) -> Result<()> @@ -161,7 +165,7 @@ impl Dictionary { self.entries.push(entry); } - pub fn find(&mut self, value: &String, group: HashGroup) -> Option<&Entry> { + pub fn find(&self, value: &String, group: HashGroup) -> Option<&Entry> { self.entries .iter() .find(|e| e.value == *value && e.group == group) From f3aeec196d2ab7e4a246366141d83d1660aca880 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 10:38:46 +0200 Subject: [PATCH 139/154] dtmt: Guess game directory from bundle path When no explicit game directory is provided, try to guess it from the bundle path given as argument during extraction. --- crates/dtmt/src/cmd/bundle/extract.rs | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/crates/dtmt/src/cmd/bundle/extract.rs b/crates/dtmt/src/cmd/bundle/extract.rs index 75f1360..b595dba 100644 --- a/crates/dtmt/src/cmd/bundle/extract.rs +++ b/crates/dtmt/src/cmd/bundle/extract.rs @@ -287,6 +287,34 @@ where P1: AsRef + std::fmt::Debug, P2: AsRef + std::fmt::Debug, { + let ctx = if ctx.game_dir.is_some() { + tracing::debug!( + "Got game directory from config: {}", + ctx.game_dir.as_ref().unwrap().display() + ); + + ctx + } else { + let game_dir = path + .as_ref() + .parent() + .and_then(|parent| parent.parent()) + .map(|p| p.to_path_buf()); + + tracing::info!( + "No game directory configured, guessing from bundle path: {:?}", + game_dir + ); + + Arc::new(sdk::Context { + game_dir, + lookup: Arc::clone(&ctx.lookup), + ljd: ctx.ljd.clone(), + revorb: ctx.revorb.clone(), + ww2ogg: ctx.ww2ogg.clone(), + }) + }; + let bundle = { let data = fs::read(path.as_ref()).await?; let name = Bundle::get_name_from_path(&ctx, path.as_ref()); From 400079237aa4f0cb4f8ff34e2537e877f07c6af7 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 10:40:18 +0200 Subject: [PATCH 140/154] oodle: Allow providing the chunk size This makes the library itself more flexible, while still keeping things relatively straightforward with a single constant for the common chunk size. --- lib/oodle/src/lib.rs | 3 ++- lib/sdk/src/bundle/filetype.rs | 3 ++- lib/sdk/src/bundle/mod.rs | 2 ++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/oodle/src/lib.rs b/lib/oodle/src/lib.rs index 871daab..7edadee 100644 --- a/lib/oodle/src/lib.rs +++ b/lib/oodle/src/lib.rs @@ -52,6 +52,7 @@ impl From for bindings::OodleLZ_CheckCRC { #[tracing::instrument(skip(data))] pub fn decompress( data: I, + out_size: usize, fuzz_safe: OodleLZ_FuzzSafe, check_crc: OodleLZ_CheckCRC, ) -> Result> @@ -59,7 +60,7 @@ where I: AsRef<[u8]>, { let data = data.as_ref(); - let mut out = vec![0; CHUNK_SIZE]; + let mut out = vec![0; out_size]; let verbosity = if tracing::enabled!(tracing::Level::INFO) { bindings::OodleLZ_Verbosity_OodleLZ_Verbosity_Minimal diff --git a/lib/sdk/src/bundle/filetype.rs b/lib/sdk/src/bundle/filetype.rs index 68ff6b5..a7a25dc 100644 --- a/lib/sdk/src/bundle/filetype.rs +++ b/lib/sdk/src/bundle/filetype.rs @@ -1,4 +1,5 @@ -use color_eyre::{eyre, Result}; +use color_eyre::eyre; +use color_eyre::Result; use serde::Serialize; use crate::murmur::Murmur64; diff --git a/lib/sdk/src/bundle/mod.rs b/lib/sdk/src/bundle/mod.rs index edb71bb..03a04c7 100644 --- a/lib/sdk/src/bundle/mod.rs +++ b/lib/sdk/src/bundle/mod.rs @@ -162,6 +162,7 @@ impl Bundle { // TODO: Optimize to not reallocate? let mut raw_buffer = oodle::decompress( &compressed_buffer, + oodle::CHUNK_SIZE, OodleLZ_FuzzSafe::No, OodleLZ_CheckCRC::No, ) @@ -359,6 +360,7 @@ where // TODO: Optimize to not reallocate? let mut raw_buffer = oodle::decompress( &compressed_buffer, + oodle::CHUNK_SIZE, OodleLZ_FuzzSafe::No, OodleLZ_CheckCRC::No, )?; From a36a59d90785aab39424c402cee7322f1a07c050 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 10:48:54 +0200 Subject: [PATCH 141/154] sdk: Improve file decompilation debug output --- lib/sdk/src/bundle/file.rs | 37 ++++++++++++++++++++++++++++--------- 1 file changed, 28 insertions(+), 9 deletions(-) diff --git a/lib/sdk/src/bundle/file.rs b/lib/sdk/src/bundle/file.rs index 6442f98..18d329f 100644 --- a/lib/sdk/src/bundle/file.rs +++ b/lib/sdk/src/bundle/file.rs @@ -117,6 +117,26 @@ impl BundleFileVariant { } } +impl std::fmt::Debug for BundleFileVariant { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + let mut out = f.debug_struct("BundleFileVariant"); + out.field("property", &self.property); + + if self.data.len() <= 5 { + out.field("data", &format!("{:x?}", &self.data)); + } else { + out.field( + "data", + &format!("{:x?}.. ({} bytes)", &self.data[..5], &self.data.len()), + ); + } + + out.field("data_file_name", &self.data_file_name) + .field("external", &self.external) + .finish() + } +} + bitflags! { #[derive(Default, Clone, Copy, Debug)] pub struct Properties: u32 { @@ -215,6 +235,7 @@ impl BundleFile { let s = r .read_string_len(header.len_data_file_name) .wrap_err("Failed to read data file name")?; + Some(s) } else { None @@ -371,18 +392,16 @@ impl BundleFile { Ok(files) } - #[tracing::instrument(name = "File::decompiled", skip_all)] + #[tracing::instrument( + name = "File::decompiled", + skip_all, + fields(file = self.name(false, None), file_type = self.file_type().ext_name(), variants = self.variants.len()) + )] pub async fn decompiled(&self, ctx: &crate::Context) -> Result> { let file_type = self.file_type(); - if tracing::enabled!(tracing::Level::DEBUG) { - tracing::debug!( - name = self.name(true, None), - variants = self.variants.len(), - "Attempting to decompile" - ); - } - + // The `Strings` type handles all variants combined. + // For the other ones, each variant will be its own file. if file_type == BundleFileType::Strings { return strings::decompile(ctx, &self.variants); } From d61ffdfef2e87d916ff95480663ec69bf44e4a6e Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 11:37:04 +0200 Subject: [PATCH 142/154] Apply clippy lints --- crates/dtmm/src/controller/deploy.rs | 2 +- crates/dtmm/src/controller/game.rs | 2 +- crates/dtmm/src/controller/import.rs | 10 +++++----- crates/dtmm/src/main.rs | 4 ++-- crates/dtmm/src/state/delegate.rs | 11 +++++------ crates/dtmm/src/ui/theme/colors.rs | 2 +- crates/dtmm/src/ui/widget/controller.rs | 1 + crates/dtmm/src/ui/window/dialog.rs | 4 ++-- crates/dtmm/src/ui/window/main.rs | 2 +- crates/dtmt/src/cmd/bundle/db.rs | 12 ++++++------ crates/dtmt/src/cmd/bundle/extract.rs | 2 +- crates/dtmt/src/cmd/bundle/inject.rs | 6 +++--- crates/dtmt/src/cmd/bundle/list.rs | 2 +- crates/dtmt/src/cmd/new.rs | 2 +- crates/dtmt/src/main.rs | 1 - lib/dtmt-shared/src/log.rs | 4 ++-- lib/nexusmods/src/lib.rs | 2 +- lib/oodle/build.rs | 2 +- lib/sdk/src/binary.rs | 4 ++-- lib/sdk/src/murmur/types.rs | 4 ++-- 20 files changed, 39 insertions(+), 40 deletions(-) diff --git a/crates/dtmm/src/controller/deploy.rs b/crates/dtmm/src/controller/deploy.rs index 481b07c..8b36ae2 100644 --- a/crates/dtmm/src/controller/deploy.rs +++ b/crates/dtmm/src/controller/deploy.rs @@ -469,7 +469,7 @@ async fn patch_boot_bundle(state: Arc, deployment_info: &str) -> Re } .instrument(tracing::trace_span!("read boot bundle")) .await - .wrap_err_with(|| format!("Failed to read bundle '{}'", BOOT_BUNDLE_NAME))?; + .wrap_err_with(|| format!("Failed to read bundle '{BOOT_BUNDLE_NAME}'"))?; { tracing::trace!("Adding mod package file to boot bundle"); diff --git a/crates/dtmm/src/controller/game.rs b/crates/dtmm/src/controller/game.rs index b93d985..a5853bb 100644 --- a/crates/dtmm/src/controller/game.rs +++ b/crates/dtmm/src/controller/game.rs @@ -208,7 +208,7 @@ pub(crate) async fn reset_mod_deployment(state: ActionState) -> Result<()> { for p in paths { let path = bundle_dir.join(p); - let backup = bundle_dir.join(format!("{}.bak", p)); + let backup = bundle_dir.join(format!("{p}.bak")); let res = async { tracing::debug!( diff --git a/crates/dtmm/src/controller/import.rs b/crates/dtmm/src/controller/import.rs index 6fc9693..36f3268 100644 --- a/crates/dtmm/src/controller/import.rs +++ b/crates/dtmm/src/controller/import.rs @@ -363,7 +363,7 @@ fn extract_legacy_mod( for i in 0..file_count { let mut f = archive .by_index(i) - .wrap_err_with(|| format!("Failed to get file at index {}", i))?; + .wrap_err_with(|| format!("Failed to get file at index {i}"))?; let Some(name) = f.enclosed_name().map(|p| p.to_path_buf()) else { let err = eyre::eyre!("File name in archive is not a safe path value.").suggestion( @@ -426,7 +426,7 @@ pub(crate) async fn import_from_file(state: ActionState, info: FileInfo) -> Resu let mod_info = api .mods_id(id) .await - .wrap_err_with(|| format!("Failed to query mod {} from Nexus", id))?; + .wrap_err_with(|| format!("Failed to query mod {id} from Nexus"))?; let version = match api.file_version(id, timestamp).await { Ok(version) => version, @@ -461,13 +461,13 @@ pub(crate) async fn import_from_file(state: ActionState, info: FileInfo) -> Resu pub(crate) async fn import_from_nxm(state: ActionState, uri: String) -> Result { let url = uri .parse() - .wrap_err_with(|| format!("Invalid Uri '{}'", uri))?; + .wrap_err_with(|| format!("Invalid Uri '{uri}'"))?; let api = NexusApi::new(state.nexus_api_key.to_string())?; let (mod_info, file_info, data) = api .handle_nxm(url) .await - .wrap_err_with(|| format!("Failed to download mod from NXM uri '{}'", uri))?; + .wrap_err_with(|| format!("Failed to download mod from NXM uri '{uri}'"))?; let nexus = NexusInfo::from(mod_info); import_mod(state, Some((nexus, file_info.version)), data).await @@ -524,7 +524,7 @@ pub(crate) async fn import_mod( let data = api .picture(url) .await - .wrap_err_with(|| format!("Failed to download Nexus image from '{}'", url))?; + .wrap_err_with(|| format!("Failed to download Nexus image from '{url}'"))?; let img = image_data_to_buffer(&data)?; diff --git a/crates/dtmm/src/main.rs b/crates/dtmm/src/main.rs index 54e101a..41a9253 100644 --- a/crates/dtmm/src/main.rs +++ b/crates/dtmm/src/main.rs @@ -47,7 +47,7 @@ fn notify_nxm_download( .to_ns_name::() .expect("Invalid socket name"), ) - .wrap_err_with(|| format!("Failed to connect to '{}'", IPC_ADDRESS)) + .wrap_err_with(|| format!("Failed to connect to '{IPC_ADDRESS}'")) .suggestion("Make sure the main window is open.")?; tracing::debug!("Connected to main process at '{}'", IPC_ADDRESS); @@ -159,7 +159,7 @@ fn main() -> Result<()> { loop { let res = server.accept().wrap_err_with(|| { - format!("IPC server failed to listen on '{}'", IPC_ADDRESS) + format!("IPC server failed to listen on '{IPC_ADDRESS}'") }); match res { diff --git a/crates/dtmm/src/state/delegate.rs b/crates/dtmm/src/state/delegate.rs index f3c4711..62fb319 100644 --- a/crates/dtmm/src/state/delegate.rs +++ b/crates/dtmm/src/state/delegate.rs @@ -108,20 +108,19 @@ impl std::fmt::Debug for AsyncAction { match self { AsyncAction::DeployMods(_) => write!(f, "AsyncAction::DeployMods(_state)"), AsyncAction::ResetDeployment(_) => write!(f, "AsyncAction::ResetDeployment(_state)"), - AsyncAction::AddMod(_, info) => write!(f, "AsyncAction::AddMod(_state, {:?})", info), + AsyncAction::AddMod(_, info) => write!(f, "AsyncAction::AddMod(_state, {info:?})"), AsyncAction::DeleteMod(_, info) => { - write!(f, "AsyncAction::DeleteMod(_state, {:?})", info) + write!(f, "AsyncAction::DeleteMod(_state, {info:?})") } AsyncAction::SaveSettings(_) => write!(f, "AsyncAction::SaveSettings(_state)"), AsyncAction::CheckUpdates(_) => write!(f, "AsyncAction::CheckUpdates(_state)"), AsyncAction::LoadInitial((path, is_default)) => write!( f, - "AsyncAction::LoadInitial(({:?}, {:?}))", - path, is_default + "AsyncAction::LoadInitial(({path:?}, {is_default:?}))" ), AsyncAction::Log(_) => write!(f, "AsyncAction::Log(_)"), AsyncAction::NxmDownload(_, uri) => { - write!(f, "AsyncAction::NxmDownload(_state, {})", uri) + write!(f, "AsyncAction::NxmDownload(_state, {uri})") } } } @@ -448,7 +447,7 @@ impl AppDelegate for Delegate { if let Err(err) = open::that_detached(Arc::as_ref(url)) { tracing::error!( "{:?}", - Report::new(err).wrap_err(format!("Failed to open url '{}'", url)) + Report::new(err).wrap_err(format!("Failed to open url '{url}'")) ); } diff --git a/crates/dtmm/src/ui/theme/colors.rs b/crates/dtmm/src/ui/theme/colors.rs index 1051539..c78644e 100644 --- a/crates/dtmm/src/ui/theme/colors.rs +++ b/crates/dtmm/src/ui/theme/colors.rs @@ -76,7 +76,7 @@ impl ColorExt for Color { fn darken(&self, fac: f32) -> Self { let (r, g, b, a) = self.as_rgba(); let rgb = Rgb::from(r as f32, g as f32, b as f32); - let rgb = rgb.lighten(-1. * fac); + let rgb = rgb.lighten(-fac); Self::rgba( rgb.get_red() as f64, rgb.get_green() as f64, diff --git a/crates/dtmm/src/ui/widget/controller.rs b/crates/dtmm/src/ui/widget/controller.rs index f789b5a..f3b8a2e 100644 --- a/crates/dtmm/src/ui/widget/controller.rs +++ b/crates/dtmm/src/ui/widget/controller.rs @@ -5,6 +5,7 @@ use druid::{ use crate::state::{State, ACTION_SET_DIRTY, ACTION_START_SAVE_SETTINGS}; +#[allow(dead_code)] pub struct DisabledButtonController; impl Controller> for DisabledButtonController { diff --git a/crates/dtmm/src/ui/window/dialog.rs b/crates/dtmm/src/ui/window/dialog.rs index 11df4d5..511d1de 100644 --- a/crates/dtmm/src/ui/window/dialog.rs +++ b/crates/dtmm/src/ui/window/dialog.rs @@ -34,9 +34,9 @@ pub fn error(err: Report, _parent: WindowHandle) -> WindowDesc { // The second to last one, the context to the root cause let context = err.chain().nth(count - 2).unwrap(); - (format!("{first}!"), format!("{}: {}", context, root)) + (format!("{first}!"), format!("{context}: {root}")) } else { - ("An error occurred!".to_string(), format!("{}: {}", first, root)) + ("An error occurred!".to_string(), format!("{first}: {root}")) } } }; diff --git a/crates/dtmm/src/ui/window/main.rs b/crates/dtmm/src/ui/window/main.rs index 022a780..3955bb1 100644 --- a/crates/dtmm/src/ui/window/main.rs +++ b/crates/dtmm/src/ui/window/main.rs @@ -348,7 +348,7 @@ fn build_mod_details_info() -> impl Widget { let nexus_link = Maybe::or_empty(|| { let link = Label::raw().lens(NexusInfo::id.map( |id| { - let url = format!("https://nexusmods.com/warhammer40kdarktide/mods/{}", id); + let url = format!("https://nexusmods.com/warhammer40kdarktide/mods/{id}"); let mut builder = RichTextBuilder::new(); builder .push("Open on Nexusmods") diff --git a/crates/dtmt/src/cmd/bundle/db.rs b/crates/dtmt/src/cmd/bundle/db.rs index b537991..2398573 100644 --- a/crates/dtmt/src/cmd/bundle/db.rs +++ b/crates/dtmt/src/cmd/bundle/db.rs @@ -94,10 +94,10 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match bundle_name { IdString64::String(name) => { - println!("{:016x} {}", bundle_hash, name); + println!("{bundle_hash:016x} {name}"); } IdString64::Hash(hash) => { - println!("{:016x}", hash); + println!("{hash:016x}"); } } @@ -110,7 +110,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { println!("\t{:016x}.{:<12} {}", file.name, extension, name); } IdString64::Hash(hash) => { - println!("\t{:016x}.{}", hash, extension); + println!("\t{hash:016x}.{extension}"); } } } @@ -127,10 +127,10 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { match bundle_name { IdString64::String(name) => { - println!("{:016x} {}", bundle_hash, name); + println!("{bundle_hash:016x} {name}"); } IdString64::Hash(hash) => { - println!("{:016x}", hash); + println!("{hash:016x}"); } } } @@ -158,7 +158,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { for bundle in bundles { found = true; - println!("{:016x}", bundle); + println!("{bundle:016x}"); } if !found { diff --git a/crates/dtmt/src/cmd/bundle/extract.rs b/crates/dtmt/src/cmd/bundle/extract.rs index b595dba..f20733d 100644 --- a/crates/dtmt/src/cmd/bundle/extract.rs +++ b/crates/dtmt/src/cmd/bundle/extract.rs @@ -473,7 +473,7 @@ where } } Err(err) => { - let err = err.wrap_err(format!("Failed to decompile file {}", name)); + let err = err.wrap_err(format!("Failed to decompile file {name}")); tracing::error!("{:?}", err); } }; diff --git a/crates/dtmt/src/cmd/bundle/inject.rs b/crates/dtmt/src/cmd/bundle/inject.rs index 23e3f8b..1fba83d 100644 --- a/crates/dtmt/src/cmd/bundle/inject.rs +++ b/crates/dtmt/src/cmd/bundle/inject.rs @@ -147,7 +147,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { let patch_number = matches .get_one::("patch") - .map(|num| format!("{:03}", num)); + .map(|num| format!("{num:03}")); let output_path = matches .get_one::("output") @@ -156,7 +156,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { let mut output_path = bundle_path.clone(); if let Some(patch_number) = patch_number.as_ref() { - output_path.set_extension(format!("patch_{:03}", patch_number)); + output_path.set_extension(format!("patch_{patch_number:03}")); } output_path @@ -196,7 +196,7 @@ pub(crate) async fn run(ctx: sdk::Context, matches: &ArgMatches) -> Result<()> { span.record("output_path", output_path.display().to_string()); span.record("raw", sub_matches.get_flag("raw")); span.record("target_name", target_name.display().to_string()); - span.record("file_type", format!("{:?}", file_type)); + span.record("file_type", format!("{file_type:?}")); } } diff --git a/crates/dtmt/src/cmd/bundle/list.rs b/crates/dtmt/src/cmd/bundle/list.rs index 558126b..d511f35 100644 --- a/crates/dtmt/src/cmd/bundle/list.rs +++ b/crates/dtmt/src/cmd/bundle/list.rs @@ -38,7 +38,7 @@ enum OutputFormat { fn format_byte_size(size: usize) -> String { if size < 1024 { - format!("{} Bytes", size) + format!("{size} Bytes") } else if size < 1024 * 1024 { format!("{} kB", size / 1024) } else if size < 1024 * 1024 * 1024 { diff --git a/crates/dtmt/src/cmd/new.rs b/crates/dtmt/src/cmd/new.rs index 571b0cb..9d69b74 100644 --- a/crates/dtmt/src/cmd/new.rs +++ b/crates/dtmt/src/cmd/new.rs @@ -164,7 +164,7 @@ pub(crate) async fn run(_ctx: sdk::Context, matches: &ArgMatches) -> Result<()> .iter() .map(|(path_tmpl, content_tmpl)| { env.render_str(path_tmpl, &render_ctx) - .wrap_err_with(|| format!("Failed to render template: {}", path_tmpl)) + .wrap_err_with(|| format!("Failed to render template: {path_tmpl}")) .and_then(|path| { env.render_named_str(&path, content_tmpl, &render_ctx) .wrap_err_with(|| format!("Failed to render template '{}'", &path)) diff --git a/crates/dtmt/src/main.rs b/crates/dtmt/src/main.rs index ef3d36b..e2cb718 100644 --- a/crates/dtmt/src/main.rs +++ b/crates/dtmt/src/main.rs @@ -1,6 +1,5 @@ #![feature(io_error_more)] #![feature(let_chains)] -#![feature(result_flattening)] #![feature(test)] #![windows_subsystem = "console"] diff --git a/lib/dtmt-shared/src/log.rs b/lib/dtmt-shared/src/log.rs index 9c95c63..e5afc6c 100644 --- a/lib/dtmt-shared/src/log.rs +++ b/lib/dtmt-shared/src/log.rs @@ -19,7 +19,7 @@ pub const TIME_FORMAT: &[FormatItem] = format_description!("[hour]:[minute]:[sec pub fn format_fields(w: &mut Writer<'_>, field: &Field, val: &dyn std::fmt::Debug) -> Result { if field.name() == "message" { - write!(w, "{:?}", val) + write!(w, "{val:?}") } else { Ok(()) } @@ -70,7 +70,7 @@ where writer, "[{}] [{:>5}] ", time, - color.bold().paint(format!("{}", level)) + color.bold().paint(format!("{level}")) )?; ctx.field_format().format_fields(writer.by_ref(), event)?; diff --git a/lib/nexusmods/src/lib.rs b/lib/nexusmods/src/lib.rs index cddf6a0..5c243e6 100644 --- a/lib/nexusmods/src/lib.rs +++ b/lib/nexusmods/src/lib.rs @@ -99,7 +99,7 @@ impl Api { #[tracing::instrument(skip(self))] pub async fn mods_id(&self, id: u64) -> Result { - let url = BASE_URL_GAME.join(&format!("mods/{}.json", id))?; + let url = BASE_URL_GAME.join(&format!("mods/{id}.json"))?; let req = self.client.get(url); self.send(req).await } diff --git a/lib/oodle/build.rs b/lib/oodle/build.rs index 1a1d4e9..03b6463 100644 --- a/lib/oodle/build.rs +++ b/lib/oodle/build.rs @@ -11,7 +11,7 @@ fn main() { } else { "oo2core_win64" }; - println!("cargo:rustc-link-lib=static={}", lib_name); + println!("cargo:rustc-link-lib=static={lib_name}"); } else { println!("cargo:rustc-link-lib=static=oo2corelinux64"); println!("cargo:rustc-link-lib=stdc++"); diff --git a/lib/sdk/src/binary.rs b/lib/sdk/src/binary.rs index 9ce9d23..f96b3e0 100644 --- a/lib/sdk/src/binary.rs +++ b/lib/sdk/src/binary.rs @@ -247,7 +247,7 @@ pub mod sync { fn read_string_len(mut r: impl Read, len: usize) -> Result { let mut buf = vec![0; len]; r.read_exact(&mut buf) - .wrap_err_with(|| format!("Failed to read {} bytes", len))?; + .wrap_err_with(|| format!("Failed to read {len} bytes"))?; let res = match CStr::from_bytes_until_nul(&buf) { Ok(s) => { @@ -259,6 +259,6 @@ pub mod sync { res.wrap_err("Invalid binary for UTF8 string") .with_section(|| format!("{}", String::from_utf8_lossy(&buf)).header("ASCI:")) - .with_section(|| format!("{:x?}", buf).header("Bytes:")) + .with_section(|| format!("{buf:x?}").header("Bytes:")) } } diff --git a/lib/sdk/src/murmur/types.rs b/lib/sdk/src/murmur/types.rs index c66e2cf..4e6965b 100644 --- a/lib/sdk/src/murmur/types.rs +++ b/lib/sdk/src/murmur/types.rs @@ -50,7 +50,7 @@ impl fmt::LowerHex for Murmur64 { impl fmt::Display for Murmur64 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:016X}", self) + write!(f, "{self:016X}") } } @@ -158,7 +158,7 @@ impl fmt::LowerHex for Murmur32 { impl fmt::Display for Murmur32 { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - write!(f, "{:08X}", self) + write!(f, "{self:08X}") } } From 1326222eb090bfa1c2c30797bd17e76510027441 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 15:01:14 +0200 Subject: [PATCH 143/154] Improve Renovate config --- .ci/image/Dockerfile | 8 +++++--- .renovaterc | 30 ++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 3 deletions(-) diff --git a/.ci/image/Dockerfile b/.ci/image/Dockerfile index f115929..b995065 100644 --- a/.ci/image/Dockerfile +++ b/.ci/image/Dockerfile @@ -1,6 +1,7 @@ # https://jake-shadle.github.io/xwin/ -FROM debian:bullseye-slim as xwin +FROM debian:bullseye-slim AS xwin +# renovate: datasource=github-releases depName=xwin packageName=Jake-Shadle/xwin ARG XWIN_VERSION=0.5.2 ARG XWIN_PREFIX="xwin-$XWIN_VERSION-x86_64-unknown-linux-musl" ADD https://github.com/Jake-Shadle/xwin/releases/download/$XWIN_VERSION/$XWIN_PREFIX.tar.gz /root/$XWIN_PREFIX.tar.gz @@ -31,7 +32,7 @@ RUN set -eux; \ # And to keep that to a minimum, we still delete the stuff we don't need. rm -rf /root/.xwin-cache; -FROM rust:slim-bullseye as linux +FROM rust:slim-bullseye AS linux RUN set -eux; \ apt-get update; \ @@ -58,8 +59,9 @@ WORKDIR /src/dtmt COPY lib/oodle/*.so lib/oodle/*.a /src/ -FROM linux as msvc +FROM linux AS msvc +# renovate: datasource=github-releases depName=llvm packageName=llvm/llvm-project ARG LLVM_VERSION=18 ENV KEYRINGS /usr/local/share/keyrings diff --git a/.renovaterc b/.renovaterc index 7ad59cd..6d8dec6 100644 --- a/.renovaterc +++ b/.renovaterc @@ -10,5 +10,35 @@ "baseBranches": [ "$default", "/^release\\/.*/" + ], + "ignorePaths": [ + "lib/color_eyre/**", + "lib/ansi-parser/**", + "lib/luajit2-sys/**", + "**/target/**" + ], + "customManagers": [ + { + "customType": "regex", + "description": "Update _VERSION variables in Dockerfiles", + "fileMatch": [ + "(^|/|\\.)Dockerfile$", + "(^|/)Dockerfile\\.[^/]*$" + ], + "matchStrings": [ + "# renovate: datasource=(?[a-z-]+?)(?: depName=(?.+?))? packageName=(?.+?)(?: versioning=(?[a-z-]+?))?\\s(?:ENV|ARG) .+?_VERSION=(?.+?)\\s" + ] + } + ], + "packageRules": [ + { + "matchDatasources": [ + "github-releases" + ], + "matchPackageNames": [ + "llvm/llvm-project" + ], + "extractVersion": "^llvmorg-(?\\d+)\\.\\d+\\.\\d+$" + } ] } From b42b4f01d297a172b85b31b21850a54e915ccc87 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 15:44:23 +0200 Subject: [PATCH 144/154] Prepare to absorb luajit2-sys submodule I had to pin the version of the LuaJIT library to a specific commit, and have reworked the build scripts heavily to work with the XWin setup, sacrificing the more flexible approach that existed before. As such it is heavily customized to the specific usage here. There is no reason to assume that it will be reconciled with the main project in the future. --- .gitmodules | 3 --- lib/luajit2-sys | 1 - 2 files changed, 4 deletions(-) delete mode 160000 lib/luajit2-sys diff --git a/.gitmodules b/.gitmodules index e1964a8..4cd74de 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,6 +1,3 @@ -[submodule "lib/luajit2-sys"] - path = lib/luajit2-sys - url = https://github.com/sclu1034/luajit2-sys.git [submodule "lib/color-eyre"] path = lib/color-eyre url = https://github.com/sclu1034/color-eyre.git diff --git a/lib/luajit2-sys b/lib/luajit2-sys deleted file mode 160000 index 6d94a4d..0000000 --- a/lib/luajit2-sys +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 6d94a4dd2c296bf1f044ee4c70fb10dca4c1c241 From 7500f9010506bfd28d400aba66cedaf0fedc4ae9 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 16:15:56 +0200 Subject: [PATCH 145/154] luajit2-sys: Remove unused files Stuff that isn't needed anymore after the merge into the workspace. --- .gitmodules | 7 +- lib/luajit2-sys/.azure-pipelines.yml | 59 -- lib/luajit2-sys/.cargo/config | 9 - lib/luajit2-sys/.gitignore | 7 - lib/luajit2-sys/.gitmodules | 3 - lib/luajit2-sys/README.md | 47 -- lib/luajit2-sys/ci/azure-install-rust.yml | 23 - lib/luajit2-sys/ci/azure-test-all.yml | 36 -- lib/luajit2-sys/etc/Makefile | 721 ---------------------- lib/luajit2-sys/examples/hello.lua | 3 - lib/luajit2-sys/examples/lua.rs | 54 -- lib/luajit2-sys/tests/test.rs | 40 -- 12 files changed, 5 insertions(+), 1004 deletions(-) delete mode 100644 lib/luajit2-sys/.azure-pipelines.yml delete mode 100644 lib/luajit2-sys/.cargo/config delete mode 100644 lib/luajit2-sys/.gitignore delete mode 100644 lib/luajit2-sys/.gitmodules delete mode 100644 lib/luajit2-sys/README.md delete mode 100644 lib/luajit2-sys/ci/azure-install-rust.yml delete mode 100644 lib/luajit2-sys/ci/azure-test-all.yml delete mode 100644 lib/luajit2-sys/etc/Makefile delete mode 100644 lib/luajit2-sys/examples/hello.lua delete mode 100644 lib/luajit2-sys/examples/lua.rs delete mode 100644 lib/luajit2-sys/tests/test.rs diff --git a/.gitmodules b/.gitmodules index 4cd74de..558929a 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,8 +1,11 @@ [submodule "lib/color-eyre"] path = lib/color-eyre url = https://github.com/sclu1034/color-eyre.git - branch = "fork" + branch = "fork" [submodule "lib/ansi-parser"] path = lib/ansi-parser url = https://gitlab.com/lschwiderski/ansi-parser.git - branch = "issue/outdated-nom" + branch = "issue/outdated-nom" +[submodule "lib/luajit2-sys/luajit"] + path = lib/luajit2-sys/luajit + url = https://github.com/LuaJIT/LuaJIT.git diff --git a/lib/luajit2-sys/.azure-pipelines.yml b/lib/luajit2-sys/.azure-pipelines.yml deleted file mode 100644 index 2445ee1..0000000 --- a/lib/luajit2-sys/.azure-pipelines.yml +++ /dev/null @@ -1,59 +0,0 @@ -trigger: - - master - -pr: - branches: - include: - - master - -schedules: - - cron: "0 12 * * 0" - displayName: Weekly Sunday build - branches: - include: - - master - always: true - -jobs: - - job: Windows - pool: - vmImage: vs2017-win2016 - steps: - - template: ci/azure-install-rust.yml - - template: ci/azure-test-all.yml - strategy: - matrix: - stable-x86_64-msvc: - TOOLCHAIN: stable-x86_64-pc-windows-msvc - # stable-x86_64-gnu: - # TOOLCHAIN: stable-x86_64-pc-windows-gnu - # stable-i686-msvc: - # TOOLCHAIN: stable-i686-pc-windows-msvc - # stable-i686-gnu: - # TOOLCHAIN: stable-i686-pc-windows-gnu - - - job: Linux - pool: - vmImage: ubuntu-16.04 - steps: - - template: ci/azure-install-rust.yml - - template: ci/azure-test-all.yml - strategy: - matrix: - stable-x86_64: - TOOLCHAIN: stable-x86_64-unknown-linux-gnu - # stable-i686: - # TOOLCHAIN: stable-i686-unknown-linux-gnu - nightly-x86_64: - TOOLCHAIN: nightly - - - job: MacOS - pool: - vmImage: macOS-10.14 - steps: - - template: ci/azure-install-rust.yml - - template: ci/azure-test-all.yml - strategy: - matrix: - stable-x86_64: - TOOLCHAIN: stable-x86_64-apple-darwin \ No newline at end of file diff --git a/lib/luajit2-sys/.cargo/config b/lib/luajit2-sys/.cargo/config deleted file mode 100644 index 134419d..0000000 --- a/lib/luajit2-sys/.cargo/config +++ /dev/null @@ -1,9 +0,0 @@ -[target.x86_64-apple-darwin] -rustflags = [ - "-C", - "link-arg=-pagezero_size 10000", - -] - -# "-C", -# "link-arg=-image_base 100000000", \ No newline at end of file diff --git a/lib/luajit2-sys/.gitignore b/lib/luajit2-sys/.gitignore deleted file mode 100644 index faa27f7..0000000 --- a/lib/luajit2-sys/.gitignore +++ /dev/null @@ -1,7 +0,0 @@ -/target -**/*.rs.bk -Cargo.lock - -*.iml -.idea -.vscode \ No newline at end of file diff --git a/lib/luajit2-sys/.gitmodules b/lib/luajit2-sys/.gitmodules deleted file mode 100644 index e7ae3a7..0000000 --- a/lib/luajit2-sys/.gitmodules +++ /dev/null @@ -1,3 +0,0 @@ -[submodule "luajit"] - path = luajit - url = https://github.com/LuaJIT/LuaJIT.git diff --git a/lib/luajit2-sys/README.md b/lib/luajit2-sys/README.md deleted file mode 100644 index 873b88e..0000000 --- a/lib/luajit2-sys/README.md +++ /dev/null @@ -1,47 +0,0 @@ -# Rust LuaJIT Bindings - -[![crates.io](https://img.shields.io/crates/v/luajit2-sys.svg)](https://crates.io/crates/luajit2-sys) -[![docs.rs](https://docs.rs/luajit2-sys/badge.svg)](https://docs.rs/luajit2-sys) -[![build](https://dev.azure.com/aloucks/aloucks/_apis/build/status/aloucks.luajit2-sys?branchName=master)](https://dev.azure.com/aloucks/aloucks/_build/latest?definitionId=3&branchName=master) - -```toml -[dependencies] -luajit2-sys = "0.0.2" -``` - -## Exported Cargo Environment Variables - -||| -| -- | -- | -| `DEP_LUAJIT_INCLUDE` | Path to the LuaJIT source and headers | -| `DEP_LUAJIT_LIB_NAME` | Platform specfic lib name (`lua51` on Windows and `luajit` everywhere else) | - -## Example - -```rust -use luajit2_sys as sys; -use std::ffi::CStr; - -fn main() { - unsafe { - let lua = sys::luaL_newstate(); - sys::luaL_openlibs(lua); - let script_data = b"return 1 + 2"; - let script_name = b"run_script\0"; - sys::luaL_loadbuffer( - lua, - script_data.as_ptr() as _, - script_data.len() as _, - script_name.as_ptr() as _, - ); - sys::lua_pcall(lua, 0, 1, 0); - let idx = sys::lua_gettop(lua); - let s = sys::lua_tostring(lua, idx); - let result = CStr::from_ptr(s).to_string_lossy().to_string(); - sys::lua_close(lua); - - println!("result: {}", result); - } -} -``` - diff --git a/lib/luajit2-sys/ci/azure-install-rust.yml b/lib/luajit2-sys/ci/azure-install-rust.yml deleted file mode 100644 index cd39cc1..0000000 --- a/lib/luajit2-sys/ci/azure-install-rust.yml +++ /dev/null @@ -1,23 +0,0 @@ -steps: - - bash: | - set -e -x - curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain $TOOLCHAIN - source $HOME/.cargo/env - echo "##vso[task.prependpath]$HOME/.cargo/bin" - rustup --version - displayName: Install rustup - condition: eq(variables['Agent.OS'], 'Darwin') - - bash: | - set -e -x - rustup --version - rustup default $TOOLCHAIN - rustup update --no-self-update $TOOLCHAIN - rustup toolchain install stable - rustup component add rustfmt --toolchain stable - displayName: Configure rust - - bash: | - set -x - rustc -Vv - cargo -Vv - cargo +stable fmt --version - displayName: Query rustc, cargo, and rustfmt versions \ No newline at end of file diff --git a/lib/luajit2-sys/ci/azure-test-all.yml b/lib/luajit2-sys/ci/azure-test-all.yml deleted file mode 100644 index 877ab5a..0000000 --- a/lib/luajit2-sys/ci/azure-test-all.yml +++ /dev/null @@ -1,36 +0,0 @@ -steps: - - checkout: self - submodules: true -# - script: | -# call "C:\Program Files (x86)\Microsoft Visual Studio\2017\VC\Auxiliary\Build\vcvarsall.bat" x86 -# displayName: Call vcvarsalls.bat x86 -# condition: eq(variables['TOOLCHAIN'], 'stable-i686-pc-windows-msvc') -# - bash: pacman -Syu -# condition: eq(variables['TOOLCHAIN'], 'stable-x86_64-pc-windows-gnu') -# displayName: Update msys -# - bash: sudo apt install gcc-multilib -# condition: eq(variables['TOOLCHAIN'], 'stable-i686-unknown-linux-gnu') -# displayName: Install gcc-multilib - - bash: | - set -e -x - cargo +stable fmt --all -- --check - displayName: Check formatting - - bash: | - set -e -x - cargo test --no-run - displayName: Build everything - env: - RUST_BACKTRACE: 1 - CARGO_INCREMENTAL: 0 - - bash: | - set -e -x - cargo test - displayName: Run unit tests - env: - RUST_BACKTRACE: 1 - CARGO_INCREMENTAL: 0 - - bash: | - pwd - /usr/bin/find ./target - displayName: List files in target - condition: always() diff --git a/lib/luajit2-sys/etc/Makefile b/lib/luajit2-sys/etc/Makefile deleted file mode 100644 index 2046c6c..0000000 --- a/lib/luajit2-sys/etc/Makefile +++ /dev/null @@ -1,721 +0,0 @@ -############################################################################## -# LuaJIT Makefile. Requires GNU Make. -# -# Please read doc/install.html before changing any variables! -# -# Suitable for POSIX platforms (Linux, *BSD, OSX etc.). -# Also works with MinGW and Cygwin on Windows. -# Please check msvcbuild.bat for building with MSVC on Windows. -# -# Copyright (C) 2005-2017 Mike Pall. See Copyright Notice in luajit.h -############################################################################## - -MAJVER= 2 -MINVER= 1 -RELVER= 0 -ABIVER= 5.1 -NODOTABIVER= 51 - -############################################################################## -############################# COMPILER OPTIONS ############################# -############################################################################## -# These options mainly affect the speed of the JIT compiler itself, not the -# speed of the JIT-compiled code. Turn any of the optional settings on by -# removing the '#' in front of them. Make sure you force a full recompile -# with "make clean", followed by "make" if you change any options. -# -DEFAULT_CC = gcc -# -# LuaJIT builds as a native 32 or 64 bit binary by default. -CC= $(DEFAULT_CC) -# -# Use this if you want to force a 32 bit build on a 64 bit multilib OS. -#CC= $(DEFAULT_CC) -m32 -# -# Since the assembler part does NOT maintain a frame pointer, it's pointless -# to slow down the C part by not omitting it. Debugging, tracebacks and -# unwinding are not affected -- the assembler part has frame unwind -# information and GCC emits it where needed (x64) or with -g (see CCDEBUG). -CCOPT= -O2 -fomit-frame-pointer -# Use this if you want to generate a smaller binary (but it's slower): -#CCOPT= -Os -fomit-frame-pointer -# Note: it's no longer recommended to use -O3 with GCC 4.x. -# The I-Cache bloat usually outweighs the benefits from aggressive inlining. -# -# Target-specific compiler options: -# -# x86/x64 only: For GCC 4.2 or higher and if you don't intend to distribute -# the binaries to a different machine you could also use: -march=native -# -CCOPT_x86= -march=i686 -msse -msse2 -mfpmath=sse -CCOPT_x64= -CCOPT_arm= -CCOPT_arm64= -CCOPT_ppc= -CCOPT_mips= -# -CCDEBUG= -# Uncomment the next line to generate debug information: -#CCDEBUG= -g -# -CCWARN= -Wall -# Uncomment the next line to enable more warnings: -#CCWARN+= -Wextra -Wdeclaration-after-statement -Wredundant-decls -Wshadow -Wpointer-arith -# -############################################################################## - -############################################################################## -################################ BUILD MODE ################################ -############################################################################## -# The default build mode is mixed mode on POSIX. On Windows this is the same -# as dynamic mode. -# -# Mixed mode creates a static + dynamic library and a statically linked luajit. -#BUILDMODE= mixed -# -# Static mode creates a static library and a statically linked luajit. -BUILDMODE= static -# -# Dynamic mode creates a dynamic library and a dynamically linked luajit. -# Note: this executable will only run when the library is installed! -#BUILDMODE= dynamic -# -############################################################################## - -############################################################################## -################################# FEATURES ################################# -############################################################################## -# Enable/disable these features as needed, but make sure you force a full -# recompile with "make clean", followed by "make". -XCFLAGS= -# -# Permanently disable the FFI extension to reduce the size of the LuaJIT -# executable. But please consider that the FFI library is compiled-in, -# but NOT loaded by default. It only allocates any memory, if you actually -# make use of it. -#XCFLAGS+= -DLUAJIT_DISABLE_FFI -# -# Features from Lua 5.2 that are unlikely to break existing code are -# enabled by default. Some other features that *might* break some existing -# code (e.g. __pairs or os.execute() return values) can be enabled here. -# Note: this does not provide full compatibility with Lua 5.2 at this time. -#XCFLAGS+= -DLUAJIT_ENABLE_LUA52COMPAT -# -# Disable the JIT compiler, i.e. turn LuaJIT into a pure interpreter. -#XCFLAGS+= -DLUAJIT_DISABLE_JIT -# -# Some architectures (e.g. PPC) can use either single-number (1) or -# dual-number (2) mode. Uncomment one of these lines to override the -# default mode. Please see LJ_ARCH_NUMMODE in lj_arch.h for details. -#XCFLAGS+= -DLUAJIT_NUMMODE=1 -#XCFLAGS+= -DLUAJIT_NUMMODE=2 -# -# Enable GC64 mode for x64. -#XCFLAGS+= -DLUAJIT_ENABLE_GC64 -# -############################################################################## - -############################################################################## -############################ DEBUGGING SUPPORT ############################# -############################################################################## -# Enable these options as needed, but make sure you force a full recompile -# with "make clean", followed by "make". -# Note that most of these are NOT suitable for benchmarking or release mode! -# -# Use the system provided memory allocator (realloc) instead of the -# bundled memory allocator. This is slower, but sometimes helpful for -# debugging. This option cannot be enabled on x64 without GC64, since -# realloc usually doesn't return addresses in the right address range. -# OTOH this option is mandatory for Valgrind's memcheck tool on x64 and -# the only way to get useful results from it for all other architectures. -#XCFLAGS+= -DLUAJIT_USE_SYSMALLOC -# -# This define is required to run LuaJIT under Valgrind. The Valgrind -# header files must be installed. You should enable debug information, too. -# Use --suppressions=lj.supp to avoid some false positives. -#XCFLAGS+= -DLUAJIT_USE_VALGRIND -# -# This is the client for the GDB JIT API. GDB 7.0 or higher is required -# to make use of it. See lj_gdbjit.c for details. Enabling this causes -# a non-negligible overhead, even when not running under GDB. -#XCFLAGS+= -DLUAJIT_USE_GDBJIT -# -# Turn on assertions for the Lua/C API to debug problems with lua_* calls. -# This is rather slow -- use only while developing C libraries/embeddings. -#XCFLAGS+= -DLUA_USE_APICHECK -# -# Turn on assertions for the whole LuaJIT VM. This significantly slows down -# everything. Use only if you suspect a problem with LuaJIT itself. -#XCFLAGS+= -DLUA_USE_ASSERT -# -############################################################################## -# You probably don't need to change anything below this line! -############################################################################## - -############################################################################## -# Host system detection. -############################################################################## - -ifeq (Windows,$(findstring Windows,$(OS))$(MSYSTEM)$(TERM)) - HOST_SYS= Windows - HOST_RM= del -else - HOST_SYS:= $(shell uname -s) - ifneq (,$(findstring MINGW,$(HOST_SYS))) - HOST_SYS= Windows - HOST_MSYS= mingw - endif - ifneq (,$(findstring MSYS,$(HOST_SYS))) - HOST_SYS= Windows - HOST_MSYS= mingw - endif - ifneq (,$(findstring CYGWIN,$(HOST_SYS))) - HOST_SYS= Windows - HOST_MSYS= cygwin - endif -endif - -############################################################################## -# Flags and options for host and target. -############################################################################## - -# You can override the following variables at the make command line: -# CC HOST_CC STATIC_CC DYNAMIC_CC -# CFLAGS HOST_CFLAGS TARGET_CFLAGS -# LDFLAGS HOST_LDFLAGS TARGET_LDFLAGS TARGET_SHLDFLAGS -# LIBS HOST_LIBS TARGET_LIBS -# CROSS HOST_SYS TARGET_SYS TARGET_FLAGS -# -# Cross-compilation examples: -# make HOST_CC="gcc -m32" CROSS=i586-mingw32msvc- TARGET_SYS=Windows -# make HOST_CC="gcc -m32" CROSS=powerpc-linux-gnu- - -ASOPTIONS= $(CCOPT) $(CCWARN) $(XCFLAGS) $(CFLAGS) -CCOPTIONS= $(CCDEBUG) $(ASOPTIONS) -LDOPTIONS= $(CCDEBUG) $(LDFLAGS) - -HOST_CC= $(CC) -HOST_RM?= rm -f -# If left blank, minilua is built and used. You can supply an installed -# copy of (plain) Lua 5.1 or 5.2, plus Lua BitOp. E.g. with: HOST_LUA=lua -HOST_LUA= - -HOST_XCFLAGS= -I. -HOST_XLDFLAGS= -HOST_XLIBS= -HOST_ACFLAGS= $(CCOPTIONS) $(HOST_XCFLAGS) $(TARGET_ARCH) $(HOST_CFLAGS) -HOST_ALDFLAGS= $(LDOPTIONS) $(HOST_XLDFLAGS) $(HOST_LDFLAGS) -HOST_ALIBS= $(HOST_XLIBS) $(LIBS) $(HOST_LIBS) - -STATIC_CC = $(CROSS)$(CC) -fPIC -DYNAMIC_CC = $(CROSS)$(CC) -fPIC -TARGET_CC= $(STATIC_CC) -TARGET_STCC= $(STATIC_CC) -TARGET_DYNCC= $(DYNAMIC_CC) -TARGET_LD= $(CROSS)$(CC) -TARGET_AR= $(CROSS)ar rcus -TARGET_STRIP= $(CROSS)strip - -TARGET_LIBPATH= $(or $(PREFIX),/usr/local)/$(or $(MULTILIB),lib) -TARGET_SONAME= libluajit-$(ABIVER).so.$(MAJVER) -TARGET_DYLIBNAME= libluajit-$(ABIVER).$(MAJVER).dylib -TARGET_DYLIBPATH= $(TARGET_LIBPATH)/$(TARGET_DYLIBNAME) -TARGET_DLLNAME= lua$(NODOTABIVER).dll -TARGET_XSHLDFLAGS= -shared -fPIC -Wl,-soname,$(TARGET_SONAME) -TARGET_DYNXLDOPTS= - -TARGET_LFSFLAGS= -D_FILE_OFFSET_BITS=64 -D_LARGEFILE_SOURCE -TARGET_XCFLAGS= $(TARGET_LFSFLAGS) -U_FORTIFY_SOURCE -TARGET_XLDFLAGS= -TARGET_XLIBS= -lm -TARGET_TCFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) -TARGET_ACFLAGS= $(CCOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) -TARGET_ASFLAGS= $(ASOPTIONS) $(TARGET_XCFLAGS) $(TARGET_FLAGS) $(TARGET_CFLAGS) -TARGET_ALDFLAGS= $(LDOPTIONS) $(TARGET_XLDFLAGS) $(TARGET_FLAGS) $(TARGET_LDFLAGS) -TARGET_ASHLDFLAGS= $(LDOPTIONS) $(TARGET_XSHLDFLAGS) $(TARGET_FLAGS) $(TARGET_SHLDFLAGS) -TARGET_ALIBS= $(TARGET_XLIBS) $(LIBS) $(TARGET_LIBS) - -TARGET_TESTARCH=$(shell $(TARGET_CC) $(TARGET_TCFLAGS) -E lj_arch.h -dM) -ifneq (,$(findstring LJ_TARGET_X64 ,$(TARGET_TESTARCH))) - TARGET_LJARCH= x64 -else -ifneq (,$(findstring LJ_TARGET_X86 ,$(TARGET_TESTARCH))) - TARGET_LJARCH= x86 -else -ifneq (,$(findstring LJ_TARGET_ARM ,$(TARGET_TESTARCH))) - TARGET_LJARCH= arm -else -ifneq (,$(findstring LJ_TARGET_ARM64 ,$(TARGET_TESTARCH))) - ifneq (,$(findstring __AARCH64EB__ ,$(TARGET_TESTARCH))) - TARGET_ARCH= -D__AARCH64EB__=1 - endif - TARGET_LJARCH= arm64 -else -ifneq (,$(findstring LJ_TARGET_PPC ,$(TARGET_TESTARCH))) - ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) - TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_LE - else - TARGET_ARCH= -DLJ_ARCH_ENDIAN=LUAJIT_BE - endif - TARGET_LJARCH= ppc -else -ifneq (,$(findstring LJ_TARGET_MIPS ,$(TARGET_TESTARCH))) - ifneq (,$(findstring MIPSEL ,$(TARGET_TESTARCH))) - TARGET_ARCH= -D__MIPSEL__=1 - endif - ifneq (,$(findstring LJ_TARGET_MIPS64 ,$(TARGET_TESTARCH))) - TARGET_LJARCH= mips64 - else - TARGET_LJARCH= mips - endif -else - $(error Unsupported target architecture) -endif -endif -endif -endif -endif -endif - -ifneq (,$(findstring LJ_TARGET_PS3 1,$(TARGET_TESTARCH))) - TARGET_SYS= PS3 - TARGET_ARCH+= -D__CELLOS_LV2__ - TARGET_XCFLAGS+= -DLUAJIT_USE_SYSMALLOC - TARGET_XLIBS+= -lpthread -endif - -TARGET_XCFLAGS+= $(CCOPT_$(TARGET_LJARCH)) -TARGET_ARCH+= $(patsubst %,-DLUAJIT_TARGET=LUAJIT_ARCH_%,$(TARGET_LJARCH)) - -ifneq (,$(PREFIX)) -ifneq (/usr/local,$(PREFIX)) - TARGET_XCFLAGS+= -DLUA_ROOT=\"$(PREFIX)\" - ifneq (/usr,$(PREFIX)) - TARGET_DYNXLDOPTS= -Wl,-rpath,$(TARGET_LIBPATH) - endif -endif -endif -ifneq (,$(MULTILIB)) - TARGET_XCFLAGS+= -DLUA_MULTILIB=\"$(MULTILIB)\" -endif -ifneq (,$(LMULTILIB)) - TARGET_XCFLAGS+= -DLUA_LMULTILIB=\"$(LMULTILIB)\" -endif - -############################################################################## -# Target system detection. -############################################################################## - -TARGET_SYS?= $(HOST_SYS) -ifeq (Windows,$(TARGET_SYS)) - TARGET_STRIP+= --strip-unneeded - TARGET_XSHLDFLAGS= -shared - TARGET_DYNXLDOPTS= -else - TARGET_AR+= 2>/dev/null -ifeq (,$(shell $(TARGET_CC) -o /dev/null -c -x c /dev/null -fno-stack-protector 2>/dev/null || echo 1)) - TARGET_XCFLAGS+= -fno-stack-protector -endif -ifeq (Darwin,$(TARGET_SYS)) - ifeq (,$(MACOSX_DEPLOYMENT_TARGET)) -# export MACOSX_DEPLOYMENT_TARGET=10.4 - endif - TARGET_STRIP+= -x - TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC - TARGET_DYNXLDOPTS= - TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) - ifeq (x64,$(TARGET_LJARCH)) - TARGET_XLDFLAGS+= -pagezero_size 10000 -image_base 100000000 - TARGET_XSHLDFLAGS+= -image_base 7fff04c4a000 - endif -else -ifeq (iOS,$(TARGET_SYS)) - TARGET_STRIP+= -x - TARGET_XSHLDFLAGS= -dynamiclib -single_module -undefined dynamic_lookup -fPIC - TARGET_DYNXLDOPTS= - TARGET_XSHLDFLAGS+= -install_name $(TARGET_DYLIBPATH) -compatibility_version $(MAJVER).$(MINVER) -current_version $(MAJVER).$(MINVER).$(RELVER) - ifeq (arm64,$(TARGET_LJARCH)) - TARGET_XCFLAGS+= -fno-omit-frame-pointer - endif -else - ifneq (SunOS,$(TARGET_SYS)) - ifneq (PS3,$(TARGET_SYS)) - TARGET_XLDFLAGS+= -Wl,-E - endif - endif - ifeq (Linux,$(TARGET_SYS)) - TARGET_XLIBS+= -ldl - endif - ifeq (GNU/kFreeBSD,$(TARGET_SYS)) - TARGET_XLIBS+= -ldl - endif -endif -endif -endif - -ifneq ($(HOST_SYS),$(TARGET_SYS)) - ifeq (Windows,$(TARGET_SYS)) - HOST_XCFLAGS+= -malign-double -DLUAJIT_OS=LUAJIT_OS_WINDOWS - else - ifeq (Linux,$(TARGET_SYS)) - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_LINUX - else - ifeq (Darwin,$(TARGET_SYS)) - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX - else - ifeq (iOS,$(TARGET_SYS)) - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OSX - else - HOST_XCFLAGS+= -DLUAJIT_OS=LUAJIT_OS_OTHER - endif - endif - endif - endif -endif - -ifneq (,$(CCDEBUG)) - TARGET_STRIP= @: -endif - -############################################################################## -# Files and pathnames. -############################################################################## - -MINILUA_O= host/minilua.o -MINILUA_LIBS= -lm -MINILUA_T= host/minilua -MINILUA_X= $(MINILUA_T) - -ifeq (,$(HOST_LUA)) - HOST_LUA= $(MINILUA_X) - DASM_DEP= $(MINILUA_T) -endif - -DASM_DIR= ../dynasm -DASM= $(HOST_LUA) $(DASM_DIR)/dynasm.lua -DASM_XFLAGS= -DASM_AFLAGS= -DASM_ARCH= $(TARGET_LJARCH) - -ifneq (,$(findstring LJ_LE 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D ENDIAN_LE -else - DASM_AFLAGS+= -D ENDIAN_BE -endif -ifneq (,$(findstring LJ_ARCH_BITS 64,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D P64 -endif -ifneq (,$(findstring LJ_HASJIT 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D JIT -endif -ifneq (,$(findstring LJ_HASFFI 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D FFI -endif -ifneq (,$(findstring LJ_DUALNUM 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D DUALNUM -endif -ifneq (,$(findstring LJ_ARCH_HASFPU 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D FPU - TARGET_ARCH+= -DLJ_ARCH_HASFPU=1 -else - TARGET_ARCH+= -DLJ_ARCH_HASFPU=0 -endif -ifeq (,$(findstring LJ_ABI_SOFTFP 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D HFABI - TARGET_ARCH+= -DLJ_ABI_SOFTFP=0 -else - TARGET_ARCH+= -DLJ_ABI_SOFTFP=1 -endif -ifneq (,$(findstring LJ_NO_UNWIND 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D NO_UNWIND - TARGET_ARCH+= -DLUAJIT_NO_UNWIND -endif -DASM_AFLAGS+= -D VER=$(subst LJ_ARCH_VERSION_,,$(filter LJ_ARCH_VERSION_%,$(subst LJ_ARCH_VERSION ,LJ_ARCH_VERSION_,$(TARGET_TESTARCH)))) -ifeq (Windows,$(TARGET_SYS)) - DASM_AFLAGS+= -D WIN -endif -ifeq (x64,$(TARGET_LJARCH)) - ifeq (,$(findstring LJ_FR2 1,$(TARGET_TESTARCH))) - DASM_ARCH= x86 - endif -else -ifeq (arm,$(TARGET_LJARCH)) - ifeq (iOS,$(TARGET_SYS)) - DASM_AFLAGS+= -D IOS - endif -else -ifeq (ppc,$(TARGET_LJARCH)) - ifneq (,$(findstring LJ_ARCH_SQRT 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D SQRT - endif - ifneq (,$(findstring LJ_ARCH_ROUND 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D ROUND - endif - ifneq (,$(findstring LJ_ARCH_PPC32ON64 1,$(TARGET_TESTARCH))) - DASM_AFLAGS+= -D GPR64 - endif - ifeq (PS3,$(TARGET_SYS)) - DASM_AFLAGS+= -D PPE -D TOC - endif - ifneq (,$(findstring LJ_ARCH_PPC64 ,$(TARGET_TESTARCH))) - DASM_ARCH= ppc64 - endif -endif -endif -endif - -DASM_FLAGS= $(DASM_XFLAGS) $(DASM_AFLAGS) -DASM_DASC= vm_$(DASM_ARCH).dasc - -BUILDVM_O= host/buildvm.o host/buildvm_asm.o host/buildvm_peobj.o \ - host/buildvm_lib.o host/buildvm_fold.o -BUILDVM_T= host/buildvm -BUILDVM_X= $(BUILDVM_T) - -HOST_O= $(MINILUA_O) $(BUILDVM_O) -HOST_T= $(MINILUA_T) $(BUILDVM_T) - -LJVM_S= lj_vm.S -LJVM_O= lj_vm.o -LJVM_BOUT= $(LJVM_S) -LJVM_MODE= elfasm - -LJLIB_O= lib_base.o lib_math.o lib_bit.o lib_string.o lib_table.o \ - lib_io.o lib_os.o lib_package.o lib_debug.o lib_jit.o lib_ffi.o -LJLIB_C= $(LJLIB_O:.o=.c) - -LJCORE_O= lj_gc.o lj_err.o lj_char.o lj_bc.o lj_obj.o lj_buf.o \ - lj_str.o lj_tab.o lj_func.o lj_udata.o lj_meta.o lj_debug.o \ - lj_state.o lj_dispatch.o lj_vmevent.o lj_vmmath.o lj_strscan.o \ - lj_strfmt.o lj_strfmt_num.o lj_api.o lj_profile.o \ - lj_lex.o lj_parse.o lj_bcread.o lj_bcwrite.o lj_load.o \ - lj_ir.o lj_opt_mem.o lj_opt_fold.o lj_opt_narrow.o \ - lj_opt_dce.o lj_opt_loop.o lj_opt_split.o lj_opt_sink.o \ - lj_mcode.o lj_snap.o lj_record.o lj_crecord.o lj_ffrecord.o \ - lj_asm.o lj_trace.o lj_gdbjit.o \ - lj_ctype.o lj_cdata.o lj_cconv.o lj_ccall.o lj_ccallback.o \ - lj_carith.o lj_clib.o lj_cparse.o \ - lj_lib.o lj_alloc.o lib_aux.o \ - $(LJLIB_O) lib_init.o - -LJVMCORE_O= $(LJVM_O) $(LJCORE_O) -LJVMCORE_DYNO= $(LJVMCORE_O:.o=_dyn.o) - -LIB_VMDEF= jit/vmdef.lua -LIB_VMDEFP= $(LIB_VMDEF) - -LUAJIT_O= luajit.o -LUAJIT_A= libluajit.a -LUAJIT_SO= libluajit.so -LUAJIT_T= luajit - -ALL_T= $(LUAJIT_T) $(LUAJIT_A) $(LUAJIT_SO) $(HOST_T) -ALL_HDRGEN= lj_bcdef.h lj_ffdef.h lj_libdef.h lj_recdef.h lj_folddef.h \ - host/buildvm_arch.h -ALL_GEN= $(LJVM_S) $(ALL_HDRGEN) $(LIB_VMDEFP) -WIN_RM= *.obj *.lib *.exp *.dll *.exe *.manifest *.pdb *.ilk -ALL_RM= $(ALL_T) $(ALL_GEN) *.o host/*.o $(WIN_RM) - -############################################################################## -# Build mode handling. -############################################################################## - -# Mixed mode defaults. -TARGET_O= $(LUAJIT_A) -TARGET_T= $(LUAJIT_T) $(LUAJIT_SO) -TARGET_DEP= $(LIB_VMDEF) $(LUAJIT_SO) - -ifeq (Windows,$(TARGET_SYS)) - TARGET_DYNCC= $(STATIC_CC) - LJVM_MODE= peobj - LJVM_BOUT= $(LJVM_O) - LUAJIT_T= luajit.exe - ifeq (cygwin,$(HOST_MSYS)) - LUAJIT_SO= cyg$(TARGET_DLLNAME) - else - LUAJIT_SO= $(TARGET_DLLNAME) - endif - # Mixed mode is not supported on Windows. And static mode doesn't work well. - # C modules cannot be loaded, because they bind to lua51.dll. - ifneq (static,$(BUILDMODE)) - BUILDMODE= dynamic - TARGET_XCFLAGS+= -DLUA_BUILD_AS_DLL - endif -endif -ifeq (Darwin,$(TARGET_SYS)) - LJVM_MODE= machasm -endif -ifeq (iOS,$(TARGET_SYS)) - LJVM_MODE= machasm -endif -ifeq (SunOS,$(TARGET_SYS)) - BUILDMODE= static -endif -ifeq (PS3,$(TARGET_SYS)) - BUILDMODE= static -endif - -ifeq (Windows,$(HOST_SYS)) - MINILUA_T= host/minilua.exe - BUILDVM_T= host/buildvm.exe - ifeq (,$(HOST_MSYS)) - MINILUA_X= host\minilua - BUILDVM_X= host\buildvm - ALL_RM:= $(subst /,\,$(ALL_RM)) - endif -endif - -ifeq (static,$(BUILDMODE)) - TARGET_DYNCC= @: - TARGET_T= $(LUAJIT_T) - TARGET_DEP= $(LIB_VMDEF) -else -ifeq (dynamic,$(BUILDMODE)) - ifneq (Windows,$(TARGET_SYS)) - TARGET_CC= $(DYNAMIC_CC) - endif - TARGET_DYNCC= @: - LJVMCORE_DYNO= $(LJVMCORE_O) - TARGET_O= $(LUAJIT_SO) - TARGET_XLDFLAGS+= $(TARGET_DYNXLDOPTS) -else -ifeq (Darwin,$(TARGET_SYS)) - TARGET_DYNCC= @: - LJVMCORE_DYNO= $(LJVMCORE_O) -endif -ifeq (iOS,$(TARGET_SYS)) - TARGET_DYNCC= @: - LJVMCORE_DYNO= $(LJVMCORE_O) -endif -endif -endif - -Q= @ -E= @echo -#Q= -#E= @: - -############################################################################## -# Make targets. -############################################################################## - -default all: $(TARGET_T) - -amalg: - @grep "^[+|]" ljamalg.c - $(MAKE) all "LJCORE_O=ljamalg.o" - -clean: - $(HOST_RM) $(ALL_RM) - -libbc: - ./$(LUAJIT_T) host/genlibbc.lua -o host/buildvm_libbc.h $(LJLIB_C) - $(MAKE) all - -depend: - @for file in $(ALL_HDRGEN); do \ - test -f $$file || touch $$file; \ - done - @$(HOST_CC) $(HOST_ACFLAGS) -MM *.c host/*.c | \ - sed -e "s| [^ ]*/dasm_\S*\.h||g" \ - -e "s|^\([^l ]\)|host/\1|" \ - -e "s| lj_target_\S*\.h| lj_target_*.h|g" \ - -e "s| lj_emit_\S*\.h| lj_emit_*.h|g" \ - -e "s| lj_asm_\S*\.h| lj_asm_*.h|g" >Makefile.dep - @for file in $(ALL_HDRGEN); do \ - test -s $$file || $(HOST_RM) $$file; \ - done - -.PHONY: default all amalg clean libbc depend - -############################################################################## -# Rules for generated files. -############################################################################## - -$(MINILUA_T): $(MINILUA_O) - $(E) "HOSTLINK $@" - $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(MINILUA_O) $(MINILUA_LIBS) $(HOST_ALIBS) - -host/buildvm_arch.h: $(DASM_DASC) $(DASM_DEP) $(DASM_DIR)/*.lua - $(E) "DYNASM $@" - $(Q)$(DASM) $(DASM_FLAGS) -o $@ $(DASM_DASC) - -host/buildvm.o: $(DASM_DIR)/dasm_*.h - -$(BUILDVM_T): $(BUILDVM_O) - $(E) "HOSTLINK $@" - $(Q)$(HOST_CC) $(HOST_ALDFLAGS) -o $@ $(BUILDVM_O) $(HOST_ALIBS) - -$(LJVM_BOUT): $(BUILDVM_T) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m $(LJVM_MODE) -o $@ - -lj_bcdef.h: $(BUILDVM_T) $(LJLIB_C) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m bcdef -o $@ $(LJLIB_C) - -lj_ffdef.h: $(BUILDVM_T) $(LJLIB_C) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m ffdef -o $@ $(LJLIB_C) - -lj_libdef.h: $(BUILDVM_T) $(LJLIB_C) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m libdef -o $@ $(LJLIB_C) - -lj_recdef.h: $(BUILDVM_T) $(LJLIB_C) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m recdef -o $@ $(LJLIB_C) - -$(LIB_VMDEF): $(BUILDVM_T) $(LJLIB_C) - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m vmdef -o $(LIB_VMDEFP) $(LJLIB_C) - -lj_folddef.h: $(BUILDVM_T) lj_opt_fold.c - $(E) "BUILDVM $@" - $(Q)$(BUILDVM_X) -m folddef -o $@ lj_opt_fold.c - -############################################################################## -# Object file rules. -############################################################################## - -%.o: %.c - $(E) "CC $@" - $(Q)$(TARGET_DYNCC) $(TARGET_ACFLAGS) -c -o $(@:.o=_dyn.o) $< - $(Q)$(TARGET_CC) $(TARGET_ACFLAGS) -c -o $@ $< - -%.o: %.S - $(E) "ASM $@" - $(Q)$(TARGET_DYNCC) $(TARGET_ASFLAGS) -c -o $(@:.o=_dyn.o) $< - $(Q)$(TARGET_CC) $(TARGET_ASFLAGS) -c -o $@ $< - -$(LUAJIT_O): - $(E) "CC $@" - $(Q)$(TARGET_STCC) $(TARGET_ACFLAGS) -c -o $@ $< - -$(HOST_O): %.o: %.c - $(E) "HOSTCC $@" - $(Q)$(HOST_CC) $(HOST_ACFLAGS) -c -o $@ $< - -include Makefile.dep - -############################################################################## -# Target file rules. -############################################################################## - -$(LUAJIT_A): $(LJVMCORE_O) - $(E) "AR $@" - $(Q)$(TARGET_AR) $@ $(LJVMCORE_O) - -# The dependency on _O, but linking with _DYNO is intentional. -$(LUAJIT_SO): $(LJVMCORE_O) - $(E) "DYNLINK $@" - $(Q)$(TARGET_LD) $(TARGET_ASHLDFLAGS) -o $@ $(LJVMCORE_DYNO) $(TARGET_ALIBS) - $(Q)$(TARGET_STRIP) $@ - -$(LUAJIT_T): $(TARGET_O) $(LUAJIT_O) $(TARGET_DEP) - $(E) "LINK $@" - $(Q)$(TARGET_LD) $(TARGET_ALDFLAGS) -o $@ $(LUAJIT_O) $(TARGET_O) $(TARGET_ALIBS) - $(Q)$(TARGET_STRIP) $@ - $(E) "OK Successfully built LuaJIT" - -############################################################################## diff --git a/lib/luajit2-sys/examples/hello.lua b/lib/luajit2-sys/examples/hello.lua deleted file mode 100644 index 87a4120..0000000 --- a/lib/luajit2-sys/examples/hello.lua +++ /dev/null @@ -1,3 +0,0 @@ -print("Hello from lua") - -return 1 + 2 diff --git a/lib/luajit2-sys/examples/lua.rs b/lib/luajit2-sys/examples/lua.rs deleted file mode 100644 index 0784409..0000000 --- a/lib/luajit2-sys/examples/lua.rs +++ /dev/null @@ -1,54 +0,0 @@ -use std::env; -use std::ffi::{CStr, CString}; -use std::ptr; - -use luajit2_sys as sys; - -unsafe fn run_script(script_name: String, script_src: String) { - let lua = sys::luaL_newstate(); - assert_ne!(lua, ptr::null_mut()); - sys::luaL_openlibs(lua); - let script_data = script_src.as_bytes(); - let script_name = CString::new(script_name).unwrap(); - let mut error = sys::luaL_loadbuffer( - lua, - script_data.as_ptr() as _, - script_data.len() as _, - script_name.as_ptr() as _, - ); - if error != 0 { - eprintln!("luaL_loadbuffer failed"); - } else { - error = sys::lua_pcall(lua, 0, 1, 0); - if error != 0 { - eprintln!("lua_pcall failed"); - } - } - let idx = sys::lua_gettop(lua); - if sys::lua_isnoneornil(lua, idx) != 1 { - let s = sys::lua_tostring(lua, idx); - assert_ne!(s, ptr::null(), "lua_tostring returned null"); - let result = CStr::from_ptr(s).to_string_lossy().to_string(); - println!("script result: {}", result); - } - sys::lua_close(lua); -} - -fn main() { - if let Some(script_name) = env::args().skip(1).next() { - let script_src = std::fs::read_to_string(&script_name) - .unwrap_or_else(|e| panic!("failed to read file: '{}' {:?}", &script_name, e)); - unsafe { - run_script(script_name, script_src); - } - } else { - println!( - "{} FILE", - env::current_exe() - .unwrap() - .file_name() - .unwrap() - .to_string_lossy() - ); - } -} diff --git a/lib/luajit2-sys/tests/test.rs b/lib/luajit2-sys/tests/test.rs deleted file mode 100644 index 8a018ea..0000000 --- a/lib/luajit2-sys/tests/test.rs +++ /dev/null @@ -1,40 +0,0 @@ -use luajit2_sys as sys; - -#[test] -fn run_script() { - use std::ffi::CStr; - use std::ptr; - - unsafe { - let lua = sys::luaL_newstate(); - assert_ne!(lua, ptr::null_mut()); - sys::luaL_openlibs(lua); - let script_data = b"return 1 + 2"; - let script_name = b"run_script\0"; - let mut error = sys::luaL_loadbuffer( - lua, - script_data.as_ptr() as _, - script_data.len() as _, - script_name.as_ptr() as _, - ); - if error != 0 { - eprintln!("luaL_loadbuffer failed"); - } else { - error = sys::lua_pcall(lua, 0, 1, 0); - if error != 0 { - eprintln!("lua_pcall failed"); - } - } - - let idx = sys::lua_gettop(lua); - println!("lua_gettop = {}", idx); - - let s = sys::lua_tostring(lua, idx); - assert_ne!(s, ptr::null(), "lua_tostring returned null"); - - let result = CStr::from_ptr(s).to_string_lossy().to_string(); - sys::lua_close(lua); - - assert_eq!("3", result); - } -} From 3bf4b7f0d1e9ee171310d0a43bc750171607e116 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Tue, 1 Jul 2025 16:17:05 +0200 Subject: [PATCH 146/154] luajit2-sys: Move dependencies to workspace --- Cargo.lock | 12 ++++++------ Cargo.toml | 4 ++++ lib/luajit2-sys/Cargo.toml | 8 ++++---- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b25b0b3..9fd5a96 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -379,9 +379,9 @@ dependencies = [ [[package]] name = "cc" -version = "1.1.13" +version = "1.2.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "72db2f7947ecee9b03b510377e8bb9077afa27176fdbff55c51027e976fdcc48" +checksum = "d487aa071b5f64da6f19a3e848e3578944b726ee5a4854b82172f02aa876bfdc" dependencies = [ "jobserver", "libc", @@ -2173,9 +2173,9 @@ checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" [[package]] name = "libc" -version = "0.2.172" +version = "0.2.174" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d750af042f7ef4f724306de029d18836c26c1765a54a6a3f094cbd23a7267ffa" +checksum = "1171693293099992e19cddea4e8b849964e9846f4acee11b3948bcc337be8776" [[package]] name = "libloading" @@ -2184,7 +2184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.48.5", + "windows-targets 0.52.6", ] [[package]] @@ -4581,7 +4581,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.59.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 99ce493..15e26c6 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,8 +16,10 @@ ansi-parser = "0.9.1" ansi_term = "0.12.1" async-recursion = "1.0.5" bincode = "2.0.0" +bindgen = "0.70.1" bitflags = "2.5.0" byteorder = "1.4.3" +cc = "1.2.27" clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } cli-table = { version = "0.5.0", default-features = false, features = ["derive"] } color-eyre = { path = "lib/color-eyre" } @@ -28,11 +30,13 @@ druid = { version = "0.8", features = ["im", "serde", "image", "png", "jpeg", "b druid-widget-nursery = "0.1" dtmt-shared = { path = "lib/dtmt-shared" } fastrand = "2.1.0" +fs_extra = "1.1.0" futures = "0.3.25" futures-util = "0.3.24" glob = "0.3.0" interprocess = "2.1.0" lazy_static = "1.4.0" +libc = "0.2.174" luajit2-sys = { path = "lib/luajit2-sys" } minijinja = { version = "2.0.1", default-features = false, features = ["serde"] } nanorand = "0.8.0" diff --git a/lib/luajit2-sys/Cargo.toml b/lib/luajit2-sys/Cargo.toml index 69e935b..65dd61a 100644 --- a/lib/luajit2-sys/Cargo.toml +++ b/lib/luajit2-sys/Cargo.toml @@ -12,9 +12,9 @@ documentation = "https://docs.rs/luajit2-sys" links = "luajit" [dependencies] -libc = "0.2" +libc = { workspace = true } [build-dependencies] -bindgen = "0.70.1" -cc = "1" -fs_extra = "1.1.0" +bindgen = { workspace = true } +cc = { workspace = true } +fs_extra = { workspace = true } From b2a98a39ce93f9caeb25faf424178a13635f4dbf Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 2 Jul 2025 13:31:19 +0200 Subject: [PATCH 147/154] luajit2-sys: Apply clippy lints --- lib/luajit2-sys/build.rs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/luajit2-sys/build.rs b/lib/luajit2-sys/build.rs index d291dd7..fc564db 100644 --- a/lib/luajit2-sys/build.rs +++ b/lib/luajit2-sys/build.rs @@ -114,7 +114,7 @@ fn build_gcc(src_dir: &str) { fn build_msvc(src_dir: &str, out_dir: &str) { let mut cc = Build::new(); - // cc can't handle many of the `cland-dl`-specific flags, so + // cc can't handle many of the `clang-dl`-specific flags, so // we need to port them manually from a `make -n` run. cc.out_dir(out_dir) // `llvm-as` (which the clang-based toolchain for MSVC would use to compile `lj_vm.S` @@ -145,7 +145,7 @@ fn build_msvc(src_dir: &str, out_dir: &str) { fn main() { let luajit_dir = format!("{}/luajit", env!("CARGO_MANIFEST_DIR")); let out_dir = env::var("OUT_DIR").unwrap(); - let src_dir = format!("{}/luajit/src", out_dir); + let src_dir = format!("{out_dir}/luajit/src"); dbg!(&luajit_dir); dbg!(&out_dir); @@ -164,20 +164,20 @@ fn main() { // sources to re-compile just the library. if env::var("CARGO_CFG_WINDOWS").is_ok() { build_msvc(&src_dir, &out_dir); - println!("cargo:rustc-link-search={}", out_dir); + println!("cargo:rustc-link-search={out_dir}"); } else { - println!("cargo:rustc-link-search=native={}", src_dir); + println!("cargo:rustc-link-search=native={src_dir}"); } - println!("cargo:lib-name={}", LIB_NAME); - println!("cargo:include={}", src_dir); - println!("cargo:rustc-link-lib=static={}", LIB_NAME); + println!("cargo:lib-name={LIB_NAME}"); + println!("cargo:include={src_dir}"); + println!("cargo:rustc-link-lib=static={LIB_NAME}"); let mut bindings = bindgen::Builder::default(); for header in LUAJIT_HEADERS { - println!("cargo:rerun-if-changed={}/src/{}", luajit_dir, header); - bindings = bindings.header(format!("{}/src/{}", luajit_dir, header)); + println!("cargo:rerun-if-changed={luajit_dir}/src/{header}"); + bindings = bindings.header(format!("{luajit_dir}/src/{header}")); } let bindings = bindings From f47dd4ecb8e47cb6910a37e9c4dd663ca154f97d Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 2 Jul 2025 14:39:47 +0200 Subject: [PATCH 148/154] Update color-eyre --- lib/color-eyre | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/color-eyre b/lib/color-eyre index 228b8ca..bdefeef 160000 --- a/lib/color-eyre +++ b/lib/color-eyre @@ -1 +1 @@ -Subproject commit 228b8ca37ee79ab9afa45c40da415e4dcb029751 +Subproject commit bdefeef09803df45bdf6dae7f3ae289e58427e3a From 71051a384b98fc55eb494dc37f2eea89d0e6c106 Mon Sep 17 00:00:00 2001 From: Lucas Schwiderski Date: Wed, 2 Jul 2025 16:18:25 +0200 Subject: [PATCH 149/154] luajit2-sys: Compile in parallel --- Cargo.toml | 2 +- lib/luajit2-sys/build.rs | 13 +++++++------ 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 15e26c6..608bcda 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -19,7 +19,7 @@ bincode = "2.0.0" bindgen = "0.70.1" bitflags = "2.5.0" byteorder = "1.4.3" -cc = "1.2.27" +cc = { version = "1.2.27", features = ["parallel"] } clap = { version = "4.0.15", features = ["color", "derive", "std", "cargo", "string", "unicode"] } cli-table = { version = "0.5.0", default-features = false, features = ["derive"] } color-eyre = { path = "lib/color-eyre" } diff --git a/lib/luajit2-sys/build.rs b/lib/luajit2-sys/build.rs index fc564db..ea6026b 100644 --- a/lib/luajit2-sys/build.rs +++ b/lib/luajit2-sys/build.rs @@ -82,6 +82,11 @@ const LUAJIT_SRC: [&str; 65] = [ fn build_gcc(src_dir: &str) { let mut buildcmd = Command::new("make"); + if let Ok(flags) = env::var("CARGO_MAKEFLAGS") { + buildcmd.env("MAKEFLAGS", flags); + } else { + buildcmd.arg("-j8"); + } buildcmd.current_dir(src_dir); buildcmd.stderr(Stdio::inherit()); buildcmd.arg("--no-silent"); @@ -102,14 +107,10 @@ fn build_gcc(src_dir: &str) { let mut child = buildcmd.spawn().expect("failed to run make"); - if !child + child .wait() .map(|status| status.success()) - .map_err(|_| false) - .unwrap_or(false) - { - panic!("Failed to build luajit"); - } + .expect("Failed to build LuaJIT"); } fn build_msvc(src_dir: &str, out_dir: &str) { From ef24d9bee6016f39fdf12c1f61b345bf74e126d9 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 2 Jul 2025 14:46:46 +0000 Subject: [PATCH 150/154] fix(deps): update rust crate reqwest to v0.12.22 --- Cargo.lock | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fd5a96..352b727 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2184,7 +2184,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3077,9 +3077,9 @@ checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" [[package]] name = "reqwest" -version = "0.12.21" +version = "0.12.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c8cea6b35bcceb099f30173754403d2eba0a5dc18cea3630fccd88251909288" +checksum = "cbc931937e6ca3a06e3b6c0aa7841849b160a90351d6ab467a8b9b9959767531" dependencies = [ "base64 0.22.1", "bytes", @@ -4581,7 +4581,7 @@ version = "0.1.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cf221c93e13a30d793f7645a0e7762c55d169dbb0a49671918a2319d289b10bb" dependencies = [ - "windows-sys 0.59.0", + "windows-sys 0.48.0", ] [[package]] From db0a597342fe3740f316efe802af2ce73341c64d Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 2 Jul 2025 14:46:49 +0000 Subject: [PATCH 151/154] chore(deps): update dependency xwin to v0.6.6 --- .ci/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/image/Dockerfile b/.ci/image/Dockerfile index b995065..96347ce 100644 --- a/.ci/image/Dockerfile +++ b/.ci/image/Dockerfile @@ -2,7 +2,7 @@ FROM debian:bullseye-slim AS xwin # renovate: datasource=github-releases depName=xwin packageName=Jake-Shadle/xwin -ARG XWIN_VERSION=0.5.2 +ARG XWIN_VERSION=0.6.6 ARG XWIN_PREFIX="xwin-$XWIN_VERSION-x86_64-unknown-linux-musl" ADD https://github.com/Jake-Shadle/xwin/releases/download/$XWIN_VERSION/$XWIN_PREFIX.tar.gz /root/$XWIN_PREFIX.tar.gz From 501b216be3f8696a226c6c4931679b6c14c70779 Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 2 Jul 2025 14:46:54 +0000 Subject: [PATCH 152/154] chore(deps): update rust crate bindgen to 0.72.0 --- Cargo.lock | 24 ++---------------------- Cargo.toml | 2 +- 2 files changed, 3 insertions(+), 23 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fd5a96..a09eacb 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -227,26 +227,6 @@ dependencies = [ "virtue", ] -[[package]] -name = "bindgen" -version = "0.70.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" -dependencies = [ - "bitflags 2.9.1", - "cexpr", - "clang-sys", - "itertools", - "log", - "prettyplease", - "proc-macro2", - "quote", - "regex", - "rustc-hash 1.1.0", - "shlex", - "syn 2.0.100", -] - [[package]] name = "bindgen" version = "0.72.0" @@ -2241,7 +2221,7 @@ checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" name = "luajit2-sys" version = "0.0.2" dependencies = [ - "bindgen 0.70.1", + "bindgen", "cc", "fs_extra", "libc", @@ -2546,7 +2526,7 @@ checksum = "3fdb12b2476b595f9358c5161aa467c2438859caa136dec86c26fdd2efe17b92" name = "oodle" version = "0.1.0" dependencies = [ - "bindgen 0.72.0", + "bindgen", "color-eyre", "tracing", ] diff --git a/Cargo.toml b/Cargo.toml index 608bcda..35f8d72 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,7 +16,7 @@ ansi-parser = "0.9.1" ansi_term = "0.12.1" async-recursion = "1.0.5" bincode = "2.0.0" -bindgen = "0.70.1" +bindgen = "0.72.0" bitflags = "2.5.0" byteorder = "1.4.3" cc = { version = "1.2.27", features = ["parallel"] } From 56d9866301d15e03ecb16aff83ce2575fcfd8ede Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 2 Jul 2025 14:47:03 +0000 Subject: [PATCH 153/154] chore(deps): update rust crate tokio to v1.46.0 --- Cargo.lock | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9fd5a96..8206d78 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2014,6 +2014,17 @@ dependencies = [ "unic-langid", ] +[[package]] +name = "io-uring" +version = "0.7.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b86e202f00093dcba4275d4636b93ef9dd75d025ae560d2521b45ea28ab49013" +dependencies = [ + "bitflags 2.9.1", + "cfg-if", + "libc", +] + [[package]] name = "ipnet" version = "2.9.0" @@ -2184,7 +2195,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" dependencies = [ "cfg-if", - "windows-targets 0.52.6", + "windows-targets 0.48.5", ] [[package]] @@ -3870,16 +3881,18 @@ dependencies = [ [[package]] name = "tokio" -version = "1.45.1" +version = "1.46.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75ef51a33ef1da925cea3e4eb122833cb377c61439ca401b770f54902b806779" +checksum = "1140bb80481756a8cbe10541f37433b459c5aa1e727b4c020fbfebdc25bf3ec4" dependencies = [ "backtrace", "bytes", + "io-uring", "libc", "mio", "pin-project-lite", "signal-hook-registry", + "slab", "socket2", "tokio-macros", "tracing", From 1e2c20ce0b37f65ddee4f07537b02dc117caa9db Mon Sep 17 00:00:00 2001 From: Renovate Date: Wed, 2 Jul 2025 15:01:33 +0000 Subject: [PATCH 154/154] chore(deps): update dependency llvm to v20 --- .ci/image/Dockerfile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.ci/image/Dockerfile b/.ci/image/Dockerfile index b995065..17865f2 100644 --- a/.ci/image/Dockerfile +++ b/.ci/image/Dockerfile @@ -62,7 +62,7 @@ COPY lib/oodle/*.so lib/oodle/*.a /src/ FROM linux AS msvc # renovate: datasource=github-releases depName=llvm packageName=llvm/llvm-project -ARG LLVM_VERSION=18 +ARG LLVM_VERSION=20 ENV KEYRINGS /usr/local/share/keyrings ADD https://apt.llvm.org/llvm-snapshot.gpg.key /root/llvm-snapshot.gpg.key