mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-08-29 10:09:43 +02:00
## Summary of the Pull Request Adds a native C++ multi-call shim that exposes existing PowerToys CLIs through `PATH`. The shims are installed under the PowerToys `bin` subfolder and follow the `PowerToys.<ModuleName>.CLI.exe` naming convention. The launcher preserves the raw argument tail, shares the caller's console, and returns the target process exit code. | PATH-visible command | Target executable | | --- | --- | | `PowerToys.FancyZones.CLI.exe` | `FancyZonesCLI.exe` | | `PowerToys.ImageResizer.CLI.exe` | `WinUI3Apps/PowerToys.ImageResizerCLI.exe` | | `PowerToys.FileLocksmith.CLI.exe` | `FileLocksmithCLI.exe` | | `PowerToys.PowerDisplay.CLI.exe` | `WinUI3Apps/PowerToys.PowerDisplay.Cli.exe` | proof of this work: <img width="1044" height="294" alt="image" src="https://github.com/user-attachments/assets/b659c552-5c08-4430-85c3-eba48f286eb0" /> <img width="1137" height="244" alt="image" src="https://github.com/user-attachments/assets/5fed493f-dc30-428d-a618-bf612ccf3635" /> <img width="1727" height="868" alt="image" src="https://github.com/user-attachments/assets/5c32fd2e-4a3a-4138-b968-fb5434eebec3" /> ## PR Checklist - [x] Closes: #48634 - [x] **Communication:** Discussed with core contributors in this PR - [x] **Tests:** Added/updated and all pass - [ ] **Localization:** CLI diagnostic messages are not localized - [x] **Dev docs:** Updated CLI naming and installation conventions - [x] **New binaries:** Added on the required places - [x] Signing JSON - [x] WiX installer entries - [x] CI builds through `PowerToys.slnx`; no dedicated YML step is required - [x] The existing release pipeline covers the solution and installer - [x] **Documentation updated:** `doc/devdocs/cli-conventions.md` ## Detailed Description of the Pull Request / Additional comments - Uses one native launcher binary for all commands and resolves the target from the invoked shim filename. - Installs PATH-visible shims under `PowerToys\bin`. - Keeps the existing module CLI binaries and their deployment locations unchanged. - Rejects the previous unsuffixed and `*cli` command aliases. ## Validation Steps Performed - Built `tools/CliShim.UnitTests/CliShim.UnitTests.vcxproj` in `Release|x64`: 0 warnings, 0 errors. - Ran `CliShim.UnitTests.dll` with `vstest.console.exe`: 5/5 tests passed. - Verified the CLI manifest, WiX command names, and `bin` installation directory are synchronized. - Ran `git diff --check`. --------- Co-authored-by: Yu Leng <yuleng@microsoft.com> Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com> Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com> Copilot-Session: d11c4221-248f-44a9-85fb-7017ed43f4ce
60 lines
2.8 KiB
XML
60 lines
2.8 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
|
|
<PropertyGroup Label="Globals">
|
|
<ProjectGuid>{D4B0ED68-867D-46B4-A03F-EC52B9FBEBE5}</ProjectGuid>
|
|
<Keyword>Win32Proj</Keyword>
|
|
<RootNamespace>PowerToysCliShimUnitTests</RootNamespace>
|
|
<ProjectName>CliShim.UnitTests</ProjectName>
|
|
<ProjectSubType>NativeUnitTestProject</ProjectSubType>
|
|
<UsePrecompiledHeaders>false</UsePrecompiledHeaders>
|
|
<OutDir>$(RepoRoot)$(Platform)\$(Configuration)\tests\CliShim\</OutDir>
|
|
</PropertyGroup>
|
|
<PropertyGroup Label="Configuration">
|
|
<ConfigurationType>DynamicLibrary</ConfigurationType>
|
|
</PropertyGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
|
|
<!-- Supplies the shared command mapping and generates CliShimTargets.g.inc into $(IntDir). -->
|
|
<Import Project="..\CliShim\CliShimManifest.props" />
|
|
<PropertyGroup>
|
|
<VcpkgEnabled>false</VcpkgEnabled>
|
|
<VcpkgManifestEnabled>false</VcpkgManifestEnabled>
|
|
</PropertyGroup>
|
|
<ItemDefinitionGroup>
|
|
<ClCompile>
|
|
<PrecompiledHeader>NotUsing</PrecompiledHeader>
|
|
<AdditionalIncludeDirectories>$(IntDir);$(MSBuildProjectDirectory)\..\CliShim;$(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
|
</ClCompile>
|
|
<Link>
|
|
<AdditionalLibraryDirectories>$(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
|
</Link>
|
|
</ItemDefinitionGroup>
|
|
<ItemGroup>
|
|
<!-- Compile the parser directly; the project reference supplies the integration-test executable. -->
|
|
<ClCompile Include="..\CliShim\CommandLine.cpp" />
|
|
<ClCompile Include="CommandLineTests.cpp" />
|
|
<ClCompile Include="LauncherIntegrationTests.cpp" />
|
|
<ClInclude Include="..\CliShim\CommandLine.h" />
|
|
</ItemGroup>
|
|
<ItemGroup>
|
|
<ProjectReference Include="..\CliShim\CliShim.vcxproj">
|
|
<Project>{8A7FB7FA-65EA-4004-BA73-1B237435A57B}</Project>
|
|
<LinkLibraryDependencies>false</LinkLibraryDependencies>
|
|
<ReferenceOutputAssembly>false</ReferenceOutputAssembly>
|
|
</ProjectReference>
|
|
</ItemGroup>
|
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
|
<Target Name="CopyCliShimUnderTest"
|
|
AfterTargets="Build"
|
|
Condition="'$(_IsSkippedTestProject)' != 'true'">
|
|
<PropertyGroup>
|
|
<_CliShimUnderTest>$(RepoRoot)$(Platform)\$(Configuration)\CliShim\PowerToys.CliShim.exe</_CliShimUnderTest>
|
|
</PropertyGroup>
|
|
<Error Condition="!Exists('$(_CliShimUnderTest)')"
|
|
Text="CLI shim under test was not built: '$(_CliShimUnderTest)'." />
|
|
<Copy SourceFiles="$(_CliShimUnderTest)"
|
|
DestinationFolder="$(OutDir)"
|
|
SkipUnchangedFiles="true" />
|
|
</Target>
|
|
</Project>
|