Skip to content

Latest commit

 

History

History

README.md

Devolutions.Cirup.Build

Devolutions.Cirup.Build packages the cross-platform cirup executable and provides buildTransitive MSBuild targets for sorting and resource-file operations.

What it does

  • Runs cirup file-sort on each file declared in @(CirupResources).
  • Exposes optional diff/changed/merge/subtract/convert targets for explicit build steps.
  • Resolves the executable for the current host OS/architecture (build machine), not the project target RID.
  • Executes sorting before build.
  • Fails the build if cirup fails.

Usage

Add the package and an explicit resource-file list in your project:

<ItemGroup>
  <PackageReference Include="Devolutions.Cirup.Build" Version="1.2.3" PrivateAssets="all" />

  <CirupResources Include="Properties\Resources.resx" />
  <CirupResources Include="Properties\Resources.fr.resx" />
</ItemGroup>

Exposed MSBuild targets

The package exposes the following targets:

  • CirupSortResources (auto-runs before build when @(CirupResources) is defined)
  • CirupDiffResources
  • CirupChangedValues
  • CirupMergeResources
  • CirupSubtractResources
  • CirupConvertResources
  • CirupSyncResources (composite target that runs all Cirup targets)

Example item definitions:

<ItemGroup>
  <CirupResources Include="Properties\Resources.resx" />

  <CirupDiffResources Include="Properties\Resources.resx">
    <CompareTo>Properties\Resources.fr.resx</CompareTo>
    <Destination>artifacts\cirup\missing.fr.restext</Destination>
  </CirupDiffResources>

  <CirupChangedValues Include="Properties\Resources.resx">
    <CompareTo>Properties\Resources.fr.resx</CompareTo>
    <Destination>artifacts\cirup\changed.fr.restext</Destination>
  </CirupChangedValues>

  <CirupMergeResources Include="Properties\Resources.resx">
    <MergeFrom>Properties\Resources.fr.resx</MergeFrom>
    <Destination>artifacts\cirup\merged.resx</Destination>
  </CirupMergeResources>

  <CirupSubtractResources Include="Properties\Resources.fr.resx">
    <CompareTo>Properties\Resources.resx</CompareTo>
    <Destination>artifacts\cirup\fr-only.restext</Destination>
  </CirupSubtractResources>

  <CirupConvertResources Include="Properties\Resources.resx">
    <Destination>artifacts\cirup\Resources.restext</Destination>
  </CirupConvertResources>
</ItemGroup>

Run explicit targets with:

dotnet msbuild -t:CirupDiffResources;CirupChangedValues;CirupMergeResources;CirupSubtractResources;CirupConvertResources

Item metadata contract:

  • CirupDiffResources: CompareTo (required), Destination (optional)
  • CirupChangedValues: CompareTo (required), Destination (optional)
  • CirupMergeResources: MergeFrom (required), Destination (optional, defaults to in-place)
  • CirupSubtractResources: CompareTo (required), Destination (optional)
  • CirupConvertResources: Destination (required)

Optional MSBuild properties

<PropertyGroup>
  <CirupEnabled>true</CirupEnabled>
  <CirupHostRuntimeIdentifier></CirupHostRuntimeIdentifier>
  <CirupWorkingDirectory>$(MSBuildProjectDirectory)</CirupWorkingDirectory>
  <CirupAdditionalArgs></CirupAdditionalArgs>
  <CirupLogImportance>high</CirupLogImportance>
</PropertyGroup>

Set <CirupEnabled>false</CirupEnabled> to disable sorting. <CirupHostRuntimeIdentifier> is optional and exists for advanced overrides.

End-to-end sample

A runnable sample project is available at nuget/samples/Devolutions.Cirup.Build.E2E.

Run the full local validation flow from the repository root:

./nuget/test-e2e.ps1

RID-specific dotnet tool package

The repository also ships a separate RID-specific dotnet tool package: Devolutions.Cirup.Tool.

  • Package type: dotnet tool (command name cirup)
  • SDK requirement: .NET 10 SDK or newer
  • Supported RIDs: win-x64, win-arm64, linux-x64, linux-arm64, osx-x64, osx-arm64
  • Includes an any fallback package that prints a guidance message on unsupported runtimes

Install and run:

dotnet tool install -g Devolutions.Cirup.Tool
cirup --help

One-shot usage:

dotnet tool exec Devolutions.Cirup.Tool -- --help
dnx Devolutions.Cirup.Tool --help

Pack from prebuilt native artifacts (same artifact input as Devolutions.Cirup.Build):

./nuget/pack-cirup-dotnet-tool.ps1 -Version 1.2.3 -ArtifactsRoot ./dist -OutputDir ./dist/nuget