v0.0.5 - Add run.sh to build (only if needed) and run the latest binary
This commit is contained in:
Generated
+6
-6
@@ -1957,7 +1957,7 @@ checksum = "0676bb32a98c1a483ce53e500a81ad9c3d5b3f7c920c28c24e9cb0980d0b5bc8"
|
||||
|
||||
[[package]]
|
||||
name = "nostr-core"
|
||||
version = "0.0.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"base64",
|
||||
@@ -1979,7 +1979,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nostr-nips"
|
||||
version = "0.0.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"block-modes",
|
||||
@@ -2001,7 +2001,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nostr-relay"
|
||||
version = "0.0.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"futures-util",
|
||||
"nostr-core",
|
||||
@@ -2019,7 +2019,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nostr-services"
|
||||
version = "0.0.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"nostr-core",
|
||||
"nostr-relay",
|
||||
@@ -2034,7 +2034,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "nostr-signer"
|
||||
version = "0.0.3"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"aes",
|
||||
"cbc",
|
||||
@@ -3056,7 +3056,7 @@ dependencies = [
|
||||
|
||||
[[package]]
|
||||
name = "sovereign-browser"
|
||||
version = "0.0.3"
|
||||
version = "0.0.4"
|
||||
dependencies = [
|
||||
"anyhow",
|
||||
"base64",
|
||||
|
||||
+1
-1
@@ -6,7 +6,7 @@ members = [
|
||||
|
||||
[package]
|
||||
name = "sovereign-browser"
|
||||
version = "0.0.4"
|
||||
version = "0.0.5"
|
||||
edition = "2021"
|
||||
license = "MIT"
|
||||
description = "A Linux x86 web browser built on WebKitGTK with Nostr identity"
|
||||
|
||||
@@ -0,0 +1,86 @@
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
# run.sh - Build (only if needed) and run the sovereign-browser binary.
|
||||
#
|
||||
# Usage:
|
||||
# ./run.sh [args...] # build if stale, then run with args
|
||||
# ./run.sh --build # force a rebuild, then run
|
||||
# ./run.sh --no-build # run without building (fails if missing)
|
||||
#
|
||||
# The binary is rebuilt only when it is missing or when any source file
|
||||
# (src/**, Cargo.toml, Cargo.lock, www/**) is newer than the binary.
|
||||
|
||||
# Colors for output
|
||||
RED='\033[0;31m'
|
||||
GREEN='\033[0;32m'
|
||||
YELLOW='\033[1;33m'
|
||||
BLUE='\033[0;34m'
|
||||
NC='\033[0m'
|
||||
|
||||
print_status() { echo -e "${BLUE}[INFO]${NC} $1" >&2; }
|
||||
print_success() { echo -e "${GREEN}[SUCCESS]${NC} $1" >&2; }
|
||||
print_warning() { echo -e "${YELLOW}[WARNING]${NC} $1" >&2; }
|
||||
print_error() { echo -e "${RED}[ERROR]${NC} $1" >&2; }
|
||||
|
||||
# --- Config -------------------------------------------------------------
|
||||
# Resolve the project root as the directory containing this script.
|
||||
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
||||
cd "$SCRIPT_DIR"
|
||||
|
||||
BIN_NAME="sovereign-browser"
|
||||
BIN_PATH="target/release/${BIN_NAME}"
|
||||
|
||||
# --- Args ---------------------------------------------------------------
|
||||
FORCE_BUILD=false
|
||||
NO_BUILD=false
|
||||
RUN_ARGS=()
|
||||
|
||||
for arg in "$@"; do
|
||||
case "$arg" in
|
||||
--build)
|
||||
FORCE_BUILD=true
|
||||
;;
|
||||
--no-build)
|
||||
NO_BUILD=true
|
||||
;;
|
||||
*)
|
||||
RUN_ARGS+=("$arg")
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# --- Determine whether a build is needed --------------------------------
|
||||
needs_build() {
|
||||
# No binary yet -> must build.
|
||||
[[ ! -x "$BIN_PATH" ]] && return 0
|
||||
|
||||
# Any tracked source file newer than the binary -> rebuild.
|
||||
local newer
|
||||
newer="$(find src www Cargo.toml Cargo.lock \
|
||||
-type f -newer "$BIN_PATH" -print -quit 2>/dev/null || true)"
|
||||
[[ -n "$newer" ]]
|
||||
}
|
||||
|
||||
# --- Build --------------------------------------------------------------
|
||||
if [[ "$NO_BUILD" == true ]]; then
|
||||
if [[ ! -x "$BIN_PATH" ]]; then
|
||||
print_error "Binary not found at ${BIN_PATH} and --no-build was given."
|
||||
exit 1
|
||||
fi
|
||||
print_status "Skipping build (--no-build)."
|
||||
elif [[ "$FORCE_BUILD" == true ]]; then
|
||||
print_status "Forcing rebuild of ${BIN_NAME} (release)..."
|
||||
cargo build --release
|
||||
print_success "Build complete."
|
||||
elif needs_build; then
|
||||
print_status "Sources changed or binary missing; building ${BIN_NAME} (release)..."
|
||||
cargo build --release
|
||||
print_success "Build complete."
|
||||
else
|
||||
print_status "Binary is up to date; skipping build."
|
||||
fi
|
||||
|
||||
# --- Run ----------------------------------------------------------------
|
||||
print_status "Running ${BIN_PATH} ${RUN_ARGS[*]}"
|
||||
exec "$BIN_PATH" "${RUN_ARGS[@]}"
|
||||
+2
-2
@@ -1,7 +1,7 @@
|
||||
//! Version information for sovereign_browser
|
||||
|
||||
/// The current version of sovereign_browser (with leading 'v').
|
||||
pub const VERSION: &str = "v0.0.4";
|
||||
pub const VERSION: &str = "v0.0.5";
|
||||
|
||||
/// Major version number.
|
||||
pub const VERSION_MAJOR: u32 = 0;
|
||||
@@ -10,4 +10,4 @@ pub const VERSION_MAJOR: u32 = 0;
|
||||
pub const VERSION_MINOR: u32 = 0;
|
||||
|
||||
/// Patch version number.
|
||||
pub const VERSION_PATCH: u32 = 4;
|
||||
pub const VERSION_PATCH: u32 = 5;
|
||||
|
||||
Reference in New Issue
Block a user