OLD | NEW |
1 # GN Reference | 1 # GN Reference |
2 | 2 |
3 *This page is automatically generated from* `gn help --markdown all`. | 3 *This page is automatically generated from* `gn help --markdown all`. |
4 | 4 |
5 ## **\--args**: Specifies build arguments overrides. | 5 ## **\--args**: Specifies build arguments overrides. |
6 | 6 |
7 ``` | 7 ``` |
8 See "gn help buildargs" for an overview of how build arguments work. | 8 See "gn help buildargs" for an overview of how build arguments work. |
9 | 9 |
10 Most operations take a build directory. The build arguments are taken | 10 Most operations take a build directory. The build arguments are taken |
(...skipping 419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
430 --as=(buildfile|label|output) | 430 --as=(buildfile|label|output) |
431 How to print targets. | 431 How to print targets. |
432 | 432 |
433 buildfile | 433 buildfile |
434 Prints the build files where the given target was declared as | 434 Prints the build files where the given target was declared as |
435 file names. | 435 file names. |
436 label (default) | 436 label (default) |
437 Prints the label of the target. | 437 Prints the label of the target. |
438 output | 438 output |
439 Prints the first output file for the target relative to the | 439 Prints the first output file for the target relative to the |
440 current directory. | 440 root build directory. |
441 | 441 |
442 --testonly=(true|false) | 442 --testonly=(true|false) |
443 Restrict outputs to targets with the testonly flag set | 443 Restrict outputs to targets with the testonly flag set |
444 accordingly. When unspecified, the target's testonly flags are | 444 accordingly. When unspecified, the target's testonly flags are |
445 ignored. | 445 ignored. |
446 | 446 |
447 --tree | 447 --tree |
448 Print a dependency tree. By default, duplicates will be elided | 448 Print a dependency tree. By default, duplicates will be elided |
449 with "..." but when --all and -tree are used together, no | 449 with "..." but when --all and -tree are used together, no |
450 eliding will be performed. | 450 eliding will be performed. |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
574 --as=(buildfile|label|output) | 574 --as=(buildfile|label|output) |
575 How to print targets. | 575 How to print targets. |
576 | 576 |
577 buildfile | 577 buildfile |
578 Prints the build files where the given target was declared as | 578 Prints the build files where the given target was declared as |
579 file names. | 579 file names. |
580 label (default) | 580 label (default) |
581 Prints the label of the target. | 581 Prints the label of the target. |
582 output | 582 output |
583 Prints the first output file for the target relative to the | 583 Prints the first output file for the target relative to the |
584 current directory. | 584 root build directory. |
585 | 585 |
586 --all-toolchains | 586 --all-toolchains |
587 Matches all toolchains. When set, if the label pattern does not | 587 Matches all toolchains. When set, if the label pattern does not |
588 specify an explicit toolchain, labels from all toolchains will be | 588 specify an explicit toolchain, labels from all toolchains will be |
589 matched. When unset, only targets in the default toolchain will | 589 matched. When unset, only targets in the default toolchain will |
590 be matched unless an explicit toolchain in the label is set. | 590 be matched unless an explicit toolchain in the label is set. |
591 | 591 |
592 --testonly=(true|false) | 592 --testonly=(true|false) |
593 Restrict outputs to targets with the testonly flag set | 593 Restrict outputs to targets with the testonly flag set |
594 accordingly. When unspecified, the target's testonly flags are | 594 accordingly. When unspecified, the target's testonly flags are |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
629 | 629 |
630 ``` | 630 ``` |
631 ## **gn path <out_dir> <target_one> <target_two>** | 631 ## **gn path <out_dir> <target_one> <target_two>** |
632 | 632 |
633 ``` | 633 ``` |
634 Finds paths of dependencies between two targets. Each unique path | 634 Finds paths of dependencies between two targets. Each unique path |
635 will be printed in one group, and groups will be separate by newlines. | 635 will be printed in one group, and groups will be separate by newlines. |
636 The two targets can appear in either order: paths will be found going | 636 The two targets can appear in either order: paths will be found going |
637 in either direction. | 637 in either direction. |
638 | 638 |
639 Each dependency will be annotated with its type. By default, only the | 639 By default, a single path will be printed. If there is a path with |
640 first path encountered will be printed, which is not necessarily the | 640 only public dependencies, the shortest public path will be printed. |
641 shortest path. | 641 Otherwise, the shortest path using either public or private |
| 642 dependencies will be printed. If --with-data is specified, data deps |
| 643 will also be considered. If there are multiple shortest paths, an |
| 644 arbitrary one will be selected. |
642 | 645 |
643 ``` | 646 ``` |
644 | 647 |
645 ### **Options** | 648 ### **Options** |
646 | 649 |
647 ``` | 650 ``` |
648 --all | 651 --all |
649 Prints all paths found rather than just the first one. | 652 Prints all paths found rather than just the first one. Public paths |
| 653 will be printed first in order of increasing length, followed by |
| 654 non-public paths in order of increasing length. |
| 655 |
| 656 --public |
| 657 Considers only public paths. Can't be used with --with-data. |
| 658 |
| 659 --with-data |
| 660 Additionally follows data deps. Without this flag, only public and |
| 661 private linked deps will be followed. Can't be used with --public. |
650 | 662 |
651 ``` | 663 ``` |
652 | 664 |
653 ### **Example** | 665 ### **Example** |
654 | 666 |
655 ``` | 667 ``` |
656 gn path out/Default //base //tools/gn | 668 gn path out/Default //base //tools/gn |
657 | 669 |
658 | 670 |
659 ``` | 671 ``` |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
712 --as=(buildfile|label|output) | 724 --as=(buildfile|label|output) |
713 How to print targets. | 725 How to print targets. |
714 | 726 |
715 buildfile | 727 buildfile |
716 Prints the build files where the given target was declared as | 728 Prints the build files where the given target was declared as |
717 file names. | 729 file names. |
718 label (default) | 730 label (default) |
719 Prints the label of the target. | 731 Prints the label of the target. |
720 output | 732 output |
721 Prints the first output file for the target relative to the | 733 Prints the first output file for the target relative to the |
722 current directory. | 734 root build directory. |
723 | 735 |
724 -q | 736 -q |
725 Quiet. If nothing matches, don't print any output. Without this | 737 Quiet. If nothing matches, don't print any output. Without this |
726 option, if there are no matches there will be an informational | 738 option, if there are no matches there will be an informational |
727 message printed which might interfere with scripts processing the | 739 message printed which might interfere with scripts processing the |
728 output. | 740 output. |
729 | 741 |
730 --testonly=(true|false) | 742 --testonly=(true|false) |
731 Restrict outputs to targets with the testonly flag set | 743 Restrict outputs to targets with the testonly flag set |
732 accordingly. When unspecified, the target's testonly flags are | 744 accordingly. When unspecified, the target's testonly flags are |
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
810 handling. If you want to pass the sources to your script, you must do | 822 handling. If you want to pass the sources to your script, you must do |
811 so explicitly by including them in the "args". Note also that this | 823 so explicitly by including them in the "args". Note also that this |
812 means there is no special handling of paths since GN doesn't know | 824 means there is no special handling of paths since GN doesn't know |
813 which of the args are paths and not. You will want to use | 825 which of the args are paths and not. You will want to use |
814 rebase_path() to convert paths to be relative to the root_build_dir. | 826 rebase_path() to convert paths to be relative to the root_build_dir. |
815 | 827 |
816 You can dynamically write input dependencies (for incremental rebuilds | 828 You can dynamically write input dependencies (for incremental rebuilds |
817 if an input file changes) by writing a depfile when the script is run | 829 if an input file changes) by writing a depfile when the script is run |
818 (see "gn help depfile"). This is more flexible than "inputs". | 830 (see "gn help depfile"). This is more flexible than "inputs". |
819 | 831 |
| 832 If the command line length is very long, you can use response files |
| 833 to pass args to your script. See "gn help response_file_contents". |
| 834 |
820 It is recommended you put inputs to your script in the "sources" | 835 It is recommended you put inputs to your script in the "sources" |
821 variable, and stuff like other Python files required to run your | 836 variable, and stuff like other Python files required to run your |
822 script in the "inputs" variable. | 837 script in the "inputs" variable. |
823 | 838 |
824 The "deps" and "public_deps" for an action will always be | 839 The "deps" and "public_deps" for an action will always be |
825 completed before any part of the action is run so it can depend on | 840 completed before any part of the action is run so it can depend on |
826 the output of previous steps. The "data_deps" will be built if the | 841 the output of previous steps. The "data_deps" will be built if the |
827 action is built, but may not have completed before all steps of the | 842 action is built, but may not have completed before all steps of the |
828 action are started. This can give additional parallelism in the build | 843 action are started. This can give additional parallelism in the build |
829 for runtime-only dependencies. | 844 for runtime-only dependencies. |
(...skipping 21 matching lines...) Expand all Loading... |
851 All output files must be inside the output directory of the build. | 866 All output files must be inside the output directory of the build. |
852 You would generally use |$target_out_dir| or |$target_gen_dir| to | 867 You would generally use |$target_out_dir| or |$target_gen_dir| to |
853 reference the output or generated intermediate file directories, | 868 reference the output or generated intermediate file directories, |
854 respectively. | 869 respectively. |
855 | 870 |
856 ``` | 871 ``` |
857 | 872 |
858 ### **Variables** | 873 ### **Variables** |
859 | 874 |
860 ``` | 875 ``` |
861 args, console, data, data_deps, depfile, deps, outputs*, script*, | 876 args, console, data, data_deps, depfile, deps, inputs, outputs*, |
862 inputs, sources | 877 response_file_contents, script*, sources |
863 * = required | 878 * = required |
864 | 879 |
865 ``` | 880 ``` |
866 | 881 |
867 ### **Example** | 882 ### **Example** |
868 | 883 |
869 ``` | 884 ``` |
870 action("run_this_guy_once") { | 885 action("run_this_guy_once") { |
871 script = "doprocessing.py" | 886 script = "doprocessing.py" |
872 sources = [ "my_configuration.txt" ] | 887 sources = [ "my_configuration.txt" ] |
(...skipping 27 matching lines...) Expand all Loading... |
900 "outputs" variable should specify one or more files with a source | 915 "outputs" variable should specify one or more files with a source |
901 expansion pattern in it (see "gn help source_expansion"). The output | 916 expansion pattern in it (see "gn help source_expansion"). The output |
902 file(s) for each script invocation should be unique. Normally you | 917 file(s) for each script invocation should be unique. Normally you |
903 use "{{source_name_part}}" in each output file. | 918 use "{{source_name_part}}" in each output file. |
904 | 919 |
905 If your script takes additional data as input, such as a shared | 920 If your script takes additional data as input, such as a shared |
906 configuration file or a Python module it uses, those files should be | 921 configuration file or a Python module it uses, those files should be |
907 listed in the "inputs" variable. These files are treated as | 922 listed in the "inputs" variable. These files are treated as |
908 dependencies of each script invocation. | 923 dependencies of each script invocation. |
909 | 924 |
| 925 If the command line length is very long, you can use response files |
| 926 to pass args to your script. See "gn help response_file_contents". |
| 927 |
910 You can dynamically write input dependencies (for incremental rebuilds | 928 You can dynamically write input dependencies (for incremental rebuilds |
911 if an input file changes) by writing a depfile when the script is run | 929 if an input file changes) by writing a depfile when the script is run |
912 (see "gn help depfile"). This is more flexible than "inputs". | 930 (see "gn help depfile"). This is more flexible than "inputs". |
913 | 931 |
914 The "deps" and "public_deps" for an action will always be | 932 The "deps" and "public_deps" for an action will always be |
915 completed before any part of the action is run so it can depend on | 933 completed before any part of the action is run so it can depend on |
916 the output of previous steps. The "data_deps" will be built if the | 934 the output of previous steps. The "data_deps" will be built if the |
917 action is built, but may not have completed before all steps of the | 935 action is built, but may not have completed before all steps of the |
918 action are started. This can give additional parallelism in the build | 936 action are started. This can give additional parallelism in the build |
919 for runtime-only dependencies. | 937 for runtime-only dependencies. |
(...skipping 18 matching lines...) Expand all Loading... |
938 All output files must be inside the output directory of the build. | 956 All output files must be inside the output directory of the build. |
939 You would generally use |$target_out_dir| or |$target_gen_dir| to | 957 You would generally use |$target_out_dir| or |$target_gen_dir| to |
940 reference the output or generated intermediate file directories, | 958 reference the output or generated intermediate file directories, |
941 respectively. | 959 respectively. |
942 | 960 |
943 ``` | 961 ``` |
944 | 962 |
945 ### **Variables** | 963 ### **Variables** |
946 | 964 |
947 ``` | 965 ``` |
948 args, console, data, data_deps, depfile, deps, outputs*, script*, | 966 args, console, data, data_deps, depfile, deps, inputs, outputs*, |
949 inputs, sources* | 967 response_file_contents, script*, sources* |
950 * = required | 968 * = required |
951 | 969 |
952 ``` | 970 ``` |
953 | 971 |
954 ### **Example** | 972 ### **Example** |
955 | 973 |
956 ``` | 974 ``` |
957 # Runs the script over each IDL file. The IDL script will generate | 975 # Runs the script over each IDL file. The IDL script will generate |
958 # both a .cc and a .h file for each input. | 976 # both a .cc and a .h file for each input. |
959 action_foreach("my_idl") { | 977 action_foreach("my_idl") { |
(...skipping 1586 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2546 All paths are relative to the root build directory, which is the | 2564 All paths are relative to the root build directory, which is the |
2547 current directory for running all tools. These expansions are | 2565 current directory for running all tools. These expansions are |
2548 available to all tools: | 2566 available to all tools: |
2549 | 2567 |
2550 {{label}} | 2568 {{label}} |
2551 The label of the current target. This is typically used in the | 2569 The label of the current target. This is typically used in the |
2552 "description" field for link tools. The toolchain will be | 2570 "description" field for link tools. The toolchain will be |
2553 omitted from the label for targets in the default toolchain, and | 2571 omitted from the label for targets in the default toolchain, and |
2554 will be included for targets in other toolchains. | 2572 will be included for targets in other toolchains. |
2555 | 2573 |
| 2574 {{label_name}} |
| 2575 The short name of the label of the target. This is the part |
| 2576 after the colon. For "//foo/bar:baz" this will be "baz". |
| 2577 Unlike {{target_output_name}}, this is not affected by the |
| 2578 "output_prefix" in the tool or the "output_name" set |
| 2579 on the target. |
| 2580 |
2556 {{output}} | 2581 {{output}} |
2557 The relative path and name of the output(s) of the current | 2582 The relative path and name of the output(s) of the current |
2558 build step. If there is more than one output, this will expand | 2583 build step. If there is more than one output, this will expand |
2559 to a list of all of them. | 2584 to a list of all of them. |
2560 Example: "out/base/my_file.o" | 2585 Example: "out/base/my_file.o" |
2561 | 2586 |
2562 {{target_gen_dir}} | 2587 {{target_gen_dir}} |
2563 {{target_out_dir}} | 2588 {{target_out_dir}} |
2564 The directory of the generated file and output directories, | 2589 The directory of the generated file and output directories, |
2565 respectively, for the current target. There is no trailing | 2590 respectively, for the current target. There is no trailing |
2566 slash. | 2591 slash. |
2567 Example: "out/base/test" | 2592 Example: "out/base/test" |
2568 | 2593 |
2569 {{target_output_name}} | 2594 {{target_output_name}} |
2570 The short name of the current target with no path information, | 2595 The short name of the current target with no path information, |
2571 or the value of the "output_name" variable if one is specified | 2596 or the value of the "output_name" variable if one is specified |
2572 in the target. This will include the "output_prefix" if any. | 2597 in the target. This will include the "output_prefix" if any. |
| 2598 See also {{label_name}}. |
2573 Example: "libfoo" for the target named "foo" and an | 2599 Example: "libfoo" for the target named "foo" and an |
2574 output prefix for the linker tool of "lib". | 2600 output prefix for the linker tool of "lib". |
2575 | 2601 |
2576 Compiler tools have the notion of a single input and a single output, | 2602 Compiler tools have the notion of a single input and a single output, |
2577 along with a set of compiler-specific flags. The following expansions | 2603 along with a set of compiler-specific flags. The following expansions |
2578 are available: | 2604 are available: |
2579 | 2605 |
2580 {{asmflags}} | 2606 {{asmflags}} |
2581 {{cflags}} | 2607 {{cflags}} |
2582 {{cflags_c}} | 2608 {{cflags_c}} |
(...skipping 278 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2861 ``` | 2887 ``` |
2862 write_file(filename, data) | 2888 write_file(filename, data) |
2863 | 2889 |
2864 If data is a list, the list will be written one-item-per-line with no | 2890 If data is a list, the list will be written one-item-per-line with no |
2865 quoting or brackets. | 2891 quoting or brackets. |
2866 | 2892 |
2867 If the file exists and the contents are identical to that being | 2893 If the file exists and the contents are identical to that being |
2868 written, the file will not be updated. This will prevent unnecessary | 2894 written, the file will not be updated. This will prevent unnecessary |
2869 rebuilds of targets that depend on this file. | 2895 rebuilds of targets that depend on this file. |
2870 | 2896 |
| 2897 One use for write_file is to write a list of inputs to an script |
| 2898 that might be too long for the command line. However, it is |
| 2899 preferrable to use response files for this purpose. See |
| 2900 "gn help response_file_contents". |
| 2901 |
2871 TODO(brettw) we probably need an optional third argument to control | 2902 TODO(brettw) we probably need an optional third argument to control |
2872 list formatting. | 2903 list formatting. |
2873 | 2904 |
2874 ``` | 2905 ``` |
2875 | 2906 |
2876 ### **Arguments**: | 2907 ### **Arguments** |
2877 | 2908 |
2878 ``` | 2909 ``` |
2879 filename | 2910 filename |
2880 Filename to write. This must be within the output directory. | 2911 Filename to write. This must be within the output directory. |
2881 | 2912 |
2882 data: | 2913 data: |
2883 The list or string to write. | 2914 The list or string to write. |
2884 | 2915 |
2885 | 2916 |
2886 ``` | 2917 ``` |
(...skipping 895 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3782 args = [ "{{source}}", "-o", depfile ] | 3813 args = [ "{{source}}", "-o", depfile ] |
3783 } | 3814 } |
3784 | 3815 |
3785 | 3816 |
3786 ``` | 3817 ``` |
3787 ## **deps**: Private linked dependencies. | 3818 ## **deps**: Private linked dependencies. |
3788 | 3819 |
3789 ``` | 3820 ``` |
3790 A list of target labels. | 3821 A list of target labels. |
3791 | 3822 |
3792 Specifies private dependencies of a target. Shared and dynamic | 3823 Specifies private dependencies of a target. Private dependencies are |
3793 libraries will be linked into the current target. | 3824 propagated up the dependency tree and linked to dependant targets, but |
| 3825 do not grant the ability to include headers from the dependency. |
| 3826 Public configs are not forwarded. |
3794 | 3827 |
3795 These dependencies are private in that it does not grant dependent | 3828 ``` |
3796 targets the ability to include headers from the dependency, and direct | |
3797 dependent configs are not forwarded. | |
3798 | 3829 |
3799 See also "public_deps" and "data_deps". | 3830 ### **Details of dependency propagation** |
| 3831 |
| 3832 ``` |
| 3833 Source sets, shared libraries, and non-complete static libraries |
| 3834 will be propagated up the dependency tree across groups, non-complete |
| 3835 static libraries and source sets. |
| 3836 |
| 3837 Executables, shared libraries, and complete static libraries will |
| 3838 link all propagated targets and stop propagation. Actions and copy |
| 3839 steps also stop propagation, allowing them to take a library as an |
| 3840 input but not force dependants to link to it. |
| 3841 |
| 3842 Propagation of all_dependent_configs and public_configs happens |
| 3843 independently of target type. all_dependent_configs are always |
| 3844 propagated across all types of targets, and public_configs |
| 3845 are always propagated across public deps of all types of targets. |
| 3846 |
| 3847 Data dependencies are propagated differently. See |
| 3848 "gn help data_deps" and "gn help runtime_deps". |
| 3849 |
| 3850 See also "public_deps". |
3800 | 3851 |
3801 | 3852 |
3802 ``` | 3853 ``` |
3803 ## **include_dirs**: Additional include directories. | 3854 ## **include_dirs**: Additional include directories. |
3804 | 3855 |
3805 ``` | 3856 ``` |
3806 A list of source directories. | 3857 A list of source directories. |
3807 | 3858 |
3808 The directories in this list will be added to the include path for | 3859 The directories in this list will be added to the include path for |
3809 the files in the affected target. | 3860 the files in the affected target. |
(...skipping 194 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4004 the library include path. Unlike a normal list of files, they will be | 4055 the library include path. Unlike a normal list of files, they will be |
4005 passed to the linker unmodified rather than being treated as file | 4056 passed to the linker unmodified rather than being treated as file |
4006 names relative to the current build file. Generally you would set | 4057 names relative to the current build file. Generally you would set |
4007 the "lib_dirs" so your library is found. If you need to specify | 4058 the "lib_dirs" so your library is found. If you need to specify |
4008 a path, you can use "rebase_path" to convert a path to be relative | 4059 a path, you can use "rebase_path" to convert a path to be relative |
4009 to the build directory. | 4060 to the build directory. |
4010 | 4061 |
4011 When constructing the linker command, the "lib_prefix" attribute of | 4062 When constructing the linker command, the "lib_prefix" attribute of |
4012 the linker tool in the current toolchain will be prepended to each | 4063 the linker tool in the current toolchain will be prepended to each |
4013 library. So your BUILD file should not specify the switch prefix | 4064 library. So your BUILD file should not specify the switch prefix |
4014 (like "-l"). On Mac, libraries ending in ".framework" will be | 4065 (like "-l"). |
4015 special-cased: the switch "-framework" will be prepended instead of | 4066 |
4016 the lib_prefix, and the ".framework" suffix will be trimmed. | 4067 Libraries ending in ".framework" will be special-cased: the switch |
| 4068 "-framework" will be prepended instead of the lib_prefix, and the |
| 4069 ".framework" suffix will be trimmed. This is to support the way Mac |
| 4070 links framework dependencies. |
4017 | 4071 |
4018 libs and lib_dirs work differently than other flags in two respects. | 4072 libs and lib_dirs work differently than other flags in two respects. |
4019 First, then are inherited across static library boundaries until a | 4073 First, then are inherited across static library boundaries until a |
4020 shared library or executable target is reached. Second, they are | 4074 shared library or executable target is reached. Second, they are |
4021 uniquified so each one is only passed once (the first instance of it | 4075 uniquified so each one is only passed once (the first instance of it |
4022 will be the one used). | 4076 will be the one used). |
4023 | 4077 |
4024 ``` | 4078 ``` |
4025 | 4079 |
4026 ### **Ordering of flags and values** | 4080 ### **Ordering of flags and values** |
(...skipping 264 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4291 more than once, only the first occurance will be used. | 4345 more than once, only the first occurance will be used. |
4292 6. public_configs pulled from dependencies, in the order of the | 4346 6. public_configs pulled from dependencies, in the order of the |
4293 "deps" list. If a dependency is public, they will be applied | 4347 "deps" list. If a dependency is public, they will be applied |
4294 recursively. | 4348 recursively. |
4295 | 4349 |
4296 | 4350 |
4297 ``` | 4351 ``` |
4298 ## **public_deps**: Declare public dependencies. | 4352 ## **public_deps**: Declare public dependencies. |
4299 | 4353 |
4300 ``` | 4354 ``` |
4301 Public dependencies are like private dependencies ("deps") but | 4355 Public dependencies are like private dependencies (see |
4302 additionally express that the current target exposes the listed deps | 4356 "gn help deps") but additionally express that the current target |
4303 as part of its public API. | 4357 exposes the listed deps as part of its public API. |
4304 | 4358 |
4305 This has several ramifications: | 4359 This has several ramifications: |
4306 | 4360 |
4307 - public_configs that are part of the dependency are forwarded | 4361 - public_configs that are part of the dependency are forwarded |
4308 to direct dependents. | 4362 to direct dependents. |
4309 | 4363 |
4310 - Public headers in the dependency are usable by dependents | 4364 - Public headers in the dependency are usable by dependents |
4311 (includes do not require a direct dependency or visibility). | 4365 (includes do not require a direct dependency or visibility). |
4312 | 4366 |
4313 - If the current target is a shared library, other shared libraries | 4367 - If the current target is a shared library, other shared libraries |
(...skipping 30 matching lines...) Expand all Loading... |
4344 deps = [ ":b" ] | 4398 deps = [ ":b" ] |
4345 } | 4399 } |
4346 | 4400 |
4347 shared_library("b") { | 4401 shared_library("b") { |
4348 deps = [ ":super_secret_implementation_details" ] | 4402 deps = [ ":super_secret_implementation_details" ] |
4349 public_deps = [ ":c" ] | 4403 public_deps = [ ":c" ] |
4350 } | 4404 } |
4351 | 4405 |
4352 | 4406 |
4353 ``` | 4407 ``` |
| 4408 ## **response_file_contents**: Contents of a response file for actions. |
| 4409 |
| 4410 ``` |
| 4411 Sometimes the arguments passed to a script can be too long for the |
| 4412 system's command-line capabilities. This is especially the case on |
| 4413 Windows where the maximum command-line length is less than 8K. A |
| 4414 response file allows you to pass an unlimited amount of data to a |
| 4415 script in a temporary file for an action or action_foreach target. |
| 4416 |
| 4417 If the response_file_contents variable is defined and non-empty, the |
| 4418 list will be treated as script args (including possibly substitution |
| 4419 patterns) that will be written to a temporary file at build time. |
| 4420 The name of the temporary file will be substituted for |
| 4421 "{{response_file_name}}" in the script args. |
| 4422 |
| 4423 The response file contents will always be quoted and escaped |
| 4424 according to Unix shell rules. To parse the response file, the Python |
| 4425 script should use "shlex.split(file_contents)". |
| 4426 |
| 4427 ``` |
| 4428 |
| 4429 ### **Example** |
| 4430 |
| 4431 ``` |
| 4432 action("process_lots_of_files") { |
| 4433 script = "process.py", |
| 4434 inputs = [ ... huge list of files ... ] |
| 4435 |
| 4436 # Write all the inputs to a response file for the script. Also, |
| 4437 # make the paths relative to the script working directory. |
| 4438 response_file_contents = rebase_path(inputs, root_build_dir) |
| 4439 |
| 4440 # The script expects the name of the response file in --file-list. |
| 4441 args = [ |
| 4442 "--enable-foo", |
| 4443 "--file-list={{response_file_name}}", |
| 4444 ] |
| 4445 } |
| 4446 |
| 4447 |
| 4448 ``` |
4354 ## **script**: Script file for actions. | 4449 ## **script**: Script file for actions. |
4355 | 4450 |
4356 ``` | 4451 ``` |
4357 An absolute or buildfile-relative file name of a Python script to run | 4452 An absolute or buildfile-relative file name of a Python script to run |
4358 for a action and action_foreach targets (see "gn help action" and | 4453 for a action and action_foreach targets (see "gn help action" and |
4359 "gn help action_foreach"). | 4454 "gn help action_foreach"). |
4360 | 4455 |
4361 | 4456 |
4362 ``` | 4457 ``` |
4363 ## **sources**: Source files for a target | 4458 ## **sources**: Source files for a target |
(...skipping 717 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
5081 ** -q**: Quiet mode. Don't print output on success. | 5176 ** -q**: Quiet mode. Don't print output on success. |
5082 ** \--root**: Explicitly specify source root. | 5177 ** \--root**: Explicitly specify source root. |
5083 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. | 5178 ** \--runtime-deps-list-file**: Save runtime dependencies for targets in file. |
5084 ** \--threads**: Specify number of worker threads. | 5179 ** \--threads**: Specify number of worker threads. |
5085 ** \--time**: Outputs a summary of how long everything took. | 5180 ** \--time**: Outputs a summary of how long everything took. |
5086 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. | 5181 ** \--tracelog**: Writes a Chrome-compatible trace log to the given file. |
5087 ** -v**: Verbose logging. | 5182 ** -v**: Verbose logging. |
5088 ** \--version**: Prints the GN version number and exits. | 5183 ** \--version**: Prints the GN version number and exits. |
5089 | 5184 |
5090 ``` | 5185 ``` |
OLD | NEW |