From 76de35e28c6c7cc993f01cc2d90a289d8118f342 Mon Sep 17 00:00:00 2001 From: Uriel Date: Fri, 16 Dec 2022 13:14:33 -0300 Subject: [PATCH] Show git commit in version (#351) --- CONTRIBUTING.md | 9 + Cargo.lock | 466 ++++++++++++++++----- gui/src-tauri/Cargo.toml | 8 +- gui/src-tauri/build.rs | 3 +- gui/src-tauri/src/main.rs | 28 +- gui/src-tauri/tauri.conf.json | 5 +- gui/src/components/TopBar.tsx | 4 +- gui/src/global.d.ts | 14 + gui/vite.config.ts | 15 + server/build.gradle | 13 + server/src/main/java/dev/slimevr/Main.java | 10 +- 11 files changed, 457 insertions(+), 118 deletions(-) create mode 100644 gui/src/global.d.ts diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 364fb7796..01f371f5e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -64,6 +64,15 @@ Import the formatting settings defined in `spotless.xml`, like this: Eclipse will only do a subset of the checks in `spotless`, so you may still want to do `./gradlew spotlessApply` if you ever see an error from spotless. +### Version bumping +* Create the git tag instead of making it from releases, you can do it by just ``git tag VERSION``, + example ``git tag v0.5.0`` +* You need to push this change with ``git push origin VERSION`` or ``git push origin --tags`` +(will push all tags you made). + +We recommend committing first and then making the tag, that tag will point to the commit you are currently +on. + ## Code Licensing SlimeVR uses an MIT license, and some parts of the project use a dual MIT/Apache 2.0 license. Be sure that any code that you reference, or dependencies you add, are diff --git a/Cargo.lock b/Cargo.lock index 363f14946..246fbefc5 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -32,6 +32,15 @@ dependencies = [ "alloc-no-stdlib", ] +[[package]] +name = "android_system_properties" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "819e7219dbd41043ac279b19830f2efc897156490d7fd6ea916720117ee66311" +dependencies = [ + "libc", +] + [[package]] name = "anyhow" version = "1.0.66" @@ -68,7 +77,7 @@ version = "0.2.14" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d9b39be18770d11421cdb1b9947a45dd3f37e93092cbf377614828a319d5fee8" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", "winapi", ] @@ -208,6 +217,9 @@ name = "cc" version = "1.0.77" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e9f73505338f7d905b19d18738976aae232eb46b8efc15554ffc56deb5d9ebe4" +dependencies = [ + "jobserver", +] [[package]] name = "cesu8" @@ -257,26 +269,24 @@ checksum = "fd16c4719339c4530435d38e511904438d07cce7950afa3718a84ac36c10e89e" [[package]] name = "clap" -version = "3.2.23" +version = "4.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "71655c45cb9845d3270c9d6df84ebe72b4dad3c2ba3f7023ad47c144e4e473a5" +checksum = "4d63b9e9c07271b9957ad22c173bae2a4d9a81127680962039296abcd2f8251d" dependencies = [ - "atty", "bitflags", "clap_derive", "clap_lex", - "indexmap", + "is-terminal", "once_cell", "strsim", "termcolor", - "textwrap", ] [[package]] name = "clap-verbosity-flag" -version = "1.0.1" +version = "2.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0636f9c040082f8e161555a305f8cec1a1c2828b3d981c812b8c39f4ac00c42c" +checksum = "23e2b6c3dcdb73299f48ae05b294da14e2f560b3ed2c09e742269eb1b22af231" dependencies = [ "clap", "log", @@ -284,9 +294,9 @@ dependencies = [ [[package]] name = "clap_derive" -version = "3.2.18" +version = "4.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ea0c8bce528c4be4da13ea6fead8965e95b6073585a2f05204bd8f4119f82a65" +checksum = "0177313f9f02afc995627906bbd8967e2be069f5261954222dac78290c2b9014" dependencies = [ "heck 0.4.0", "proc-macro-error", @@ -297,9 +307,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.2.4" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2850f2f5a82cbf437dd5af4d49848fbdfc27c157c3d010345776f952765261c5" +checksum = "0d4198f73e42b4936b35b5bb248d81d2b595ecb170da0bac7655c54eedfa8da8" dependencies = [ "os_str_bytes", ] @@ -335,6 +345,16 @@ dependencies = [ "objc", ] +[[package]] +name = "codespan-reporting" +version = "0.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3538270d33cc669650c4b093848450d380def10c331d38c768e34cac80576e6e" +dependencies = [ + "termcolor", + "unicode-width", +] + [[package]] name = "color_quant" version = "1.1.0" @@ -351,6 +371,32 @@ dependencies = [ "memchr", ] +[[package]] +name = "const_fn" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fbdcdcb6d86f71c5e97409ad45898af11cbc995b4ee8112d59095a28d376c935" + +[[package]] +name = "const_format" +version = "0.2.30" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7309d9b4d3d2c0641e018d449232f2e28f1b22933c137f157d3dbc14228b8c0e" +dependencies = [ + "const_format_proc_macros", +] + +[[package]] +name = "const_format_proc_macros" +version = "0.2.29" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d897f47bf7270cf70d370f8f98c1abb6d2d4cf60a6845d30e05bfb90c6568650" +dependencies = [ + "proc-macro2", + "quote", + "unicode-xid", +] + [[package]] name = "convert_case" version = "0.4.0" @@ -488,6 +534,50 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b365fabc795046672053e29c954733ec3b05e4be654ab130fe8f1f94d7051f35" +[[package]] +name = "cxx" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bdf07d07d6531bfcdbe9b8b739b104610c6508dcc4d63b410585faf338241daf" +dependencies = [ + "cc", + "cxxbridge-flags", + "cxxbridge-macro", + "link-cplusplus", +] + +[[package]] +name = "cxx-build" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2eb5b96ecdc99f72657332953d4d9c50135af1bac34277801cc3937906ebd39" +dependencies = [ + "cc", + "codespan-reporting", + "once_cell", + "proc-macro2", + "quote", + "scratch", + "syn", +] + +[[package]] +name = "cxxbridge-flags" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac040a39517fd1674e0f32177648334b0f4074625b5588a64519804ba0553b12" + +[[package]] +name = "cxxbridge-macro" +version = "1.0.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1362b0ddcfc4eb0a1f57b68bd77dd99f0e826958a96abd0ae9bd092e114ffed6" +dependencies = [ + "proc-macro2", + "quote", + "syn", +] + [[package]] name = "darling" version = "0.13.4" @@ -628,6 +718,27 @@ dependencies = [ "termcolor", ] +[[package]] +name = "errno" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f639046355ee4f37944e44f60642c6f3a7efa3cf6b78c78a0d989a8ce6c396a1" +dependencies = [ + "errno-dragonfly", + "libc", + "winapi", +] + +[[package]] +name = "errno-dragonfly" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa68f1b12764fab894d2755d2518754e71b4fd80ecfb822714a1206c2aab39bf" +dependencies = [ + "cc", + "libc", +] + [[package]] name = "fastrand" version = "1.8.0" @@ -649,9 +760,9 @@ dependencies = [ [[package]] name = "filetime" -version = "0.2.18" +version = "0.2.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b9663d381d07ae25dc88dbdf27df458faa83a9b25336bcac83d5e452b5fc9d3" +checksum = "4e884668cd0c7480504233e951174ddc3b382f7c2666e3b7310b5c4e7b0c37f9" dependencies = [ "cfg-if", "libc", @@ -855,15 +966,15 @@ dependencies = [ [[package]] name = "generator" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc184cace1cea8335047a471cc1da80f18acf8a76f3bab2028d499e328948ec7" +checksum = "d266041a359dfa931b370ef684cceb84b166beb14f7f0421f4a6a3d0c446d12e" dependencies = [ "cc", "libc", "log", "rustversion", - "windows 0.32.0", + "windows 0.39.0", ] [[package]] @@ -928,6 +1039,19 @@ dependencies = [ "winapi", ] +[[package]] +name = "git2" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2994bee4a3a6a51eb90c218523be382fd7ea09b16380b9312e9dbe955ff7c7d1" +dependencies = [ + "bitflags", + "libc", + "libgit2-sys", + "log", + "url", +] + [[package]] name = "glib" version = "0.15.12" @@ -1088,6 +1212,15 @@ dependencies = [ "libc", ] +[[package]] +name = "hermit-abi" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" +dependencies = [ + "libc", +] + [[package]] name = "html5ever" version = "0.25.2" @@ -1128,6 +1261,30 @@ dependencies = [ "quick-error", ] +[[package]] +name = "iana-time-zone" +version = "0.1.53" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64c122667b287044802d6ce17ee2ddf13207ed924c712de9a66a5814d5b64765" +dependencies = [ + "android_system_properties", + "core-foundation-sys", + "iana-time-zone-haiku", + "js-sys", + "wasm-bindgen", + "winapi", +] + +[[package]] +name = "iana-time-zone-haiku" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0703ae284fc167426161c2e3f1da3ea71d94b21bedbcc9494e92b28e334e3dca" +dependencies = [ + "cxx", + "cxx-build", +] + [[package]] name = "ico" version = "0.2.0" @@ -1213,6 +1370,34 @@ dependencies = [ "cfg-if", ] +[[package]] +name = "io-lifetimes" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46112a93252b123d31a119a8d1a1ac19deac4fac6e0e8b0df58f0d4e5870e63c" +dependencies = [ + "libc", + "windows-sys", +] + +[[package]] +name = "is-terminal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "927609f78c2913a6f6ac3c27a4fe87f43e2a35367c0c4b0f8265e8f49a104330" +dependencies = [ + "hermit-abi 0.2.6", + "io-lifetimes", + "rustix", + "windows-sys", +] + +[[package]] +name = "is_debug" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "06d198e9919d9822d5f7083ba8530e04de87841eaf21ead9af8f2304efd57c89" + [[package]] name = "itoa" version = "0.4.8" @@ -1268,6 +1453,15 @@ version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "8eaf4bc02d17cbdd7ff4c7438cafcdf7fb9a4613313ad11b4f8fefe7d3fa0130" +[[package]] +name = "jobserver" +version = "0.1.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "068b1ee6743e4d11fb9c6a1e6064b3693a1b600e7f5f5988047d98b3dc9fb90b" +dependencies = [ + "libc", +] + [[package]] name = "js-sys" version = "0.3.60" @@ -1279,9 +1473,9 @@ dependencies = [ [[package]] name = "json-patch" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f995a3c8f2bc3dd52a18a583e90f9ec109c047fa1603a853e46bcda14d2e279d" +checksum = "eb3fa5a61630976fc4c353c70297f2e93f1930e3ccee574d59d618ccbd5154ce" dependencies = [ "serde", "serde_json", @@ -1308,9 +1502,33 @@ checksum = "e2abad23fbc42b3700f2f279844dc832adb2b2eb069b2df918f455c4e18cc646" [[package]] name = "libc" -version = "0.2.137" +version = "0.2.138" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fc7fcc620a3bff7cdd7a365be3376c97191aeaccc2a603e600951e452615bf89" +checksum = "db6d7e329c562c5dfab7a46a2afabc8b987ab9a4834c9d1ca04dc54c1546cef8" + +[[package]] +name = "libgit2-sys" +version = "0.14.0+1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "47a00859c70c8a4f7218e6d1cc32875c4b55f6799445b842b0d8ed5e4c3d959b" +dependencies = [ + "cc", + "libc", + "libz-sys", + "pkg-config", +] + +[[package]] +name = "libz-sys" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9702761c3935f8cc2f101793272e202c72b99da8f4224a19ddcf1279a6450bbf" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] [[package]] name = "line-wrap" @@ -1321,6 +1539,21 @@ dependencies = [ "safemem", ] +[[package]] +name = "link-cplusplus" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9272ab7b96c9046fbc5bc56c06c117cb639fe2d509df0c421cad82d2915cf369" +dependencies = [ + "cc", +] + +[[package]] +name = "linux-raw-sys" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f051f77a7c8e6957c0696eac88f26b0117e54f52d3fc682ab19397a8812846a4" + [[package]] name = "lock_api" version = "0.4.9" @@ -1509,7 +1742,7 @@ version = "1.14.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f6058e64324c71e02bc2b150e4f3bc8286db6c83092132ffa3f6b1eab0f9def5" dependencies = [ - "hermit-abi", + "hermit-abi 0.1.19", "libc", ] @@ -1534,6 +1767,15 @@ dependencies = [ "syn", ] +[[package]] +name = "num_threads" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2819ce041d2ee131036f4fc9d6ae7ae125a3a40e97ba64d04fe799ad9dabbb44" +dependencies = [ + "libc", +] + [[package]] name = "objc" version = "0.2.7" @@ -1591,12 +1833,12 @@ dependencies = [ [[package]] name = "os_pipe" -version = "1.1.1" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dceb7e43f59c35ee1548045b2c72945a5a3bb6ce6d6f07cdc13dc8f6bc4930a" +checksum = "c6a252f1f8c11e84b3ab59d7a488e48e4478a93937e027076638c49536204639" dependencies = [ "libc", - "winapi", + "windows-sys", ] [[package]] @@ -1648,9 +1890,9 @@ dependencies = [ [[package]] name = "parking_lot_core" -version = "0.9.4" +version = "0.9.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4dc9e0dc2adc1c69d09143aff38d3d30c5c3f0df0dad82e6d25547af174ebec0" +checksum = "7ff9f3fef3968a3ec5945535ed654cb38ff72d7495a25619e2247fb15a2ed9ba" dependencies = [ "cfg-if", "libc", @@ -1661,9 +1903,9 @@ dependencies = [ [[package]] name = "paste" -version = "1.0.9" +version = "1.0.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b1de2e551fb905ac83f73f7aedf2f0cb4a0da7e35efa24a202a936269f1f18e1" +checksum = "cf1c2c742266c2f1041c914ba65355a83ae8747b05f208319784083583494b4b" [[package]] name = "pathdiff" @@ -1679,9 +1921,9 @@ checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" [[package]] name = "pest" -version = "2.5.0" +version = "2.5.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f400b0f7905bf702f9f3dc3df5a121b16c54e9e8012c082905fdf09a931861a" +checksum = "cc8bed3549e0f9b0a2a78bf7c0018237a2cdf085eecbbc048e52612438e4e9d0" dependencies = [ "thiserror", "ucd-trie", @@ -2103,6 +2345,20 @@ dependencies = [ "semver 1.0.14", ] +[[package]] +name = "rustix" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a3807b5d10909833d3e9acd1eb5fb988f79376ff10fce42937de71a449c4c588" +dependencies = [ + "bitflags", + "errno", + "io-lifetimes", + "libc", + "linux-raw-sys", + "windows-sys", +] + [[package]] name = "rustversion" version = "1.0.9" @@ -2142,6 +2398,12 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d29ab0c6d3fc0ee92fe66e2d99f700eab17a8d57d1c1d3b748380fb20baa78cd" +[[package]] +name = "scratch" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8132065adcfd6e02db789d9285a0deb2f3fcb04002865ab67d5fb103533898" + [[package]] name = "selectors" version = "0.22.0" @@ -2191,18 +2453,18 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.147" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d193d69bae983fc11a79df82342761dfbf28a99fc8d203dca4c3c1b590948965" +checksum = "e326c9ec8042f1b5da33252c8a37e9ffbd2c9bef0155215b6e6c80c790e05f91" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.147" +version = "1.0.150" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4f1d362ca8fc9c3e3a7484440752472d68a6caa98f1ab81d99b5dfe517cec852" +checksum = "42a3df25b0713732468deadad63ab9da1f1fd75a48a15024b50363f128db627e" dependencies = [ "proc-macro2", "quote", @@ -2296,6 +2558,19 @@ dependencies = [ "digest", ] +[[package]] +name = "shadow-rs" +version = "0.18.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bf8e33626554dd9027d240a3b91d73be43054c0f9ef645cdf0483b6ebe822fa" +dependencies = [ + "const_format", + "git2", + "is_debug", + "time", + "tzdb", +] + [[package]] name = "sharded-slab" version = "0.1.4" @@ -2335,13 +2610,16 @@ name = "slimevr" version = "0.0.0" dependencies = [ "cfg_aliases", + "clap", "clap-verbosity-flag", + "const_format", "log", "open", "pretty_env_logger", "rand 0.8.5", "serde", "serde_json", + "shadow-rs", "tauri", "tauri-build", "tauri-plugin-window-state", @@ -2434,9 +2712,9 @@ checksum = "73473c0e59e6d5812c5dfe2a064a6444949f089e20eec9a2e5506596494e4623" [[package]] name = "syn" -version = "1.0.103" +version = "1.0.105" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a864042229133ada95abf3b54fdc62ef5ccabe9515b64717bcb9a1919e59445d" +checksum = "60b9b43d45702de4c839cb9b51d9f529c5dd26a4aff255b42b1ebc03e88ee908" dependencies = [ "proc-macro2", "quote", @@ -2471,9 +2749,9 @@ dependencies = [ [[package]] name = "tao" -version = "0.15.6" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8c8fab9f2ba9a6d7ad55b46f812984b6ab203d774c162163ac297edc9567404b" +checksum = "a1fa15735311b4816d030ff54da58560b047daca0970e1031aed5502e84231a8" dependencies = [ "bitflags", "cairo-rs", @@ -2528,12 +2806,11 @@ dependencies = [ [[package]] name = "tauri" -version = "1.2.1" +version = "1.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18203448b9d4dcad55607eafeda6dc7fe135848e5f567cd8bdade6cafd8b1a85" +checksum = "d8ea1d785ab2164373703817bff144c4610a69ad3f659becaca0e1ea004b98d8" dependencies = [ "anyhow", - "clap", "cocoa", "dirs-next", "embed_plist", @@ -2666,9 +2943,9 @@ dependencies = [ [[package]] name = "tauri-runtime-wry" -version = "0.12.1" +version = "0.12.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7821c34cf1bd6d89ff46b46a53f3a5050d92afaf2053569f1cc4531167257b24" +checksum = "36b1c5764a41a13176a4599b5b7bd0881bea7d94dfe45e1e755f789b98317e30" dependencies = [ "cocoa", "gtk", @@ -2746,12 +3023,6 @@ dependencies = [ "winapi-util", ] -[[package]] -name = "textwrap" -version = "0.16.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "222a222a5bfe1bba4a77b45ec488a741b3cb8872e5e499451fd7d0129c9c7c3d" - [[package]] name = "thin-slice" version = "0.1.1" @@ -2794,6 +3065,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a561bf4617eebd33bca6434b988f39ed798e527f51a1e797d0ee4f61c0a38376" dependencies = [ "itoa 1.0.4", + "libc", + "num_threads", "serde", "time-core", "time-macros", @@ -2831,15 +3104,16 @@ checksum = "cda74da7e1a664f795bb1f8a87ec406fb89a02522cf6e50620d016add6dbbf5c" [[package]] name = "tokio" -version = "1.22.0" +version = "1.23.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d76ce4a75fb488c605c54bf610f221cea8b0dafb53333c1a67e8ee199dcd2ae3" +checksum = "eab6d665857cc6ca78d6e80303a02cea7a7851e85dfbd77cbdc09bd129f1ef46" dependencies = [ "autocfg", "bytes", "memchr", "num_cpus", "pin-project-lite", + "windows-sys", ] [[package]] @@ -2924,9 +3198,28 @@ dependencies = [ [[package]] name = "typenum" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dcf81ac59edc17cc8697ff311e8f5ef2d99fcbd9817b34cec66f90b6c3dfd987" +checksum = "497961ef93d974e23eb6f433eb5fe1b7930b659f06d12dec6fc44a8f554c0bba" + +[[package]] +name = "tz-rs" +version = "0.6.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "33851b15c848fad2cf4b105c6bb66eb9512b6f6c44a4b13f57c53c73c707e2b4" +dependencies = [ + "const_fn", +] + +[[package]] +name = "tzdb" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "12cf8bd66b64b0801ee3faac2b86a657d4ddbb345efa9bb6a18d626693d9c2de" +dependencies = [ + "iana-time-zone", + "tz-rs", +] [[package]] name = "ucd-trie" @@ -2961,6 +3254,18 @@ version = "1.10.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "0fdbf052a0783de01e944a6ce7a8cb939e295b1e7be835a1112c3b9a7f047a5a" +[[package]] +name = "unicode-width" +version = "0.1.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0edd1e5b14653f783770bce4a4dabb4a5108a5370a5f5d8cfe8710c361f6c8b" + +[[package]] +name = "unicode-xid" +version = "0.2.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f962df74c8c05a667b5ee8bcf162993134c104e96440b663c8daa176dc772d8c" + [[package]] name = "url" version = "2.3.1" @@ -3000,6 +3305,12 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + [[package]] name = "version-compare" version = "0.0.11" @@ -3254,19 +3565,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fbedf6db9096bc2364adce0ae0aa636dcd89f3c3f2cd67947062aaf0ca2a10ec" -dependencies = [ - "windows_aarch64_msvc 0.32.0", - "windows_i686_gnu 0.32.0", - "windows_i686_msvc 0.32.0", - "windows_x86_64_gnu 0.32.0", - "windows_x86_64_msvc 0.32.0", -] - [[package]] name = "windows" version = "0.37.0" @@ -3347,12 +3645,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "41d2aa71f6f0cbe00ae5167d90ef3cfe66527d6f613ca78ac8024c3ccab9a19e" -[[package]] -name = "windows_aarch64_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d8e92753b1c443191654ec532f14c199742964a061be25d77d7a96f09db20bf5" - [[package]] name = "windows_aarch64_msvc" version = "0.37.0" @@ -3371,12 +3663,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "dd0f252f5a35cac83d6311b2e795981f5ee6e67eb1f9a7f64eb4500fbc4dcdb4" -[[package]] -name = "windows_i686_gnu" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6a711c68811799e017b6038e0922cb27a5e2f43a2ddb609fe0b6f3eeda9de615" - [[package]] name = "windows_i686_gnu" version = "0.37.0" @@ -3395,12 +3681,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "fbeae19f6716841636c28d695375df17562ca208b2b7d0dc47635a50ae6c5de7" -[[package]] -name = "windows_i686_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "146c11bb1a02615db74680b32a68e2d61f553cc24c4eb5b4ca10311740e44172" - [[package]] name = "windows_i686_msvc" version = "0.37.0" @@ -3419,12 +3699,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "84c12f65daa39dd2babe6e442988fc329d6243fdce47d7d2d155b8d874862246" -[[package]] -name = "windows_x86_64_gnu" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c912b12f7454c6620635bbff3450962753834be2a594819bd5e945af18ec64bc" - [[package]] name = "windows_x86_64_gnu" version = "0.37.0" @@ -3449,12 +3723,6 @@ version = "0.42.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09d525d2ba30eeb3297665bd434a54297e4170c7f1a44cad4ef58095b4cd2028" -[[package]] -name = "windows_x86_64_msvc" -version = "0.32.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "504a2476202769977a040c6364301a3f65d0cc9e3fb08600b2bda150a0488316" - [[package]] name = "windows_x86_64_msvc" version = "0.37.0" @@ -3493,9 +3761,9 @@ dependencies = [ [[package]] name = "wry" -version = "0.22.4" +version = "0.23.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "538b1e167b9905baca8e8a91367ac0c7d0afbead632ad76ad9667748209a4c78" +checksum = "4c1ad8e2424f554cc5bdebe8aa374ef5b433feff817aebabca0389961fc7ef98" dependencies = [ "base64", "block", diff --git a/gui/src-tauri/Cargo.toml b/gui/src-tauri/Cargo.toml index 0b1e0c850..452aa212d 100644 --- a/gui/src-tauri/Cargo.toml +++ b/gui/src-tauri/Cargo.toml @@ -23,19 +23,23 @@ custom-protocol = ["tauri/custom-protocol"] [build-dependencies] tauri-build = { version = "1.2", features = [] } cfg_aliases = "0.1" +shadow-rs = "0.18" [dependencies] serde_json = "1" serde = { version = "1", features = ["derive"] } -tauri = { version = "1.2", features = ["cli", "devtools", "dialog", "fs-all", "path-all", "shell-execute", "window-close", "window-maximize", "window-minimize", "window-set-resizable", "window-set-title", "window-start-dragging", "window-unmaximize", "window-unminimize"] } +tauri = { version = "1.2", features = ["devtools", "dialog", "fs-all", "path-all", "shell-execute", "window-close", "window-maximize", "window-minimize", "window-set-resizable", "window-set-title", "window-start-dragging", "window-unmaximize", "window-unminimize"] } pretty_env_logger = "0.4" log = "0.4" -clap-verbosity-flag = "1" +clap = { version = "4.0.29", features = ["derive"] } +clap-verbosity-flag = "2" tauri-plugin-window-state = "0.1.0" rand = "0.8.5" tempfile = "3" which = "4.3.0" open = "3" +shadow-rs = { version = "0.18", default-features = false } +const_format = "0.2.30" [target.'cfg(windows)'.dependencies] win32job = "1" diff --git a/gui/src-tauri/build.rs b/gui/src-tauri/build.rs index 1ca8a194b..02ab9cb66 100644 --- a/gui/src-tauri/build.rs +++ b/gui/src-tauri/build.rs @@ -1,9 +1,10 @@ use cfg_aliases::cfg_aliases; -fn main() { +fn main() -> shadow_rs::SdResult<()> { tauri_build::build(); cfg_aliases! { mobile: { any(target_os = "ios", target_os = "android") }, desktop: { not(any(target_os = "ios", target_os = "android")) } } + shadow_rs::new() } diff --git a/gui/src-tauri/src/main.rs b/gui/src-tauri/src/main.rs index 4bdd7f5c2..c0996b590 100644 --- a/gui/src-tauri/src/main.rs +++ b/gui/src-tauri/src/main.rs @@ -9,9 +9,10 @@ use std::path::PathBuf; use std::process::{Child, Stdio}; use clap::Parser; -use clap_verbosity_flag::{InfoLevel, Verbosity}; +use const_format::concatcp; use rand::{seq::SliceRandom, thread_rng}; -use tauri::api::{clap, process::Command}; +use shadow_rs::shadow; +use tauri::api::process::Command; use tauri::Manager; use tempfile::Builder; use which::which_all; @@ -21,11 +22,7 @@ use which::which_all; const CREATE_NO_WINDOW: u32 = 0x0800_0000; /// It's an i32 because we check it through exit codes of the process const MINIMUM_JAVA_VERSION: i32 = 17; -const JAVA_BIN: &str = if cfg!(windows) { - "java.exe" -} else { - "java" -}; +const JAVA_BIN: &str = if cfg!(windows) { "java.exe" } else { "java" }; static POSSIBLE_TITLES: &[&str] = &[ "Panicking situation", "looking for spatula", @@ -33,16 +30,27 @@ static POSSIBLE_TITLES: &[&str] = &[ "never gonna let you down", "uwu sowwy", ]; +shadow!(build); +// Tauri has a way to return the package.json version, but it's not a constant... +const VERSION: &str = if build::TAG.is_empty() { + build::SHORT_COMMIT +} else { + build::TAG +}; +const MODIFIED: &str = if build::GIT_CLEAN { "" } else { "-dirty" }; -#[derive(Parser)] -#[clap(version, about)] +#[derive(Debug, Parser)] +#[clap( + version = concatcp!(VERSION, MODIFIED), + about +)] struct Cli { #[clap(short, long)] display_console: bool, #[clap(long)] launch_from_path: Option, #[clap(flatten)] - verbosity: Verbosity, + verbose: clap_verbosity_flag::Verbosity, } fn is_valid_path(path: &PathBuf) -> bool { diff --git a/gui/src-tauri/tauri.conf.json b/gui/src-tauri/tauri.conf.json index 57e27a868..74eb92ef3 100644 --- a/gui/src-tauri/tauri.conf.json +++ b/gui/src-tauri/tauri.conf.json @@ -1,7 +1,7 @@ { "package": { "productName": "slimevr", - "version": "0.0.0" + "version": "../package.json" }, "build": { "distDir": "../dist", @@ -80,7 +80,6 @@ ], "security": { "csp": null - }, - "cli": {} + } } } diff --git a/gui/src/components/TopBar.tsx b/gui/src/components/TopBar.tsx index cc4796226..05cd9eeb1 100644 --- a/gui/src/components/TopBar.tsx +++ b/gui/src/components/TopBar.tsx @@ -1,7 +1,6 @@ import { appWindow } from '@tauri-apps/api/window'; import { ReactNode } from 'react'; import { NavLink } from 'react-router-dom'; -import packagejson from '../../package.json'; import { CloseIcon } from './commons/icon/CloseIcon'; import { MaximiseIcon } from './commons/icon/MaximiseIcon'; import { MinimiseIcon } from './commons/icon/MinimiseIcon'; @@ -36,7 +35,8 @@ export function TopBar({ className="mx-2 flex justify-around flex-col text-standard-bold text-status-success bg-status-success bg-opacity-20 rounded-lg px-3" data-tauri-drag-region > - v{packagejson.version} + {(window.__VERSION_TAG__ || window.__COMMIT_HASH__) + + (window.__GIT_CLEAN__ ? '' : '-dirty')} diff --git a/gui/src/global.d.ts b/gui/src/global.d.ts new file mode 100644 index 000000000..d239bc34d --- /dev/null +++ b/gui/src/global.d.ts @@ -0,0 +1,14 @@ +/* eslint-disable no-var */ +// Use var for globalThis: +// https://www.typescriptlang.org/docs/handbook/release-notes/typescript-3-4.html#type-checking-for-globalthis + +declare global { + interface Window { + __COMMIT_HASH__: string; + __VERSION_TAG__: string; + __GIT_CLEAN__: boolean; + } +} + +// Export is necessary for types to export +export {}; diff --git a/gui/vite.config.ts b/gui/vite.config.ts index 1c7aa75a6..fd0694b2f 100644 --- a/gui/vite.config.ts +++ b/gui/vite.config.ts @@ -1,9 +1,24 @@ import { esbuildCommonjs, viteCommonjs } from '@originjs/vite-plugin-commonjs'; import react from '@vitejs/plugin-react'; import { defineConfig } from 'vite'; +import { execSync } from 'child_process'; + +const commitHash = execSync('git rev-parse --verify --short HEAD') + .toString() + .trim(); +const versionTag = execSync('git --no-pager tag --points-at HEAD') + .toString() + .trim(); +// If not empty then it's not clean +const gitClean = execSync('git status --porcelain').toString() ? false : true; // https://vitejs.dev/config/ export default defineConfig({ + define: { + __COMMIT_HASH__: JSON.stringify(commitHash), + __VERSION_TAG__: JSON.stringify(versionTag), + __GIT_CLEAN__: gitClean, + }, plugins: [viteCommonjs(), react()], build: { target: 'es2020', diff --git a/server/build.gradle b/server/build.gradle index 032ffec29..4c2c4ab89 100644 --- a/server/build.gradle +++ b/server/build.gradle @@ -10,6 +10,7 @@ plugins { id 'application' id "com.github.johnrengelman.shadow" version "7.1.2" id "com.diffplug.spotless" version "6.5.1" + id "com.github.gmazzo.buildconfig" version "3.1.0" } sourceCompatibility = JavaVersion.VERSION_17 @@ -81,6 +82,16 @@ application { getMainClass().set('dev.slimevr.Main') } +def gitCommitHash = 'git rev-parse --verify --short HEAD'.execute().text.trim() +def gitVersionTag = 'git --no-pager tag --points-at HEAD'.execute().text.trim() +def gitClean = 'git status --porcelain'.execute().text.isEmpty() +buildConfig { + packageName("dev.slimevr") + buildConfigField("String", "GIT_COMMIT_HASH", "\"${gitCommitHash}\"") + buildConfigField("String", "GIT_VERSION_TAG", "\"${gitVersionTag}\"") + buildConfigField("boolean", "GIT_CLEAN", "${gitClean}") +} + spotless { // optional: limit format enforcement to just the files changed by this feature branch // ratchetFrom 'origin/main' @@ -102,6 +113,8 @@ spotless { // indentWithSpaces(2) // YAML cannot contain tabs: https://yaml.org/faq.html // } java { + targetExclude '**/BuildConfig.java' + removeUnusedImports() // Use eclipse JDT formatter eclipse().configFile("spotless.xml") diff --git a/server/src/main/java/dev/slimevr/Main.java b/server/src/main/java/dev/slimevr/Main.java index 67a7e2c74..c6093d077 100644 --- a/server/src/main/java/dev/slimevr/Main.java +++ b/server/src/main/java/dev/slimevr/Main.java @@ -13,7 +13,9 @@ import java.net.ServerSocket; public class Main { - public static String VERSION = "0.5.1"; + public static final String VERSION = (BuildConfig.GIT_VERSION_TAG.isEmpty() + ? BuildConfig.GIT_COMMIT_HASH + : BuildConfig.GIT_VERSION_TAG) + (BuildConfig.GIT_CLEAN ? "" : "-dirty"); public static VRServer vrServer; @@ -28,8 +30,10 @@ public class Main { Options options = new Options(); Option help = new Option("h", "help", false, "Show help"); + Option version = new Option("V", "version", false, "Show version"); options.addOption(help); + options.addOption(version); try { cmd = parser.parse(options, args, true); } catch (ParseException e) { @@ -42,6 +46,10 @@ public class Main { formatter.printHelp("slimevr.jar", options); System.exit(0); } + if (cmd.hasOption("version")) { + System.out.println("SlimeVR Server " + VERSION); + System.exit(0); + } File dir = new File("").getAbsoluteFile(); try {