Skip to content

Commit 21b633b

Browse files
authored
Update rest source and wingetutil interop to include 1.28 manifest (#… (#6237)
1 parent f5b00a2 commit 21b633b

23 files changed

Lines changed: 1144 additions & 25 deletions

src/AppInstallerCLITests/AppInstallerCLITests.vcxproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -284,6 +284,7 @@
284284
<ClCompile Include="RestInterface_1_1.cpp" />
285285
<ClCompile Include="RestInterface_1_10.cpp" />
286286
<ClCompile Include="RestInterface_1_12.cpp" />
287+
<ClCompile Include="RestInterface_1_28.cpp" />
287288
<ClCompile Include="RestInterface_1_4.cpp" />
288289
<ClCompile Include="RestInterface_1_5.cpp" />
289290
<ClCompile Include="RestInterface_1_6.cpp" />

src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,9 @@
383383
<ClCompile Include="RestInterface_1_12.cpp">
384384
<Filter>Source Files\Repository</Filter>
385385
</ClCompile>
386+
<ClCompile Include="RestInterface_1_28.cpp">
387+
<Filter>Source Files\Repository</Filter>
388+
</ClCompile>
386389
<ClCompile Include="ManifestComparator.cpp">
387390
<Filter>Source Files\Common</Filter>
388391
</ClCompile>

src/AppInstallerCLITests/RestClient.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ TEST_CASE("GetSupportedInterface", "[RestSource]")
6363
REQUIRE(RestClient::GetSupportedInterface(TestRestUri, {}, info, {}, version, {})->GetVersion() == version);
6464

6565
// Update this test to next version so that we don't forget to add to supported versions before rest e2e tests are available.
66-
Version invalid{ "1.13.0" };
66+
Version invalid{ "1.29.0" };
6767
REQUIRE_THROWS_HR(RestClient::GetSupportedInterface(TestRestUri, {}, info, {}, invalid, {}), APPINSTALLER_CLI_ERROR_RESTSOURCE_INVALID_VERSION);
6868

6969
Authentication::AuthenticationArguments authArgs;

src/AppInstallerCLITests/RestInterface_1_28.cpp

Lines changed: 440 additions & 0 deletions
Large diffs are not rendered by default.

src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,8 @@
377377
<ClInclude Include="Rest\Schema\1_10\Json\ManifestDeserializer.h" />
378378
<ClInclude Include="Rest\Schema\1_12\Interface.h" />
379379
<ClInclude Include="Rest\Schema\1_12\Json\ManifestDeserializer.h" />
380+
<ClInclude Include="Rest\Schema\1_28\Interface.h" />
381+
<ClInclude Include="Rest\Schema\1_28\Json\ManifestDeserializer.h" />
380382
<ClInclude Include="Rest\Schema\1_1\Interface.h" />
381383
<ClInclude Include="Rest\Schema\1_1\Json\ManifestDeserializer.h" />
382384
<ClInclude Include="Rest\Schema\1_1\Json\SearchRequestSerializer.h" />
@@ -478,6 +480,8 @@
478480
<ClCompile Include="Rest\Schema\1_10\RestInterface_1_10.cpp" />
479481
<ClCompile Include="Rest\Schema\1_12\Json\ManifestDeserializer_1_12.cpp" />
480482
<ClCompile Include="Rest\Schema\1_12\RestInterface_1_12.cpp" />
483+
<ClCompile Include="Rest\Schema\1_28\Json\ManifestDeserializer_1_28.cpp" />
484+
<ClCompile Include="Rest\Schema\1_28\RestInterface_1_28.cpp" />
481485
<ClCompile Include="Rest\Schema\1_1\Json\ManifestDeserializer_1_1.cpp" />
482486
<ClCompile Include="Rest\Schema\1_1\Json\SearchRequestSerializer_1_1.cpp" />
483487
<ClCompile Include="Rest\Schema\1_1\RestInterface_1_1.cpp" />

src/AppInstallerRepositoryCore/AppInstallerRepositoryCore.vcxproj.filters

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,12 @@
121121
<Filter Include="Rest\Schema\1_12\Json">
122122
<UniqueIdentifier>{2075b51e-aa11-473a-bae0-e0d4366f926b}</UniqueIdentifier>
123123
</Filter>
124+
<Filter Include="Rest\Schema\1_28">
125+
<UniqueIdentifier>{a3b7c8d1-e2f4-5a6b-9c0d-1e2f3a4b5c6d}</UniqueIdentifier>
126+
</Filter>
127+
<Filter Include="Rest\Schema\1_28\Json">
128+
<UniqueIdentifier>{b4c8d9e2-f3a5-6b7c-0d1e-2f3a4b5c6d7e}</UniqueIdentifier>
129+
</Filter>
124130
</ItemGroup>
125131
<ItemGroup>
126132
<ClInclude Include="pch.h">
@@ -501,6 +507,12 @@
501507
<ClInclude Include="Rest\Schema\1_12\Json\ManifestDeserializer.h">
502508
<Filter>Rest\Schema\1_12\Json</Filter>
503509
</ClInclude>
510+
<ClInclude Include="Rest\Schema\1_28\Interface.h">
511+
<Filter>Rest\Schema\1_28</Filter>
512+
</ClInclude>
513+
<ClInclude Include="Rest\Schema\1_28\Json\ManifestDeserializer.h">
514+
<Filter>Rest\Schema\1_28\Json</Filter>
515+
</ClInclude>
504516
<ClInclude Include="Rest\RestInformationCache.h">
505517
<Filter>Rest</Filter>
506518
</ClInclude>
@@ -785,6 +797,12 @@
785797
<ClCompile Include="Rest\Schema\1_12\Json\ManifestDeserializer_1_12.cpp">
786798
<Filter>Rest\Schema\1_12\Json</Filter>
787799
</ClCompile>
800+
<ClCompile Include="Rest\Schema\1_28\RestInterface_1_28.cpp">
801+
<Filter>Rest\Schema\1_28</Filter>
802+
</ClCompile>
803+
<ClCompile Include="Rest\Schema\1_28\Json\ManifestDeserializer_1_28.cpp">
804+
<Filter>Rest\Schema\1_28\Json</Filter>
805+
</ClCompile>
788806
<ClCompile Include="Rest\RestInformationCache.cpp">
789807
<Filter>Rest</Filter>
790808
</ClCompile>

src/AppInstallerRepositoryCore/ManifestJSONParser.cpp

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
#include "Rest/Schema/1_9/Json/ManifestDeserializer.h"
1212
#include "Rest/Schema/1_10/Json/ManifestDeserializer.h"
1313
#include "Rest/Schema/1_12/Json/ManifestDeserializer.h"
14+
#include "Rest/Schema/1_28/Json/ManifestDeserializer.h"
1415

1516
namespace AppInstaller::Repository::JSON
1617
{
@@ -61,10 +62,14 @@ namespace AppInstaller::Repository::JSON
6162
{
6263
m_pImpl->m_deserializer = std::make_unique<Rest::Schema::V1_10::Json::ManifestDeserializer>();
6364
}
64-
else
65+
else if (parts.size() > 1 && parts[1].Integer < 28)
6566
{
6667
m_pImpl->m_deserializer = std::make_unique<Rest::Schema::V1_12::Json::ManifestDeserializer>();
6768
}
69+
else
70+
{
71+
m_pImpl->m_deserializer = std::make_unique<Rest::Schema::V1_28::Json::ManifestDeserializer>();
72+
}
6873
}
6974
else
7075
{

src/AppInstallerRepositoryCore/Rest/RestClient.cpp

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include "Rest/Schema/1_9/Interface.h"
1313
#include "Rest/Schema/1_10/Interface.h"
1414
#include "Rest/Schema/1_12/Interface.h"
15+
#include "Rest/Schema/1_28/Interface.h"
1516
#include "Rest/Schema/InformationResponseDeserializer.h"
1617
#include "Rest/Schema/CommonRestConstants.h"
1718
#include <AppInstallerDownloader.h>
@@ -37,6 +38,7 @@ namespace AppInstaller::Repository::Rest
3738
Version_1_9_0,
3839
Version_1_10_0,
3940
Version_1_12_0,
41+
Version_1_28_0,
4042
};
4143

4244
constexpr std::string_view WindowsPackageManagerHeader = "Windows-Package-Manager"sv;
@@ -218,6 +220,10 @@ namespace AppInstaller::Repository::Rest
218220
{
219221
return std::make_unique<Schema::V1_12::Interface>(api, helper, information, additionalHeaders, authArgs);
220222
}
223+
else if (version == Version_1_28_0)
224+
{
225+
return std::make_unique<Schema::V1_28::Interface>(api, helper, information, additionalHeaders, authArgs);
226+
}
221227

222228
THROW_HR(APPINSTALLER_CLI_ERROR_RESTSOURCE_INVALID_VERSION);
223229
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
#pragma once
4+
#include "Rest/Schema/1_12/Interface.h"
5+
6+
namespace AppInstaller::Repository::Rest::Schema::V1_28
7+
{
8+
// Interface to this schema version exposed through IRestClient.
9+
struct Interface : public V1_12::Interface
10+
{
11+
Interface(const std::string& restApi, const Http::HttpClientHelper& helper, IRestClient::Information information, const Http::HttpClientHelper::HttpRequestHeaders& additionalHeaders = {}, Authentication::AuthenticationArguments authArgs = {});
12+
13+
Interface(const Interface&) = delete;
14+
Interface& operator=(const Interface&) = delete;
15+
16+
Interface(Interface&&) = default;
17+
Interface& operator=(Interface&&) = default;
18+
19+
Utility::Version GetVersion() const override;
20+
};
21+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
// Copyright (c) Microsoft Corporation.
2+
// Licensed under the MIT License.
3+
#pragma once
4+
#include "Rest/Schema/1_12/Json/ManifestDeserializer.h"
5+
6+
namespace AppInstaller::Repository::Rest::Schema::V1_28::Json
7+
{
8+
// Manifest Deserializer.
9+
struct ManifestDeserializer : public V1_12::Json::ManifestDeserializer
10+
{
11+
protected:
12+
13+
std::optional<Manifest::ManifestInstaller> DeserializeInstaller(const web::json::value& installerJsonObject) const override;
14+
15+
Manifest::ManifestVer GetManifestVersion() const override;
16+
};
17+
}

0 commit comments

Comments
 (0)