Skip to content
Merged
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
6 changes: 1 addition & 5 deletions .github/actions/nativeforms-source/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
6 changes: 6 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -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.

---
Expand Down
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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=<path>`. 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.
Expand Down
15 changes: 12 additions & 3 deletions build/NativeForms.props
Original file line number Diff line number Diff line change
Expand Up @@ -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.
-->
Expand All @@ -29,9 +34,13 @@
</ItemGroup>

<ItemGroup Condition="'$(NativeFormsFromSource)' != 'true'">
<PackageReference Include="Hawkynt.NativeForms" Version="1.0.0.227" />
<PackageReference Include="Hawkynt.NativeForms.Backends.Windows" Version="1.0.0.63" />
<PackageReference Include="Hawkynt.NativeForms.Backends.Gtk" Version="1.0.0.73" />
<PackageReference Include="Hawkynt.NativeForms" Version="1.0.0.245" />
<PackageReference Include="Hawkynt.NativeForms.Backends.Windows" Version="1.0.0.70" />
<PackageReference Include="Hawkynt.NativeForms.Backends.Gtk" Version="1.0.0.82" />
</ItemGroup>

<Target Name="ReportNativeFormsPackageFallback" BeforeTargets="CoreCompile" Condition="'$(NativeFormsFromSource)' != 'true'">
<Message Importance="high" Text="NativeForms: no checkout at '$(NativeFormsSource)', building against the published packages, which lag behind what this project uses. If the build fails with missing NativeForms types (RibbonComboBox, RibbonSpinner, ...), run build/get-nativeforms.sh (or build/get-nativeforms.ps1) to fetch the pinned source, or set NativeFormsSource to an existing checkout." />
</Target>

</Project>
18 changes: 18 additions & 0 deletions build/get-nativeforms.ps1
Original file line number Diff line number Diff line change
@@ -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 <target-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."
}
18 changes: 18 additions & 0 deletions build/get-nativeforms.sh
Original file line number Diff line number Diff line change
@@ -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
Binary file modified docs/screenshots/archive-browser.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading