commit f95cdb9a596b1cf0d34aacf93721d45c114c8396 parent 75d47fc4c105c81cb3664d6bf976dca6f0a12110 Author: yao-msft <50888816+yao-msft@users.noreply.github.com> Date: Fri, 12 Aug 2022 12:09:04 -0700 Add DisplayName to InstallationMetadata installed files (#2442) Diffstat:
7 files changed, 23 insertions(+), 2 deletions(-)
diff --git a/schemas/JSON/manifests/v1.3.0/manifest.installer.1.3.0.json b/schemas/JSON/manifests/v1.3.0/manifest.installer.1.3.0.json @@ -527,6 +527,7 @@ "Files": { "type": [ "array", "null" ], "uniqueItems": true, + "maxItems": 2048, "items": { "type": "object", "title": "InstalledFile", @@ -552,10 +553,16 @@ "description": "The optional installed file type. If not specified, the file is treated as other." }, "InvocationParameter": { - "type": "string", + "type": [ "string", "null" ], "minLength": 1, "maxLength": 2048, "description": "Optional parameter for invocable files." + }, + "DisplayName": { + "type": [ "string", "null" ], + "minLength": 1, + "maxLength": 256, + "description": "Optional display name for invocable files." } }, "required": [ "RelativeFilePath" ], diff --git a/schemas/JSON/manifests/v1.3.0/manifest.singleton.1.3.0.json b/schemas/JSON/manifests/v1.3.0/manifest.singleton.1.3.0.json @@ -568,6 +568,7 @@ "Files": { "type": [ "array", "null" ], "uniqueItems": true, + "maxItems": 2048, "items": { "type": "object", "title": "InstalledFile", @@ -593,10 +594,16 @@ "description": "The optional installed file type. If not specified, the file is treated as other." }, "InvocationParameter": { - "type": "string", + "type": [ "string", "null" ], "minLength": 1, "maxLength": 2048, "description": "Optional parameter for invocable files." + }, + "DisplayName": { + "type": [ "string", "null" ], + "minLength": 1, + "maxLength": 256, + "description": "Optional display name for invocable files." } }, "required": [ "RelativeFilePath" ], diff --git a/src/AppInstallerCLITests/TestData/ManifestV1_3-Singleton.yaml b/src/AppInstallerCLITests/TestData/ManifestV1_3-Singleton.yaml @@ -114,6 +114,7 @@ InstallationMetadata: FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82 FileType: launch InvocationParameter: "/arg" + DisplayName: "DisplayName" Installers: - Architecture: x86 diff --git a/src/AppInstallerCLITests/TestData/MultiFileManifestV1_3/ManifestV1_3-MultiFile-Installer.yaml b/src/AppInstallerCLITests/TestData/MultiFileManifestV1_3/ManifestV1_3-MultiFile-Installer.yaml @@ -85,6 +85,7 @@ InstallationMetadata: FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82 FileType: launch InvocationParameter: "/arg" + DisplayName: "DisplayName" Installers: - Architecture: x86 @@ -185,5 +186,6 @@ Installers: FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82 FileType: other InvocationParameter: "/arg2" + DisplayName: "DisplayName2" ManifestType: installer ManifestVersion: 1.3.0 \ No newline at end of file diff --git a/src/AppInstallerCLITests/YamlManifest.cpp b/src/AppInstallerCLITests/YamlManifest.cpp @@ -603,6 +603,7 @@ void VerifyV1ManifestContent(const Manifest& manifest, bool isSingleton, Manifes REQUIRE(installer1.InstallationMetadata.Files.at(0).FileType == InstalledFileTypeEnum::Launch); REQUIRE(installer1.InstallationMetadata.Files.at(0).FileSha256 == SHA256::ConvertToBytes("69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82")); REQUIRE(installer1.InstallationMetadata.Files.at(0).InvocationParameter == "/arg"); + REQUIRE(installer1.InstallationMetadata.Files.at(0).DisplayName == "DisplayName"); } if (!isSingleton) @@ -671,6 +672,7 @@ void VerifyV1ManifestContent(const Manifest& manifest, bool isSingleton, Manifes REQUIRE(installer4.InstallationMetadata.Files.at(0).FileType == InstalledFileTypeEnum::Other); REQUIRE(installer4.InstallationMetadata.Files.at(0).FileSha256 == SHA256::ConvertToBytes("69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82")); REQUIRE(installer4.InstallationMetadata.Files.at(0).InvocationParameter == "/arg2"); + REQUIRE(installer4.InstallationMetadata.Files.at(0).DisplayName == "DisplayName2"); } // Localization diff --git a/src/AppInstallerCommonCore/Manifest/ManifestYamlPopulator.cpp b/src/AppInstallerCommonCore/Manifest/ManifestYamlPopulator.cpp @@ -615,6 +615,7 @@ namespace AppInstaller::Manifest { "FileSha256", [this](const YAML::Node& value)->ValidationErrors { m_p_installedFile->FileSha256 = Utility::SHA256::ConvertToBytes(value.as<std::string>()); return {}; } }, { "FileType", [this](const YAML::Node& value)->ValidationErrors { m_p_installedFile->FileType = ConvertToInstalledFileTypeEnum(value.as<std::string>()); return {}; } }, { "InvocationParameter", [this](const YAML::Node& value)->ValidationErrors { m_p_installedFile->InvocationParameter = Utility::Trim(value.as<std::string>()); return {}; } }, + { "DisplayName", [this](const YAML::Node& value)->ValidationErrors { m_p_installedFile->DisplayName = Utility::Trim(value.as<std::string>()); return {}; } }, }; } diff --git a/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h b/src/AppInstallerCommonCore/Public/winget/ManifestCommon.h @@ -270,6 +270,7 @@ namespace AppInstaller::Manifest std::vector<BYTE> FileSha256; InstalledFileTypeEnum FileType = InstalledFileTypeEnum::Other; string_t InvocationParameter; + string_t DisplayName; }; struct InstallationMetadataInfo