Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add Fuse.js to the documentation website #3197

Draft
wants to merge 1 commit into
base: 3192-add-search-functionality-to-docs-website-create-fuse-list
Choose a base branch
from

Conversation

mauriceyap
Copy link
Member

@mauriceyap mauriceyap commented Jul 6, 2024

This adds the Fuse.js library to the documentation website, in order to implement searching functionality.

In search.js, we add the fuseSearch() function to the global scope. It performs an include-match search on the list of generated search items.

An example of the usage of this function using the browser console:

fuseSearch('gcc')

[
    {
        "item": {
            "pageTitle": "Writing build rules",
            "pagePath": "build_rules.html",
            "heading": "Tests",
            "headingAnchorTag": "tests",
            "textContent": "As well as genrule() , there's also gentest() which defines tests. Test rules are very similar to other build rules in that they have a build step. This build step usually produces a test binary which is then executed in the test step as defined by test_cmd : gentest( name = \"some_test\", ... cmd = \"$TOOLS $SRCS -o $OUT\", # compiles a binary that we can later run tools = [CONFIG.SOME_COMPILER], # Some sort of compiler e.g. gcc outs = [\"test\"], test_cmd = \"$TEST > $RESULTS_FILE\", # Execute the test. $TEST is set to the output of cmd ) In this example, this rule will generate test , a binary containing our compiled tests. We then execute this in test_cmd. The test output is piped to test.results as defined by the $RESULTS_FILE variable. For more information on testing in general, see Testing with Please ."
        },
        "refIndex": 17,
        "matches": [
            {
                "indices": [
                    [
                        426,
                        428
                    ]
                ],
                "value": "As well as genrule() , there's also gentest() which defines tests. Test rules are very similar to other build rules in that they have a build step. This build step usually produces a test binary which is then executed in the test step as defined by test_cmd : gentest( name = \"some_test\", ... cmd = \"$TOOLS $SRCS -o $OUT\", # compiles a binary that we can later run tools = [CONFIG.SOME_COMPILER], # Some sort of compiler e.g. gcc outs = [\"test\"], test_cmd = \"$TEST > $RESULTS_FILE\", # Execute the test. $TEST is set to the output of cmd ) In this example, this rule will generate test , a binary containing our compiled tests. We then execute this in test_cmd. The test output is piped to test.results as defined by the $RESULTS_FILE variable. For more information on testing in general, see Testing with Please .",
                "key": "textContent"
            }
        ]
    },
    {
        "item": {
            "pageTitle": "Please Plugins, C/C++ rules, Go rules, Go proto rules, Java rules, Proto rules, Python rules, Python proto rules, Shell rules",
            "pagePath": "plugins_content.html",
            "heading": "[Plugin \"cc\"]",
            "headingAnchorTag": "please",
            "textContent": "DefaultLdFlags (string) The default set of flags to apply when linking If set, DefaultLdFlags is inherited from the host repo. Defaults to -lpthread -ldl PkgConfigPath (string) A path to the systems package configs If set, PkgConfigPath is inherited from the host repo. AsmTool (string) The tool to use for assembling assembly code If set, AsmTool is inherited from the host repo. Defaults to nasm Coverage (bool) Whether to build with coverage If set, Coverage is inherited from the host repo. Defaults to true CCTool (string) The path or build label for the C compiler If set, CCTool is inherited from the host repo. Defaults to gcc DefaultOptCppFlags (string) The default c++ compiler flags when compiling for release If set, DefaultOptCppFlags is inherited from the host repo. Defaults to --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror DefaultNamespace (string) The default namespace to compile c++ code in CoverageTool (string) The path or build target for the C coverage analysis tool If set, CoverageTool is inherited from the host repo. Defaults to gcov LDTool (string) If set, LDTool is inherited from the host repo. Defaults to ld TestMain (string) A build label with c/c++ source code to use run tests. If set, TestMain is inherited from the host repo. Defaults to //unittest-pp:main DsymTool (string) Set this to dsymutil or equivalent on MacOS to use this tool to generate xcode symbol information for debug builds. If set, DsymTool is inherited from the host repo. ARTool (string) If set, ARTool is inherited from the host repo. Defaults to ar DefaultOptCFlags (string) The default c compiler flags when compiling for release If set, DefaultOptCFlags is inherited from the host repo. Defaults to --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror DefaultDbgCppFlags (string) The default c++ compiler flags when compiling for debug If set, DefaultDbgCppFlags is inherited from the host repo. Defaults to --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror CPPTool (string) The path or build label for the C++ compiler If set, CPPTool is inherited from the host repo. Defaults to g++ DefaultDbgCFlags (string) The default c compiler flags when compiling for debug If set, DefaultDbgCFlags is inherited from the host repo. Defaults to --std=c99 -g3 -pipe -DDEBUG -Wall -Werror"
        },
        "refIndex": 109,
        "matches": [
            {
                "indices": [
                    [
                        631,
                        633
                    ]
                ],
                "value": "DefaultLdFlags (string) The default set of flags to apply when linking If set, DefaultLdFlags is inherited from the host repo. Defaults to -lpthread -ldl PkgConfigPath (string) A path to the systems package configs If set, PkgConfigPath is inherited from the host repo. AsmTool (string) The tool to use for assembling assembly code If set, AsmTool is inherited from the host repo. Defaults to nasm Coverage (bool) Whether to build with coverage If set, Coverage is inherited from the host repo. Defaults to true CCTool (string) The path or build label for the C compiler If set, CCTool is inherited from the host repo. Defaults to gcc DefaultOptCppFlags (string) The default c++ compiler flags when compiling for release If set, DefaultOptCppFlags is inherited from the host repo. Defaults to --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror DefaultNamespace (string) The default namespace to compile c++ code in CoverageTool (string) The path or build target for the C coverage analysis tool If set, CoverageTool is inherited from the host repo. Defaults to gcov LDTool (string) If set, LDTool is inherited from the host repo. Defaults to ld TestMain (string) A build label with c/c++ source code to use run tests. If set, TestMain is inherited from the host repo. Defaults to //unittest-pp:main DsymTool (string) Set this to dsymutil or equivalent on MacOS to use this tool to generate xcode symbol information for debug builds. If set, DsymTool is inherited from the host repo. ARTool (string) If set, ARTool is inherited from the host repo. Defaults to ar DefaultOptCFlags (string) The default c compiler flags when compiling for release If set, DefaultOptCFlags is inherited from the host repo. Defaults to --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror DefaultDbgCppFlags (string) The default c++ compiler flags when compiling for debug If set, DefaultDbgCppFlags is inherited from the host repo. Defaults to --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror CPPTool (string) The path or build label for the C++ compiler If set, CPPTool is inherited from the host repo. Defaults to g++ DefaultDbgCFlags (string) The default c compiler flags when compiling for debug If set, DefaultDbgCFlags is inherited from the host repo. Defaults to --std=c99 -g3 -pipe -DDEBUG -Wall -Werror",
                "key": "textContent"
            }
        ]
    },
    {
        "item": {
            "pageTitle": "Please Plugins, C/C++ rules, Go rules, Go proto rules, Java rules, Proto rules, Python rules, Python proto rules, Shell rules",
            "pagePath": "plugins_content.html",
            "heading": "C/C++ rules",
            "headingAnchorTag": "cc",
            "textContent": "c_binary c_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , pkg_config_cflags , test_only , static , includes , defines , labels , optional_outs ) Builds a binary from a collection of C rules. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. labels list optional_outs list Name of optional outputs. c_embed_binary c_embed_binary(name, src, deps , visibility , test_only ) Build rule to embed an arbitrary binary file into a C library. You can depend on the output of this as though it were a c_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. c_library c_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels ) Generate a C library target. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. c_object c_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C object file from a single source. N.B. This is fairly low-level; for most use cases c_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list c_shared_object c_shared_object(name, srcs , hdrs , out , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels , optional_outs ) Generates a C shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to name + .so. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list optional_outs list Name of optional outputs. c_static_library c_static_library(name, srcs , hdrs , compiler_flags , linker_flags , deps , out , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels , optional_outs ) Generates a C static library (.a). This is essentially just a collection of other c_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list optional_outs list Name of optional outputs. c_test c_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox ) Defines a C test target. Note that you must supply your own main() and test framework (ala cc_test when write_main=False). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. cc_binary cc_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , includes , defines , pkg_config_cflags , test_only , static , linkstatic , labels , optional_outs ) Builds a binary from a collection of C++ rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_embed_binary cc_embed_binary(name, src, deps , visibility , test_only , namespace ) Build rule to embed an arbitrary binary file into a C++ library. You can depend on the output of this as though it were a cc_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. namespace str Allows specifying the namespace the symbols will be available in. cc_library cc_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , linkstatic , textual_hdrs , labels ) Generate a C++ library target. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. linkstatic bool Only provided for Bazel compatibility. Has no actual effect. textual_hdrs list Also provided for Bazel compatibility. Effectively works the same as hdrs for now. labels list Labels to attach to this rule. cc_module cc_module(name, srcs , hdrs , interfaces , private_hdrs , deps , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels , optional_outs ) Generate a C++ module. This is still experimental. Currently it has only been tested with clang; support for GCC will be added later once versions of GCC supporting modules are more conveniently available. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. interfaces list Module interface files. Again, these are treated differently to `srcs` in terms of compilation so the distinction is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_object cc_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C or C++ object file from a single source. N.B. This is fairly low-level; for most use cases cc_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list Labels to attach to this rule. cc_shared_object cc_shared_object(name, srcs , hdrs , out , optional_outs , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels ) Generates a C++ shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to lib<name>.so (or just <name>.so if name already begins with 'lib'). optional_outs list Name of optional outputs. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list Labels to attach to this rule. cc_static_library cc_static_library(name, srcs , hdrs , compiler_flags , out , optional_outs , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels ) Generates a C++ static library (.a). This is essentially just a collection of other cc_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list Labels to attach to this rule. cc_test cc_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox , write_main , linkstatic ) Defines a C++ test. We template in a main file so you don't have to supply your own. (Later we might allow that to be configured to help support other unit test frameworks). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str Reference to worker script, A persistent worker process that is used to set up the test. data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. write_main bool Deprecated, has no effect. See `plz help testmain` for more information about how to define a default dependency for the test main. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode."
        },
        "refIndex": 108,
        "matches": [
            {
                "indices": [
                    [
                        15940,
                        15942
                    ],
                    [
                        15981,
                        15983
                    ]
                ],
                "value": "c_binary c_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , pkg_config_cflags , test_only , static , includes , defines , labels , optional_outs ) Builds a binary from a collection of C rules. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. labels list optional_outs list Name of optional outputs. c_embed_binary c_embed_binary(name, src, deps , visibility , test_only ) Build rule to embed an arbitrary binary file into a C library. You can depend on the output of this as though it were a c_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. c_library c_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels ) Generate a C library target. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. c_object c_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C object file from a single source. N.B. This is fairly low-level; for most use cases c_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list c_shared_object c_shared_object(name, srcs , hdrs , out , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels , optional_outs ) Generates a C shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to name + .so. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list optional_outs list Name of optional outputs. c_static_library c_static_library(name, srcs , hdrs , compiler_flags , linker_flags , deps , out , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels , optional_outs ) Generates a C static library (.a). This is essentially just a collection of other c_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list optional_outs list Name of optional outputs. c_test c_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox ) Defines a C test target. Note that you must supply your own main() and test framework (ala cc_test when write_main=False). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. cc_binary cc_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , includes , defines , pkg_config_cflags , test_only , static , linkstatic , labels , optional_outs ) Builds a binary from a collection of C++ rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_embed_binary cc_embed_binary(name, src, deps , visibility , test_only , namespace ) Build rule to embed an arbitrary binary file into a C++ library. You can depend on the output of this as though it were a cc_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. namespace str Allows specifying the namespace the symbols will be available in. cc_library cc_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , linkstatic , textual_hdrs , labels ) Generate a C++ library target. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. linkstatic bool Only provided for Bazel compatibility. Has no actual effect. textual_hdrs list Also provided for Bazel compatibility. Effectively works the same as hdrs for now. labels list Labels to attach to this rule. cc_module cc_module(name, srcs , hdrs , interfaces , private_hdrs , deps , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels , optional_outs ) Generate a C++ module. This is still experimental. Currently it has only been tested with clang; support for GCC will be added later once versions of GCC supporting modules are more conveniently available. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. interfaces list Module interface files. Again, these are treated differently to `srcs` in terms of compilation so the distinction is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_object cc_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C or C++ object file from a single source. N.B. This is fairly low-level; for most use cases cc_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list Labels to attach to this rule. cc_shared_object cc_shared_object(name, srcs , hdrs , out , optional_outs , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels ) Generates a C++ shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to lib<name>.so (or just <name>.so if name already begins with 'lib'). optional_outs list Name of optional outputs. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list Labels to attach to this rule. cc_static_library cc_static_library(name, srcs , hdrs , compiler_flags , out , optional_outs , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels ) Generates a C++ static library (.a). This is essentially just a collection of other cc_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list Labels to attach to this rule. cc_test cc_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox , write_main , linkstatic ) Defines a C++ test. We template in a main file so you don't have to supply your own. (Later we might allow that to be configured to help support other unit test frameworks). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str Reference to worker script, A persistent worker process that is used to set up the test. data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. write_main bool Deprecated, has no effect. See `plz help testmain` for more information about how to define a default dependency for the test main. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode.",
                "key": "textContent"
            }
        ]
    }
]

