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
9 changes: 6 additions & 3 deletions claude.md
Original file line number Diff line number Diff line change
Expand Up @@ -678,15 +678,16 @@ the comment there about not caching "nothing staged" asks for.
itself) had not. GLFW opens the X11 extension libraries and `libGL` itself at run time, so only
`libX11` is left of them.

**DiffEngineTray (`src/DiffEngineTray/`):**
**DiffEngineTray (`src/DiffEngineTray.*`):**
- Windows Forms tray application that handles pending file diffs, in two projects. `src/DiffEngineTray.Core`
is everything that is not WinForms - `Tracker`, both inline hosts, `PiperServer`, the settings,
`DebugReport`, `IssueLauncher`, `ProcessEx` (which reads a process's image and command line
through kernel32 and ntdll, `/proc` on Linux, and `proc_pidpath` and `ps -ww` on macOS),
`DiffToolLauncher` and `FileLockKiller` (the restart manager's, which compiles anywhere and runs
only on Windows, Unix locks being advisory) - and builds on every platform, so a macOS or
Linux head can be put on it. Showing a file in a file manager is the viewer's `RevealFile`,
which the core links. `src/DiffEngineTray` is the Windows head:
which the core links. `src/DiffEngineTray.Windows` is the Windows head, a `WinExe` named
`DiffEngineTray` as the other heads are:
`Program`, the forms, the hot keys (`KeyRegister`, `KeyName`, which parses into WinForms'
`Keys`), the icons and the Run key. The menu is the core's `TrayMenu`: PlatformHeads'
`TrayMenuItem`s built from what the tracker holds, an action for each by id, and tips kept beside
Expand Down Expand Up @@ -759,7 +760,9 @@ the comment there about not caching "nothing staged" asks for.
and `dotnet tool install -g DiffEngineTray` fetches `DiffEngineTray.{rid}` beside it, so the
command did not change. Each RID's package is its head built for that RID, with that RID's viewer
at `viewer/{rid}` and the documents folder, with that RID's natives only, at `viewer/documents`.
The Windows head's build for no RID packs `DiffEngineTray` (`TrayPointer`), and its
`DiffEngineTray` is packed by `src/DiffEngineTray`, a project that is that package and nothing
else: a head's build for no RID packs nothing. The SDK packs a tool only from an `Exe`, and builds
it though the package holds none of its output, so it has a `Program.cs` that ships nowhere. Its
`PackTrayHeads` first builds each RID's head by the MSBuild task with `RuntimeIdentifier` added
and nothing else, as the SDK does for a tool's own RID list: their references are then the
instances the solution already built, restore is the solution's (`RuntimeIdentifiers` is each
Expand Down
6 changes: 6 additions & 0 deletions src/DiffEngine.slnx
Original file line number Diff line number Diff line change
Expand Up @@ -80,10 +80,16 @@
<BuildType Solution="Release-NotWindows|*" Project="Release" />
<Build Solution="Release-NotWindows|*" Project="false" />
</Project>
<!-- The package naming every RID's, which packs the Windows head's RIDs, so Windows only too. -->
<Project Path="DiffEngineTray/DiffEngineTray.csproj">
<BuildType Solution="Release-NotWindows|*" Project="Release" />
<Build Solution="Release-NotWindows|*" Project="false" />
</Project>
<!-- The Windows head. -->
<Project Path="DiffEngineTray.Windows/DiffEngineTray.Windows.csproj">
<BuildType Solution="Release-NotWindows|*" Project="Release" />
<Build Solution="Release-NotWindows|*" Project="false" />
</Project>
<!-- Builds everywhere: the tray's non-WinForms half, which a macOS or Linux head shares. -->
<Project Path="DiffEngineTray.Core/DiffEngineTray.Core.csproj">
<BuildType Solution="Release-NotWindows|*" Project="Release" />
Expand Down
2 changes: 1 addition & 1 deletion src/DiffEngineTray.Core.Tests/IconPixelsTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,5 +87,5 @@ static byte[] Ico(int size, byte[] bgra)
}

static string Image(string name, [CallerFilePath] string source = "") =>
Path.Combine(Path.GetDirectoryName(source)!, "..", "DiffEngineTray", "Images", name);
Path.Combine(Path.GetDirectoryName(source)!, "..", "DiffEngineTray.Windows", "Images", name);
}
2 changes: 1 addition & 1 deletion src/DiffEngineTray.Core/DiffEngineTray.Core.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<!-- One way of showing a file in a file manager, the viewer's, rather than a second one. -->
<Compile Include="..\DiffEngineViewer\RevealFile.cs" Link="RevealFile.cs" />
<!-- The Windows head's pictures, under the names it embeds them by, for the heads with no WinForms. -->
<EmbeddedResource Include="..\DiffEngineTray\Images\*.ico;..\DiffEngineTray\Images\*.png"
<EmbeddedResource Include="..\DiffEngineTray.Windows\Images\*.ico;..\DiffEngineTray.Windows\Images\*.png"
LinkBase="Images"
LogicalName="DiffEngineTray.Images.%(Filename)%(Extension)" />
</ItemGroup>
Expand Down
69 changes: 7 additions & 62 deletions src/DiffEngineTray.Core/TrayHead.targets
Original file line number Diff line number Diff line change
Expand Up @@ -11,21 +11,19 @@
viewers and six sets of document natives, at tens of MB each.

