// Copyright 2022 Huawei Cloud Computing Technology Co., Ltd. // // Licensed under the Apache License, Version 2.0 (the "License"); // you may not use this file except in compliance with the License. // You may obtain a copy of the License at // // http://www.apache.org/licenses/LICENSE-2.0 // // Unless required by applicable law or agreed to in writing, software // distributed under the License is distributed on an "AS IS" BASIS, // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. // See the License for the specific language governing permissions and // limitations under the License. #ifndef INCLUDED_SRC_BUILDTOOL_BUILDENGINE_ANALYSED_TARGET_ANALYSED_TARGET_HPP #define INCLUDED_SRC_BUILDTOOL_BUILDENGINE_ANALYSED_TARGET_ANALYSED_TARGET_HPP #include #include #include #include #include #include // std::move #include #include "src/buildtool/build_engine/analysed_target/target_graph_information.hpp" #include "src/buildtool/build_engine/expression/expression_ptr.hpp" #include "src/buildtool/build_engine/expression/target_result.hpp" #include "src/buildtool/common/action_description.hpp" #include "src/buildtool/common/artifact_description.hpp" #include "src/buildtool/common/tree.hpp" #include "src/buildtool/common/tree_overlay.hpp" class AnalysedTarget { public: explicit AnalysedTarget(TargetResult result, std::vector actions, std::vector blobs, std::vector trees, std::vector tree_overlays, std::unordered_set vars, std::set tainted, std::set implied_export_targets, TargetGraphInformation graph_information) : result_{std::move(result)}, actions_{std::move(actions)}, blobs_{std::move(blobs)}, trees_{std::move(trees)}, tree_overlays_{std::move(tree_overlays)}, vars_{std::move(vars)}, tainted_{std::move(tainted)}, implied_export_targets_{std::move(implied_export_targets)}, graph_information_{std::move(graph_information)} {} [[nodiscard]] auto Actions() const& noexcept -> std::vector const& { return actions_; } [[nodiscard]] auto Actions() && noexcept -> std::vector { return std::move(actions_); } [[nodiscard]] auto Artifacts() const& noexcept -> ExpressionPtr const& { return result_.artifact_stage; } [[nodiscard]] auto Artifacts() && noexcept -> ExpressionPtr { return std::move(result_.artifact_stage); } [[nodiscard]] auto RunFiles() const& noexcept -> ExpressionPtr const& { return result_.runfiles; } [[nodiscard]] auto RunFiles() && noexcept -> ExpressionPtr { return std::move(result_.runfiles); } [[nodiscard]] auto Provides() const& noexcept -> ExpressionPtr const& { return result_.provides; } [[nodiscard]] auto Provides() && noexcept -> ExpressionPtr { return std::move(result_.provides); } [[nodiscard]] auto Blobs() const& noexcept -> std::vector const& { return blobs_; } [[nodiscard]] auto Trees() && noexcept -> std::vector { return std::move(trees_); } [[nodiscard]] auto Trees() const& noexcept -> std::vector const& { return trees_; } [[nodiscard]] auto TreeOverlays() && noexcept -> std::vector { return std::move(tree_overlays_); } [[nodiscard]] auto TreeOverlays() const& noexcept -> std::vector const& { return tree_overlays_; } [[nodiscard]] auto Blobs() && noexcept -> std::vector { return std::move(blobs_); } [[nodiscard]] auto Vars() const& noexcept -> std::unordered_set const& { return vars_; } [[nodiscard]] auto Vars() && noexcept -> std::unordered_set { return std::move(vars_); } [[nodiscard]] auto Tainted() const& noexcept -> std::set const& { return tainted_; } [[nodiscard]] auto Tainted() && noexcept -> std::set { return std::move(tainted_); } [[nodiscard]] auto ImpliedExport() const& noexcept -> std::set const& { return implied_export_targets_; } [[nodiscard]] auto ImpliedExport() && noexcept -> std::set { return std::move(implied_export_targets_); } [[nodiscard]] auto Result() const& noexcept -> TargetResult const& { return result_; } [[nodiscard]] auto Result() && noexcept -> TargetResult { return std::move(result_); } [[nodiscard]] auto GraphInformation() const& noexcept -> TargetGraphInformation const& { return graph_information_; } [[nodiscard]] auto GraphInformation() && noexcept -> TargetGraphInformation { return std::move(graph_information_); } // Obtain a set of all non-known artifacts from artifacts/runfiles/provides. [[nodiscard]] auto ContainedNonKnownArtifacts() const -> std::vector; private: TargetResult result_; std::vector actions_; std::vector blobs_; std::vector trees_; std::vector tree_overlays_; std::unordered_set vars_; std::set tainted_; std::set implied_export_targets_; TargetGraphInformation graph_information_; }; using AnalysedTargetPtr = std::shared_ptr; #endif // INCLUDED_SRC_BUILDTOOL_BUILDENGINE_ANALYSED_TARGET_ANALYSED_TARGET_HPP