Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -158,3 +158,18 @@ jobs:
cat coverage-summary.txt 2>/dev/null || echo 'no coverage output'
echo '```'
} >> "$GITHUB_STEP_SUMMARY"

# The vendored branded icon is byte-pinned; see scripts/check-icon.sh for why
# drift is made loud rather than impossible. Cheap and dependency-free, so it
# runs as its own job and reports independently of the compile gates.
icon:
name: icon asset (sha256 pin)
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
persist-credentials: false
# Invoked through `bash` rather than relying on the file mode: a checkout
# that loses the executable bit would otherwise fail this gate for a
# reason that has nothing to do with the icon.
- run: bash scripts/check-icon.sh
91 changes: 76 additions & 15 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added assets/dig.ico
Binary file not shown.
18 changes: 18 additions & 0 deletions assets/dig.rc
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// Windows resource script for dig-node.
//
// Windows shows the LOWEST-ORDINAL icon resource as an executable's icon in
// Explorer, the taskbar and the Alt-Tab switcher, so the branded DIG mark must
// be ordinal 1 and must stay the only ICON statement in this file.
//
// `dig.ico` is the canonical, byte-pinned DIG icon (10 frames: 16/20/24/32/40/
// 48/64/96/128/256, with hardened alpha at <=32 so the D's counter does not
// bleed shut at taskbar size). It is vendored verbatim and gated on its sha256
// by `scripts/check-icon.sh` — never re-save or "optimize" it, as any rewrite
// changes the hash and breaks the gate in this repo and in every sibling repo
// that vendors the same bytes.
//
// Deliberately NOT declared here: an RT_MANIFEST resource. Declaring a
// manifest in both the .rc and the linker's /MANIFEST:EMBED lets one silently
// displace the other (CVT1100/LNK1123 if both name RT_MANIFEST).

1 ICON "dig.ico"
6 changes: 6 additions & 0 deletions crates/dig-node-service/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -393,3 +393,9 @@ async-trait = "0.1"
# into a mock `dig.getContent` window, so the node's RPC tier verifies-then-fails-closed and records
# the failed entry. `base64` matches dig-node-core's version.
base64 = "0.22"

# Compiles the branded DIG icon (`../../assets/dig.rc`) into a Windows resource that
# `build.rs` links into `dig-node`/`dign` (dig_ecosystem#2917). Not a `dig-*`/`chia-*`
# crate, so no cross-repo version lockstep applies here.
[target.'cfg(windows)'.build-dependencies]
embed-resource = "3"
32 changes: 32 additions & 0 deletions crates/dig-node-service/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@
//! is emitted as a compile-time env var (`DIG_NODE_GIT_SHA`). When the build
//! happens outside a git checkout (e.g. a packaged source tarball), the SHA is
//! recorded as `"unknown"` rather than failing the build.
//!
//! On Windows this also embeds the branded DIG application icon
//! (`../../assets/dig.rc`, dig_ecosystem#2917) into the `dig-node` and `dign`
//! binaries only -- see `embed_icon` below for why `fake_beacon_cli` is excluded.

use std::process::Command;

Expand All @@ -15,6 +19,34 @@ fn main() {
// Rerun if the checked-out commit moves, so the embedded SHA stays accurate.
println!("cargo:rerun-if-changed=.git/HEAD");
println!("cargo:rerun-if-changed=.git/refs");

#[cfg(windows)]
embed_icon();
}

/// Compile the branded DIG icon into `dig-node` and `dign` only.
///
/// `embed_resource::compile` (unscoped) emits `cargo:rustc-link-arg-bins`, which
/// reaches EVERY bin this crate produces -- including `fake_beacon_cli`, a test
/// fixture that stands in for the real (separate-repo) `dig-updater` beacon CLI
/// and must never carry the DIG brand. `compile_for` scopes the link line to the
/// two shipped binary names instead, so `fake_beacon_cli` stays icon-less.
///
/// `.manifest_required()`/`.expect(..)` is deliberate: an environment that cannot
/// compile a resource must fail the build loudly rather than silently ship an
/// unbranded `dig-node`/`dign`.
#[cfg(windows)]
fn embed_icon() {
embed_resource::compile_for(
"../../assets/dig.rc",
&["dig-node", "dign"],
embed_resource::NONE,
)
.manifest_required()
.expect("failed to compile assets/dig.rc — no usable Windows resource compiler?");

println!("cargo:rerun-if-changed=../../assets/dig.rc");
println!("cargo:rerun-if-changed=../../assets/dig.ico");
}

/// The short git SHA of HEAD, or `None` outside a git checkout / without git.
Expand Down
6 changes: 6 additions & 0 deletions crates/dig-wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ path = "src/lib.rs"
name = "dig-wallet"
path = "src/main.rs"

# Compiles the branded DIG icon (`../../assets/dig.rc`) into a Windows resource that
# `build.rs` links into the `dig-wallet` binary (dig_ecosystem#2917). Not a `dig-*`/
# `chia-*` crate, so no cross-repo version lockstep applies here.
[target.'cfg(windows)'.build-dependencies]
embed-resource = "3"

[dependencies]
# Store-format libs from the digstore repo (git deps, pinned to the same rev as the
# node — bump together). digstore-chain: BIP-39 seed + HD wallet scan + DIG-CAT +
Expand Down
28 changes: 28 additions & 0 deletions crates/dig-wallet/build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
//! Build script: on Windows, embed the branded DIG application icon
//! (`../../assets/dig.rc`, dig_ecosystem#2917) into the `dig-wallet` binary.
//!
//! This crate has a single bin (`dig-wallet`), so the unscoped
//! `embed_resource::compile` -- which links to every bin the crate produces --
//! is safe to use here (contrast `dig-node-service`, which must exclude its
//! `fake_beacon_cli` test fixture and therefore uses `compile_for` instead).
//!
//! `.manifest_required()`/`.expect(..)` is deliberate: an environment that
//! cannot compile a resource must fail the build loudly rather than silently
//! ship an unbranded binary.
//!
//! No-op on non-Windows.

fn main() {
#[cfg(windows)]
embed_icon();
}

#[cfg(windows)]
fn embed_icon() {
embed_resource::compile("../../assets/dig.rc", embed_resource::NONE)
.manifest_required()
.expect("failed to compile assets/dig.rc — no usable Windows resource compiler?");

println!("cargo:rerun-if-changed=../../assets/dig.rc");
println!("cargo:rerun-if-changed=../../assets/dig.ico");
}
Loading
Loading