commit bc28f9dd8a74c7698d5b2b2f0dbd96e4c4a22f4e parent f236fa2fda208e29827f10a50e56968e308e23b4 Author: yao-msft <50888816+yao-msft@users.noreply.github.com> Date: Mon, 1 Mar 2021 22:04:55 -0800 Add back Channel Not Supported check (#766) * Add back Channel Not Supported check * Make PackageLocale in singleton manifest required * Add previous missing export Diffstat:
10 files changed, 33 insertions(+), 5 deletions(-)
diff --git a/schemas/JSON/manifests/v1.0.0/manifest.singleton.1.0.0.json b/schemas/JSON/manifests/v1.0.0/manifest.singleton.1.0.0.json @@ -378,7 +378,9 @@ "$ref": "#/definitions/PackageVersion" }, "PackageLocale": { - "$ref": "#/definitions/Locale", + "type": "string", + "pattern": "^([a-zA-Z]{2}|[iI]-[a-zA-Z]+|[xX]-[a-zA-Z]{1,8})(-[a-zA-Z]{1,8})*$", + "maxLength": 20, "description": "The package meta-data locale" }, "Publisher": { @@ -538,6 +540,7 @@ "required": [ "PackageIdentifier", "PackageVersion", + "PackageLocale", "Publisher", "PackageName", "License", diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj @@ -479,6 +479,9 @@ <CopyFileToFolders Include="TestData\MultiFileManifestV1\ManifestV1-MultiFile-Version.yaml"> <DeploymentContent>true</DeploymentContent> </CopyFileToFolders> + <CopyFileToFolders Include="TestData\Manifest-Bad-Channel-NotSupported.yaml"> + <DeploymentContent>true</DeploymentContent> + </CopyFileToFolders> </ItemGroup> <ItemGroup> <ProjectReference Include="..\AppInstallerCLICore\AppInstallerCLICore.vcxproj"> diff --git a/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters b/src/AppInstallerCLITests/AppInstallerCLITests.vcxproj.filters @@ -390,5 +390,8 @@ <CopyFileToFolders Include="TestData\MultiFileManifestV1\ManifestV1-MultiFile-Version.yaml"> <Filter>TestData\MultiFileManifestV1</Filter> </CopyFileToFolders> + <CopyFileToFolders Include="TestData\Manifest-Bad-Channel-NotSupported.yaml"> + <Filter>TestData</Filter> + </CopyFileToFolders> </ItemGroup> </Project> \ No newline at end of file diff --git a/src/AppInstallerCLITests/TestData/Manifest-Bad-Channel-NotSupported.yaml b/src/AppInstallerCLITests/TestData/Manifest-Bad-Channel-NotSupported.yaml @@ -0,0 +1,12 @@ +Id: microsoft.msixsdk +Name: MSIX SDK +Version: 1.7.32 +Publisher: Microsoft +Channel: release +InstallerType: Zip +License: Test +Installers: + - Arch: x86 + Url: https://rubengustorage.blob.core.windows.net/publiccontainer/msixsdk-x86.zip + Sha256: 98B67758CEAFFCBB3FE47838FD0A8D7BD581C2650842D6B2B0E0D49A23270CCD +ManifestVersion: 0.1.0 diff --git a/src/AppInstallerCLITests/TestData/ManifestV1-Singleton.yaml b/src/AppInstallerCLITests/TestData/ManifestV1-Singleton.yaml @@ -18,7 +18,6 @@ Moniker: msixsdk Tags: - "appxsdk" - "msixsdk" -Channel: release InstallerLocale: en-US Platform: - Windows.Desktop diff --git a/src/AppInstallerCLITests/TestData/MultiFileManifestV1/ManifestV1-MultiFile-Installer.yaml b/src/AppInstallerCLITests/TestData/MultiFileManifestV1/ManifestV1-MultiFile-Installer.yaml @@ -1,6 +1,5 @@ PackageIdentifier: microsoft.msixsdk PackageVersion: 1.7.32 -Channel: release InstallerLocale: en-US Platform: - Windows.Desktop diff --git a/src/AppInstallerCLITests/YamlManifest.cpp b/src/AppInstallerCLITests/YamlManifest.cpp @@ -208,6 +208,7 @@ TEST_CASE("ReadBadManifests", "[ManifestValidation]") { { "Manifest-Bad-ArchInvalid.yaml", "Invalid field value. Field: Arch" }, { "Manifest-Bad-ArchMissing.yaml", "Missing required property 'Arch'" }, + { "Manifest-Bad-Channel-NotSupported.yaml", "Field is not supported. Field: Channel" }, { "Manifest-Bad-DifferentCase-camelCase.yaml", "All field names should be PascalCased. Field: installerType" }, { "Manifest-Bad-DifferentCase-lower.yaml", "All field names should be PascalCased. Field: installertype" }, { "Manifest-Bad-DifferentCase-UPPER.yaml", "All field names should be PascalCased. Field: INSTALLERTYPE" }, @@ -349,7 +350,6 @@ void VerifyV1ManifestContent(const Manifest& manifest, bool isSingleton) REQUIRE(manifest.DefaultLocalization.Get<Localization::Description>() == "The MSIX SDK project is an effort to enable developers"); REQUIRE(manifest.Moniker == "msixsdk"); REQUIRE(manifest.DefaultLocalization.Get<Localization::Tags>() == MultiValue{ "appxsdk", "msixsdk" }); - REQUIRE(manifest.Channel == "release"); REQUIRE(manifest.DefaultInstallerInfo.Locale == "en-US"); REQUIRE(manifest.DefaultInstallerInfo.Platform == std::vector<PlatformEnum>{ PlatformEnum::Desktop, PlatformEnum::Universal }); REQUIRE(manifest.DefaultInstallerInfo.MinOSVersion == "10.0.0.0"); diff --git a/src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp b/src/AppInstallerCommonCore/Manifest/ManifestValidation.cpp @@ -9,6 +9,12 @@ namespace AppInstaller::Manifest { std::vector<ValidationError> resultErrors; + // Channel is not supported currently + if (!manifest.Channel.empty()) + { + resultErrors.emplace_back(ManifestError::FieldNotSupported, "Channel", manifest.Channel); + } + try { // Version value should be successfully parsed diff --git a/src/WinGetUtil/Exports.cpp b/src/WinGetUtil/Exports.cpp @@ -210,7 +210,9 @@ extern "C" try { - (void)YamlParser::CreateFromPath(inputPath, true, true, mergedManifestPath, option == WinGetValidateManifestOption::SchemaValidationOnly); + (void)YamlParser::CreateFromPath(inputPath, true, true, + mergedManifestPath ? mergedManifestPath : L"", + option == WinGetValidateManifestOption::SchemaValidationOnly); *succeeded = TRUE; } catch (const ManifestException& e) diff --git a/src/WinGetUtil/Source.def b/src/WinGetUtil/Source.def @@ -13,3 +13,4 @@ EXPORTS WinGetValidateManifest WinGetDownload WinGetCompareVersions + WinGetValidateManifestV2