Skip to content

Commit

Permalink
Add DisplayName to InstallationMetadata installed files (#2442)
Browse files Browse the repository at this point in the history
  • Loading branch information
yao-msft authored Aug 12, 2022
1 parent 75d47fc commit f95cdb9
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 2 deletions.
9 changes: 8 additions & 1 deletion schemas/JSON/manifests/v1.3.0/manifest.installer.1.3.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -527,6 +527,7 @@
"Files": {
"type": [ "array", "null" ],
"uniqueItems": true,
"maxItems": 2048,
"items": {
"type": "object",
"title": "InstalledFile",
Expand All @@ -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" ],
Expand Down
9 changes: 8 additions & 1 deletion schemas/JSON/manifests/v1.3.0/manifest.singleton.1.3.0.json
Original file line number Diff line number Diff line change
Expand Up @@ -568,6 +568,7 @@
"Files": {
"type": [ "array", "null" ],
"uniqueItems": true,
"maxItems": 2048,
"items": {
"type": "object",
"title": "InstalledFile",
Expand All @@ -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" ],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ InstallationMetadata:
FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82
FileType: launch
InvocationParameter: "/arg"
DisplayName: "DisplayName"

Installers:
- Architecture: x86
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ InstallationMetadata:
FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82
FileType: launch
InvocationParameter: "/arg"
DisplayName: "DisplayName"

Installers:
- Architecture: x86
Expand Down Expand Up @@ -185,5 +186,6 @@ Installers:
FileSha256: 69D84CA8899800A5575CE31798293CD4FEBAB1D734A07C2E51E56A28E0DF8C82
FileType: other
InvocationParameter: "/arg2"
DisplayName: "DisplayName2"
ManifestType: installer
ManifestVersion: 1.3.0
2 changes: 2 additions & 0 deletions src/AppInstallerCLITests/YamlManifest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {}; } },
};
}

Expand Down
1 change: 1 addition & 0 deletions src/AppInstallerCommonCore/Public/winget/ManifestCommon.h
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ namespace AppInstaller::Manifest
std::vector<BYTE> FileSha256;
InstalledFileTypeEnum FileType = InstalledFileTypeEnum::Other;
string_t InvocationParameter;
string_t DisplayName;
};

struct InstallationMetadataInfo
Expand Down

0 comments on commit f95cdb9

Please sign in to comment.