mirror of
https://seed.radicle.dev/rad:z4V1sjrXqjvFdnCUbxPFqd5p4DtH5.git
synced 2026-10-18 19:30:27 +08:00
Add short commit hash in about popup for macOS build
This commit is contained in:
@@ -1,3 +1,12 @@
|
||||
use std::process::Command;
|
||||
|
||||
fn main() {
|
||||
let output = Command::new("git")
|
||||
.args(&["rev-parse", "--short", "HEAD"])
|
||||
.output()
|
||||
.expect("failed to execute git");
|
||||
let git_head = String::from_utf8(output.stdout).unwrap();
|
||||
println!("cargo:rustc-env=GIT_HEAD={}", git_head);
|
||||
|
||||
tauri_build::build()
|
||||
}
|
||||
|
||||
@@ -1,16 +1,47 @@
|
||||
use std::collections::BTreeMap;
|
||||
|
||||
use serde::Serialize;
|
||||
use tauri::{AppHandle, Emitter, Manager};
|
||||
|
||||
use radicle::cob::cache::COBS_DB_FILE;
|
||||
use radicle::identity::RepoId;
|
||||
use radicle::node::{Handle, Node, NOTIFICATIONS_DB_FILE};
|
||||
use radicle::storage::ReadStorage;
|
||||
use tauri::{AppHandle, Emitter, Manager};
|
||||
|
||||
use radicle_types::config::Config;
|
||||
use radicle_types::error::Error;
|
||||
use radicle_types::traits::Profile;
|
||||
use radicle_types::{domain, AppState};
|
||||
|
||||
pub struct Version {
|
||||
pub version: String,
|
||||
pub head: String,
|
||||
}
|
||||
|
||||
impl Serialize for Version {
|
||||
fn serialize<S>(&self, serializer: S) -> Result<S::Ok, S::Error>
|
||||
where
|
||||
S: serde::Serializer,
|
||||
{
|
||||
serializer.serialize_str(&format!("{} ({})", self.version, self.head))
|
||||
}
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) fn version(app: AppHandle) -> Result<Version, Error> {
|
||||
let version = app
|
||||
.config()
|
||||
.version
|
||||
.clone()
|
||||
.expect("The build version has not been set.");
|
||||
pub const GIT_HEAD: &str = env!("GIT_HEAD");
|
||||
|
||||
Ok(Version {
|
||||
version,
|
||||
head: GIT_HEAD.to_string(),
|
||||
})
|
||||
}
|
||||
|
||||
#[tauri::command]
|
||||
pub(crate) fn startup(app: AppHandle) -> Result<Config, Error> {
|
||||
let profile = radicle::Profile::load()?;
|
||||
|
||||
@@ -57,6 +57,7 @@ pub fn run() {
|
||||
repo::repo_by_id,
|
||||
repo::repo_count,
|
||||
startup::startup,
|
||||
startup::version,
|
||||
thread::create_issue_comment,
|
||||
thread::create_patch_comment,
|
||||
])
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
{
|
||||
"productName": "Radicle",
|
||||
"mainBinaryName": "radicle-desktop",
|
||||
"version": "0.2.0",
|
||||
"identifier": "xyz.radicle.desktop",
|
||||
"version": "0.2.0",
|
||||
"build": {
|
||||
"beforeDevCommand": "npm start",
|
||||
"devUrl": "http://localhost:1420",
|
||||
|
||||
@@ -1,8 +1,12 @@
|
||||
<script lang="ts">
|
||||
import type { ComponentProps } from "svelte";
|
||||
|
||||
import { onMount } from "svelte";
|
||||
import { invoke } from "@app/lib/invoke";
|
||||
|
||||
import AnnounceSwitch from "./AnnounceSwitch.svelte";
|
||||
import Border from "./Border.svelte";
|
||||
import CopyableId from "./CopyableId.svelte";
|
||||
import FontSizeSwitch from "./FontSizeSwitch.svelte";
|
||||
import Icon from "./Icon.svelte";
|
||||
import NakedButton from "./NakedButton.svelte";
|
||||
@@ -15,6 +19,12 @@
|
||||
popoverProps: Partial<ComponentProps<typeof Popover>>;
|
||||
}
|
||||
|
||||
let version = $state("");
|
||||
|
||||
onMount(async () => {
|
||||
version = await invoke<string>("version");
|
||||
});
|
||||
|
||||
const {
|
||||
compact = true,
|
||||
styleHeight = "2.5rem",
|
||||
@@ -39,6 +49,14 @@
|
||||
style:align-items="flex-start"
|
||||
style:gap="1rem"
|
||||
style:width="100%">
|
||||
<div
|
||||
class="global-flex"
|
||||
style:justify-content="space-between"
|
||||
style:width="100%"
|
||||
style:min-height="2rem">
|
||||
Version <CopyableId id={version} />
|
||||
</div>
|
||||
|
||||
<div
|
||||
class="global-flex"
|
||||
style:justify-content="space-between"
|
||||
|
||||
Reference in New Issue
Block a user