From 629cbcb3b97c670fb582b1c77f1543475400e060 Mon Sep 17 00:00:00 2001 From: mahach666 <79989386+mahach666@users.noreply.github.com> Date: Thu, 26 Nov 2026 18:20:57 +0000 Subject: [PATCH 1/2] Pack the CLI separately for each platform --- .github/workflows/ci.yml | 30 ++++++- .github/workflows/release.yml | 5 +- CHANGELOG.md | 5 ++ CONTRIBUTING.md | 2 + README.md | 5 ++ docs/getting-started.md | 3 + src/IOViewer.Cli/IOViewer.Cli.csproj | 12 ++- tests/fixtures/cli/generate-lgs.cs | 128 +++++++++++++++++++++++++++ tools/pack-release.ps1 | 2 +- tools/test-cli-package.ps1 | 72 +++++++++++++++ 10 files changed, 257 insertions(+), 7 deletions(-) create mode 100644 tests/fixtures/cli/generate-lgs.cs create mode 100644 tools/test-cli-package.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cf971ef..175a69b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -22,23 +22,38 @@ jobs: global-json-file: global.json dotnet-version: | 8.0.x + 10.0.x - run: dotnet restore IOViewer.slnx - run: dotnet build IOViewer.slnx -c Release --no-restore - run: dotnet test IOViewer.slnx -c Release --no-build - - run: dotnet pack IOViewer.slnx -c Release --no-build -o artifacts + - run: dotnet pack IOViewer.slnx -c Release -p:PackCliForPlatforms=true -o artifacts - name: Check package dependencies shell: pwsh run: | ./tools/check-packages.ps1 -PackageDirectory artifacts ./tools/test-package-checks.ps1 + - name: Install the Windows CLI and export a scan + shell: pwsh + run: ./tools/test-cli-package.ps1 -PackageDirectory artifacts -Rid win-x64 - uses: actions/upload-artifact@v7 with: name: packages-${{ matrix.os }} path: artifacts/*.nupkg if-no-files-found: error - build-linux: - runs-on: ubuntu-latest + cli-package: + needs: build + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-latest + rid: linux-x64 + - os: macos-15 + rid: osx-arm64 + - os: macos-15-intel + rid: any + runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@v7 - uses: actions/setup-dotnet@v6 @@ -46,7 +61,14 @@ jobs: global-json-file: global.json dotnet-version: | 8.0.x - - run: dotnet build src/IOViewer.Cli/IOViewer.Cli.csproj -c Release + 10.0.x + - uses: actions/download-artifact@v8 + with: + name: packages-windows-latest + path: artifacts + - name: Install the CLI and export a scan + shell: pwsh + run: ./tools/test-cli-package.ps1 -PackageDirectory artifacts -Rid ${{ matrix.rid }} viewer: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 80e3234..2693aab 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,10 @@ jobs: - name: Publish NuGet packages shell: pwsh run: | - foreach ($package in Get-ChildItem artifacts -Filter *.nupkg) { + $pointer = "IOViewer.Cli.$($env:GITHUB_REF_NAME.Substring(1)).nupkg" + # Publish the platform packages before the package that refers to them. + $packages = Get-ChildItem artifacts -Filter *.nupkg | Sort-Object { $_.Name -eq $pointer } + foreach ($package in $packages) { dotnet nuget push $package.FullName --api-key '${{ steps.nuget-login.outputs.NUGET_API_KEY }}' --source https://api.nuget.org/v3/index.json --skip-duplicate if ($LASTEXITCODE -ne 0) { throw "dotnet nuget push failed for $($package.Name) with exit code $LASTEXITCODE" } } diff --git a/CHANGELOG.md b/CHANGELOG.md index cef3266..a3a494f 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ API between minor releases. ## [Unreleased] +### Changed + +- The .NET tool downloads a smaller package for Windows x64, Linux x64 and macOS ARM64. Other architectures + receive the portable package. The platform-aware installer requires the .NET 10 SDK or later. + ## [0.4.1] - 2026-11-26 ### Added diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 90959c4..58625d6 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -149,6 +149,8 @@ with a stable lower bound, and rejects dependency bounds that nuget.org refuses prerelease label of one part that does not start with a letter). Before the tag, run the Revit test with a real Revit 2022 file, which CI does not have: set `IOVIEWER_RVT_FILE` to its path and run `dotnet test IOViewer.slnx -c Release --filter Cli_ConvertRvtToHtml`. The NuGet policy must name this repository, `release.yml`, the configured NuGet profile and the `IOViewer*` package pattern. +The release and CI use `-p:PackCliForPlatforms=true` to create the CLI's platform packages and portable fallback. +The release publishes them before the top-level `IOViewer.Cli` package, so the installer can resolve its references. ## Licensing contributions diff --git a/README.md b/README.md index 9f8d0ae..b781cd9 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,11 @@ Install the command line tool: dotnet tool install --global IOViewer.Cli ``` +Use the .NET 10 SDK or later to install platform-specific CLI releases. The installer selects a package for +Windows x64, Linux x64 or macOS ARM64 and uses the portable package on other platforms. The CLI runs on +.NET 8 or rolls forward when a newer runtime is available. Portable ZIPs are also available in +[GitHub Releases](https://github.com/IOExtend/IOViewer/releases). + Add the library to a .NET project: ```sh diff --git a/docs/getting-started.md b/docs/getting-started.md index c52d696..3c7435d 100644 --- a/docs/getting-started.md +++ b/docs/getting-started.md @@ -8,6 +8,9 @@ Install the global CLI tool: dotnet tool install --global IOViewer.Cli ``` +Install platform-specific CLI releases with the .NET 10 SDK or later. The command selects the package for +your system, with a portable fallback. The CLI runs on .NET 8 or rolls forward to a newer installed runtime. + Add the library to your .NET project: ```sh diff --git a/src/IOViewer.Cli/IOViewer.Cli.csproj b/src/IOViewer.Cli/IOViewer.Cli.csproj index d0d73b6..b1e9111 100644 --- a/src/IOViewer.Cli/IOViewer.Cli.csproj +++ b/src/IOViewer.Cli/IOViewer.Cli.csproj @@ -14,6 +14,16 @@ NU1901;NU1902;NU1903 + + net8.0 + Major + win-x64;linux-x64;osx-arm64;any + false + false + + false + + @@ -34,7 +44,7 @@ Pack="true" PackagePath="licenses/SkiaSharp-NOTICES.txt" Visible="false" /> - + ' | + Set-Content -LiteralPath $config -Encoding utf8 + $toolPath = Join-Path $temp 'tool' + Invoke-Checked dotnet @('tool', 'install', 'IOViewer.Cli', '--version', $version, '--tool-path', $toolPath, + '--configfile', $config, '--no-cache') + $installed = @(Get-ChildItem -LiteralPath (Join-Path $toolPath '.store') -File -Recurse -Filter '*.nupkg') + if ($package.Name -notin $installed.Name) { throw "The installer did not select $($package.Name)." } + Write-Host "Installed $($package.Name) ($($package.Length) bytes)." + + $fixture = Join-Path $temp 'scan.lgs' + $generator = Join-Path $PSScriptRoot '../tests/fixtures/cli/generate-lgs.cs' + Invoke-Checked dotnet @('run', $generator, '-c', 'Release', '--', $fixture) + + $cli = Join-Path $toolPath $(if ($IsWindows) { 'ioviewer.exe' } else { 'ioviewer' }) + $html = Join-Path $temp 'scan.html' + $json = Join-Path $temp 'scan.json' + Invoke-Checked $cli @($fixture, '-o', $html, '--json', $json) + $document = Get-Content -LiteralPath $json -Raw | ConvertFrom-Json -AsHashtable + $points = @($document.Scene.Geometries | Where-Object Topology -eq 2) + if ($points.Count -ne 1 -or $points[0].Vertices.Count -ne 12) { throw 'Expected four LGS points.' } + $id = [string]$points[0].Id + $rgb = [Convert]::FromBase64String($document.PointColors[$id]) + $intensity = [Convert]::FromBase64String($document.PointIntensities[$id]) + if (($rgb -join ',') -ne '10,70,55,30,70,55,20,70,55,40,70,55' -or $intensity.Length -ne 4) { + throw 'Expected the four LGS colors and intensity samples.' + } + $photos = @($document.Panoramas) + if ($photos.Count -ne 1 -or $photos[0].Name -ne 'Synthetic station') { + throw 'Expected the panorama and station name from the LGS project database.' + } + $jpeg = [Convert]::FromBase64String($photos[0].Jpeg) + if ($jpeg.Length -lt 4 -or $jpeg[0] -ne 0xff -or $jpeg[1] -ne 0xd8 -or + $jpeg[-2] -ne 0xff -or $jpeg[-1] -ne 0xd9) { + throw 'Expected a JPEG panorama encoded by the installed tool.' + } + if (-not (Test-Path -LiteralPath $html -PathType Leaf)) { throw 'Expected the standalone HTML export.' } + Write-Host 'Exported four colored points, measured intensity and a JPEG panorama.' +} +finally { + Remove-Item -LiteralPath $temp -Recurse -Force +} From fb43c139a7043e01d41de9bcb6867e9db1130175 Mon Sep 17 00:00:00 2001 From: mahach666 <79989386+mahach666@users.noreply.github.com> Date: Thu, 26 Nov 2026 18:23:04 +0000 Subject: [PATCH 2/2] Pass the platform pack property as one argument --- tools/pack-release.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tools/pack-release.ps1 b/tools/pack-release.ps1 index ce17cbb..7e569c9 100644 --- a/tools/pack-release.ps1 +++ b/tools/pack-release.ps1 @@ -75,7 +75,7 @@ if ($LASTEXITCODE -ne 0) { throw "git archive failed with exit code $LASTEXITCOD Write-Host "Packing NuGet packages..." # Packages left from an earlier run would be checked and published together with this version. Get-ChildItem -LiteralPath $Output -File | Where-Object { $_.Extension -in '.nupkg', '.snupkg' } | Remove-Item -Invoke-DotNet pack (Join-Path $root 'IOViewer.slnx') -c Release -p:PackCliForPlatforms=true -o $Output +Invoke-DotNet pack (Join-Path $root 'IOViewer.slnx') -c Release '-p:PackCliForPlatforms=true' -o $Output & (Join-Path $PSScriptRoot 'check-packages.ps1') -PackageDirectory $Output