Update versioning (#1404)

This commit is contained in:
Leendert de Borst
2026-01-19 12:40:23 +01:00
parent 50e10e9400
commit 5e00a6f2a8
6 changed files with 63 additions and 36 deletions

View File

@@ -1453,7 +1453,7 @@
ARCHS = arm64;
CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2600100;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@@ -1707,7 +1707,7 @@
ARCHS = arm64;
CLANG_ENABLE_OBJC_WEAK = NO;
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 1;
CURRENT_PROJECT_VERSION = 2600100;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;

View File

@@ -1,11 +1,11 @@
[package]
name = "aliasvault-core"
version = "0.1.0"
version = "0.26.0"
edition = "2021"
description = "Cross-platform core library for AliasVault - provides shared merge logic for all platforms"
license = "MIT"
repository = "https://github.com/landhb/AliasVault"
authors = ["AliasVault Team"]
description = "Cross-platform core library for AliasVault"
license = "AGPL-3.0"
repository = "https://github.com/aliasvault/aliasvault"
authors = ["AliasVault"]
[package.metadata.wasm-pack.profile.release]
wasm-opt = false

View File

@@ -9,27 +9,6 @@
//! This library accepts data as JSON and returns results as JSON.
//! Each platform (browser, iOS, Android, .NET) handles its own I/O
//! and calls this library for the core logic.
//!
//! # Example (conceptual)
//! ```ignore
//! // Merge example
//! let local_tables = read_all_tables_as_json(local_db);
//! let server_tables = read_all_tables_as_json(server_db);
//! let result = merge_vaults(local_tables, server_tables);
//!
//! // Prune example (removes items in trash for > 30 days)
//! let tables = read_all_tables_as_json(local_db);
//! let result = prune_vault(tables, 30);
//!
//! // Credential matching example
//! let credentials = get_credentials_json();
//! let matches = filter_credentials(credentials, "https://github.com", "GitHub");
//!
//! // SRP authentication example
//! let salt = srp::srp_generate_salt();
//! let private_key = srp::srp_derive_private_key(&salt, "user", &password_hash);
//! let verifier = srp::srp_derive_verifier(&private_key);
//! ```
pub mod error;
pub mod vault_merge;
@@ -77,3 +56,9 @@ pub use uniffi_api::*;
// UniFFI scaffolding - generates the FFI glue code
#[cfg(feature = "uniffi")]
uniffi::setup_scaffolding!();
/// Returns the version of the aliasvault-core library.
/// This is set at compile time from Cargo.toml.
pub fn get_core_version() -> &'static str {
env!("CARGO_PKG_VERSION")
}

View File

@@ -6,6 +6,12 @@
use crate::error::VaultError;
use crate::vault_merge::SYNCABLE_TABLE_NAMES;
/// Get the version of the aliasvault-core library.
#[uniffi::export]
pub fn get_core_version() -> String {
crate::get_core_version().to_string()
}
/// Get the list of syncable table names.
/// These are the tables that need to be read from the database for merge/prune operations.
#[uniffi::export]

View File

@@ -20,6 +20,16 @@ pub fn init() {
console_error_panic_hook::set_once();
}
// ═══════════════════════════════════════════════════════════════════════════════
// Version
// ═══════════════════════════════════════════════════════════════════════════════
/// Get the version of the aliasvault-core library.
#[wasm_bindgen(js_name = getCoreVersion)]
pub fn get_core_version_js() -> String {
crate::get_core_version().to_string()
}
// ═══════════════════════════════════════════════════════════════════════════════
// Vault Merge WASM Bindings
// ═══════════════════════════════════════════════════════════════════════════════

View File

@@ -242,9 +242,14 @@ get_mobile_app_ts_version() {
grep "public static readonly VERSION = " ../apps/mobile-app/utils/AppInfo.ts | tr -d "'" | tr -d ';' | tr -d ' ' | cut -d'=' -f2
}
# Function to extract version from iOS app
# Function to extract version from iOS app (main target only, identified by net.aliasvault.app bundle ID)
get_ios_version() {
grep "MARKETING_VERSION = " ../apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj | head -n1 | tr -d '"' | tr -d ';' | tr -d ' ' | cut -d'=' -f2
local pbxproj="../apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj"
# Find the line number of the main app's bundle identifier
local line_num=$(grep -n "PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app;" "$pbxproj" | head -n1 | cut -d: -f1)
# Look back within the same build settings block (typically within 30 lines) for MARKETING_VERSION
local start_line=$((line_num - 30))
sed -n "${start_line},${line_num}p" "$pbxproj" | grep "MARKETING_VERSION" | head -n1 | sed 's/.*= //' | tr -d ';'
}
# Function to extract version from Android app
@@ -257,6 +262,11 @@ get_safari_version() {
grep "MARKETING_VERSION = " ../apps/browser-extension/safari-xcode/AliasVault/AliasVault.xcodeproj/project.pbxproj | head -n1 | tr -d '"' | tr -d ';' | tr -d ' ' | cut -d'=' -f2
}
# Function to extract version from Rust core Cargo.toml
get_rust_core_version() {
grep "^version = " ../core/rust/Cargo.toml | head -n1 | tr -d '"' | tr -d ' ' | cut -d'=' -f2
}
# Check current versions
server_version=$(get_server_version)
browser_wxt_version=$(get_browser_extension_version)
@@ -267,6 +277,7 @@ mobile_ts_version=$(get_mobile_app_ts_version)
ios_version=$(get_ios_version)
android_version=$(get_android_version)
safari_version=$(get_safari_version)
rust_core_version=$(get_rust_core_version)
# Create associative array of versions
declare -A versions
@@ -279,6 +290,7 @@ versions["mobile_ts"]="$mobile_ts_version"
versions["ios"]="$ios_version"
versions["android"]="$android_version"
versions["safari"]="$safari_version"
versions["rust_core"]="$rust_core_version"
# Create display names for output
declare -A display_names
@@ -291,6 +303,7 @@ display_names["mobile_ts"]="Mobile App (TS)"
display_names["ios"]="iOS App"
display_names["android"]="Android App"
display_names["safari"]="Safari Extension"
display_names["rust_core"]="Rust Core"
# Function to normalize version by removing stage suffix
normalize_version() {
@@ -299,14 +312,17 @@ normalize_version() {
}
# Check if all versions are equal (comparing base versions without stage suffixes)
# Use .version/version.txt as the canonical reference if it exists, otherwise fall back to server version
all_equal=true
first_normalized_version=""
if [ -f "../apps/.version/version.txt" ]; then
first_version=$(cat "../apps/.version/version.txt")
else
first_version="$server_version"
fi
first_normalized_version=$(normalize_version "$first_version")
for project in "${!versions[@]}"; do
normalized_version=$(normalize_version "${versions[$project]}")
if [[ -z "$first_normalized_version" ]]; then
first_normalized_version="$normalized_version"
first_version="${versions[$project]}"
elif [[ "$normalized_version" != "$first_normalized_version" ]]; then
if [[ "$normalized_version" != "$first_normalized_version" ]]; then
all_equal=false
break
fi
@@ -462,6 +478,12 @@ elif [[ "$MARKETING_UPDATE" == true ]]; then
update_version "../apps/browser-extension/safari-xcode/AliasVault/AliasVault.xcodeproj/project.pbxproj" \
"MARKETING_VERSION = [0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^;]*;" \
"MARKETING_VERSION = $version;"
# Update Rust core version (Cargo.toml uses base version without suffix)
echo "Updating Rust core version..."
update_version "../core/rust/Cargo.toml" \
"^version = \"[0-9][0-9]*\.[0-9][0-9]*\.[0-9][0-9]*[^\"]*\"" \
"version = \"$version\""
fi
# Handle build numbers with semantic versioning
@@ -487,7 +509,11 @@ echo " (leading zeros removed)"
echo ""
# Read current build numbers
current_ios_build=$(grep -A1 "CURRENT_PROJECT_VERSION" ../apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj | grep "CURRENT_PROJECT_VERSION = [0-9]\+;" | head -n1 | tr -d ';' | tr -d ' ' | cut -d'=' -f2 | grep -E '^[0-9]+$')
# For iOS, read from main app target (identified by net.aliasvault.app bundle ID)
ios_pbxproj="../apps/mobile-app/ios/AliasVault.xcodeproj/project.pbxproj"
ios_main_line=$(grep -n "PRODUCT_BUNDLE_IDENTIFIER = net.aliasvault.app;" "$ios_pbxproj" | head -n1 | cut -d: -f1)
ios_start_line=$((ios_main_line - 30))
current_ios_build=$(sed -n "${ios_start_line},${ios_main_line}p" "$ios_pbxproj" | grep "CURRENT_PROJECT_VERSION" | head -n1 | sed 's/.*= //' | tr -d ';' | grep -E '^[0-9]+$')
if [ -z "$current_ios_build" ]; then
echo "Error: Could not read iOS build number or invalid format"
exit 1