A build of a head for one of its RIDs packs that RID's package, with that RID's viewer and
documents folder in it. The Windows head's own build, for no RID, packs DiffEngineTray, and
builds every RID's head first to pack the rest (TrayPointer, below).
documents folder in it. A head's build for no RID packs nothing. DiffEngineTray itself is the
project in src/DiffEngineTray, which builds every RID's head first to pack the rest.
-->

<Import Project="TrayPackage.props" />

<PropertyGroup>
<PackAsTool>true</PackAsTool>
<PackageId>DiffEngineTray</PackageId>
<ToolCommandName>DiffEngineTray</ToolCommandName>
<Description>A utility that runs in the notification area, or the menu bar on macOS, and handles the results of file differences.</Description>
<!--
So the solution's restore covers each RID's build, since nothing restores for it on its own: it
is built by the MSBuild task in PackTrayHeads, which does not restore.
is built by the MSBuild task in DiffEngineTray's PackTrayHeads, which does not restore.
-->
<RuntimeIdentifiers>$(TrayRids)</RuntimeIdentifiers>
<!-- For no RID, so the SDK does not pack the Windows head for every RID itself. -->
<!-- For no RID, so the SDK does not pack a head for every RID itself. -->
<CreateRidSpecificToolPackages Condition="'$(RuntimeIdentifier)' == ''">false</CreateRidSpecificToolPackages>
<CreateRidSpecificToolPackages Condition="'$(RuntimeIdentifier)' != ''">true</CreateRidSpecificToolPackages>
<!--
Expand All @@ -38,7 +36,7 @@
.cmd opens a console at every login.
-->
<UseAppHost Condition="'$(RuntimeIdentifier)' != ''">false</UseAppHost>
<IsPackable Condition="'$(RuntimeIdentifier)' == '' And '$(TrayPointer)' != 'true'">false</IsPackable>
<IsPackable Condition="'$(RuntimeIdentifier)' == ''">false</IsPackable>
</PropertyGroup>

<!--
Expand Down Expand Up @@ -127,58 +125,5 @@
</ItemGroup>
</Target>

<!--
DiffEngineTray itself, which the Windows head packs: a package naming one for each RID, and
nothing else, which `dotnet tool install` reads to choose the one to fetch beside it. Each is
packed by a build of its head for that RID, from here, before this package is, so DiffEngineTray
is never packed without them.

By the MSBuild task with RuntimeIdentifier and nothing else, so the projects each one references
are the instances the solution already built, as the SDK does for a tool with a RID list of its
own. A separate `dotnet pack` for each RID would restore them all again under the solution being
built. Build rather than Pack, which ProjectDefaults' GeneratePackageOnBuild hooks the pack to:
Pack on its own then publishes for the RID without building for it.

The RIDs here and in ToolPackageRuntimeIdentifiers have to be the same, and
PackageTests.ThePointerNamesEveryRidsPackage checks that what it names was packed.
-->
<PropertyGroup Condition="'$(TrayPointer)' == 'true' And '$(RuntimeIdentifier)' == ''">
<ToolPackageRuntimeIdentifiers>win-x64;win-arm64;linux-x64;linux-arm64;osx-x64;osx-arm64</ToolPackageRuntimeIdentifiers>
<GenerateNuspecDependsOn>PackTrayHeads;$(GenerateNuspecDependsOn)</GenerateNuspecDependsOn>
</PropertyGroup>

<!--
For restore and build order, nothing else, as DiffEngine references the viewer's heads: restore
then covers their RIDs when this is built on its own, and each is built for no RID before it is
built for one. Every piece of metadata keeps the head's output, natives included, out of this
one's.
-->
<ItemGroup Condition="'$(TrayPointer)' == 'true' And '$(RuntimeIdentifier)' == ''">
<ProjectReference Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Linux\DiffEngineTray.Linux.csproj"
ReferenceOutputAssembly="false"
Private="false"
ExcludeAssets="all" />
<ProjectReference Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Mac\DiffEngineTray.Mac.csproj"
ReferenceOutputAssembly="false"
Private="false"
ExcludeAssets="all" />
</ItemGroup>

