Skip to content

Commit

Permalink
Delete more namespaces. (#581)
Browse files Browse the repository at this point in the history
* Delete more namespaces: PortFileProvider::

* Delete more namespaces: Build => nothing, Build::Command => Build

* Delete more namespaces: Input::

* Delete more namespaces: Dependencies::

* Delete more namespaces: Install::

* Delete more namespaces: Graphs.
  • Loading branch information
BillyONeal authored Jul 12, 2022
1 parent 0591682 commit aab7be4
Show file tree
Hide file tree
Showing 66 changed files with 841 additions and 997 deletions.
2 changes: 1 addition & 1 deletion include/vcpkg-test/mockcmakevarprovider.h
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ namespace vcpkg::Test
}

void load_tag_vars(Span<const FullPackageSpec> specs,
const PortFileProvider::PortFileProvider& port_provider,
const PortFileProvider& port_provider,
Triplet host_triplet) const override
{
for (auto&& spec : specs)
Expand Down
14 changes: 8 additions & 6 deletions include/vcpkg/base/graphs.h
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
#include <unordered_map>
#include <vector>

namespace vcpkg::Graphs
namespace vcpkg
{
DECLARE_MESSAGE(GraphCycleDetected,
(msg::package_name),
Expand All @@ -35,18 +35,18 @@ namespace vcpkg::Graphs
virtual U load_vertex_data(const V& vertex) const = 0;
};

struct Randomizer
struct GraphRandomizer
{
virtual int random(int max_exclusive) = 0;

protected:
~Randomizer() { }
~GraphRandomizer() { }
};

namespace details
{
template<class Container>
void shuffle(Container& c, Randomizer* r)
void shuffle(Container& c, GraphRandomizer* r)
{
if (!r) return;
for (auto i = c.size(); i > 1; --i)
Expand All @@ -64,7 +64,7 @@ namespace vcpkg::Graphs
const AdjacencyProvider<V, U>& f,
std::unordered_map<V, ExplorationStatus>& exploration_status,
std::vector<U>& sorted,
Randomizer* randomizer)
GraphRandomizer* randomizer)
{
ExplorationStatus& status = exploration_status[vertex];
switch (status)
Expand Down Expand Up @@ -101,7 +101,9 @@ namespace vcpkg::Graphs
}

template<class Range, class V, class U>
std::vector<U> topological_sort(Range starting_vertices, const AdjacencyProvider<V, U>& f, Randomizer* randomizer)
std::vector<U> topological_sort(Range starting_vertices,
const AdjacencyProvider<V, U>& f,
GraphRandomizer* randomizer)
{
std::vector<U> sorted;
std::unordered_map<V, ExplorationStatus> exploration_status;
Expand Down
20 changes: 10 additions & 10 deletions include/vcpkg/binarycaching.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,26 +48,26 @@ namespace vcpkg

/// Attempts to restore the package referenced by `action` into the packages directory.
/// Prerequisite: action has a package_abi()
virtual RestoreResult try_restore(const Dependencies::InstallPlanAction& action) const = 0;
virtual RestoreResult try_restore(const InstallPlanAction& action) const = 0;

/// Called upon a successful build of `action` to store those contents in the binary cache.
/// Prerequisite: action has a package_abi()
virtual void push_success(const Dependencies::InstallPlanAction& action) const = 0;
virtual void push_success(const InstallPlanAction& action) const = 0;

/// Gives the IBinaryProvider an opportunity to batch any downloading or server communication for
/// executing `actions`.
/// `cache_status` is a vector with the same number of entries of actions, where each index corresponds
/// to the action at the same index in `actions`. The provider must mark the cache status as appropriate.
/// Note: `actions` *might not* have package ABIs (for example, a --head package)!
/// Prerequisite: if `actions[i]` has no package ABI, `cache_status[i]` is nullptr.
virtual void prefetch(View<Dependencies::InstallPlanAction> actions, View<CacheStatus*> cache_status) const = 0;
virtual void prefetch(View<InstallPlanAction> actions, View<CacheStatus*> cache_status) const = 0;

/// Checks whether the `actions` are present in the cache, without restoring them. Used by CI to determine
/// missing packages.
/// `cache_status` is a view with the same number of entries of actions, where each index corresponds
/// to the action at the same index in `actions`. The provider must mark the cache status as appropriate.
/// Prerequisite: `actions` have package ABIs.
virtual void precheck(View<Dependencies::InstallPlanAction> actions, View<CacheStatus*> cache_status) const = 0;
virtual void precheck(View<InstallPlanAction> actions, View<CacheStatus*> cache_status) const = 0;
};

struct UrlTemplate
Expand All @@ -77,7 +77,7 @@ namespace vcpkg
std::vector<std::string> headers_for_get;

LocalizedString valid();
std::string instantiate_variables(const Dependencies::InstallPlanAction& action) const;
std::string instantiate_variables(const InstallPlanAction& action) const;
};

struct BinaryConfigParserState
Expand Down Expand Up @@ -128,19 +128,19 @@ namespace vcpkg
void install_providers_for(const VcpkgCmdArguments& args, const VcpkgPaths& paths);

/// Attempts to restore the package referenced by `action` into the packages directory.
RestoreResult try_restore(const Dependencies::InstallPlanAction& action);
RestoreResult try_restore(const InstallPlanAction& action);

/// Called upon a successful build of `action` to store those contents in the binary cache.
void push_success(const Dependencies::InstallPlanAction& action);
void push_success(const InstallPlanAction& action);

/// Gives the IBinaryProvider an opportunity to batch any downloading or server communication for
/// executing `actions`.
void prefetch(View<Dependencies::InstallPlanAction> actions);
void prefetch(View<InstallPlanAction> actions);

/// Checks whether the `actions` are present in the cache, without restoring them. Used by CI to determine
/// missing packages.
/// Returns a vector where each index corresponds to the matching index in `actions`.
std::vector<CacheAvailability> precheck(View<Dependencies::InstallPlanAction> actions);
std::vector<CacheAvailability> precheck(View<InstallPlanAction> actions);

private:
std::unordered_map<std::string, CacheStatus> m_status;
Expand All @@ -149,7 +149,7 @@ namespace vcpkg

ExpectedS<DownloadManagerConfig> parse_download_configuration(const Optional<std::string>& arg);

std::string generate_nuget_packages_config(const Dependencies::ActionPlan& action);
std::string generate_nuget_packages_config(const ActionPlan& action);

void help_topic_asset_caching(const VcpkgPaths& paths);
void help_topic_binary_caching(const VcpkgPaths& paths);
Expand Down
4 changes: 2 additions & 2 deletions include/vcpkg/binarycaching.private.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ namespace vcpkg
{
return {Strings::concat(prefix, spec.dir()), format_version_for_nugetref(raw_version, abi_tag)};
}
inline NugetReference make_nugetref(const Dependencies::InstallPlanAction& action, const std::string& prefix)
inline NugetReference make_nugetref(const InstallPlanAction& action, const std::string& prefix)
{
return make_nugetref(action.spec,
action.source_control_file_and_location.value_or_exit(VCPKG_LINE_INFO)
Expand All @@ -57,7 +57,7 @@ namespace vcpkg
}

std::string generate_nuspec(const Path& package_dir,
const Dependencies::InstallPlanAction& action,
const InstallPlanAction& action,
const NugetReference& ref,
details::NuGetRepoInfo rinfo = details::get_nuget_repo_info_from_env());
}
65 changes: 31 additions & 34 deletions include/vcpkg/build.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,7 @@ namespace vcpkg
struct Environment;

DECLARE_MESSAGE(ElapsedForPackage, (msg::spec, msg::elapsed), "", "Elapsed time to handle {spec}: {elapsed}");
}

namespace vcpkg::Build
{
enum class BuildResult
{
SUCCEEDED,
Expand All @@ -54,19 +51,19 @@ namespace vcpkg::Build

const IBuildLogsRecorder& null_build_logs_recorder() noexcept;

namespace Command
namespace Build
{
int perform_ex(const VcpkgCmdArguments& args,
const FullPackageSpec& full_spec,
Triplet host_triplet,
const PortFileProvider::PathsPortFileProvider& provider,
const PathsPortFileProvider& provider,
BinaryCache& binary_cache,
const IBuildLogsRecorder& build_logs_recorder,
const VcpkgPaths& paths);
void perform_and_exit_ex(const VcpkgCmdArguments& args,
const FullPackageSpec& full_spec,
Triplet host_triplet,
const PortFileProvider::PathsPortFileProvider& provider,
const PathsPortFileProvider& provider,
BinaryCache& binary_cache,
const IBuildLogsRecorder& build_logs_recorder,
const VcpkgPaths& paths);
Expand All @@ -79,7 +76,7 @@ namespace vcpkg::Build
const VcpkgPaths& paths,
Triplet default_triplet,
Triplet host_triplet);
}
} // namespace vcpkg::Build

enum class UseHeadVersion
{
Expand Down Expand Up @@ -169,31 +166,31 @@ namespace vcpkg::Build
};

static constexpr BuildPackageOptions default_build_package_options{
Build::BuildMissing::YES,
Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::OnlyDownloads::NO,
Build::CleanBuildtrees::YES,
Build::CleanPackages::YES,
Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
Build::PurgeDecompressFailure::YES,
Build::Editable::NO,
Build::BackcompatFeatures::ALLOW,
BuildMissing::YES,
UseHeadVersion::NO,
AllowDownloads::YES,
OnlyDownloads::NO,
CleanBuildtrees::YES,
CleanPackages::YES,
CleanDownloads::NO,
DownloadTool::BUILT_IN,
PurgeDecompressFailure::YES,
Editable::NO,
BackcompatFeatures::ALLOW,
};

static constexpr BuildPackageOptions backcompat_prohibiting_package_options{
Build::BuildMissing::YES,
Build::UseHeadVersion::NO,
Build::AllowDownloads::YES,
Build::OnlyDownloads::NO,
Build::CleanBuildtrees::YES,
Build::CleanPackages::YES,
Build::CleanDownloads::NO,
Build::DownloadTool::BUILT_IN,
Build::PurgeDecompressFailure::YES,
Build::Editable::NO,
Build::BackcompatFeatures::PROHIBIT,
BuildMissing::YES,
UseHeadVersion::NO,
AllowDownloads::YES,
OnlyDownloads::NO,
CleanBuildtrees::YES,
CleanPackages::YES,
CleanDownloads::NO,
DownloadTool::BUILT_IN,
PurgeDecompressFailure::YES,
Editable::NO,
BackcompatFeatures::PROHIBIT,
};

struct BuildResultCounts
Expand All @@ -214,7 +211,7 @@ namespace vcpkg::Build

StringLiteral to_string_locale_invariant(const BuildResult build_result);
LocalizedString to_string(const BuildResult build_result);
LocalizedString create_user_troubleshooting_message(const Dependencies::InstallPlanAction& action,
LocalizedString create_user_troubleshooting_message(const InstallPlanAction& action,
const VcpkgPaths& paths,
Optional<Path>&& issue_body = nullopt);

Expand Down Expand Up @@ -273,11 +270,11 @@ namespace vcpkg::Build
std::string create_github_issue(const VcpkgCmdArguments& args,
const ExtendedBuildResult& build_result,
const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& action);
const InstallPlanAction& action);

ExtendedBuildResult build_package(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
const Dependencies::InstallPlanAction& config,
const InstallPlanAction& config,
BinaryCache& binary_cache,
const IBuildLogsRecorder& build_logs_recorder,
const StatusParagraphs& status_db);
Expand Down Expand Up @@ -377,7 +374,7 @@ namespace vcpkg::Build
};

void compute_all_abis(const VcpkgPaths& paths,
Dependencies::ActionPlan& action_plan,
ActionPlan& action_plan,
const CMakeVars::CMakeVarProvider& var_provider,
const StatusParagraphs& status_db);

Expand Down Expand Up @@ -422,4 +419,4 @@ namespace vcpkg::Build
Triplet default_triplet,
Triplet host_triplet) const override;
};
}
} // namespace vcpkg
2 changes: 1 addition & 1 deletion include/vcpkg/ci-baseline.h
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ namespace vcpkg
SkipFailures skip_failures);

LocalizedString format_ci_result(const PackageSpec& spec,
Build::BuildResult result,
BuildResult result,
const CiBaselineData& cidata,
StringView cifile,
bool allow_unexpected_passing);
Expand Down
8 changes: 4 additions & 4 deletions include/vcpkg/cmakevars.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,13 @@ namespace vcpkg::CMakeVars
virtual void load_dep_info_vars(Span<const PackageSpec> specs, Triplet host_triplet) const = 0;

virtual void load_tag_vars(Span<const FullPackageSpec> specs,
const PortFileProvider::PortFileProvider& port_provider,
const PortFileProvider& port_provider,
Triplet host_triplet) const = 0;

void load_tag_vars(const vcpkg::Dependencies::ActionPlan& action_plan,
const PortFileProvider::PortFileProvider& port_provider,
void load_tag_vars(const ActionPlan& action_plan,
const PortFileProvider& port_provider,
Triplet host_triplet) const;
};

std::unique_ptr<CMakeVarProvider> make_triplet_cmake_var_provider(const vcpkg::VcpkgPaths& paths);
std::unique_ptr<CMakeVarProvider> make_triplet_cmake_var_provider(const VcpkgPaths& paths);
}
6 changes: 3 additions & 3 deletions include/vcpkg/commands.setinstalled.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ namespace vcpkg::Commands::SetInstalled
extern const CommandStructure COMMAND_STRUCTURE;
void perform_and_exit_ex(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
const PortFileProvider::PathsPortFileProvider& provider,
const PathsPortFileProvider& provider,
BinaryCache& binary_cache,
const CMakeVars::CMakeVarProvider& cmake_vars,
Dependencies::ActionPlan action_plan,
ActionPlan action_plan,
DryRun dry_run,
const Optional<Path>& pkgsconfig_path,
Triplet host_triplet,
const Install::KeepGoing keep_going);
const KeepGoing keep_going);
void perform_and_exit(const VcpkgCmdArguments& args,
const VcpkgPaths& paths,
Triplet default_triplet,
Expand Down
Loading

0 comments on commit aab7be4

Please sign in to comment.