feat(gui-client): make all modules Linux-friendly (#3737)

Splits up platform-specific modules into `linux.rs` and `windows.rs`
submodules, or `imp` modules within the parent module, so that we can
compile all the platform-independent code (e.g. Tauri calls,
`run_controller`) for Linux.

This will show the Tauri GUI on Linux:


![image](https://github.com/firezone/firezone/assets/13400041/320a4b91-1a37-48dd-94b9-cc280cc09854)

---------

Signed-off-by: Reactor Scram <ReactorScram@users.noreply.github.com>
This commit is contained in:
Reactor Scram
2024-02-28 16:09:56 -06:00
committed by GitHub
parent 127b97e588
commit ca95dcdf77
19 changed files with 1163 additions and 959 deletions

View File

@@ -9,28 +9,47 @@ PACKAGE=firezone-gui-client
export RUST_LOG=firezone_gui_client=debug,warn
export WEBKIT_DISABLE_COMPOSITING_MODE=1
# Make sure the files we want to check don't exist on the system yet
stat "$HOME/.cache/$BUNDLE_ID" && exit 1
stat "$HOME/.config/$BUNDLE_ID" && exit 1
function smoke_test() {
# Make sure the files we want to check don't exist on the system yet
stat "$HOME/.cache/$BUNDLE_ID/data/logs" && exit 1
stat "$HOME/.config/$BUNDLE_ID/config/advanced_settings.json" && exit 1
stat "$HOME/.config/$BUNDLE_ID/config/device_id.json" && exit 1
# Run the smoke test normally
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- smoke-test
# Run the smoke test normally
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- smoke-test
# Make sure the files were written in the right paths
# TODO: Inject some bogus sign-in sequence to test the actor_name file
stat "$HOME/.config/$BUNDLE_ID/config/advanced_settings.json"
stat "$HOME/.cache/$BUNDLE_ID/data/logs/"connlib*log
stat "$HOME/.config/$BUNDLE_ID/config/device_id.json"
# Make sure the files were written in the right paths
# TODO: Inject some bogus sign-in sequence to test the actor_name file
stat "$HOME/.cache/$BUNDLE_ID/data/logs/"connlib*log
stat "$HOME/.config/$BUNDLE_ID/config/advanced_settings.json"
stat "$HOME/.config/$BUNDLE_ID/config/device_id.json"
# Delete the crash file if present
rm -f "$DUMP_PATH"
# Clean up the files but not the folders
rm -rf "$HOME/.cache/$BUNDLE_ID/data/logs"
rm "$HOME/.config/$BUNDLE_ID/config/advanced_settings.json"
rm "$HOME/.config/$BUNDLE_ID/config/device_id.json"
}
# Fail if it returns success, this is supposed to crash
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- --crash && exit 1
function crash_test() {
# Delete the crash file if present
rm -f "$DUMP_PATH"
# Fail if the crash file wasn't written
stat "$DUMP_PATH"
rm "$DUMP_PATH"
# Fail if it returns success, this is supposed to crash
xvfb-run --auto-servernum cargo run -p "$PACKAGE" -- --crash && exit 1
# Fail if the crash file wasn't written
stat "$DUMP_PATH"
# Clean up
rm "$DUMP_PATH"
}
# Run the tests twice to make sure it's okay for the directories to stay intact,
# and to make sure the tests can cycle.
smoke_test
smoke_test
crash_test
crash_test
# I'm not sure if the last command is handled specially, so explicitly exit with 0
exit 0