This adds the [Fuse.js](https://fusejs.io) library to the documentation website, in order to implement searching functionality.

In `search.js`, we add the `fuseSearch()` function to the global scope. It performs an [include-match](https://www.fusejs.io/examples.html#extended-search) search on the list of generated search items.

An example of the usage of this function using the browser console:
```javascript
fuseSearch('gcc')

[
    {
        "item": {
            "pageTitle": "Writing build rules",
            "pagePath": "build_rules.html",
            "heading": "Tests",
            "headingAnchorTag": "tests",
            "textContent": "As well as genrule() , there's also gentest() which defines tests. Test rules are very similar to other build rules in that they have a build step. This build step usually produces a test binary which is then executed in the test step as defined by test_cmd : gentest( name = \"some_test\", ... cmd = \"$TOOLS $SRCS -o $OUT\", # compiles a binary that we can later run tools = [CONFIG.SOME_COMPILER], # Some sort of compiler e.g. gcc outs = [\"test\"], test_cmd = \"$TEST > $RESULTS_FILE\", # Execute the test. $TEST is set to the output of cmd ) In this example, this rule will generate test , a binary containing our compiled tests. We then execute this in test_cmd. The test output is piped to test.results as defined by the $RESULTS_FILE variable. For more information on testing in general, see Testing with Please ."
        },
        "refIndex": 17,
        "matches": [
            {
                "indices": [
                    [
                        426,
                        428
                    ]
                ],
                "value": "As well as genrule() , there's also gentest() which defines tests. Test rules are very similar to other build rules in that they have a build step. This build step usually produces a test binary which is then executed in the test step as defined by test_cmd : gentest( name = \"some_test\", ... cmd = \"$TOOLS $SRCS -o $OUT\", # compiles a binary that we can later run tools = [CONFIG.SOME_COMPILER], # Some sort of compiler e.g. gcc outs = [\"test\"], test_cmd = \"$TEST > $RESULTS_FILE\", # Execute the test. $TEST is set to the output of cmd ) In this example, this rule will generate test , a binary containing our compiled tests. We then execute this in test_cmd. The test output is piped to test.results as defined by the $RESULTS_FILE variable. For more information on testing in general, see Testing with Please .",
                "key": "textContent"
            }
        ]
    },
    {
        "item": {
            "pageTitle": "Please Plugins, C/C++ rules, Go rules, Go proto rules, Java rules, Proto rules, Python rules, Python proto rules, Shell rules",
            "pagePath": "plugins_content.html",
            "heading": "[Plugin \"cc\"]",
            "headingAnchorTag": "please",
            "textContent": "DefaultLdFlags (string) The default set of flags to apply when linking If set, DefaultLdFlags is inherited from the host repo. Defaults to -lpthread -ldl PkgConfigPath (string) A path to the systems package configs If set, PkgConfigPath is inherited from the host repo. AsmTool (string) The tool to use for assembling assembly code If set, AsmTool is inherited from the host repo. Defaults to nasm Coverage (bool) Whether to build with coverage If set, Coverage is inherited from the host repo. Defaults to true CCTool (string) The path or build label for the C compiler If set, CCTool is inherited from the host repo. Defaults to gcc DefaultOptCppFlags (string) The default c++ compiler flags when compiling for release If set, DefaultOptCppFlags is inherited from the host repo. Defaults to --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror DefaultNamespace (string) The default namespace to compile c++ code in CoverageTool (string) The path or build target for the C coverage analysis tool If set, CoverageTool is inherited from the host repo. Defaults to gcov LDTool (string) If set, LDTool is inherited from the host repo. Defaults to ld TestMain (string) A build label with c/c++ source code to use run tests. If set, TestMain is inherited from the host repo. Defaults to //unittest-pp:main DsymTool (string) Set this to dsymutil or equivalent on MacOS to use this tool to generate xcode symbol information for debug builds. If set, DsymTool is inherited from the host repo. ARTool (string) If set, ARTool is inherited from the host repo. Defaults to ar DefaultOptCFlags (string) The default c compiler flags when compiling for release If set, DefaultOptCFlags is inherited from the host repo. Defaults to --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror DefaultDbgCppFlags (string) The default c++ compiler flags when compiling for debug If set, DefaultDbgCppFlags is inherited from the host repo. Defaults to --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror CPPTool (string) The path or build label for the C++ compiler If set, CPPTool is inherited from the host repo. Defaults to g++ DefaultDbgCFlags (string) The default c compiler flags when compiling for debug If set, DefaultDbgCFlags is inherited from the host repo. Defaults to --std=c99 -g3 -pipe -DDEBUG -Wall -Werror"
        },
        "refIndex": 109,
        "matches": [
            {
                "indices": [
                    [
                        631,
                        633
                    ]
                ],
                "value": "DefaultLdFlags (string) The default set of flags to apply when linking If set, DefaultLdFlags is inherited from the host repo. Defaults to -lpthread -ldl PkgConfigPath (string) A path to the systems package configs If set, PkgConfigPath is inherited from the host repo. AsmTool (string) The tool to use for assembling assembly code If set, AsmTool is inherited from the host repo. Defaults to nasm Coverage (bool) Whether to build with coverage If set, Coverage is inherited from the host repo. Defaults to true CCTool (string) The path or build label for the C compiler If set, CCTool is inherited from the host repo. Defaults to gcc DefaultOptCppFlags (string) The default c++ compiler flags when compiling for release If set, DefaultOptCppFlags is inherited from the host repo. Defaults to --std=c++11 -O3 -pipe -DNDEBUG -Wall -Werror DefaultNamespace (string) The default namespace to compile c++ code in CoverageTool (string) The path or build target for the C coverage analysis tool If set, CoverageTool is inherited from the host repo. Defaults to gcov LDTool (string) If set, LDTool is inherited from the host repo. Defaults to ld TestMain (string) A build label with c/c++ source code to use run tests. If set, TestMain is inherited from the host repo. Defaults to //unittest-pp:main DsymTool (string) Set this to dsymutil or equivalent on MacOS to use this tool to generate xcode symbol information for debug builds. If set, DsymTool is inherited from the host repo. ARTool (string) If set, ARTool is inherited from the host repo. Defaults to ar DefaultOptCFlags (string) The default c compiler flags when compiling for release If set, DefaultOptCFlags is inherited from the host repo. Defaults to --std=c99 -O3 -pipe -DNDEBUG -Wall -Werror DefaultDbgCppFlags (string) The default c++ compiler flags when compiling for debug If set, DefaultDbgCppFlags is inherited from the host repo. Defaults to --std=c++11 -g3 -pipe -DDEBUG -Wall -Werror CPPTool (string) The path or build label for the C++ compiler If set, CPPTool is inherited from the host repo. Defaults to g++ DefaultDbgCFlags (string) The default c compiler flags when compiling for debug If set, DefaultDbgCFlags is inherited from the host repo. Defaults to --std=c99 -g3 -pipe -DDEBUG -Wall -Werror",
                "key": "textContent"
            }
        ]
    },
    {
        "item": {
            "pageTitle": "Please Plugins, C/C++ rules, Go rules, Go proto rules, Java rules, Proto rules, Python rules, Python proto rules, Shell rules",
            "pagePath": "plugins_content.html",
            "heading": "C/C++ rules",
            "headingAnchorTag": "cc",
            "textContent": "c_binary c_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , pkg_config_cflags , test_only , static , includes , defines , labels , optional_outs ) Builds a binary from a collection of C rules. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. labels list optional_outs list Name of optional outputs. c_embed_binary c_embed_binary(name, src, deps , visibility , test_only ) Build rule to embed an arbitrary binary file into a C library. You can depend on the output of this as though it were a c_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. c_library c_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels ) Generate a C library target. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. c_object c_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C object file from a single source. N.B. This is fairly low-level; for most use cases c_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list c_shared_object c_shared_object(name, srcs , hdrs , out , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels , optional_outs ) Generates a C shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to name + .so. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list optional_outs list Name of optional outputs. c_static_library c_static_library(name, srcs , hdrs , compiler_flags , linker_flags , deps , out , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels , optional_outs ) Generates a C static library (.a). This is essentially just a collection of other c_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list optional_outs list Name of optional outputs. c_test c_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox ) Defines a C test target. Note that you must supply your own main() and test framework (ala cc_test when write_main=False). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. cc_binary cc_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , includes , defines , pkg_config_cflags , test_only , static , linkstatic , labels , optional_outs ) Builds a binary from a collection of C++ rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_embed_binary cc_embed_binary(name, src, deps , visibility , test_only , namespace ) Build rule to embed an arbitrary binary file into a C++ library. You can depend on the output of this as though it were a cc_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. namespace str Allows specifying the namespace the symbols will be available in. cc_library cc_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , linkstatic , textual_hdrs , labels ) Generate a C++ library target. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. linkstatic bool Only provided for Bazel compatibility. Has no actual effect. textual_hdrs list Also provided for Bazel compatibility. Effectively works the same as hdrs for now. labels list Labels to attach to this rule. cc_module cc_module(name, srcs , hdrs , interfaces , private_hdrs , deps , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels , optional_outs ) Generate a C++ module. This is still experimental. Currently it has only been tested with clang; support for GCC will be added later once versions of GCC supporting modules are more conveniently available. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. interfaces list Module interface files. Again, these are treated differently to `srcs` in terms of compilation so the distinction is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_object cc_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C or C++ object file from a single source. N.B. This is fairly low-level; for most use cases cc_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list Labels to attach to this rule. cc_shared_object cc_shared_object(name, srcs , hdrs , out , optional_outs , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels ) Generates a C++ shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to lib<name>.so (or just <name>.so if name already begins with 'lib'). optional_outs list Name of optional outputs. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list Labels to attach to this rule. cc_static_library cc_static_library(name, srcs , hdrs , compiler_flags , out , optional_outs , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels ) Generates a C++ static library (.a). This is essentially just a collection of other cc_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list Labels to attach to this rule. cc_test cc_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox , write_main , linkstatic ) Defines a C++ test. We template in a main file so you don't have to supply your own. (Later we might allow that to be configured to help support other unit test frameworks). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str Reference to worker script, A persistent worker process that is used to set up the test. data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. write_main bool Deprecated, has no effect. See `plz help testmain` for more information about how to define a default dependency for the test main. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode."
        },
        "refIndex": 108,
        "matches": [
            {
                "indices": [
                    [
                        15940,
                        15942
                    ],
                    [
                        15981,
                        15983
                    ]
                ],
                "value": "c_binary c_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , pkg_config_cflags , test_only , static , includes , defines , labels , optional_outs ) Builds a binary from a collection of C rules. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. labels list optional_outs list Name of optional outputs. c_embed_binary c_embed_binary(name, src, deps , visibility , test_only ) Build rule to embed an arbitrary binary file into a C library. You can depend on the output of this as though it were a c_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. c_library c_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels ) Generate a C library target. Argument Required Type name yes str Name of the rule srcs list C source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. c_object c_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C object file from a single source. N.B. This is fairly low-level; for most use cases c_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a c_binary or c_test rule. pkg_config_libs list Libraries to declare a dependency on using pkg-config. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list c_shared_object c_shared_object(name, srcs , hdrs , out , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels , optional_outs ) Generates a C shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to name + .so. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list optional_outs list Name of optional outputs. c_static_library c_static_library(name, srcs , hdrs , compiler_flags , linker_flags , deps , out , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels , optional_outs ) Generates a C static library (.a). This is essentially just a collection of other c_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list optional_outs list Name of optional outputs. c_test c_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox ) Defines a C test target. Note that you must supply your own main() and test framework (ala cc_test when write_main=False). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using pkg-config pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. cc_binary cc_binary(name, srcs , hdrs , private_hdrs , compiler_flags , linker_flags , deps , visibility , pkg_config_libs , includes , defines , pkg_config_cflags , test_only , static , linkstatic , labels , optional_outs ) Builds a binary from a collection of C++ rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` test_only bool If True, this rule can only be used by tests. static bool If True, the binary will be linked statically. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_embed_binary cc_embed_binary(name, src, deps , visibility , test_only , namespace ) Build rule to embed an arbitrary binary file into a C++ library. You can depend on the output of this as though it were a cc_library rule. There are five functions available to access the data once compiled, all of which are prefixed with the file's basename: filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Argument Required Type name yes str filename_start(): returns a const char* pointing to the beginning of the data. filename_end(): returns a const char* pointing to the end of the data. filename_size(): returns the length of the data in bytes. filename_start_nc(): returns a char* pointing to the beginning of the data. This is a convenience wrapper using const_cast, you should not mutate the contents of the returned pointer. filename_end_nc(): returns a char* pointing to the end of the data. Again, don't mutate the contents of the pointer. You don't own the contents of any of these pointers so don't try to delete them :) Args: src yes str Source file to embed. deps list Dependencies. visibility list Rule visibility. test_only bool If True, is only available to test rules. namespace str Allows specifying the namespace the symbols will be available in. cc_library cc_library(name, srcs , hdrs , private_hdrs , deps , out , optional_outs , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , linkstatic , textual_hdrs , labels ) Generate a C++ library target. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. linkstatic bool Only provided for Bazel compatibility. Has no actual effect. textual_hdrs list Also provided for Bazel compatibility. Effectively works the same as hdrs for now. labels list Labels to attach to this rule. cc_module cc_module(name, srcs , hdrs , interfaces , private_hdrs , deps , visibility , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , labels , optional_outs ) Generate a C++ module. This is still experimental. Currently it has only been tested with clang; support for GCC will be added later once versions of GCC supporting modules are more conveniently available. Argument Required Type name yes str Name of the rule srcs list C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. interfaces list Module interface files. Again, these are treated differently to `srcs` in terms of compilation so the distinction is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. labels list Labels to attach to this rule. optional_outs list Name of optional outputs. cc_object cc_object(name, src, hdrs , private_hdrs , out , optional_outs , test_only , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , includes , defines , alwayslink , visibility , deps , labels ) Generate a C or C++ object file from a single source. N.B. This is fairly low-level; for most use cases cc_library should be preferred. Argument Required Type name yes str Name of the rule src yes str C or C++ source file to compile. This can be another rule, but if so it must have exactly one output. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. private_hdrs list Header files that are available only to this rule and not exported to dependent rules. out str Name of the output file. Defaults to name + .o. optional_outs list Name of optional outputs. test_only bool If True, is only available to other test rules. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker; these will not be used here but will be picked up by a cc_binary or cc_test rule. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs`. Again, the ldflags will be picked up by cc_binary or cc_test rules. pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags`. Again, the ldflags will be picked up by cc_binary or cc_test rules. includes list List of include directories to be added to the compiler's path. defines list or dict List of tokens to define in the preprocessor. Alternatively can be a dict of name -> value to define, in which case values are surrounded by quotes. alwayslink bool If True, any binaries / tests using this library will link in all symbols, even if they don't directly reference them. This is useful for e.g. having static members that register themselves at construction time. visibility list Visibility declaration for this rule. deps list Dependent rules. labels list Labels to attach to this rule. cc_shared_object cc_shared_object(name, srcs , hdrs , out , optional_outs , compiler_flags , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , includes , labels ) Generates a C++ shared object (.so) with its dependencies linked in. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. These will be made available to dependent rules, so the distinction between srcs and hdrs is important. out str Name of the output .so. Defaults to lib<name>.so (or just <name>.so if name already begins with 'lib'). optional_outs list Name of optional outputs. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` includes list Include directories to be added to the compiler's lookup path. labels list Labels to attach to this rule. cc_static_library cc_static_library(name, srcs , hdrs , compiler_flags , out , optional_outs , linker_flags , deps , visibility , test_only , pkg_config_libs , pkg_config_cflags , labels ) Generates a C++ static library (.a). This is essentially just a collection of other cc_library rules into a single archive. Optionally this rule can have sources of its own, but it's quite reasonable just to use it as a collection of other rules. Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. out str Name of the output library. Defaults to lib<name>.a (or just <name>.a if name already begins with 'lib'). optional_outs list Name of optional outputs. linker_flags list Flags to pass to the linker. deps list Dependent rules. visibility list Visibility declaration for this rule. test_only bool If True, is only available to other test rules. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` labels list Labels to attach to this rule. cc_test cc_test(name, srcs , hdrs , compiler_flags , linker_flags , pkg_config_libs , pkg_config_cflags , deps , worker , data , visibility , flags , labels , flaky , test_outputs , size , timeout , sandbox , write_main , linkstatic ) Defines a C++ test. We template in a main file so you don't have to supply your own. (Later we might allow that to be configured to help support other unit test frameworks). Argument Required Type name yes str Name of the rule srcs list C or C++ source files to compile. hdrs list Header files. compiler_flags list Flags to pass to the compiler. linker_flags list Flags to pass to the linker. pkg_config_libs list Libraries to declare a dependency on using `pkg-config --libs` pkg_config_cflags list Libraries to declare a dependency on using `pkg-config --cflags` deps list Dependent rules. worker str Reference to worker script, A persistent worker process that is used to set up the test. data list or dict Runtime data files for this test. visibility list Visibility declaration for this rule. flags str Flags to pass to the compiler. labels list Labels to attach to this test. flaky bool or int If true the test will be marked as flaky and automatically retried. test_outputs list Extra test output files to generate from this test. size str Test size (enormous, large, medium or small). timeout int Length of time in seconds to allow the test to run for before killing it. sandbox bool Sandbox the test on Linux to restrict access to namespaces such as network. write_main bool Deprecated, has no effect. See `plz help testmain` for more information about how to define a default dependency for the test main. linkstatic bool Only provided for Bazel compatibility. Has no actual effect since we always link roughly equivalently to their \"mostly-static\" mode.",
                "key": "textContent"
            }
        ]
    }
]
```
@mauriceyap mauriceyap changed the title 3192 add search functionality to docs website add fuse js Add Fuse.js to the documentation website Jul 6, 2024
@mauriceyap mauriceyap changed the base branch from master to 3192-add-search-functionality-to-docs-website-create-fuse-list July 6, 2024 23:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant