Skip to content

Commit

Permalink
Add Campaign IDs (#1408)
Browse files Browse the repository at this point in the history
  • Loading branch information
JavierMatosD committed Jun 24, 2024
1 parent efb750b commit dfc8c0f
Show file tree
Hide file tree
Showing 19 changed files with 161 additions and 78 deletions.
3 changes: 2 additions & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
"cinttypes": "cpp",
"typeindex": "cpp",
"typeinfo": "cpp",
"variant": "cpp"
"variant": "cpp",
"__bit_reference": "cpp"
}
}
9 changes: 4 additions & 5 deletions include/vcpkg/base/message-data.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,6 @@ DECLARE_MESSAGE(AString, (), "", "a string")
DECLARE_MESSAGE(ADateVersionString, (), "", "a date version string")
DECLARE_MESSAGE(AddArtifactOnlyOne, (msg::command_line), "", "'{command_line}' can only add one artifact at a time.")
DECLARE_MESSAGE(AddCommandFirstArg, (), "", "The first parameter to add must be 'artifact' or 'port'.")
DECLARE_MESSAGE(AddFirstArgument,
(msg::command_line),
"",
"The first argument to '{command_line}' must be 'artifact' or 'port'.")
DECLARE_MESSAGE(AddingCompletionEntry, (msg::path), "", "Adding vcpkg completion entry to {path}.")
DECLARE_MESSAGE(AdditionalPackagesToExport,
(),
Expand Down Expand Up @@ -45,7 +41,6 @@ DECLARE_MESSAGE(AddVersionArtifactsOnly,
"--version is artifacts only and can't be used with vcpkg add port")
DECLARE_MESSAGE(AddVersionAddedVersionToFile, (msg::version, msg::path), "", "added version {version} to {path}")
DECLARE_MESSAGE(AddVersionCommitChangesReminder, (), "", "Did you remember to commit your changes?")
DECLARE_MESSAGE(AddVersionCommitResultReminder, (), "", "Don't forget to commit the result!")
DECLARE_MESSAGE(AddVersionDetectLocalChangesError,
(),
"",
Expand Down Expand Up @@ -1309,6 +1304,10 @@ DECLARE_MESSAGE(FileSeekFailed,
"",
"Failed to seek to position {byte_offset} in {path}.")
DECLARE_MESSAGE(FilesExported, (msg::path), "", "Files exported at: {path}")
DECLARE_MESSAGE(FindCommandFirstArg,
(),
"'find', 'artifact', and 'port' are vcpkg specific terms and should not be translated.",
"The first argument to 'find' must be 'artifact' or 'port' .")
DECLARE_MESSAGE(FishCompletion, (msg::path), "", "vcpkg fish completion is already added at \"{path}\".")
DECLARE_MESSAGE(FloatingPointConstTooBig, (msg::count), "", "Floating point constant too big: {count}")
DECLARE_MESSAGE(FollowingPackagesMissingControl,
Expand Down
48 changes: 40 additions & 8 deletions include/vcpkg/documentation.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,45 @@ namespace vcpkg
{
namespace docs
{
inline constexpr StringLiteral registries_url = "https://learn.microsoft.com/vcpkg/users/registries";
inline constexpr StringLiteral manifests_url = "https://learn.microsoft.com/vcpkg/users/manifests";
inline constexpr StringLiteral package_name_url = "https://learn.microsoft.com/vcpkg/reference/vcpkg-json#name";
inline constexpr StringLiteral assetcaching_url = "https://learn.microsoft.com/vcpkg/users/assetcaching";
inline constexpr StringLiteral binarycaching_url = "https://learn.microsoft.com/vcpkg/users/binarycaching";
inline constexpr StringLiteral versioning_url = "https://learn.microsoft.com/vcpkg/users/versioning";
inline constexpr StringLiteral vcpkg_visual_studio_path_url =
"https://learn.microsoft.com/vcpkg/users/triplets#VCPKG_VISUAL_STUDIO_PATH";
static constexpr StringLiteral registries_url =
"https://learn.microsoft.com/vcpkg/users/registries?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral manifests_url =
"https://learn.microsoft.com/vcpkg/users/manifests?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral vcpkg_json_ref_name =
"https://learn.microsoft.com/vcpkg/reference/vcpkg-json?WT.mc_id=vcpkg_inproduct_cli#name";
static constexpr StringLiteral assetcaching_url =
"https://learn.microsoft.com/vcpkg/users/assetcaching?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral binarycaching_url =
"https://learn.microsoft.com/vcpkg/users/binarycaching?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral binarycaching_gha_url =
"https://learn.microsoft.com/vcpkg/users/binarycaching?WT.mc_id=vcpkg_inproduct_cli#gha";
static constexpr StringLiteral versioning_url =
"https://learn.microsoft.com/vcpkg/users/versioning?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral version_schemes =
"https://learn.microsoft.com/vcpkg/users/versioning?WT.mc_id=vcpkg_inproduct_cli#version-schemes";
static constexpr StringLiteral triplets_url =
"https://learn.microsoft.com/vcpkg/users/triplets?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral vcpkg_visual_studio_path_url =
"https://learn.microsoft.com/vcpkg/users/triplets?WT.mc_id=vcpkg_inproduct_cli#VCPKG_VISUAL_STUDIO_PATH";
inline constexpr StringLiteral package_name_url =
"https://learn.microsoft.com/vcpkg/reference/vcpkg-json?WT.mc_id=vcpkg_inproduct_cli#name";
static constexpr StringLiteral troubleshoot_build_failures_url =
"https://learn.microsoft.com/vcpkg/troubleshoot/build-failures?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral add_command_url =
"https://learn.microsoft.com/vcpkg/commands/add?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral add_command_recurse_opt_url =
"https://learn.microsoft.com/vcpkg/commands/remove?WT.mc_id=vcpkg_inproduct_cli#--recurse";
static constexpr StringLiteral add_version_command_url =
"https://learn.microsoft.com/vcpkg/commands/add-version?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral add_version_command_overwrite_version_opt_url =
"https://learn.microsoft.com/vcpkg/commands/add-version?WT.mc_id=vcpkg_inproduct_cli#--overwrite-version";
static constexpr StringLiteral radd_version_command_all_opt_url =
"https://learn.microsoft.com/vcpkg/commands/add-version?WT.mc_id=vcpkg_inproduct_cli#--all";
static constexpr StringLiteral format_manifest_command_url =
"https://learn.microsoft.com/vcpkg/commands/format-manifest?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral troubleshoot_binary_cache_url =
"https://learn.microsoft.com/vcpkg/users/binarycaching-troubleshooting?WT.mc_id=vcpkg_inproduct_cli";
static constexpr StringLiteral troubleshoot_versioning_url =
"https://learn.microsoft.com/vcpkg/users/versioning-troubleshooting?WT.mc_id=vcpkg_inproduct_cli";
}
}
5 changes: 2 additions & 3 deletions locales/messages.json
Original file line number Diff line number Diff line change
Expand Up @@ -48,8 +48,6 @@
"AddArtifactOnlyOne": "'{command_line}' can only add one artifact at a time.",
"_AddArtifactOnlyOne.comment": "An example of {command_line} is vcpkg install zlib.",
"AddCommandFirstArg": "The first parameter to add must be 'artifact' or 'port'.",
"AddFirstArgument": "The first argument to '{command_line}' must be 'artifact' or 'port'.",
"_AddFirstArgument.comment": "An example of {command_line} is vcpkg install zlib.",
"AddPortRequiresManifest": "'{command_line}' requires an active manifest file.",
"_AddPortRequiresManifest.comment": "An example of {command_line} is vcpkg install zlib.",
"AddPortSucceeded": "Succeeded in adding ports to vcpkg.json file.",
Expand All @@ -61,7 +59,6 @@
"AddVersionArtifactsOnly": "--version is artifacts only and can't be used with vcpkg add port",
"_AddVersionArtifactsOnly.comment": "'--version', and 'vcpkg add port' are command lines that must not be localized",
"AddVersionCommitChangesReminder": "Did you remember to commit your changes?",
"AddVersionCommitResultReminder": "Don't forget to commit the result!",
"AddVersionDetectLocalChangesError": "skipping detection of local changes due to unexpected format in git status output",
"AddVersionFileNotFound": "couldn't find required file {path}",
"_AddVersionFileNotFound.comment": "An example of {path} is /foo/bar.",
Expand Down Expand Up @@ -781,6 +778,8 @@
"_FilesExported.comment": "An example of {path} is /foo/bar.",
"FilesRelativeToTheBuildDirectoryHere": "the files are relative to the build directory here",
"FilesRelativeToThePackageDirectoryHere": "the files are relative to ${{CURRENT_PACKAGES_DIR}} here",
"FindCommandFirstArg": "The first argument to 'find' must be 'artifact' or 'port' .",
"_FindCommandFirstArg.comment": "'find', 'artifact', and 'port' are vcpkg specific terms and should not be translated.",
"FindVersionArtifactsOnly": "--version can't be used with vcpkg search or vcpkg find port",
"_FindVersionArtifactsOnly.comment": "'--version', 'vcpkg search', and 'vcpkg find port' are command lines that must not be localized",
"FishCompletion": "vcpkg fish completion is already added at \"{path}\".",
Expand Down
13 changes: 9 additions & 4 deletions src/vcpkg-test/dependencies.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <vcpkg/commands.set-installed.h>
#include <vcpkg/dependencies.h>
#include <vcpkg/documentation.h>
#include <vcpkg/portfileprovider.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/vcpkgcmdarguments.h>
Expand Down Expand Up @@ -478,7 +479,8 @@ This can be resolved by adding an explicit override to the preferred version. Fo
"version": "2with\"quotes"
}
]
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)");
See `vcpkg help versioning` or )" +
docs::troubleshoot_versioning_url + R"( for more information.)");
}

