Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configuration commands #3036

Merged
merged 43 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
c7e10fb
Mid-adding commands
JohnMcPMS Feb 15, 2023
dbd1c65
Hook up commands; needs experimental setup still
JohnMcPMS Feb 15, 2023
dfc75e7
Very basic show command hooked up and functional, working on apply
JohnMcPMS Feb 16, 2023
add857d
Expanded show command, implemented apply command. Both need integrat…
JohnMcPMS Feb 17, 2023
35fac60
Change API and flow to better present information as it is available …
JohnMcPMS Feb 28, 2023
9252d9e
Finish updates to show flow
JohnMcPMS Feb 28, 2023
2244699
Config unit test fixes
JohnMcPMS Feb 28, 2023
2164411
Merge branch 'master' into config-command
JohnMcPMS Feb 28, 2023
d30eb2a
Change commands to use existing not implemented path
JohnMcPMS Mar 1, 2023
d83500e
Fix tests that were leaving user settings file around
JohnMcPMS Mar 1, 2023
7343470
Add test processor factory
JohnMcPMS Mar 1, 2023
a553454
Merge branch 'master' into config-command
JohnMcPMS Mar 1, 2023
89706ef
Fixes to integrate with merge
JohnMcPMS Mar 2, 2023
b0ab59d
Configuration processor remoting impl
JohnMcPMS Mar 3, 2023
7239a7d
Merge branch 'master' into config-command
JohnMcPMS Mar 3, 2023
9720812
Improve failure reporting from remoting and set up package project fully
JohnMcPMS Mar 3, 2023
49af67e
Fix async progress callbacks happening on wrong thread context
JohnMcPMS Mar 3, 2023
0769704
Update agreement arg
JohnMcPMS Mar 3, 2023
cd607e3
Spelling fixes
JohnMcPMS Mar 3, 2023
a7f244a
Try AnyCPU build for remoting server
JohnMcPMS Mar 3, 2023
826fd74
Revert "Try AnyCPU build for remoting server"
JohnMcPMS Mar 3, 2023
7658eee
Merge branch 'master' into config-command
JohnMcPMS Mar 3, 2023
8050aeb
Add RIDs :shrug:
JohnMcPMS Mar 3, 2023
862ae92
Use different marshal function
JohnMcPMS Mar 4, 2023
581d323
More RIDs and always pull in from AnyCPU for package
JohnMcPMS Mar 4, 2023
1290142
PR feedback and smoke test in E2E
JohnMcPMS Mar 6, 2023
0b0794f
Add logging and artifact publish to investigate processor build error
JohnMcPMS Mar 6, 2023
b17b2cb
Revert "Add logging and artifact publish to investigate processor bui…
JohnMcPMS Mar 7, 2023
a9e6136
Publish dev package for testing
JohnMcPMS Mar 7, 2023
c9c84a6
Move the package output to maybe be included with the artifacts?
JohnMcPMS Mar 7, 2023
00dab2c
Try moving the appxpackages directory and directly referencing the co…
JohnMcPMS Mar 7, 2023
79a0b8d
Update spelling
JohnMcPMS Mar 7, 2023
1b80556
Fix pipeline
JohnMcPMS Mar 7, 2023
d33eb06
Revert "Revert "Add logging and artifact publish to investigate proce…
JohnMcPMS Mar 7, 2023
7569ed1
More files published
JohnMcPMS Mar 7, 2023
57b0363
Dump build output directory
JohnMcPMS Mar 7, 2023
4b280d3
Fix pipeline
JohnMcPMS Mar 7, 2023
8ded116
Try using OutDir like E2E tests to get correct location on build server
JohnMcPMS Mar 7, 2023
d16ee92
Closing in?
JohnMcPMS Mar 7, 2023
2e09143
Revert OutDir
JohnMcPMS Mar 7, 2023
b076839
Fix relative file path, ignore smoke test for now, add message for pr…
JohnMcPMS Mar 8, 2023
4cbeeec
Remove some debugging steps from pipeline and use win10 RIDs
JohnMcPMS Mar 8, 2023
ca21ff8
Nope, has to be win-arch
JohnMcPMS Mar 8, 2023
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
1 change: 1 addition & 0 deletions .github/actions/spelling/allow.txt
Original file line number Diff line number Diff line change
Expand Up @@ -446,6 +446,7 @@ REFCLSID
REFCOUNT
regex
regexp
remoting
removefile
removemanifest
removepin
Expand Down
5 changes: 5 additions & 0 deletions .github/actions/spelling/expect.txt
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,7 @@ liv
liwpx
localizationpriority
LPBYTE
LPCWSTR
LPDWORD
lpitemidlist
LPSTR
Expand All @@ -197,10 +198,12 @@ LTDA
luffy
Luffytaro
malware
mapview
maxvalue
maybenull
MBH
mdmp
MDs
megamorf
midl
minexample
Expand Down Expand Up @@ -320,6 +323,7 @@ SHCONTF
SHGDN
SHOWNORMAL
sid
Sideload
SIGNATUREHASH
Sku
sortof
Expand All @@ -331,6 +335,7 @@ SRL
srs
standalone
startswith
STARTUPINFOW
STRRET
stylecop
subdir
Expand Down
18 changes: 16 additions & 2 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ jobs:
/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload'
/p:UapAppxPackageBuildMode=SideloadOnly'

