|
BuildCache
|
The base class for all program wrappers. More...
#include <program_wrapper.hpp>
Classes | |
| class | capabilities_t |
| A helper class for managing wrapper capabilities. More... | |
Public Member Functions | |
| bool | handle_command (int &return_code) |
| Try to wrap a program command. More... | |
| virtual bool | can_handle_command ()=0 |
| Check if this class implements a wrapper for the given command. More... | |
Protected Member Functions | |
| program_wrapper_t (const file::exe_path_t &exe_path, const string_list_t &args) | |
| virtual void | resolve_args () |
| Resolve arguments on the command line. More... | |
| virtual string_list_t | get_capabilities () |
| Generate a list of supported capabilites. More... | |
| virtual std::map< std::string, expected_file_t > | get_build_files () |
| Get the paths to the files that are to be generated by the command. More... | |
| virtual std::string | get_program_id () |
| Get a string that uniquely identifies the program. More... | |
| virtual string_list_t | get_relevant_arguments () |
| Get relevant command line arguments for hashing. More... | |
| virtual std::map< std::string, std::string > | get_relevant_env_vars () |
| Get relevant environment variables for hashing. More... | |
| virtual string_list_t | get_input_files () |
| Get the paths to the input files for the command. More... | |
| virtual std::string | preprocess_source () |
| Generate the preprocessed source text. More... | |
| virtual string_list_t | get_implicit_input_files () |
| Get a list of paths to implicit input files. More... | |
| virtual sys::run_result_t | run_for_miss () |
| Run the actual command (when there is a cache miss). More... | |
Protected Attributes | |
| const file::exe_path_t & | m_exe_path |
| const string_list_t & | m_args |
| capabilities_t | m_active_capabilities |
| Active capabilities. More... | |
Private Member Functions | |
| std::string | get_program_id_cached () |
Private Attributes | |
| cache_t | m_cache |
The base class for all program wrappers.
Specialized program wrappers inherit from this class and implement the relevant virtual methods that constitute the "wrapper API".
This class also implements the entire program wrapping mechanism, with cache lookups etc.
|
pure virtual |
Check if this class implements a wrapper for the given command.
Implemented in bcache::lua_wrapper_t, bcache::qcc_wrapper_t, bcache::ccc_analyzer_wrapper_t, bcache::ghs_wrapper_t, bcache::clang_cl_wrapper_t, bcache::gcc_wrapper_t, bcache::msvc_wrapper_t, bcache::ti_arm_cgt_wrapper_t, bcache::ti_arp32_wrapper_t, and bcache::ti_c6x_wrapper_t.
|
protectedvirtual |
Get the paths to the files that are to be generated by the command.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::qcc_wrapper_t, bcache::ccc_analyzer_wrapper_t, bcache::msvc_wrapper_t, bcache::gcc_wrapper_t, and bcache::ti_common_wrapper_t.
|
protectedvirtual |
Generate a list of supported capabilites.
The list of capabilites can contain zero or more of the following (case sensitive) strings:
| String | Meaning |
|---|---|
| create_target_dirs | Request creation of missing output dirs |
| direct_mode | Supports direct mode |
| hard_links | Can use hard links for cached files |
In order to support direct mode, get_input_files() and get_implicit_input_files() need to be implemented.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::ghs_wrapper_t, bcache::qcc_wrapper_t, bcache::msvc_wrapper_t, and bcache::gcc_wrapper_t.
|
protectedvirtual |
Get a list of paths to implicit input files.
This method is only used in direct mode, and the main use case is for collecting a list of all include files for C/C++ builds.
| runtime_error | if the request could not be completed. |
preprocess_source method has been called before calling this method (so the list can be collected during the preprocessing step and later be returned by this method). Reimplemented in bcache::lua_wrapper_t, bcache::msvc_wrapper_t, and bcache::gcc_wrapper_t.
|
protectedvirtual |
Get the paths to the input files for the command.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::msvc_wrapper_t, and bcache::gcc_wrapper_t.
|
protectedvirtual |
Get a string that uniquely identifies the program.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::ghs_wrapper_t, bcache::qcc_wrapper_t, bcache::msvc_wrapper_t, bcache::gcc_wrapper_t, bcache::clang_cl_wrapper_t, and bcache::ti_common_wrapper_t.
|
protectedvirtual |
Get relevant command line arguments for hashing.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::ghs_wrapper_t, bcache::msvc_wrapper_t, bcache::gcc_wrapper_t, and bcache::ti_common_wrapper_t.
|
protectedvirtual |
Get relevant environment variables for hashing.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::ghs_wrapper_t, bcache::qcc_wrapper_t, bcache::msvc_wrapper_t, bcache::gcc_wrapper_t, and bcache::ccc_analyzer_wrapper_t.
| bool bcache::program_wrapper_t::handle_command | ( | int & | return_code | ) |
Try to wrap a program command.
| [out] | return_code | The command return code (if handled). |
|
protectedvirtual |
Generate the preprocessed source text.
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::msvc_wrapper_t, bcache::gcc_wrapper_t, and bcache::ti_common_wrapper_t.
|
protectedvirtual |
Resolve arguments on the command line.
This method is called after can_handle_command, but before calling other methods that rely on the command line arguments. This gives a wrapper the opportunity to resolve special arguments so that they can be properly interpretade by later steps.
The primary use case of this method is to implement support for so called response files, which contain further command line arguments (this is common on Windows to work around the relativlely small command line length limit).
| runtime_error | if the request could not be completed. |
Reimplemented in bcache::lua_wrapper_t, bcache::gcc_wrapper_t, bcache::msvc_wrapper_t, and bcache::ti_common_wrapper_t.
|
protectedvirtual |
Run the actual command (when there is a cache miss).
Reimplemented in bcache::lua_wrapper_t, bcache::msvc_wrapper_t, and bcache::ccc_analyzer_wrapper_t.
|
protected |
Active capabilities.
The capabilities in this object are only active (true) when they are both supported by the wrapper and are active in the user configuration.
1.8.17