TEST_CASE ("version install string port version", "[versionplan]")
Expand Down Expand Up @@ -1117,7 +1119,8 @@ This can be resolved by adding an explicit override to the preferred version. Fo
"version": "1.0.0"
}
]
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)");
See `vcpkg help versioning` or )" +
docs::troubleshoot_versioning_url + R"( for more information.)");
}
SECTION ("higher baseline")
{
Expand Down Expand Up @@ -1148,7 +1151,8 @@ This can be resolved by adding an explicit override to the preferred version. Fo
"version": "1.0.2"
}
]
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)");
See `vcpkg help versioning` or )" +
docs::troubleshoot_versioning_url + R"( for more information.)");
}
}

Expand Down Expand Up @@ -1241,7 +1245,8 @@ This can be resolved by adding an explicit override to the preferred version. Fo
"version": "1"
}
]
See `vcpkg help versioning` or https://learn.microsoft.com/vcpkg/users/versioning for more information.)");
See `vcpkg help versioning` or )" +
docs::troubleshoot_versioning_url + R"( for more information.)");
}
SECTION ("lower baseline")
{
Expand Down
22 changes: 13 additions & 9 deletions src/vcpkg-test/input.cpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
#include <vcpkg-test/util.h>

#include <vcpkg/documentation.h>
#include <vcpkg/input.h>
#include <vcpkg/triplet.h>

Expand Down Expand Up @@ -94,13 +95,14 @@ TEST_CASE ("check_triplet validates", "[input][check_triplet]")
REQUIRE(maybe_check.has_value());
maybe_check = check_triplet("x86-windows", db);
REQUIRE(!maybe_check.has_value());
REQUIRE(maybe_check.error() == LocalizedString::from_raw(R"(error: Invalid triplet: x86-windows
std::string expected_error = R"(error: Invalid triplet: x86-windows
Built-in Triplets:
Community Triplets:
Overlay Triplets from "x64-windows.cmake":
x64-windows
See https://learn.microsoft.com/vcpkg/users/triplets for more information.
)"));
See )" + docs::triplets_url + R"( for more information.
)";
REQUIRE(maybe_check.error() == expected_error);
}

