Skip to content

Commit 3891c46

Browse files
committed
Merge from master
2 parents 306a1ad + 511d4f9 commit 3891c46

File tree

55 files changed

+1508
-56
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+1508
-56
lines changed

doc/windows-package-manager-release-roadmap.md

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,17 @@ Releases will be available here on GitHub first. We will release to the App Inst
3737

3838
## GitHub Milestones
3939

40-
We use [GitHub milestones](https://github.com/microsoft/winget-cli/milestones) to broadly organize what we intend to work on. Dates are only used for sequencing and do not represent a commitment.
41-
42-
| Milestone | Description |
43-
| --- | --- |
44-
| [v1.7-Client](https://github.com/microsoft/winget-cli/milestone/42) | Work Targeted for v1.7 |
45-
| [v1.8-Client](https://github.com/microsoft/winget-cli/milestone/43) | Work Targeted for v1.8 |
46-
| [v.Next-Client](https://github.com/microsoft/winget-cli/milestone/34) | Triage for the next Milestone |
47-
| [Backlog-Client](https://github.com/microsoft/winget-cli/milestone/2) | Work not yet assigned to a milestone or release |
40+
We use [GitHub Projects](https://github.com/orgs/microsoft/projects/137) to broadly organize what we intend to work on. Issues will be added to milestones when we're reasonably confident they will land in the next milestone. Dates in [GitHub milestones](https://github.com/microsoft/winget-cli/milestones) are only used for sequencing and do not represent a commitment.
41+
42+
| Milestone | Description | Status |
43+
| ------------------------------------------------------------------------------------------------------------- | ----------------------------------------------- | ------------------ |
44+
| [v1.7-Client](https://github.com/microsoft/winget-cli/milestone/42) | Work Targeted for v1.7 | :white_check_mark: |
45+
| [v1.8-Client](https://github.com/microsoft/winget-cli/milestone/43) | Work Targeted for v1.8 | :white_check_mark: |
46+
| [v1.9-Client](https://github.com/microsoft/winget-cli/milestone/44) | Work Targeted for v1.9 | :white_check_mark: |
47+
| [v1.10-Client](https://github.com/microsoft/winget-cli/milestone/45) | Work Targeted for v1.10 | :white_check_mark: |
48+
| [v1.11-Client](https://github.com/microsoft/winget-cli/milestone/46) | Work Targeted for v1.11 | :construction: |
49+
| [v.Next-Client](https://github.com/microsoft/winget-cli/milestone/41) | Triage for the next Milestone | :rocket: |
50+
| [Backlog-Client](https://github.com/microsoft/winget-cli/issues?q=is%3Aissue%20state%3Aopen%20no%3Amilestone) | Work not yet assigned to a milestone or release | N/A |
4851

4952
## Issue Triage & Prioritization
5053

@@ -55,3 +58,4 @@ Incoming issues/asks/etc. are triaged several times a week, labelled appropriate
5558
* Issues/features/asks not on our list of the features of next release is assigned to the [Windows Package Manager Backlog](https://github.com/microsoft/winget-cli/milestone/2) for subsequent triage, prioritization & scheduling.
5659

5760
#### Feature Priorities will be influenced by community feedback on issues.
61+

src/AppInstallerCLI/AppInstallerCLI.vcxproj

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<?xml version="1.0" encoding="utf-8"?>
1+
<?xml version="1.0" encoding="utf-8"?>
22
<Project DefaultTargets="Build" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
33
<Import Project="$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props" Condition="Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" />
44
<PropertyGroup Label="Globals">
@@ -160,6 +160,7 @@
160160
<SubSystem>Console</SubSystem>
161161
<GenerateWindowsMetadata>false</GenerateWindowsMetadata>
162162
<AdditionalDependencies Condition="'$(Configuration)'=='Debug'">%(AdditionalDependencies)</AdditionalDependencies>
163+
<CETCompat Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</CETCompat>
163164
</Link>
164165
<Manifest>
165166
<AdditionalManifestFiles Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">$(ProjectDir)..\manifest\shared.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
@@ -182,6 +183,9 @@
182183
<Manifest>
183184
<AdditionalManifestFiles Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)..\manifest\shared.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
184185
</Manifest>
186+
<Link>
187+
<CETCompat Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</CETCompat>
188+
</Link>
185189
</ItemDefinitionGroup>
186190
<ItemDefinitionGroup Condition="'$(Configuration)'=='Release'">
187191
<ClCompile>
@@ -220,6 +224,8 @@
220224
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">/debug:full /debugtype:cv,fixup /incremental:no %(AdditionalOptions)</AdditionalOptions>
221225
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">/debug:full /debugtype:cv,fixup /incremental:no %(AdditionalOptions)</AdditionalOptions>
222226
<AdditionalOptions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">/debug:full /debugtype:cv,fixup /incremental:no %(AdditionalOptions)</AdditionalOptions>
227+
<CETCompat Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">true</CETCompat>
228+
<CETCompat Condition="'$(Configuration)|$(Platform)'=='Release|x64'">true</CETCompat>
223229
</Link>
224230
<Manifest>
225231
<AdditionalManifestFiles Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">$(ProjectDir)..\manifest\shared.manifest %(AdditionalManifestFiles)</AdditionalManifestFiles>
@@ -254,4 +260,4 @@
254260
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.props'))" />
255261
<Error Condition="!Exists('$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets')" Text="$([System.String]::Format('$(ErrorText)', '$(SolutionDir)\packages\Microsoft.Windows.CppWinRT.2.0.230706.1\build\native\Microsoft.Windows.CppWinRT.targets'))" />
256262
</Target>
257-
</Project>
263+
</Project>

src/AppInstallerCLICore/AppInstallerCLICore.vcxproj

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -306,6 +306,7 @@
306306
<ClInclude Include="Commands\DscCommandBase.h" />
307307
<ClInclude Include="Commands\DscComposableObject.h" />
308308
<ClInclude Include="Commands\DscTestFileResource.h" />
309+
<ClInclude Include="Commands\DscTestJsonResource.h" />
309310
<ClInclude Include="Commands\ErrorCommand.h" />
310311
<ClInclude Include="Commands\ExperimentalCommand.h" />
311312
<ClInclude Include="Commands\ExportCommand.h" />
@@ -391,6 +392,7 @@
391392
<ClCompile Include="Commands\DscCommandBase.cpp" />
392393
<ClCompile Include="Commands\DscComposableObject.cpp" />
393394
<ClCompile Include="Commands\DscTestFileResource.cpp" />
395+
<ClCompile Include="Commands\DscTestJsonResource.cpp" />
394396
<ClCompile Include="Commands\ErrorCommand.cpp" />
395397
<ClCompile Include="Commands\FontCommand.cpp" />
396398
<ClCompile Include="Commands\ImportCommand.cpp" />

src/AppInstallerCLICore/AppInstallerCLICore.vcxproj.filters

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -281,6 +281,9 @@
281281
<ClInclude Include="Commands\DscComposableObject.h">
282282
<Filter>Commands\Configuration</Filter>
283283
</ClInclude>
284+
<ClInclude Include="Commands\DscTestJsonResource.h">
285+
<Filter>Commands\Configuration</Filter>
286+
</ClInclude>
284287
</ItemGroup>
285288
<ItemGroup>
286289
<ClCompile Include="pch.cpp">
@@ -529,6 +532,9 @@
529532
<ClCompile Include="Commands\DscComposableObject.cpp">
530533
<Filter>Commands\Configuration</Filter>
531534
</ClCompile>
535+
<ClCompile Include="Commands\DscTestJsonResource.cpp">
536+
<Filter>Commands\Configuration</Filter>
537+
</ClCompile>
532538
</ItemGroup>
533539
<ItemGroup>
534540
<None Include="PropertySheet.props" />

src/AppInstallerCLICore/Commands/DscCommand.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
#ifndef AICLI_DISABLE_TEST_HOOKS
77
#include "DscTestFileResource.h"
8+
#include "DscTestJsonResource.h"
89
#endif
910

1011
namespace AppInstaller::CLI
@@ -14,6 +15,7 @@ namespace AppInstaller::CLI
1415
return InitializeFromMoveOnly<std::vector<std::unique_ptr<Command>>>({
1516
#ifndef AICLI_DISABLE_TEST_HOOKS
1617
std::make_unique<DscTestFileResource>(FullName()),
18+
std::make_unique<DscTestJsonResource>(FullName()),
1719
#endif
1820
});
1921
}

src/AppInstallerCLICore/Commands/DscCommandBase.cpp

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ namespace AppInstaller::CLI
9292
return false;
9393
}
9494

95+
std::optional<std::string> GetReturnType(DscFunctionModifiers modifiers)
96+
{
97+
if (WI_IsFlagSet(modifiers, DscFunctionModifiers::ReturnsStateAndDiff))
98+
{
99+
return "stateAndDiff";
100+
}
101+
102+
if (WI_IsFlagSet(modifiers, DscFunctionModifiers::ReturnsState))
103+
{
104+
return "state";
105+
}
106+
107+
return std::nullopt;
108+
}
109+
95110
Json::Value CreateJsonDefinitionFor(std::string_view name, DscFunctions function, DscFunctionModifiers modifiers)
96111
{
97112
THROW_HR_IF(E_INVALIDARG, !WI_IsSingleFlagSet(function));
@@ -131,7 +146,12 @@ namespace AppInstaller::CLI
131146

132147
if (FunctionSpecifiesReturn(function))
133148
{
134-
result["return"] = "stateAndDiff";
149+
std::optional<std::string> returnType = GetReturnType(modifiers);
150+
151+
if (returnType)
152+
{
153+
result["return"] = returnType.value();
154+
}
135155
}
136156

137157
if (function == DscFunctions::Schema)

src/AppInstallerCLICore/Commands/DscCommandBase.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,10 @@ namespace AppInstaller::CLI
5858
// The resource will act on the `_exist` property during Set (and WhatIf).
5959
// If not provided, the resource should implement Delete.
6060
HandlesExist = 0x02,
61+
// Functions that may return state information (set, what-if, test) return only the state.
62+
ReturnsState = 0x04,
63+
// Functions that may return state information (set, what-if, test) return the state and property difference.
64+
ReturnsStateAndDiff = 0x08,
6165
};
6266

6367
DEFINE_ENUM_FLAG_OPERATORS(DscFunctionModifiers);

src/AppInstallerCLICore/Commands/DscComposableObject.cpp

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,11 @@ namespace AppInstaller::CLI
4545

4646
Json::Value property{ Json::ValueType::objectValue };
4747

48-
property["type"] = std::string{ type };
48+
if (!type.empty())
49+
{
50+
property["type"] = std::string{ type };
51+
}
52+
4953
property["description"] = std::string{ description };
5054

5155
propertiesObject[nameString] = std::move(property);

src/AppInstallerCLICore/Commands/DscComposableObject.h

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
#pragma once
44
#include <AppInstallerErrors.h>
55
#include <AppInstallerLanguageUtilities.h>
6+
#include <AppInstallerLogging.h>
67
#include <json/json.h>
78
#include <optional>
89

@@ -69,6 +70,21 @@ namespace AppInstaller::CLI
6970
}
7071
};
7172

73+
template <>
74+
struct GetJsonTypeValue<Json::Value>
75+
{
76+
static Json::Value Get(const Json::Value& value)
77+
{
78+
return value;
79+
}
80+
81+
static std::string_view SchemaTypeName()
82+
{
83+
// Indicates that the schema should not set a type
84+
return {};
85+
}
86+
};
87+
7288
// Template useful for composing objects for DSC resources.
7389
// Properties should be of the shape:
7490
//
@@ -140,7 +156,7 @@ namespace AppInstaller::CLI
140156
{
141157
if constexpr (WI_IsFlagSet(PropertyFlags, DscComposablePropertyFlag::Required))
142158
{
143-
THROW_HR(WINGET_CONFIG_ERROR_MISSING_FIELD);
159+
THROW_HR_MSG(WINGET_CONFIG_ERROR_MISSING_FIELD, "Required property `%hs` not provided.", Derived::Name().data());
144160
}
145161
else
146162
{

src/AppInstallerCLICore/Commands/DscTestFileResource.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ namespace AppInstaller::CLI
1515

1616
using TestFileObject = DscComposableObject<StandardExistProperty, StandardInDesiredStateProperty, PathProperty, ContentProperty>;
1717

18-
struct FunctionData
18+
struct TestFileFunctionData
1919
{
20-
FunctionData(const std::optional<Json::Value>& json) : Input(json), Output(Input.CopyForOutput())
20+
TestFileFunctionData(const std::optional<Json::Value>& json) : Input(json), Output(Input.CopyForOutput())
2121
{
2222
Path = Utility::ConvertToUTF16(Input.Path().value());
2323
THROW_HR_IF(E_INVALIDARG, !Path.is_absolute());
@@ -104,7 +104,7 @@ namespace AppInstaller::CLI
104104
DscTestFileResource::DscTestFileResource(std::string_view parent) :
105105
DscCommandBase(parent, "test-file", DscResourceKind::Resource,
106106
DscFunctions::Get | DscFunctions::Set | DscFunctions::Test | DscFunctions::Export | DscFunctions::Schema,
107-
DscFunctionModifiers::ImplementsPretest | DscFunctionModifiers::HandlesExist)
107+
DscFunctionModifiers::ImplementsPretest | DscFunctionModifiers::HandlesExist | DscFunctionModifiers::ReturnsStateAndDiff)
108108
{
109109
}
110110

@@ -127,7 +127,7 @@ namespace AppInstaller::CLI
127127
{
128128
if (auto json = GetJsonFromInput(context))
129129
{
130-
anon::FunctionData data{ json };
130+
anon::TestFileFunctionData data{ json };
131131

132132
data.Get();
133133

@@ -139,7 +139,7 @@ namespace AppInstaller::CLI
139139
{
140140
if (auto json = GetJsonFromInput(context))
141141
{
142-
anon::FunctionData data{ json };
142+
anon::TestFileFunctionData data{ json };
143143

144144
data.Get();
145145

@@ -186,7 +186,7 @@ namespace AppInstaller::CLI
186186
{
187187
if (auto json = GetJsonFromInput(context))
188188
{
189-
anon::FunctionData data{ json };
189+
anon::TestFileFunctionData data{ json };
190190

191191
data.Get();
192192
data.Output.InDesiredState(data.Test());
@@ -200,7 +200,7 @@ namespace AppInstaller::CLI
200200
{
201201
if (auto json = GetJsonFromInput(context))
202202
{
203-
anon::FunctionData data{ json };
203+
anon::TestFileFunctionData data{ json };
204204

205205
if (std::filesystem::exists(data.Path))
206206
{

0 commit comments

Comments
 (0)