diff --git a/.github/actions/nativeforms-source/action.yml b/.github/actions/nativeforms-source/action.yml index f5313b7af..60505050b 100644 --- a/.github/actions/nativeforms-source/action.yml +++ b/.github/actions/nativeforms-source/action.yml @@ -12,10 +12,6 @@ runs: shell: bash run: | set -euo pipefail - ref=$(tr -d '[:space:]' < build/NativeForms.ref) dir="$GITHUB_WORKSPACE/../NativeForms" rm -rf "$dir" - git init -q "$dir" - git -C "$dir" fetch -q --depth 1 https://github.com/Hawkynt/NativeForms.git "$ref" - git -C "$dir" checkout -q FETCH_HEAD - echo "NativeForms $(git -C "$dir" log -1 --format='%h %s')" + build/get-nativeforms.sh "$dir" diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 75a01e1cd..d4b21c43b 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -21,9 +21,15 @@ deliberately stricter than the archive API, are in ## Build ```bash +build/get-nativeforms.sh # once (build/get-nativeforms.ps1 on Windows) dotnet build CompressionWorkbench.slnx ``` +`Compression.NativeUI` needs NativeForms at the commit pinned in `build/NativeForms.ref`: the +published packages lag behind it. The script fetches that commit to `../NativeForms`, where +`build/NativeForms.props` finds it (the same checkout CI makes); point `NativeFormsSource` at a +checkout elsewhere. Without one the build falls back to the packages and says so. + The solution uses the `.slnx` XML solution format. `Directory.Build.props` applies shared settings to all projects: `net10.0` target, C# 14, nullable reference types enabled, and warnings-as-errors. --- diff --git a/README.md b/README.md index 57edf19bf..5e439d3c0 100644 --- a/README.md +++ b/README.md @@ -573,10 +573,17 @@ See [ARCHITECTURE.md](ARCHITECTURE.md) for project-level dependencies and ## 🛠️ Building ```bash +build/get-nativeforms.sh # once: NativeForms at the pinned commit, as ../NativeForms dotnet build CompressionWorkbench.slnx dotnet test ``` +`Compression.NativeUI` builds against NativeForms from source, because the published NativeForms +packages do not yet carry all the controls it uses. The script (`build/get-nativeforms.ps1` on +Windows) fetches the commit pinned in `build/NativeForms.ref` next to this repository, exactly as CI +does; a checkout elsewhere works with `-p:NativeFormsSource=`. Everything except +`Compression.NativeUI` builds without it. + One frontend ships. `Compression.NativeUI` is a NativeForms shell over the Win32 and GTK backends, so the same code is the Windows workstation and the Linux one, and both are released as native `win-x64` and `linux-x64` binaries. diff --git a/build/NativeForms.props b/build/NativeForms.props index 16db7c7c1..3f897fc74 100644 --- a/build/NativeForms.props +++ b/build/NativeForms.props @@ -14,6 +14,11 @@ NativeFormsFromSource forced true/false to override the detection, e.g. -p:NativeFormsFromSource=false to build against the packages. + The published packages currently lag behind what Compression.NativeUI uses (the ribbon field + controls are only on NativeForms main), so a clean checkout needs the source: run + build/get-nativeforms.sh (or .ps1), which fetches the pinned commit to ../NativeForms exactly as + CI does. A build that falls back to the packages says so up front. + The checkout stays outside this repository on purpose: a copy inside it would be scanned by the source audits and linted by the package-README check as if it were ours. --> @@ -29,9 +34,13 @@ - - - + + + + + + + diff --git a/build/get-nativeforms.ps1 b/build/get-nativeforms.ps1 new file mode 100644 index 000000000..ca81262dc --- /dev/null +++ b/build/get-nativeforms.ps1 @@ -0,0 +1,18 @@ +# Fetches NativeForms at the commit pinned in build/NativeForms.ref into ..\NativeForms, where +# build/NativeForms.props picks it up - the same checkout CI makes (.github/actions/nativeforms-source). +# Needed because Compression.NativeUI uses NativeForms types that no published package carries yet. +# Usage: build/get-nativeforms.ps1 [-Directory ] +param([string]$Directory) +$ErrorActionPreference = 'Stop' +$root = Split-Path -Parent $PSScriptRoot +$ref = (Get-Content (Join-Path $root 'build/NativeForms.ref') -Raw).Trim() +if (-not $Directory) { $Directory = Join-Path (Split-Path -Parent $root) 'NativeForms' } +if (-not (Test-Path (Join-Path $Directory '.git'))) { git init -q $Directory; if ($LASTEXITCODE) { exit $LASTEXITCODE } } +git -C $Directory fetch -q --depth 1 https://github.com/Hawkynt/NativeForms.git $ref +if ($LASTEXITCODE) { exit $LASTEXITCODE } +git -C $Directory checkout -q --detach FETCH_HEAD +if ($LASTEXITCODE) { exit $LASTEXITCODE } +Write-Host "NativeForms $(git -C $Directory log -1 --format='%h %s') in $Directory" +if ($PSBoundParameters.ContainsKey('Directory')) { + Write-Host "Build with -p:NativeFormsSource=`"$((Resolve-Path $Directory).Path)`" (or set NativeFormsSource) to use this location." +} diff --git a/build/get-nativeforms.sh b/build/get-nativeforms.sh new file mode 100755 index 000000000..8cce4adb5 --- /dev/null +++ b/build/get-nativeforms.sh @@ -0,0 +1,18 @@ +#!/usr/bin/env bash +# Fetches NativeForms at the commit pinned in build/NativeForms.ref into ../NativeForms, where +# build/NativeForms.props picks it up - the same checkout CI makes (.github/actions/nativeforms-source). +# Needed because Compression.NativeUI uses NativeForms types that no published package carries yet. +# Usage: build/get-nativeforms.sh [target-directory] +set -euo pipefail +root="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)" +ref="$(tr -d '[:space:]' < "$root/build/NativeForms.ref")" +dir="${1:-$root/../NativeForms}" +if [ ! -d "$dir/.git" ]; then + git init -q "$dir" +fi +git -C "$dir" fetch -q --depth 1 https://github.com/Hawkynt/NativeForms.git "$ref" +git -C "$dir" checkout -q --detach FETCH_HEAD +echo "NativeForms $(git -C "$dir" log -1 --format='%h %s') in $dir" +if [ "$#" -gt 0 ]; then + echo "Build with -p:NativeFormsSource=\"$(cd "$dir" && pwd)\" (or set NativeFormsSource) to use this location." +fi diff --git a/docs/screenshots/archive-browser.png b/docs/screenshots/archive-browser.png index 45d205ed9..26d3015b2 100644 Binary files a/docs/screenshots/archive-browser.png and b/docs/screenshots/archive-browser.png differ