reverts changes to tauri.conf and zebrad_bin_path(), updates build script to add zebrad binary to binaries directory

This commit is contained in:
Automated Release Test 2024-07-10 18:15:33 -04:00
parent 5374d5d799
commit 3417a604ba
8 changed files with 112 additions and 71 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
node_modules
dist
.DS_Store
src-tauri/binaries

View File

@ -9,6 +9,7 @@ edition = "2021"
[build-dependencies]
tauri-build = { version = "2.0.0-beta", features = [] }
zebrad = { version = "1.8.0", artifact = "bin:zebrad" }
[dependencies]
tauri = { version = "2.0.0-beta.6", features = ["devtools"] }
@ -18,8 +19,10 @@ serde_json = "1"
tokio = { version = "1.36.0", features = ["full", "tracing", "test-util"] }
tracing = "0.1.40"
zebrad = { version = "1.8.0", artifact = "bin:zebrad" }
[features]
# This feature is used for production builds or when a dev server is not specified, DO NOT REMOVE!!
custom-protocol = ["tauri/custom-protocol"]
[profile.release]
panic = "abort"
lto = "thin"

View File

@ -1,5 +1,28 @@
//! Build script for zebra-app
fn main() {
let zebrad_binary_path = std::env::var_os("CARGO_BIN_FILE_ZEBRAD_zebrad")
.expect("zebrad binary should be compiled as an artifact dependency");
let target_platform = std::env::var_os("TARGET")
.expect("must have a build target")
.into_string()
.expect("target should successfully convert into string");
let zebrad_external_bin_dir_path = std::env::current_dir()
.expect("should have a current directory")
.join("binaries");
std::fs::create_dir_all(&zebrad_external_bin_dir_path)
.expect("must have permission to create binaries directory if it missing");
let zebrad_external_bin_path =
zebrad_external_bin_dir_path.join(format!("zebrad-{target_platform}"));
if !std::fs::exists(&zebrad_external_bin_path).expect("must check if file exists") {
std::fs::copy(zebrad_binary_path, zebrad_external_bin_path)
.expect("build must copy zebrad into external binary directory");
}
tauri_build::build()
}

View File

@ -209,6 +209,14 @@
"sidecar"
],
"properties": {
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
@ -217,14 +225,6 @@
}
]
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
@ -244,6 +244,14 @@
"sidecar"
],
"properties": {
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
@ -252,14 +260,6 @@
}
]
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
@ -2163,6 +2163,22 @@
}
]
},
"ShellAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellAllowedArg"
}
}
]
},
"ShellAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
@ -2185,22 +2201,6 @@
"additionalProperties": false
}
]
},
"ShellAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellAllowedArg"
}
}
]
}
}
}

View File

@ -209,6 +209,14 @@
"sidecar"
],
"properties": {
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
@ -217,14 +225,6 @@
}
]
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
@ -244,6 +244,14 @@
"sidecar"
],
"properties": {
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"args": {
"description": "The allowed arguments for the command execution.",
"allOf": [
@ -252,14 +260,6 @@
}
]
},
"command": {
"description": "The command name. It can start with a variable that resolves to a system base directory. The variables are: `$AUDIO`, `$CACHE`, `$CONFIG`, `$DATA`, `$LOCALDATA`, `$DESKTOP`, `$DOCUMENT`, `$DOWNLOAD`, `$EXE`, `$FONT`, `$HOME`, `$PICTURE`, `$PUBLIC`, `$RUNTIME`, `$TEMPLATE`, `$VIDEO`, `$RESOURCE`, `$APP`, `$LOG`, `$TEMP`, `$APPCONFIG`, `$APPDATA`, `$APPLOCALDATA`, `$APPCACHE`, `$APPLOG`.",
"type": "string"
},
"name": {
"description": "The name for this allowed shell command configuration.\n\nThis name will be used inside of the webview API to call this command along with any specified arguments.",
"type": "string"
},
"sidecar": {
"description": "If this command is a sidecar command.",
"type": "boolean"
@ -2163,6 +2163,22 @@
}
]
},
"ShellAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellAllowedArg"
}
}
]
},
"ShellAllowedArg": {
"description": "A command argument allowed to be executed by the webview API.",
"anyOf": [
@ -2185,22 +2201,6 @@
"additionalProperties": false
}
]
},
"ShellAllowedArgs": {
"description": "A set of command arguments allowed to be executed by the webview API.\n\nA value of `true` will allow any arguments to be passed to the command. `false` will disable all arguments. A list of [`ShellAllowedArg`] will set those arguments as the only valid arguments to be passed to the attached command configuration.",
"anyOf": [
{
"description": "Use a simple boolean to allow all or disable all arguments to this command configuration.",
"type": "boolean"
},
{
"description": "A specific set of [`ShellAllowedArg`] that are valid to call for the command configuration.",
"type": "array",
"items": {
"$ref": "#/definitions/ShellAllowedArg"
}
}
]
}
}
}

File diff suppressed because one or more lines are too long

View File

@ -22,9 +22,15 @@ pub const CONFIG_FILE: &str = "zebrad.toml";
#[cfg(windows)]
const CREATE_NO_WINDOW: u32 = 0x08000000;
#[cfg(windows)]
pub const ZEBRAD_COMMAND_NAME: &str = "zebrad.exe";
#[cfg(windows)]
use std::os::windows::process::CommandExt;
#[cfg(not(windows))]
pub const ZEBRAD_COMMAND_NAME: &str = "zebrad";
pub fn zebrad_config_path() -> PathBuf {
let exe_path =
utils::platform::current_exe().expect("could not get path to current executable");
@ -37,7 +43,14 @@ pub fn zebrad_config_path() -> PathBuf {
}
pub fn zebrad_bin_path() -> PathBuf {
env!("CARGO_BIN_FILE_ZEBRAD_zebrad").into()
let exe_path =
utils::platform::current_exe().expect("could not get path to current executable");
let exe_dir_path = exe_path
.parent()
.expect("could not get path to parent directory of executable");
exe_dir_path.join(ZEBRAD_COMMAND_NAME)
}
pub fn run_zebrad() -> (Child, Receiver<String>, oneshot::Sender<()>) {

View File

@ -29,6 +29,7 @@
"icons/128x128@2x.png",
"icons/icon.icns",
"icons/icon.ico"
]
],
"externalBin": ["binaries/zebrad"]
}
}