<ItemGroup Condition="'$(TrayPointer)' == 'true' And '$(RuntimeIdentifier)' == ''">
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray\DiffEngineTray.csproj" AdditionalProperties="RuntimeIdentifier=win-x64" />
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray\DiffEngineTray.csproj" AdditionalProperties="RuntimeIdentifier=win-arm64" />
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Linux\DiffEngineTray.Linux.csproj" AdditionalProperties="RuntimeIdentifier=linux-x64" />
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Linux\DiffEngineTray.Linux.csproj" AdditionalProperties="RuntimeIdentifier=linux-arm64" />
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Mac\DiffEngineTray.Mac.csproj" AdditionalProperties="RuntimeIdentifier=osx-x64" />
<_TrayRidPackage Include="$(MSBuildThisFileDirectory)..\DiffEngineTray.Mac\DiffEngineTray.Mac.csproj" AdditionalProperties="RuntimeIdentifier=osx-arm64" />
</ItemGroup>

<Target Name="PackTrayHeads"
Condition="'$(TrayPointer)' == 'true' And '$(RuntimeIdentifier)' == ''">
<MSBuild Projects="@(_TrayRidPackage)"
Targets="Build"
BuildInParallel="true" />
</Target>

<Import Project="$(MSBuildThisFileDirectory)..\DiffEngineViewer.Documents\Documents.targets" />
</Project>
14 changes: 14 additions & 0 deletions src/DiffEngineTray.Core/TrayPackage.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
<Project>

<!--
What DiffEngineTray is called and says about itself, in its own package and in every RID's:
imported by TrayHead.targets for the heads and by src/DiffEngineTray for the package that names
them.
-->
<PropertyGroup>
<PackAsTool>true</PackAsTool>
<PackageId>DiffEngineTray</PackageId>
<ToolCommandName>DiffEngineTray</ToolCommandName>
<Description>A utility that runs in the notification area, or the menu bar on macOS, and handles the results of file differences.</Description>
</PropertyGroup>
</Project>
2 changes: 1 addition & 1 deletion src/DiffEngineTray.Tests/DiffEngineTray.Tests.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
<PackageReference Include="SimpleInfoName" />
<PackageReference Include="Verify" />
<PackageReference Include="ProjectDefaults" PrivateAssets="all" />
<ProjectReference Include="..\DiffEngineTray\DiffEngineTray.csproj" />
<ProjectReference Include="..\DiffEngineTray.Windows\DiffEngineTray.Windows.csproj" />
<ProjectReference Include="..\DiffEngine\DiffEngine.csproj" />
<!--
Aliased. DiffEngineViewer links DiffEngine's Inline and Protocol sources rather than referencing
Expand Down
50 changes: 50 additions & 0 deletions src/DiffEngineTray.Windows/DiffEngineTray.Windows.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<Project Sdk="Microsoft.NET.Sdk.WindowsDesktop">

<!--
The tray on Windows. Named as the other heads are, so the core's InternalsVisibleTo names it, and
the pictures and forms keep their resource names.
-->
<PropertyGroup>
<OutputType>WinExe</OutputType>
<TargetFramework>net10.0</TargetFramework>
<AssemblyName>DiffEngineTray</AssemblyName>
<RootNamespace>DiffEngineTray</RootNamespace>
<UseWindowsForms>true</UseWindowsForms>
<CopyLocalLockFileAssemblies>true</CopyLocalLockFileAssemblies>
<NoWarn>NETSDK1137;WFAC010;NU5119</NoWarn>
<GenerateDocumentationFile>false</GenerateDocumentationFile>
<RollForward>LatestMajor</RollForward>
<!-- Packed as DiffEngineTray.win-x64 and .win-arm64, by TrayHead.targets. -->
<TrayRids>win-x64;win-arm64</TrayRids>
</PropertyGroup>
<Target Name="RemoveTargetPlatformIdentifier" BeforeTargets="_CheckForInvalidWindowsDesktopTargetingConfiguration">
<PropertyGroup>
<TargetPlatformIdentifier>Windows</TargetPlatformIdentifier>
</PropertyGroup>
</Target>
<Target Name="RestoreTargetPlatformIdentifier" AfterTargets="_CheckForInvalidWindowsDesktopTargetingConfiguration">
<PropertyGroup>
<TargetPlatformIdentifier></TargetPlatformIdentifier>
</PropertyGroup>
</Target>

<ItemGroup>
<None Remove="**\*.ico" />
<None Remove="**\*.png" />
<Using Include="DiffEngine" />
<Using Include="PlatformHeads" />
<EmbeddedResource Include="Images\*.ico" />
<EmbeddedResource Include="Images\*.png" />
<!-- The tray pieces BuildMonitor's tray shares: SessionEndWindow, MenuOnOpening, IssueLink
and LinkOpener. -->
<PackageReference Include="PlatformHeads.WindowsForms" />
<PackageReference Include="Serilog" />
<PackageReference Include="Serilog.Sinks.File" />
<PackageReference Include="ProjectDefaults" PrivateAssets="all" />
<ProjectReference Include="..\DiffEngine\DiffEngine.csproj" />
<!-- Everything that is not WinForms, which a head for another platform shares. -->
<ProjectReference Include="..\DiffEngineTray.Core\DiffEngineTray.Core.csproj" />
</ItemGroup>

<Import Project="..\DiffEngineTray.Core\TrayHead.targets" />
</Project>
Loading
Loading