TEST_CASE ("check_and_get_package_spec validates the triplet", "[input][check_and_get_package_spec]")
Expand All @@ -120,13 +122,14 @@ TEST_CASE ("check_and_get_package_spec validates the triplet", "[input][check_an

maybe_spec = check_and_get_package_spec("zlib:x86-windows", Triplet::from_canonical_name("x64-windows"), db);
REQUIRE(!maybe_spec.has_value());
REQUIRE(maybe_spec.error() == LocalizedString::from_raw(R"(error: Invalid triplet: x86-windows
std::string expected_error = R"(error: Invalid triplet: x86-windows
Built-in Triplets:
Community Triplets:
Overlay Triplets from "x64-windows.cmake":
x64-windows
See https://learn.microsoft.com/vcpkg/users/triplets for more information.
)"));
See )" + docs::triplets_url + R"( for more information.
)";
REQUIRE(maybe_spec.error() == expected_error);
}

TEST_CASE ("check_and_get_package_spec forbids malformed", "[input][check_and_get_package_spec]")
Expand Down Expand Up @@ -187,13 +190,14 @@ TEST_CASE ("check_and_get_full_package_spec validates the triplet", "[input][che
maybe_spec =
check_and_get_full_package_spec("zlib[core]:x86-windows", Triplet::from_canonical_name("x64-windows"), db);
REQUIRE(!maybe_spec.has_value());
REQUIRE(maybe_spec.error() == LocalizedString::from_raw(R"(error: Invalid triplet: x86-windows
std::string expected_error = R"(error: Invalid triplet: x86-windows
Built-in Triplets:
Community Triplets:
Overlay Triplets from "x64-windows.cmake":
x64-windows
See https://learn.microsoft.com/vcpkg/users/triplets for more information.
)"));
See )" + docs::triplets_url + R"( for more information.
)";
REQUIRE(maybe_spec.error() == expected_error);
}

