Skip to content

Commit

Permalink
pass VERSION to cmake when building port (#717)
Browse files Browse the repository at this point in the history
* pass PORT_VERSION to cmake when building port

* Rename PORT_VERSION to VERSION

* Add e2e tests
  • Loading branch information
autoantwort authored Oct 10, 2022
1 parent 8eec413 commit 3221bf0
Show file tree
Hide file tree
Showing 10 changed files with 44 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (NOT VERSION STREQUAL "2020-10-10")
message(FATAL_ERROR "\${VERSION} should be '2020-10-10' but is '${VERSION}'")
endif()
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "version-date",
"version-date": "2020-10-10"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (NOT VERSION STREQUAL "1.0.0")
message(FATAL_ERROR "\${VERSION} should be '1.0.0' but is '${VERSION}'")
endif()
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "version-semver",
"version-semver": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (NOT VERSION STREQUAL "1.0.0")
message(FATAL_ERROR "\${VERSION} should be '1.0.0' but is '${VERSION}'")
endif()
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "version-string",
"version-string": "1.0.0"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
if (NOT VERSION STREQUAL "1.0.0")
message(FATAL_ERROR "\${VERSION} should be '1.0.0' but is '${VERSION}'")
endif()
set(VCPKG_POLICY_EMPTY_PACKAGE enabled)
4 changes: 4 additions & 0 deletions azure-pipelines/e2e_ports/version-variable/version/vcpkg.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"name": "version",
"version": "1.0.0"
}
11 changes: 11 additions & 0 deletions azure-pipelines/end-to-end-tests-dir/version-variable.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
. $PSScriptRoot/../end-to-end-tests-prelude.ps1

$portsPath = "$PSScriptRoot/../e2e_ports/version-variable"

$CurrentTest = "version variable in portfile.cmake"
Run-Vcpkg install @commonArgs `
"--x-builtin-ports-root=$portsPath" `
--binarysource=clear `
version version-string version-date version-semver
Throw-IfFailed
Refresh-TestRoot
1 change: 1 addition & 0 deletions src/vcpkg/build.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -720,6 +720,7 @@ namespace vcpkg
{"_HOST_TRIPLET", action.host_triplet.canonical_name()},
{"FEATURES", Strings::join(";", action.feature_list)},
{"PORT", scf.core_paragraph->name},
{"VERSION", scf.core_paragraph->raw_version},
{"VCPKG_USE_HEAD_VERSION", Util::Enum::to_bool(action.build_options.use_head_version) ? "1" : "0"},
{"_VCPKG_DOWNLOAD_TOOL", to_string(action.build_options.download_tool)},
{"_VCPKG_EDITABLE", Util::Enum::to_bool(action.build_options.editable) ? "1" : "0"},
Expand Down

0 comments on commit 3221bf0

Please sign in to comment.