-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for 1.9 manifest in rest source parsing and winget utils …
…interop (#4906)
- Loading branch information
Showing
19 changed files
with
861 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
src/AppInstallerRepositoryCore/Rest/Schema/1_9/Interface.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#pragma once | ||
#include "Rest/Schema/1_7/Interface.h" | ||
|
||
namespace AppInstaller::Repository::Rest::Schema::V1_9 | ||
{ | ||
// Interface to this schema version exposed through IRestClient. | ||
struct Interface : public V1_7::Interface | ||
{ | ||
Interface(const std::string& restApi, const Http::HttpClientHelper& helper, IRestClient::Information information, const Http::HttpClientHelper::HttpRequestHeaders& additionalHeaders = {}, Authentication::AuthenticationArguments authArgs = {}); | ||
|
||
Interface(const Interface&) = delete; | ||
Interface& operator=(const Interface&) = delete; | ||
|
||
Interface(Interface&&) = default; | ||
Interface& operator=(Interface&&) = default; | ||
|
||
Utility::Version GetVersion() const override; | ||
}; | ||
} |
17 changes: 17 additions & 0 deletions
17
src/AppInstallerRepositoryCore/Rest/Schema/1_9/Json/ManifestDeserializer.h
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#pragma once | ||
#include "Rest/Schema/1_7/Json/ManifestDeserializer.h" | ||
|
||
namespace AppInstaller::Repository::Rest::Schema::V1_9::Json | ||
{ | ||
// Manifest Deserializer. | ||
struct ManifestDeserializer : public V1_7::Json::ManifestDeserializer | ||
{ | ||
protected: | ||
|
||
std::optional<Manifest::ManifestInstaller> DeserializeInstaller(const web::json::value& installerJsonObject) const override; | ||
|
||
Manifest::ManifestVer GetManifestVersion() const override; | ||
}; | ||
} |
35 changes: 35 additions & 0 deletions
35
src/AppInstallerRepositoryCore/Rest/Schema/1_9/Json/ManifestDeserializer_1_9.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
#include "ManifestDeserializer.h" | ||
#include <winget/JsonUtil.h> | ||
|
||
using namespace AppInstaller::Manifest; | ||
|
||
namespace AppInstaller::Repository::Rest::Schema::V1_9::Json | ||
{ | ||
namespace | ||
{ | ||
// Installer | ||
constexpr std::string_view ArchiveBinariesDependOnPath = "ArchiveBinariesDependOnPath"sv; | ||
} | ||
|
||
std::optional<Manifest::ManifestInstaller> ManifestDeserializer::DeserializeInstaller(const web::json::value& installerJsonObject) const | ||
{ | ||
auto result = V1_7::Json::ManifestDeserializer::DeserializeInstaller(installerJsonObject); | ||
|
||
if (result) | ||
{ | ||
auto& installer = result.value(); | ||
|
||
installer.ArchiveBinariesDependOnPath = JSON::GetRawBoolValueFromJsonNode(installerJsonObject, JSON::GetUtilityString(ArchiveBinariesDependOnPath)).value_or(false); | ||
} | ||
|
||
return result; | ||
} | ||
|
||
Manifest::ManifestVer ManifestDeserializer::GetManifestVersion() const | ||
{ | ||
return Manifest::s_ManifestVersionV1_9; | ||
} | ||
} |
26 changes: 26 additions & 0 deletions
26
src/AppInstallerRepositoryCore/Rest/Schema/1_9/RestInterface_1_9.cpp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
// Copyright (c) Microsoft Corporation. | ||
// Licensed under the MIT License. | ||
#include "pch.h" | ||
#include "Rest/Schema/1_9/Interface.h" | ||
#include "Rest/Schema/CommonRestConstants.h" | ||
#include "Rest/Schema/IRestClient.h" | ||
#include <winget/HttpClientHelper.h> | ||
#include <winget/JsonUtil.h> | ||
|
||
namespace AppInstaller::Repository::Rest::Schema::V1_9 | ||
{ | ||
Interface::Interface( | ||
const std::string& restApi, | ||
const Http::HttpClientHelper& httpClientHelper, | ||
IRestClient::Information information, | ||
const Http::HttpClientHelper::HttpRequestHeaders& additionalHeaders, | ||
Authentication::AuthenticationArguments authArgs) : V1_7::Interface(restApi, httpClientHelper, std::move(information), additionalHeaders, std::move(authArgs)) | ||
{ | ||
m_requiredRestApiHeaders[JSON::GetUtilityString(ContractVersion)] = JSON::GetUtilityString(Version_1_9_0.ToString()); | ||
} | ||
|
||
Utility::Version Interface::GetVersion() const | ||
{ | ||
return Version_1_9_0; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.