- task: VSBuild@1
displayName: Build Test Project
Expand All @@ -118,7 +118,7 @@ jobs:
/p:AppxBundlePlatforms="$(buildPlatform)"
/p:AppxPackageDir="$(appxPackageDir)"
/p:AppxBundle=Always
/p:UapAppxPackageBuildMode=StoreUpload'
/p:UapAppxPackageBuildMode=SideloadOnly'

- task: CopyFiles@2
displayName: 'Copy WindowsPackageManager.dll Symbols to artifacts folder'
Expand Down Expand Up @@ -317,6 +317,20 @@ jobs:
TargetFolder: '$(artifactsDir)\PowerShell'
condition: always()

- task: CopyFiles@2
displayName: 'Copy Dev Package (Loose Files)'
inputs:
SourceFolder: 'src\AppInstallerCLIPackage\bin\$(buildPlatform)\$(buildConfiguration)'
TargetFolder: '$(artifactsDir)\DevPackage'
condition: always()

- task: CopyFiles@2
displayName: 'Copy Dev Packages'
inputs:
SourceFolder: '$(appxPackageDir)'
TargetFolder: '$(artifactsDir)\AppxPackages'
condition: always()

- task: PublishPipelineArtifact@1
displayName: Publish Pipeline Artifacts
inputs:
Expand Down
11 changes: 11 additions & 0 deletions doc/Settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -263,3 +263,14 @@ You can enable the feature as shown below.
"pinning": true
},
```

### configuration

This feature enables the configuration commands. These commands allow configuring the system into a desired state.
You can enable the feature as shown below.

```json
"experimentalFeatures": {
"configuration": true
},
```
5 changes: 5 additions & 0 deletions schemas/JSON/settings/settings.schema.0.2.json
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,11 @@
"description": "Enable support for package pinning",
"type": "boolean",
"default": false
},
"configuration": {
"description": "Enable support for configuration",
"type": "boolean",
"default": false
}
}
}
Expand Down
27 changes: 27 additions & 0 deletions src/AppInstallerCLI.sln
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Project("{C7167F0D-BC9F-4E6E-AFE1-012C56B48DB5}") = "AppInstallerCLIPackage", "A
{1CC41A9A-AE66-459D-9210-1E572DD7BE69} = {1CC41A9A-AE66-459D-9210-1E572DD7BE69}
{2B00D362-AC92-41F3-A8D2-5B1599BDCA01} = {2B00D362-AC92-41F3-A8D2-5B1599BDCA01}
{5B6F90DF-FD19-4BAE-83D9-24DAD128E777} = {5B6F90DF-FD19-4BAE-83D9-24DAD128E777}
{CA460806-5E41-4E97-9A3D-1D74B433B663} = {CA460806-5E41-4E97-9A3D-1D74B433B663}
EndProjectSection
EndProject
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AppInstallerCLI", "AppInstallerCLI\AppInstallerCLI.vcxproj", "{5B6F90DF-FD19-4BAE-83D9-24DAD128E777}"
Expand Down Expand Up @@ -157,6 +158,8 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Management.Config
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Microsoft.Management.Configuration.Processor", "Microsoft.Management.Configuration.Processor\Microsoft.Management.Configuration.Processor.csproj", "{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ConfigurationRemotingServer", "ConfigurationRemotingServer\ConfigurationRemotingServer.csproj", "{6597EB04-D105-49A7-A5A3-D27FE1DF895E}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|ARM64 = Debug|ARM64
Expand Down Expand Up @@ -846,6 +849,30 @@ Global
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x64.Build.0 = Release|x64
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.ActiveCfg = Release|x86
{71FA29AA-9035-468B-A11D-0F0B0F5D5AF4}.TestRelease|x86.Build.0 = Release|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|ARM64.ActiveCfg = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|ARM64.Build.0 = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|x64.ActiveCfg = Debug|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|x64.Build.0 = Debug|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|x86.ActiveCfg = Debug|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Debug|x86.Build.0 = Debug|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|ARM64.ActiveCfg = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|ARM64.Build.0 = Debug|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|x64.ActiveCfg = Debug|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|x64.Build.0 = Debug|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|x86.ActiveCfg = Debug|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Fuzzing|x86.Build.0 = Debug|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|ARM64.ActiveCfg = Release|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|ARM64.Build.0 = Release|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|x64.ActiveCfg = Release|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|x64.Build.0 = Release|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|x86.ActiveCfg = Release|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.Release|x86.Build.0 = Release|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|ARM64.ActiveCfg = Release|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|ARM64.Build.0 = Release|arm64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|x64.ActiveCfg = Release|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|x64.Build.0 = Release|x64
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|x86.ActiveCfg = Release|x86
{6597EB04-D105-49A7-A5A3-D27FE1DF895E}.TestRelease|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
17 changes: 17 additions & 0 deletions src/AppInstallerCLICore/AppInstallerCLICore.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -243,6 +243,10 @@
<ClInclude Include="Command.h" />
<ClInclude Include="Commands\COMCommand.h" />
<ClInclude Include="Commands\CompleteCommand.h" />
<ClInclude Include="Commands\ConfigureCommand.h" />
<ClInclude Include="Commands\ConfigureShowCommand.h" />
<ClInclude Include="Commands\ConfigureTestCommand.h" />
<ClInclude Include="Commands\ConfigureValidateCommand.h" />
<ClInclude Include="Commands\ExperimentalCommand.h" />
<ClInclude Include="Commands\ExportCommand.h" />
<ClInclude Include="Commands\ImportCommand.h" />
Expand All @@ -260,8 +264,11 @@
<ClInclude Include="Commands\ValidateCommand.h" />
<ClInclude Include="Commands\SettingsCommand.h" />
<ClInclude Include="CompletionData.h" />
<ClInclude Include="ConfigurationContext.h" />
<ClInclude Include="ConfigurationSetProcessorFactoryRemoting.h" />
<ClInclude Include="ContextOrchestrator.h" />
<ClInclude Include="COMContext.h" />
<ClInclude Include="Workflows\ConfigurationFlow.h" />
<ClInclude Include="Workflows\DependenciesFlow.h" />
<ClInclude Include="ExecutionArgs.h" />
<ClInclude Include="ExecutionContextData.h" />
Expand Down Expand Up @@ -301,9 +308,16 @@
<ItemGroup>
<ClCompile Include="COMContext.cpp" />
<ClCompile Include="Commands\COMCommand.cpp" />
<ClCompile Include="Commands\ConfigureCommand.cpp" />
<ClCompile Include="Commands\ConfigureShowCommand.cpp" />
<ClCompile Include="Commands\ConfigureTestCommand.cpp" />
<ClCompile Include="Commands\ConfigureValidateCommand.cpp" />
<ClCompile Include="Commands\ImportCommand.cpp" />
<ClCompile Include="Commands\PinCommand.cpp" />
<ClCompile Include="ConfigurationContext.cpp" />
<ClCompile Include="ConfigurationSetProcessorFactoryRemoting.cpp" />
<ClCompile Include="ContextOrchestrator.cpp" />
<ClCompile Include="Workflows\ConfigurationFlow.cpp" />
<ClCompile Include="Workflows\DependenciesFlow.cpp" />
<ClCompile Include="PackageCollection.cpp" />
<ClCompile Include="Argument.cpp" />
Expand Down Expand Up @@ -367,6 +381,9 @@
<ProjectReference Include="..\AppInstallerRepositoryCore\AppInstallerRepositoryCore.vcxproj">
<Project>{5eb88068-5fb9-4e69-89b2-72dbc5e068f9}</Project>
</ProjectReference>
<ProjectReference Include="..\Microsoft.Management.Configuration\Microsoft.Management.Configuration.vcxproj">
<Project>{ca460806-5e41-4e97-9a3d-1d74b433b663}</Project>
</ProjectReference>
<ProjectReference Include="..\YamlCppLib\YamlCppLib.vcxproj">
<Project>{8bb94bb8-374f-4294-bca1-c7811514a6b7}</Project>
</ProjectReference>
Expand Down
42 changes: 42 additions & 0 deletions src/AppInstallerCLICore/AppInstallerCLICore.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,27 @@
<ClInclude Include="Workflows\MultiQueryFlow.h">
<Filter>Workflows</Filter>
</ClInclude>
<ClInclude Include="Commands\ConfigureCommand.h">
<Filter>Commands</Filter>
</ClInclude>
<ClInclude Include="Commands\ConfigureShowCommand.h">
<Filter>Commands</Filter>
</ClInclude>
<ClInclude Include="Commands\ConfigureTestCommand.h">
<Filter>Commands</Filter>
</ClInclude>
<ClInclude Include="Commands\ConfigureValidateCommand.h">
<Filter>Commands</Filter>
</ClInclude>
<ClInclude Include="ConfigurationContext.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="Workflows\ConfigurationFlow.h">
<Filter>Workflows</Filter>
</ClInclude>
<ClInclude Include="ConfigurationSetProcessorFactoryRemoting.h">
<Filter>Workflows</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="pch.cpp">
Expand Down Expand Up @@ -361,6 +382,27 @@
<ClCompile Include="Workflows\MultiQueryFlow.cpp">
<Filter>Workflows</Filter>
</ClCompile>
<ClCompile Include="Commands\ConfigureCommand.cpp">
<Filter>Commands</Filter>
</ClCompile>
<ClCompile Include="Commands\ConfigureShowCommand.cpp">
<Filter>Commands</Filter>
</ClCompile>
<ClCompile Include="Commands\ConfigureTestCommand.cpp">
<Filter>Commands</Filter>
</ClCompile>
<ClCompile Include="Commands\ConfigureValidateCommand.cpp">
<Filter>Commands</Filter>
</ClCompile>
<ClCompile Include="ConfigurationContext.cpp">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="Workflows\ConfigurationFlow.cpp">
<Filter>Workflows</Filter>
</ClCompile>
<ClCompile Include="ConfigurationSetProcessorFactoryRemoting.cpp">
<Filter>Workflows</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<None Include="PropertySheet.props" />
Expand Down
8 changes: 7 additions & 1 deletion src/AppInstallerCLICore/Argument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,12 @@ namespace AppInstaller::CLI
case Execution::Args::Type::BlockingPin:
return { type, "blocking"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::PinType };

// Configuration commands
case Execution::Args::Type::ConfigurationFile:
return { type, "file"_liv, 'f' };
case Execution::Args::Type::ConfigurationAcceptWarning:
return { type, "accept-configuration-agreements"_liv };

// Common arguments
case Execution::Args::Type::NoVT:
return { type, "no-vt"_liv, ArgTypeCategory::None, ArgTypeExclusiveSet::ProgressBarOption };
Expand Down Expand Up @@ -196,7 +202,7 @@ namespace AppInstaller::CLI
case Execution::Args::Type::ToolVersion:
return { type, "version"_liv, 'v' };

// Used for demonstration purposes
// Used for demonstration purposes
case Execution::Args::Type::ExperimentalArg:
return { type, "arg"_liv };

Expand Down
2 changes: 1 addition & 1 deletion src/AppInstallerCLICore/Argument.h
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ namespace AppInstaller::CLI

// An argument to a command; containing only data that is common to all its uses.
// Argument extends this by adding command-specific values, like help strings.
struct ArgumentCommon
struct ArgumentCommon
{
// Defines an argument with no alias.
constexpr static char NoAlias = '\0';
Expand Down
6 changes: 6 additions & 0 deletions src/AppInstallerCLICore/ChannelStreams.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,6 +96,9 @@ namespace AppInstaller::CLI::Execution
{
if (m_enabled && m_VTEnabled)
{
// Apply format as normal to ensure that any previous format doesn't bleed through.
ApplyFormat();

m_out << sequence;

// An incoming sequence will be valid for 1 "standard" output after this one.
Expand All @@ -111,6 +114,9 @@ namespace AppInstaller::CLI::Execution
{
if (m_enabled && m_VTEnabled)
{
// Apply format as normal to ensure that any previous format doesn't bleed through.
ApplyFormat();

m_out << sequence;
// An incoming sequence will be valid for 1 "standard" output after this one.
// We set this to 2 to make that happen, because when it is 1, we will output
Expand Down
13 changes: 12 additions & 1 deletion src/AppInstallerCLICore/Command.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ namespace AppInstaller::CLI
}
else
{
commandChain = commandChain.substr(firstSplit);
commandChain = commandChain.substr(firstSplit + 1);
for (char& c : commandChain)
{
if (c == ParentSplitChar)
Expand Down Expand Up @@ -301,6 +301,12 @@ namespace AppInstaller::CLI
}
}

// The command has opted-in to be executed when it has subcommands and the next token is a positional parameter value
if (m_selectCurrentCommandIfUnrecognizedSubcommandFound)
{
return {};
}

// TODO: If we get to a large number of commands, do a fuzzy search much like git
throw CommandException(Resource::String::UnrecognizedCommand(Utility::LocIndView{ *itr }));
}
Expand Down Expand Up @@ -859,6 +865,11 @@ namespace AppInstaller::CLI
}
}

void Command::SelectCurrentCommandIfUnrecognizedSubcommandFound(bool value)
{
m_selectCurrentCommandIfUnrecognizedSubcommandFound = value;
}

void Command::ValidateArgumentsInternal(Execution::Args&) const
{
// Do nothing by default.
Expand Down
3 changes: 3 additions & 0 deletions src/AppInstallerCLICore/Command.h
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,8 @@ namespace AppInstaller::CLI
virtual void Execute(Execution::Context& context) const;

protected:
void SelectCurrentCommandIfUnrecognizedSubcommandFound(bool value);

virtual void ValidateArgumentsInternal(Execution::Args& execArgs) const;
virtual void ExecuteInternal(Execution::Context& context) const;

Expand All @@ -124,6 +126,7 @@ namespace AppInstaller::CLI
Settings::ExperimentalFeature::Feature m_feature;
Settings::TogglePolicy::Policy m_groupPolicy;
CommandOutputFlags m_outputFlags;
bool m_selectCurrentCommandIfUnrecognizedSubcommandFound = false;
};

template <typename Container>
Expand Down
Loading