-
Notifications
You must be signed in to change notification settings - Fork 253
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Don't require a name or version in "project" manifests. (#605)
* Don't require a name or version in "project" manifests. In resolving https://devdiv.visualstudio.com/DevDiv/_workitems/edit/1494960 "[vcpkg ce] vcpkg-ce does not find vcpkg.json to find vcpkg-configuration.json" I ran into a problem for existing vcpkg artifacts-only customers, where today they can name artifact dependencies without needing to supply a name or version. I want to be able to provide a reasonable "how to fix it" message for these customers and it seems reasonable to be able to declare dependencies without having a name or version. After some discussion with @ras0219-msft and @vicroms , the requirement for a name and version seems to be a historical artifact of using the same code to parse both port manifests and consumer/project manifests. include/vcpkg/sourceparagraph.h: Rename parse_manifest_object to parse_port_manifest_object and add parse_project_manifest_object. include/vcpkg/versiondeserializers.h: Declare visit_optional_schemed_deserializer (with static removed in the versiondeserializers.cpp) include/vcpkg/versions.h: Add VersionScheme::Missing for the case that it isn't provided. cmakevars.cpp: Use "_manifest_" as the "port" name when a name wasn't supplied for purposes of vcpkg_get_dep_info. add.ps1: Add a new test of add port that uses an input manifest with no name or version information. manifests.ps1: Remove name and version from the prototype manifest. Note that some of the tests still use a manifest with a name; in particular the "self reference" ones so we still have coverage of that. format-manifest.ps1: Add project manifest examples in addition to the previous "reserialize all ports" test. * Put the json entity type assert in the right place. * Use JSON stuff rather than string stuff in the parsing tests. * Invert template method pattern in manifest deserializer. * Formatting * Add overlay ports test. * Add output asserts.
- Loading branch information
1 parent
1e942c6
commit b4d664f
Showing
46 changed files
with
631 additions
and
344 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{} |
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 @@ | ||
{} |
4 changes: 4 additions & 0 deletions
4
azure-pipelines/e2e_assets/format-manifest/expected/name-and-version.json
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,4 @@ | ||
{ | ||
"name": "name-and-version", | ||
"version": "1.0" | ||
} |
3 changes: 3 additions & 0 deletions
3
azure-pipelines/e2e_assets/format-manifest/expected/name.json
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,3 @@ | ||
{ | ||
"name": "hello" | ||
} |
3 changes: 3 additions & 0 deletions
3
azure-pipelines/e2e_assets/format-manifest/expected/version.json
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,3 @@ | ||
{ | ||
"version": "1.2" | ||
} |
1 change: 1 addition & 0 deletions
1
azure-pipelines/e2e_assets/format-manifest/name-and-version.json
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 @@ | ||
{"name":"name-and-version", "version": "1.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{"name":"hello"} |
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 @@ | ||
{"version":"1.2"} |
1 change: 1 addition & 0 deletions
1
azure-pipelines/e2e_ports/overlays/broken-no-name/portfile.cmake
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 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) |
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,3 @@ | ||
{ | ||
"version": "1.0" | ||
} |
1 change: 1 addition & 0 deletions
1
azure-pipelines/e2e_ports/overlays/broken-no-version/portfile.cmake
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 @@ | ||
set(VCPKG_POLICY_EMPTY_PACKAGE enabled) |
3 changes: 3 additions & 0 deletions
3
azure-pipelines/e2e_ports/overlays/broken-no-version/vcpkg.json
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,3 @@ | ||
{ | ||
"name": "hello" | ||
} |
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 @@ | ||
. "$PSScriptRoot/../end-to-end-tests-prelude.ps1" | ||
|
||
$manifestDir = "$TestingRoot/add_port" | ||
$manifestDirArgs = $commonArgs + @("--x-manifest-root=$manifestDir") | ||
$manifestPath = "$manifestDir/vcpkg.json" | ||
$vcpkgJson = @{} | ||
|
||
New-Item -Path $manifestDir -ItemType Directory | ||
New-Item -Path $manifestPath -ItemType File ` | ||
-Value (ConvertTo-Json -Depth 5 -InputObject $vcpkgJson) | ||
|
||
Run-Vcpkg add port zlib @manifestDirArgs | ||
Throw-IfFailed | ||
|
||
$expected = @" | ||
{ | ||
"dependencies": [ | ||
"zlib" | ||
] | ||
} | ||
"@ | ||
|
||
$actual = (Get-Content -Path $manifestPath -Raw).TrimEnd() | ||
if ($expected -ne $actual) { | ||
throw "Add port didn't add zlib dependency correctly.`nExpected: $expected`nActual:$actual" | ||
} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
. "$PSScriptRoot/../end-to-end-tests-prelude.ps1" | ||
|
||
$formatManifestAssets = (Get-Item "$PSScriptRoot/../e2e_assets/format-manifest").FullName | ||
$testProjects = Get-ChildItem "$formatManifestAssets/*.json" -File | ||
$testProjects | % { | ||
$asItem = Get-Item $_ | ||
$full = $asItem.FullName | ||
$name = $asItem.Name | ||
$expectedPath = "$formatManifestAssets/expected/$name" | ||
$tempItemPath = "$TestingRoot/$name" | ||
Write-Trace "test that format-manifest on $full produces $expectedPath" | ||
[string]$expected = Get-Content $expectedPath -Raw | ||
Copy-Item $asItem $tempItemPath | ||
Run-Vcpkg format-manifest $tempItemPath | ||
$actual = Get-Content $tempItemPath -Raw | ||
if ($expected -ne $actual) { | ||
throw "Expected formatting $full to produce $expectedPath but was $tempItemPath" | ||
} | ||
} | ||
|
||
Write-Trace "test re-serializing every manifest" | ||
$manifestDir = "$TestingRoot/manifest-dir" | ||
New-Item -Path $manifestDir -ItemType Directory | Out-Null | ||
|
||
$ports = Get-ChildItem "$env:VCPKG_ROOT/ports" | ||
|
||
$ports | % { | ||
Copy-Item "$_/vcpkg.json" "$manifestDir" | Out-Null | ||
$x = Get-Content "$manifestDir/vcpkg.json" -Raw | ||
Run-Vcpkg -EndToEndTestSilent format-manifest "$manifestDir/vcpkg.json" | Out-Null | ||
Throw-IfFailed "$_/vcpkg.json" | ||
$y = Get-Content "$manifestDir/vcpkg.json" -Raw | ||
if ($x -ne $y) { | ||
throw "Expected formatting manifest $_/vcpkg.json to cause no modifications" | ||
} | ||
} |
20 changes: 0 additions & 20 deletions
20
azure-pipelines/end-to-end-tests-dir/manifest-reserialize.ps1
This file was deleted.
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
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 |
---|---|---|
|
@@ -60,6 +60,7 @@ namespace vcpkg | |
|
||
enum class VersionScheme | ||
{ | ||
Missing, | ||
Relaxed, | ||
Semver, | ||
Date, | ||
|
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.