diff options
| author | JackBoosY <yuzaiyang@beyondsoft.com> | 2020-01-13 23:55:59 -0800 |
|---|---|---|
| committer | JackBoosY <yuzaiyang@beyondsoft.com> | 2020-01-13 23:55:59 -0800 |
| commit | 2514481b42ebdeec28649582fc666955cf206c84 (patch) | |
| tree | 60c9809a5c3c8adbad240a40b1088a6f8e42c019 /toolsrc/src | |
| parent | b751326c91c9a307aaf5e340b61ab9f2d1ad45a4 (diff) | |
| parent | 28eee51adb36f2165be846e77ef7b3ee5b3f8789 (diff) | |
| download | vcpkg-2514481b42ebdeec28649582fc666955cf206c84.tar.gz vcpkg-2514481b42ebdeec28649582fc666955cf206c84.zip | |
Merge branch 'master' of https://github.com/Microsoft/vcpkg into dev/jack/upgrade_libi
Diffstat (limited to 'toolsrc/src')
| -rw-r--r-- | toolsrc/src/vcpkg.cpp | 4 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/base/system.cpp | 15 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/build.cpp | 15 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/export.chocolatey.cpp | 230 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/export.cpp | 31 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/help.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/install.cpp | 7 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/metrics.cpp | 2 | ||||
| -rw-r--r-- | toolsrc/src/vcpkg/postbuildlint.cpp | 10 |
9 files changed, 298 insertions, 18 deletions
diff --git a/toolsrc/src/vcpkg.cpp b/toolsrc/src/vcpkg.cpp index 9cd0ddf19..c336d2f63 100644 --- a/toolsrc/src/vcpkg.cpp +++ b/toolsrc/src/vcpkg.cpp @@ -304,7 +304,6 @@ int main(const int argc, const char* const* const argv) SetConsoleCP(CP_UTF8); SetConsoleOutputCP(CP_UTF8); - const std::string trimmed_command_line = trim_path_from_command_line(Strings::to_utf8(GetCommandLineW())); #endif Checks::register_global_shutdown_handler([]() { @@ -335,9 +334,6 @@ int main(const int argc, const char* const* const argv) { auto locked_metrics = Metrics::g_metrics.lock(); locked_metrics->track_property("version", Commands::Version::version()); -#if defined(_WIN32) - locked_metrics->track_property("cmdline", trimmed_command_line); -#endif } System::register_console_ctrl_handler(); diff --git a/toolsrc/src/vcpkg/base/system.cpp b/toolsrc/src/vcpkg/base/system.cpp index d9c6349be..c84b7f8be 100644 --- a/toolsrc/src/vcpkg/base/system.cpp +++ b/toolsrc/src/vcpkg/base/system.cpp @@ -157,11 +157,24 @@ namespace vcpkg std::vector<CPUArchitecture> supported_architectures; supported_architectures.push_back(get_host_processor()); - // AMD64 machines support to run x86 applications + // AMD64 machines support running x86 applications and ARM64 machines support running ARM applications if (supported_architectures.back() == CPUArchitecture::X64) { supported_architectures.push_back(CPUArchitecture::X86); } + else if (supported_architectures.back() == CPUArchitecture::ARM64) + { + supported_architectures.push_back(CPUArchitecture::ARM); + } + +#if defined(_WIN32) + // On ARM32/64 Windows we can rely on x86 emulation + if (supported_architectures.front() == CPUArchitecture::ARM || + supported_architectures.front() == CPUArchitecture::ARM64) + { + supported_architectures.push_back(CPUArchitecture::X86); + } +#endif return supported_architectures; } diff --git a/toolsrc/src/vcpkg/build.cpp b/toolsrc/src/vcpkg/build.cpp index 618e4126b..f13dd2a25 100644 --- a/toolsrc/src/vcpkg/build.cpp +++ b/toolsrc/src/vcpkg/build.cpp @@ -129,6 +129,7 @@ namespace vcpkg::Build {
static const std::string NAME_EMPTY_PACKAGE = "PolicyEmptyPackage";
static const std::string NAME_DLLS_WITHOUT_LIBS = "PolicyDLLsWithoutLIBs";
+ static const std::string NAME_DLLS_WITHOUT_EXPORTS = "PolicyDLLsWithoutExports";
static const std::string NAME_ONLY_RELEASE_CRT = "PolicyOnlyReleaseCRT";
static const std::string NAME_EMPTY_INCLUDE_FOLDER = "PolicyEmptyIncludeFolder";
static const std::string NAME_ALLOW_OBSOLETE_MSVCRT = "PolicyAllowObsoleteMsvcrt";
@@ -139,6 +140,7 @@ namespace vcpkg::Build {
case BuildPolicy::EMPTY_PACKAGE: return NAME_EMPTY_PACKAGE;
case BuildPolicy::DLLS_WITHOUT_LIBS: return NAME_DLLS_WITHOUT_LIBS;
+ case BuildPolicy::DLLS_WITHOUT_EXPORTS: return NAME_DLLS_WITHOUT_EXPORTS;
case BuildPolicy::ONLY_RELEASE_CRT: return NAME_ONLY_RELEASE_CRT;
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return NAME_EMPTY_INCLUDE_FOLDER;
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return NAME_ALLOW_OBSOLETE_MSVCRT;
@@ -152,6 +154,7 @@ namespace vcpkg::Build {
case BuildPolicy::EMPTY_PACKAGE: return "VCPKG_POLICY_EMPTY_PACKAGE";
case BuildPolicy::DLLS_WITHOUT_LIBS: return "VCPKG_POLICY_DLLS_WITHOUT_LIBS";
+ case BuildPolicy::DLLS_WITHOUT_EXPORTS: return "VCPKG_POLICY_DLLS_WITHOUT_EXPORTS";
case BuildPolicy::ONLY_RELEASE_CRT: return "VCPKG_POLICY_ONLY_RELEASE_CRT";
case BuildPolicy::EMPTY_INCLUDE_FOLDER: return "VCPKG_POLICY_EMPTY_INCLUDE_FOLDER";
case BuildPolicy::ALLOW_OBSOLETE_MSVCRT: return "VCPKG_POLICY_ALLOW_OBSOLETE_MSVCRT";
@@ -580,7 +583,15 @@ namespace vcpkg::Build {
auto locked_metrics = Metrics::g_metrics.lock();
- locked_metrics->track_buildtime(spec.to_string() + ":[" + Strings::join(",", config.feature_list) + "]",
+
+ locked_metrics->track_buildtime(Hash::get_string_hash(spec.to_string(), Hash::Algorithm::Sha256) + ":[" +
+ Strings::join(",",
+ config.feature_list,
+ [](const std::string& feature) {
+ return Hash::get_string_hash(feature,
+ Hash::Algorithm::Sha256);
+ }) +
+ "]",
buildtimeus);
if (return_code != 0)
{
@@ -654,7 +665,7 @@ namespace vcpkg::Build std::vector<AbiEntry> abi_tag_entries(dependency_abis.begin(), dependency_abis.end());
// Sorted here as the order of dependency_abis is the only
- // non-deterministicly ordered set of AbiEntries
+ // non-deterministically ordered set of AbiEntries
Util::sort(abi_tag_entries);
// If there is an unusually large number of files in the port then
diff --git a/toolsrc/src/vcpkg/export.chocolatey.cpp b/toolsrc/src/vcpkg/export.chocolatey.cpp new file mode 100644 index 000000000..492e5d371 --- /dev/null +++ b/toolsrc/src/vcpkg/export.chocolatey.cpp @@ -0,0 +1,230 @@ +#include "pch.h"
+
+#include <vcpkg/base/system.print.h>
+#include <vcpkg/base/system.process.h>
+#include <vcpkg/commands.h>
+#include <vcpkg/export.chocolatey.h>
+#include <vcpkg/export.h>
+#include <vcpkg/install.h>
+
+namespace vcpkg::Export::Chocolatey
+{
+ using Dependencies::ExportPlanAction;
+ using Dependencies::ExportPlanType;
+ using Install::InstallDir;
+
+ static std::string create_nuspec_dependencies(const BinaryParagraph& binary_paragraph,
+ const std::map<std::string, std::string>& packages_version)
+ {
+ static constexpr auto CONTENT_TEMPLATE = R"(<dependency id="@PACKAGE_ID@" version="[@PACKAGE_VERSION@]" />)";
+
+ std::string nuspec_dependencies;
+ for (const std::string& depend : binary_paragraph.depends)
+ {
+ auto found = packages_version.find(depend);
+ if (found == packages_version.end())
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot find desired dependency version.");
+ }
+ std::string nuspec_dependency = Strings::replace_all(CONTENT_TEMPLATE, "@PACKAGE_ID@", depend);
+ nuspec_dependency = Strings::replace_all(std::move(nuspec_dependency), "@PACKAGE_VERSION@", found->second);
+ nuspec_dependencies += nuspec_dependency;
+ }
+ return nuspec_dependencies;
+ }
+
+ static std::string create_nuspec_file_contents(const std::string& exported_root_dir,
+ const BinaryParagraph& binary_paragraph,
+ const std::map<std::string, std::string>& packages_version,
+ const Options& chocolatey_options)
+ {
+ static constexpr auto CONTENT_TEMPLATE = R"(<?xml version="1.0" encoding="utf-8"?>
+<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
+ <metadata>
+ <id>@PACKAGE_ID@</id>
+ <version>@PACKAGE_VERSION@</version>
+ <authors>@PACKAGE_MAINTAINER@</authors>
+ <description><![CDATA[
+ @PACKAGE_DESCRIPTION@
+ ]]></description>
+ <dependencies>
+ @PACKAGE_DEPENDENCIES@
+ </dependencies>
+ </metadata>
+ <files>
+ <file src="@EXPORTED_ROOT_DIR@\installed\**" target="installed" />
+ <file src="@EXPORTED_ROOT_DIR@\tools\**" target="tools" />
+ </files>
+</package>
+)";
+ auto package_version = packages_version.find(binary_paragraph.spec.name());
+ if (package_version == packages_version.end())
+ {
+ Checks::exit_with_message(VCPKG_LINE_INFO, "Cannot find desired package version.");
+ }
+ std::string nuspec_file_content =
+ Strings::replace_all(CONTENT_TEMPLATE, "@PACKAGE_ID@", binary_paragraph.spec.name());
+ nuspec_file_content =
+ Strings::replace_all(std::move(nuspec_file_content), "@PACKAGE_VERSION@", package_version->second);
+ nuspec_file_content = Strings::replace_all(
+ std::move(nuspec_file_content), "@PACKAGE_MAINTAINER@", chocolatey_options.maybe_maintainer.value_or(""));
+ nuspec_file_content =
+ Strings::replace_all(std::move(nuspec_file_content), "@PACKAGE_DESCRIPTION@", binary_paragraph.description);
+ nuspec_file_content =
+ Strings::replace_all(std::move(nuspec_file_content), "@EXPORTED_ROOT_DIR@", exported_root_dir);
+ nuspec_file_content = Strings::replace_all(std::move(nuspec_file_content),
+ "@PACKAGE_DEPENDENCIES@",
+ create_nuspec_dependencies(binary_paragraph, packages_version));
+ return nuspec_file_content;
+ }
+
+ static std::string create_chocolatey_install_contents()
+ {
+ static constexpr auto CONTENT_TEMPLATE = R"###(
+$ErrorActionPreference = 'Stop';
+
+$packageName= $env:ChocolateyPackageName
+$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
+$rootDir = "$(Split-Path -parent $toolsDir)"
+$installedDir = Join-Path $rootDir 'installed'
+
+$whereToInstall = (pwd).path
+$whereToInstallCache = Join-Path $rootDir 'install.txt'
+Set-Content -Path $whereToInstallCache -Value $whereToInstall
+Copy-Item $installedDir -destination $whereToInstall -recurse -force
+)###";
+ return CONTENT_TEMPLATE;
+ }
+
+ static std::string create_chocolatey_uninstall_contents(const BinaryParagraph& binary_paragraph)
+ {
+ static constexpr auto CONTENT_TEMPLATE = R"###(
+$ErrorActionPreference = 'Stop';
+
+$packageName= $env:ChocolateyPackageName
+$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"
+$rootDir = "$(Split-Path -parent $toolsDir)"
+$listFile = Join-Path $rootDir 'installed\vcpkg\info\@PACKAGE_FULLSTEM@.list'
+
+$whereToInstall = $null
+$whereToInstallCache = Join-Path $rootDir 'install.txt'
+Get-Content $whereToInstallCache | Foreach-Object {
+ $whereToInstall = $_
+}
+
+$installedDir = Join-Path $whereToInstall 'installed'
+Get-Content $listFile | Foreach-Object {
+ $fileToRemove = Join-Path $installedDir $_
+ if (Test-Path $fileToRemove -PathType Leaf) {
+ Remove-Item $fileToRemove
+ }
+}
+
+Get-Content $listFile | Foreach-Object {
+ $fileToRemove = Join-Path $installedDir $_
+ if (Test-Path $fileToRemove -PathType Container) {
+ $folderToDelete = Join-Path $fileToRemove *
+ if (-Not (Test-Path $folderToDelete))
+ {
+ Remove-Item $fileToRemove
+ }
+ }
+}
+
+$listFileToRemove = Join-Path $whereToInstall 'installed\vcpkg\info\@PACKAGE_FULLSTEM@.list'
+Remove-Item $listFileToRemove
+
+if (Test-Path $installedDir)
+{
+ while (
+ $empties = Get-ChildItem $installedDir -recurse -Directory | Where-Object {
+ $_.GetFiles().Count -eq 0 -and $_.GetDirectories().Count -eq 0
+ }
+ ) { $empties | Remove-Item }
+}
+)###";
+ std::string chocolatey_uninstall_content =
+ Strings::replace_all(CONTENT_TEMPLATE, "@PACKAGE_FULLSTEM@", binary_paragraph.fullstem());
+ return chocolatey_uninstall_content;
+ }
+
+ void do_export(const std::vector<ExportPlanAction>& export_plan,
+ const VcpkgPaths& paths,
+ const Options& chocolatey_options)
+ {
+ Checks::check_exit(
+ VCPKG_LINE_INFO, chocolatey_options.maybe_maintainer.has_value(), "--x-maintainer option is required.");
+
+ Files::Filesystem& fs = paths.get_filesystem();
+ const fs::path vcpkg_root_path = paths.root;
+ const fs::path raw_exported_dir_path = vcpkg_root_path / "chocolatey";
+ const fs::path exported_dir_path = vcpkg_root_path / "chocolatey_exports";
+ const fs::path& nuget_exe = paths.get_tool_exe(Tools::NUGET);
+
+ std::error_code ec;
+ fs.remove_all(raw_exported_dir_path, VCPKG_LINE_INFO);
+ fs.create_directory(raw_exported_dir_path, ec);
+ fs.remove_all(exported_dir_path, VCPKG_LINE_INFO);
+ fs.create_directory(exported_dir_path, ec);
+
+ // execute the plan
+ std::map<std::string, std::string> packages_version;
+ for (const ExportPlanAction& action : export_plan)
+ {
+ if (action.plan_type != ExportPlanType::ALREADY_BUILT)
+ {
+ Checks::unreachable(VCPKG_LINE_INFO);
+ }
+
+ const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
+ auto norm_version = binary_paragraph.version;
+
+ // normalize the version string to be separated by dots to be compliant with Nusepc.
+ norm_version = Strings::replace_all(std::move(norm_version), "-", ".");
+ norm_version = Strings::replace_all(std::move(norm_version), "_", ".");
+ norm_version = norm_version + chocolatey_options.maybe_version_suffix.value_or("");
+ packages_version.insert(std::make_pair(binary_paragraph.spec.name(), norm_version));
+ }
+
+ for (const ExportPlanAction& action : export_plan)
+ {
+ const std::string display_name = action.spec.to_string();
+ System::print2("Exporting package ", display_name, "...\n");
+
+ const fs::path per_package_dir_path = raw_exported_dir_path / action.spec.name();
+
+ const BinaryParagraph& binary_paragraph = action.core_paragraph().value_or_exit(VCPKG_LINE_INFO);
+
+ const InstallDir dirs = InstallDir::from_destination_root(
+ per_package_dir_path / "installed",
+ action.spec.triplet().to_string(),
+ per_package_dir_path / "installed" / "vcpkg" / "info" / (binary_paragraph.fullstem() + ".list"));
+
+ Install::install_files_and_write_listfile(paths.get_filesystem(), paths.package_dir(action.spec), dirs);
+
+ const std::string nuspec_file_content = create_nuspec_file_contents(
+ per_package_dir_path.string(), binary_paragraph, packages_version, chocolatey_options);
+ const fs::path nuspec_file_path =
+ per_package_dir_path / Strings::concat(binary_paragraph.spec.name(), ".nuspec");
+ fs.write_contents(nuspec_file_path, nuspec_file_content, VCPKG_LINE_INFO);
+
+ fs.create_directory(per_package_dir_path / "tools", ec);
+
+ const std::string chocolatey_install_content = create_chocolatey_install_contents();
+ const fs::path chocolatey_install_file_path = per_package_dir_path / "tools" / "chocolateyInstall.ps1";
+ fs.write_contents(chocolatey_install_file_path, chocolatey_install_content, VCPKG_LINE_INFO);
+
+ const std::string chocolatey_uninstall_content = create_chocolatey_uninstall_contents(binary_paragraph);
+ const fs::path chocolatey_uninstall_file_path = per_package_dir_path / "tools" / "chocolateyUninstall.ps1";
+ fs.write_contents(chocolatey_uninstall_file_path, chocolatey_uninstall_content, VCPKG_LINE_INFO);
+
+ const auto cmd_line = Strings::format(R"("%s" pack -OutputDirectory "%s" "%s" -NoDefaultExcludes > nul)",
+ nuget_exe.u8string(),
+ exported_dir_path.u8string(),
+ nuspec_file_path.u8string());
+
+ const int exit_code = System::cmd_execute_clean(cmd_line);
+ Checks::check_exit(VCPKG_LINE_INFO, exit_code == 0, "Error: NuGet package creation failed");
+ }
+ }
+}
diff --git a/toolsrc/src/vcpkg/export.cpp b/toolsrc/src/vcpkg/export.cpp index 349d9aefd..34f9053ea 100644 --- a/toolsrc/src/vcpkg/export.cpp +++ b/toolsrc/src/vcpkg/export.cpp @@ -4,6 +4,7 @@ #include <vcpkg/dependencies.h> #include <vcpkg/export.h> #include <vcpkg/export.ifw.h> +#include <vcpkg/export.chocolatey.h> #include <vcpkg/help.h> #include <vcpkg/input.h> #include <vcpkg/install.h> @@ -257,6 +258,7 @@ namespace vcpkg::Export bool ifw = false; bool zip = false; bool seven_zip = false; + bool chocolatey = false; Optional<std::string> maybe_output; @@ -264,6 +266,7 @@ namespace vcpkg::Export Optional<std::string> maybe_nuget_version; IFW::Options ifw_options; + Chocolatey::Options chocolatey_options; std::vector<PackageSpec> specs; }; @@ -281,17 +284,21 @@ namespace vcpkg::Export static constexpr StringLiteral OPTION_IFW_REPOSITORY_DIR_PATH = "--ifw-repository-directory-path"; static constexpr StringLiteral OPTION_IFW_CONFIG_FILE_PATH = "--ifw-configuration-file-path"; static constexpr StringLiteral OPTION_IFW_INSTALLER_FILE_PATH = "--ifw-installer-file-path"; + static constexpr StringLiteral OPTION_CHOCOLATEY = "--x-chocolatey"; + static constexpr StringLiteral OPTION_CHOCOLATEY_MAINTAINER = "--x-maintainer"; + static constexpr StringLiteral OPTION_CHOCOLATEY_VERSION_SUFFIX = "--x-version-suffix"; - static constexpr std::array<CommandSwitch, 6> EXPORT_SWITCHES = {{ + static constexpr std::array<CommandSwitch, 7> EXPORT_SWITCHES = {{ {OPTION_DRY_RUN, "Do not actually export"}, {OPTION_RAW, "Export to an uncompressed directory"}, {OPTION_NUGET, "Export a NuGet package"}, {OPTION_IFW, "Export to an IFW-based installer"}, {OPTION_ZIP, "Export to a zip file"}, {OPTION_SEVEN_ZIP, "Export to a 7zip (.7z) file"}, + {OPTION_CHOCOLATEY, "Export a Chocolatey package (experimental feature)"}, }}; - static constexpr std::array<CommandSetting, 8> EXPORT_SETTINGS = {{ + static constexpr std::array<CommandSetting, 10> EXPORT_SETTINGS = {{ {OPTION_OUTPUT, "Specify the output name (used to construct filename)"}, {OPTION_NUGET_ID, "Specify the id for the exported NuGet package (overrides --output)"}, {OPTION_NUGET_VERSION, "Specify the version for the exported NuGet package"}, @@ -300,6 +307,8 @@ namespace vcpkg::Export {OPTION_IFW_REPOSITORY_DIR_PATH, "Specify the directory path for the exported repository"}, {OPTION_IFW_CONFIG_FILE_PATH, "Specify the temporary file path for the installer configuration"}, {OPTION_IFW_INSTALLER_FILE_PATH, "Specify the file path for the exported installer"}, + {OPTION_CHOCOLATEY_MAINTAINER, "Specify the maintainer for the exported Chocolatey package (experimental feature)"}, + {OPTION_CHOCOLATEY_VERSION_SUFFIX, "Specify the version suffix to add for the exported Chocolatey package (experimental feature)"}, }}; const CommandStructure COMMAND_STRUCTURE = { @@ -327,13 +336,14 @@ namespace vcpkg::Export ret.ifw = options.switches.find(OPTION_IFW) != options.switches.cend(); ret.zip = options.switches.find(OPTION_ZIP) != options.switches.cend(); ret.seven_zip = options.switches.find(OPTION_SEVEN_ZIP) != options.switches.cend(); + ret.chocolatey = options.switches.find(OPTION_CHOCOLATEY) != options.switches.cend(); ret.maybe_output = maybe_lookup(options.settings, OPTION_OUTPUT); - if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run) + if (!ret.raw && !ret.nuget && !ret.ifw && !ret.zip && !ret.seven_zip && !ret.dry_run && !ret.chocolatey) { System::print2(System::Color::error, - "Must provide at least one export type: --raw --nuget --ifw --zip --7zip\n"); + "Must provide at least one export type: --raw --nuget --ifw --zip --7zip --chocolatey\n"); System::print2(COMMAND_STRUCTURE.example_text); Checks::exit_fail(VCPKG_LINE_INFO); } @@ -384,6 +394,14 @@ namespace vcpkg::Export {OPTION_IFW_CONFIG_FILE_PATH, ret.ifw_options.maybe_config_file_path}, {OPTION_IFW_INSTALLER_FILE_PATH, ret.ifw_options.maybe_installer_file_path}, }); + + options_implies(OPTION_CHOCOLATEY, + ret.chocolatey, + { + {OPTION_CHOCOLATEY_MAINTAINER, ret.chocolatey_options.maybe_maintainer}, + {OPTION_CHOCOLATEY_VERSION_SUFFIX, ret.chocolatey_options.maybe_version_suffix}, + }); + #if defined(_MSC_VER) && _MSC_VER <= 1900 #pragma warning(pop) #endif @@ -560,6 +578,11 @@ With a project open, go to Tools->NuGet Package Manager->Package Manager Console print_next_step_info("@RootDir@/src/vcpkg"); } + if (opts.chocolatey) + { + Chocolatey::do_export(export_plan, paths, opts.chocolatey_options); + } + Checks::exit_success(VCPKG_LINE_INFO); } } diff --git a/toolsrc/src/vcpkg/help.cpp b/toolsrc/src/vcpkg/help.cpp index 0c53536fb..a4908e02e 100644 --- a/toolsrc/src/vcpkg/help.cpp +++ b/toolsrc/src/vcpkg/help.cpp @@ -105,7 +105,7 @@ namespace vcpkg::Help " vcpkg create <pkg> <url>\n" " [archivename] Create a new package\n" " vcpkg owns <pat> Search for files in installed packages\n" - " vcpkg depend-info [pkg]... Display a list of dependencies for packages\n" + " vcpkg depend-info <pkg>... Display a list of dependencies for packages\n" " vcpkg env Creates a clean shell environment for development or " "compiling.\n" " vcpkg version Display version information\n" diff --git a/toolsrc/src/vcpkg/install.cpp b/toolsrc/src/vcpkg/install.cpp index 21be2d7b0..a082f1b95 100644 --- a/toolsrc/src/vcpkg/install.cpp +++ b/toolsrc/src/vcpkg/install.cpp @@ -1,6 +1,7 @@ #include "pch.h" #include <vcpkg/base/files.h> +#include <vcpkg/base/hash.h> #include <vcpkg/base/system.print.h> #include <vcpkg/base/util.h> #include <vcpkg/build.h> @@ -690,13 +691,13 @@ namespace vcpkg::Install // log the plan const std::string specs_string = Strings::join(",", action_plan, [](const AnyAction& action) { if (auto iaction = action.install_action.get()) - return iaction->spec.to_string(); + return Hash::get_string_hash(iaction->spec.to_string(), Hash::Algorithm::Sha256); else if (auto raction = action.remove_action.get()) - return "R$" + raction->spec.to_string(); + return "R$" + Hash::get_string_hash(raction->spec.to_string(), Hash::Algorithm::Sha256); Checks::unreachable(VCPKG_LINE_INFO); }); - Metrics::g_metrics.lock()->track_property("installplan", specs_string); + Metrics::g_metrics.lock()->track_property("installplan_1", specs_string); Dependencies::print_plan(action_plan, is_recursive, paths.ports); diff --git a/toolsrc/src/vcpkg/metrics.cpp b/toolsrc/src/vcpkg/metrics.cpp index b8c55919e..b971d96da 100644 --- a/toolsrc/src/vcpkg/metrics.cpp +++ b/toolsrc/src/vcpkg/metrics.cpp @@ -184,7 +184,7 @@ namespace vcpkg::Metrics if (buildtime_names.size() > 0) { if (props_plus_buildtimes.size() > 0) props_plus_buildtimes.push_back(','); - props_plus_buildtimes.append(Strings::format(R"("buildnames": [%s], "buildtimes": [%s])", + props_plus_buildtimes.append(Strings::format(R"("buildnames_1": [%s], "buildtimes": [%s])", Strings::join(",", buildtime_names, to_json_string), Strings::join(",", buildtime_times))); } diff --git a/toolsrc/src/vcpkg/postbuildlint.cpp b/toolsrc/src/vcpkg/postbuildlint.cpp index a85d879fe..2a13d2786 100644 --- a/toolsrc/src/vcpkg/postbuildlint.cpp +++ b/toolsrc/src/vcpkg/postbuildlint.cpp @@ -295,8 +295,10 @@ namespace vcpkg::PostBuildLint return LintStatus::SUCCESS; } - static LintStatus check_exports_of_dlls(const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe) + static LintStatus check_exports_of_dlls(const Build::BuildPolicies& policies, const std::vector<fs::path>& dlls, const fs::path& dumpbin_exe) { + if (policies.is_enabled(BuildPolicy::DLLS_WITHOUT_EXPORTS)) return LintStatus::SUCCESS; + std::vector<fs::path> dlls_with_no_exports; for (const fs::path& dll : dlls) { @@ -316,6 +318,10 @@ namespace vcpkg::PostBuildLint System::print2(System::Color::warning, "The following DLLs have no exports:\n"); Files::print_paths(dlls_with_no_exports); System::print2(System::Color::warning, "DLLs without any exports are likely a bug in the build script.\n"); + System::printf(System::Color::warning, + "If this is intended, add the following line in the portfile:\n" + " SET(%s enabled)\n", + to_cmake_variable(BuildPolicy::DLLS_WITHOUT_EXPORTS)); return LintStatus::ERROR_DETECTED; } @@ -809,7 +815,7 @@ namespace vcpkg::PostBuildLint if (!toolset.dumpbin.empty()) { - error_count += check_exports_of_dlls(dlls, toolset.dumpbin); + error_count += check_exports_of_dlls(build_info.policies, dlls, toolset.dumpbin); error_count += check_uwp_bit_of_dlls(pre_build_info.cmake_system_name, dlls, toolset.dumpbin); error_count += check_outdated_crt_linkage_of_dlls(dlls, toolset.dumpbin, build_info, pre_build_info); |
