• Home
  • Raw
  • Download

Lines Matching +full:ninja +full:- +full:build

2 // Use of this source code is governed by a BSD-style license that can be
36 const char kSwitchCleanStale[] = "clean-stale";
50 const char kSwitchIdeRootTarget[] = "ide-root-target";
51 const char kSwitchNinjaExecutable[] = "ninja-executable";
52 const char kSwitchNinjaExtraArgs[] = "ninja-extra-args";
53 const char kSwitchNoDeps[] = "no-deps";
55 const char kSwitchXcodeProject[] = "xcode-project";
56 const char kSwitchXcodeBuildSystem[] = "xcode-build-system";
59 const char kSwitchJsonFileName[] = "json-file-name";
60 const char kSwitchJsonIdeScript[] = "json-ide-script";
61 const char kSwitchJsonIdeScriptArgs[] = "json-ide-script-args";
62 const char kSwitchExportCompileCommands[] = "export-compile-commands";
63 const char kSwitchExportRustProject[] = "export-rust-project";
65 // Collects Ninja rules for each toolchain. The lock protectes the rules.
71 // Called on worker thread to write the ninja file.
77 std::lock_guard<std::mutex> lock(write_info->lock); in BackgroundDoWrite()
78 write_info->rules[target->toolchain()].emplace_back(target, in BackgroundDoWrite()
86 const Item* item = record->item(); in ItemResolvedAndGeneratedCallback()
87 const Target* target = item->AsTarget(); in ItemResolvedAndGeneratedCallback()
89 g_scheduler->ScheduleWork( in ItemResolvedAndGeneratedCallback()
103 OutputFile output_file(targets[0]->settings()->build_settings(), file); in FindTargetThatGeneratesFile()
105 for (const auto& cur_output : target->computed_outputs()) { in FindTargetThatGeneratesFile()
124 targets[0]->settings()->default_toolchain_label(); in PrintInvalidGeneratedInput()
126 if (target->settings()->toolchain_label() != default_toolchain) { in PrintInvalidGeneratedInput()
134 generator->settings()->toolchain_label() != default_toolchain) in PrintInvalidGeneratedInput()
142 err += " " + target->label().GetUserVisibleName(show_toolchains) + "\n"; in PrintInvalidGeneratedInput()
147 err += generator->label().GetUserVisibleName(show_toolchains); in PrintInvalidGeneratedInput()
149 err += "but no targets in the build generate that file."; in PrintInvalidGeneratedInput()
159 g_scheduler->GetUnknownGeneratedInputs(); in CheckForInvalidGeneratedInputs()
167 auto end_of_range = unknown_inputs.upper_bound(cur->first); in CheckForInvalidGeneratedInputs()
170 SourceFile bad_input = cur->first; in CheckForInvalidGeneratedInputs()
173 targets.push_back((cur++)->second); in CheckForInvalidGeneratedInputs()
175 PrintInvalidGeneratedInput(setup->builder(), bad_input, targets); in CheckForInvalidGeneratedInputs()
201 bool quiet = command_line->HasSwitch(switches::kQuiet); in RunIdeWriter()
226 if (command_line->HasSwitch(kSwitchSln)) in RunIdeWriter()
227 sln_name = command_line->GetSwitchValueASCII(kSwitchSln); in RunIdeWriter()
229 if (command_line->HasSwitch(kSwitchFilters)) in RunIdeWriter()
230 filters = command_line->GetSwitchValueASCII(kSwitchFilters); in RunIdeWriter()
232 if (command_line->HasSwitch(kSwitchIdeValueWinSdk)) in RunIdeWriter()
233 win_kit = command_line->GetSwitchValueASCII(kSwitchIdeValueWinSdk); in RunIdeWriter()
235 if (command_line->HasSwitch(kSwitchNinjaExtraArgs)) { in RunIdeWriter()
237 command_line->GetSwitchValueASCII(kSwitchNinjaExtraArgs); in RunIdeWriter()
240 if (command_line->HasSwitch(kSwitchNinjaExecutable)) { in RunIdeWriter()
242 command_line->GetSwitchValueASCII(kSwitchNinjaExecutable); in RunIdeWriter()
244 bool no_deps = command_line->HasSwitch(kSwitchNoDeps); in RunIdeWriter()
256 command_line->GetSwitchValueASCII(kSwitchXcodeProject), in RunIdeWriter()
257 command_line->GetSwitchValueASCII(kSwitchIdeRootTarget), in RunIdeWriter()
258 command_line->GetSwitchValueASCII(kSwitchNinjaExecutable), in RunIdeWriter()
259 command_line->GetSwitchValueASCII(kSwitchFilters), in RunIdeWriter()
268 command_line->GetSwitchValueASCII(kSwitchXcodeBuildSystem); in RunIdeWriter()
275 *err = Err(Location(), "Unknown build system: " + build_system); in RunIdeWriter()
290 if (command_line->HasSwitch(kSwitchIdeRootTarget)) in RunIdeWriter()
291 root_target = command_line->GetSwitchValueASCII(kSwitchIdeRootTarget); in RunIdeWriter()
302 command_line->GetSwitchValueASCII(kSwitchJsonFileName); in RunIdeWriter()
306 command_line->GetSwitchValueASCII(kSwitchJsonIdeScript); in RunIdeWriter()
308 command_line->GetSwitchValueASCII(kSwitchJsonIdeScriptArgs); in RunIdeWriter()
309 std::string filters = command_line->GetSwitchValueASCII(kSwitchFilters); in RunIdeWriter()
331 bool quiet = command_line->HasSwitch(switches::kQuiet); in RunRustProjectWriter()
334 std::string file_name = "rust-project.json"; in RunRustProjectWriter()
338 OutputString("Generating rust-project.json took " + in RunRustProjectWriter()
350 bool quiet = command_line->HasSwitch(switches::kQuiet); in RunCompileCommandsWriter()
355 command_line->GetSwitchValueASCII(kSwitchExportCompileCommands); in RunCompileCommandsWriter()
373 // tools. Since these tools can re-write ninja build log and dep logs, it is in RunNinjaPostProcessTools()
374 // really important that ninja executable used for tools matches the in RunNinjaPostProcessTools()
378 *err = Err(Location(), "No --ninja-executable provided.", in RunNinjaPostProcessTools()
379 "--clean-stale requires a ninja executable to run. You can " in RunNinjaPostProcessTools()
380 "provide one on the command line via --ninja-executable."); in RunNinjaPostProcessTools()
388 build_settings->GetFullPath(build_settings->build_dir()); in RunNinjaPostProcessTools()
391 if (build_settings->ninja_required_version() < Version{1, 10, 0}) { in RunNinjaPostProcessTools()
392 *err = Err(Location(), "Need a ninja executable at least version 1.10.0.", in RunNinjaPostProcessTools()
393 "--clean-stale requires a ninja executable of version 1.10.0 " in RunNinjaPostProcessTools()
407 // If we have a ninja version that supports restat, we should restat the in RunNinjaPostProcessTools()
408 // build.ninja file so the next ninja invocation will use the right mtime. If in RunNinjaPostProcessTools()
409 // gen is being invoked as part of a re-gen (ie, ninja is invoking gn gen), in RunNinjaPostProcessTools()
410 // then we can elide this restat, as ninja will restat build.ninja anyways in RunNinjaPostProcessTools()
413 build_settings->ninja_required_version() >= Version{1, 10, 0}) { in RunNinjaPostProcessTools()
415 base::FilePath(FILE_PATH_LITERAL("build.ninja"))}; in RunNinjaPostProcessTools()
427 const char kGen_HelpShort[] = "gen: Generate ninja files.";
429 R"(gn gen [--check] [<ide options>] <out_dir>
431 Generates ninja files from the current tree and puts them in the given output
434 The output directory can be a source-repo-absolute path name such as:
439 "gn gen --check" is the same as running "gn check". "gn gen --check=system" is
440 the same as running "gn check --check-system". See "gn help check" for
443 See "gn help switches" for the common command-line switches.
447 --ninja-executable=<string>
448 Can be used to specify the ninja executable to use. This executable will
449 be used as an IDE option to indicate which ninja to use for building. This
451 restat on generated ninja files and for use with --clean-stale.
453 --clean-stale
455 the build directory, and their records pruned from the ninja build log and
456 dependency database after the ninja build graph has been generated. This
457 option requires a ninja executable of at least version 1.10.0. It can be
458 provided by the --ninja-executable switch. Also see "gn help clean_stale".
465 --ide=<ide_name>
467 "eclipse" - Eclipse CDT settings file.
468 "vs" - Visual Studio project/solution files.
470 "vs2013" - Visual Studio 2013 project/solution files.
471 "vs2015" - Visual Studio 2015 project/solution files.
472 "vs2017" - Visual Studio 2017 project/solution files.
473 "vs2019" - Visual Studio 2019 project/solution files.
474 "vs2022" - Visual Studio 2022 project/solution files.
475 "xcode" - Xcode workspace/solution files.
476 "qtcreator" - QtCreator project files.
477 "json" - JSON file containing target information
479 --filters=<path_prefixes>
480 Semicolon-separated list of label patterns used to limit the set of
487 --sln=<file_name>
489 root build directory.
491 --no-deps
493 --filters option works. Only directly matching targets are included.
495 --winsdk=<sdk_version>
500 --ninja-executable=<string>
501 Can be used to specify the ninja executable to use when building.
503 --ninja-extra-args=<string>
504 This string is passed without any quoting to the ninja invocation
505 command-line. Can be used to configure ninja flags, like "-j".
509 --xcode-project=<file_name>
511 written to the root build directory.
513 --xcode-build-system=<value>
514 Configure the build system to use for the Xcode project. Supported
516 "legacy" - Legacy Build system
517 "new" - New Build System
519 --ninja-executable=<string>
520 Can be used to specify the ninja executable to use when building.
522 --ninja-extra-args=<string>
523 This string is passed without any quoting to the ninja invocation
524 command-line. Can be used to configure ninja flags, like "-j".
526 --ide-root-target=<target_name>
528 "All" invokes ninja without any target and builds everything.
532 --ide-root-target=<target_name>
534 to contain files of it and its dependencies. If unset, the whole build
555 --json-file-name=<json_file_name>
558 --json-ide-script=<path_to_python_script>
564 --json-ide-script-args=<argument>
569 --export-rust-project
570 Produces a rust-project.json file in the root of the build directory
572 replay of individual compilations independent of the build system.
575 --export-compile-commands[=<target_name1,target_name2...>]
576 Produces a compile_commands.json file in the root of the build directory
580 target in any build file whose name is target_name will be used for
582 This is used for various Clang-based tooling, allowing for the replay of
583 individual compilations independent of the build system.
585 - "//path/to/src:foo"
586 - "//other/path:foo"
587 - "//foo:foo"
589 - "//foo:bar"
596 Err(Location(), "Need exactly one build directory to generate.", in RunGen()
606 if (!base::CommandLine::ForCurrentProcess()->HasSwitch(switches::kArgs)) {
607 setup->set_gen_empty_args(true);
609 if (!setup->DoSetup(args[0], true))
614 if (command_line->HasSwitch(kSwitchCheck)) {
615 setup->set_check_public_headers(true);
616 if (command_line->GetSwitchValueASCII(kSwitchCheck) == "system")
617 setup->set_check_system_includes(true);
620 // Cause the load to also generate the ninja files for each target.
622 setup->builder().set_resolved_and_generated_callback(
627 // Do the actual load. This will also write out the target ninja files.
628 if (!setup->Run())
632 // the ninja files have deterministic content.
637 return a.first->label() < b.first->label(); in __anon9810d1cc0402()
642 // Write the root ninja files.
643 if (!NinjaWriter::RunAndWriteFiles(&setup->build_settings(), setup->builder(),
650 &setup->build_settings(),
651 command_line->GetSwitchValuePath(switches::kNinjaExecutable),
652 command_line->HasSwitch(switches::kRegeneration),
653 command_line->HasSwitch(kSwitchCleanStale), &err)) {
658 if (!WriteRuntimeDepsFilesIfNecessary(&setup->build_settings(),
659 setup->builder(), &err)) {
667 if (command_line->HasSwitch(kSwitchIde) &&
668 !RunIdeWriter(command_line->GetSwitchValueASCII(kSwitchIde),
669 &setup->build_settings(), setup->builder(), &err)) {
674 if (command_line->HasSwitch(kSwitchExportCompileCommands) &&
675 !RunCompileCommandsWriter(&setup->build_settings(), setup->builder(),
681 if (command_line->HasSwitch(kSwitchExportRustProject) &&
682 !RunRustProjectWriter(&setup->build_settings(), setup->builder(), &err)) {
689 if (!command_line->HasSwitch(switches::kQuiet)) {
699 setup->scheduler().input_file_manager()->GetInputFileCount()) +