TEST_CASE ("check_and_get_full_package_spec forbids malformed", "[input][check_and_get_full_package_spec]")
Expand Down
25 changes: 13 additions & 12 deletions src/vcpkg-test/manifests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

#include <vcpkg/base/json.h>

#include <vcpkg/documentation.h>
#include <vcpkg/sourceparagraph.h>
#include <vcpkg/vcpkgcmdarguments.h>

Expand Down Expand Up @@ -1418,8 +1419,8 @@ TEST_CASE ("default-feature-empty errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.default-features[0] (a feature name): \"\" is not a valid feature name. Feature "
"names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}

TEST_CASE ("default-feature-empty-object errors", "[manifests]")
Expand All @@ -1431,8 +1432,8 @@ TEST_CASE ("default-feature-empty-object errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.default-features[0].name (a feature name): \"\" is not a valid feature name. "
"Feature names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"Feature names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}

TEST_CASE ("dependency-name-empty errors", "[manifests]")
Expand All @@ -1444,8 +1445,8 @@ TEST_CASE ("dependency-name-empty errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.dependencies[0] (a package name): \"\" is not a valid package name. Package "
"names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}

TEST_CASE ("dependency-name-empty-object errors", "[manifests]")
Expand All @@ -1457,8 +1458,8 @@ TEST_CASE ("dependency-name-empty-object errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.dependencies[0].name (a package name): \"\" is not a valid package name. "
"Package names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"Package names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}

TEST_CASE ("dependency-feature-name-core errors", "[manifests]")
Expand Down Expand Up @@ -1544,8 +1545,8 @@ TEST_CASE ("dependency-feature-name-empty errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.dependencies[0].features[0] (a feature name): \"\" is not a valid feature name. "
"Feature names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"Feature names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}

TEST_CASE ("dependency-feature-name-empty-object errors", "[manifests]")
Expand All @@ -1562,6 +1563,6 @@ TEST_CASE ("dependency-feature-name-empty-object errors", "[manifests]")
REQUIRE(!m_pgh.has_value());
REQUIRE(m_pgh.error().data() ==
"<test manifest>: error: $.dependencies[0].features[0].name (a feature name): \"\" is not a valid feature "
"name. Feature names must be lowercase alphanumeric+hypens and not reserved (see "
"https://learn.microsoft.com/vcpkg/users/manifests for more information).");
"name. Feature names must be lowercase alphanumeric+hypens and not reserved (see " +
docs::manifests_url + " for more information).");
}
23 changes: 13 additions & 10 deletions src/vcpkg-test/registries.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
#include <vcpkg/base/strings.h>

#include <vcpkg/configuration.h>
#include <vcpkg/documentation.h>
#include <vcpkg/registries.h>

using namespace vcpkg;
Expand Down Expand Up @@ -421,16 +422,18 @@ TEST_CASE ("registries report pattern errors", "[registries]")
REQUIRE(errors.size() == 3);
CHECK(errors[0] == "test: error: $.registries[0].packages[1] (a package pattern): \"\" is not a valid package "
"pattern. Package patterns must "
"use only one wildcard character (*) and it must be the last character in the pattern (see "
"https://learn.microsoft.com/vcpkg/users/registries for more information).");
CHECK(errors[1] == "test: error: $.registries[0].packages[2] (a package pattern): \"a*a\" is not a valid package "
"pattern. Package patterns "
"must use only one wildcard character (*) and it must be the last character in the pattern (see "
"https://learn.microsoft.com/vcpkg/users/registries for more information).");
CHECK(errors[2] == "test: error: $.registries[0].packages[3] (a package pattern): \"*a\" is not a valid package "
"pattern. Package patterns "
"must use only one wildcard character (*) and it must be the last character in the pattern (see "
"https://learn.microsoft.com/vcpkg/users/registries for more information).");
"use only one wildcard character (*) and it must be the last character in the pattern (see " +
docs::registries_url + " for more information).");
CHECK(errors[1] ==
"test: error: $.registries[0].packages[2] (a package pattern): \"a*a\" is not a valid package "
"pattern. Package patterns "
"must use only one wildcard character (*) and it must be the last character in the pattern (see " +
docs::registries_url + " for more information).");
CHECK(errors[2] ==
"test: error: $.registries[0].packages[3] (a package pattern): \"*a\" is not a valid package "
"pattern. Package patterns "
"must use only one wildcard character (*) and it must be the last character in the pattern (see " +
docs::registries_url + " for more information).");
}

TEST_CASE ("registries ignored patterns warning", "[registries]")
Expand Down
Loading

0 comments on commit dfc8c0f

Please sign in to comment.