diff --git a/.gn b/.gn deleted file mode 100644 index aaaf5e0a4261..000000000000 --- a/.gn +++ /dev/null @@ -1,8 +0,0 @@ -# This file is used by the experimental meta-buildsystem in src/tools/gn to -# find the root of the source tree and to set startup options. - -# The location of the build configuration file. -buildconfig = "//build/config/BUILDCONFIG.gn" - -# The secondary source root is a parallel directory tree where -secondary_source = "//tools/gn/secondary/" diff --git a/tools/gn/BUILD.gn b/tools/gn/BUILD.gn deleted file mode 100644 index ccb54113238f..000000000000 --- a/tools/gn/BUILD.gn +++ /dev/null @@ -1,153 +0,0 @@ -static_library("gn_lib") { - sources = [ - "build_settings.cc", - "build_settings.h", - "command_desc.cc", - "command_desc.h", - "command_gen.cc", - "command_gen.h", - "command.cc", - "config.cc", - "config.h", - "config_values.h", - "config_values_extractors.cc", - "config_values_extractors.h", - "config_values_generator.cc", - "config_values_generator.h", - "err.cc", - "err.h", - "escape.cc", - "escape.h", - "file_template.cc", - "file_template.h", - "filesystem_utils.cc", - "filesystem_utils.h", - "functions.cc", - "functions.h", - "functions_target.cc", - "function_exec_script.cc", - "function_process_file_template.cc", - "function_read_file.cc", - "function_set_default_toolchain.cc", - "function_template.cc", - "function_toolchain.cc", - "function_write_file.cc", - "import_manager.cc", - "import_manager.h", - "input_conversion.cc", - "input_conversion.h", - "input_file.cc", - "input_file.h", - "input_file_manager.cc", - "input_file_manager.h", - "item.cc", - "item.h", - "item_node.cc", - "item_node.h", - "item_tree.cc", - "item_tree.h", - "label.cc", - "label.h", - "location.h", - "ninja_build_writer.cc", - "ninja_build_writer.h", - "ninja_helper.cc", - "ninja_helper.h", - "ninja_target_writer.cc", - "ninja_target_writer.h", - "ninja_toolchain_writer.cc", - "ninja_toolchain_writer.h", - "ninja_writer.cc", - "ninja_writer.h", - "operators.cc", - "operators.h", - "output_file.h", - "parse_tree.cc", - "parse_tree.h", - "parser.cc", - "parser.h", - "path_output.cc", - "path_output.h", - "pattern.cc", - "pattern.h", - "scheduler.cc", - "scheduler.h", - "scope.cc", - "scope.h", - "scope_per_file_provider.cc", - "scope_per_file_provider.h", - "settings.cc", - "settings.h", - "setup.cc", - "setup.h", - "source_dir.cc", - "source_dir.h", - "source_file.cc", - "source_file.h", - "standard_out.cc", - "standard_out.h", - "string_utils.cc", - "string_utils.h", - "target.cc", - "target.h", - "target_generator.cc", - "target_generator.h", - "target_manager.cc", - "target_manager.h", - "token.cc", - "token.h", - "tokenizer.cc", - "tokenizer.h", - "toolchain.cc", - "toolchain.h", - "toolchain_manager.cc", - "toolchain_manager.h", - "value.cc", - "value.h", - "value_extractors.cc", - "value_extractors.h", - ] - deps = [ - "//base", - "//base/third_party/dynamic_annotations", - ] -} - -executable("gn") { - sources = [ - "gn_main.cc", - ] - deps = [ - ":gn_lib", - ] -} - -test("gn_unittests") { - sources = [ - "escape_unittest.cc", - "file_template_unittest.cc", - "filesystem_utils_unittest.cc", - "input_conversion_unittest.cc", - "label_unittest.cc", - "ninja_helper_unittest.cc", - "parser_unittest.cc", - "path_output_unittest.cc", - "pattern_unittest.cc", - "source_dir_unittest.cc", - "string_utils_unittest.cc", - "target_generator_unittest.cc", - "target_manager_unittest.cc", - "tokenizer_unittest.cc", - ] - deps = [ - ":gn_lib", - "//base:run_all_unittests", - "//base:test_support_base", - "//testing:gtest", - ] -} - -executable("generate_test_gn_data") { - sources = [ "generate_test_gn_data.cc" ] - deps = [ "//base" ] -} diff --git a/tools/gn/OWNERS b/tools/gn/OWNERS deleted file mode 100644 index 06fefbf4eccb..000000000000 --- a/tools/gn/OWNERS +++ /dev/null @@ -1 +0,0 @@ -brettw@chromium.org diff --git a/tools/gn/README.txt b/tools/gn/README.txt deleted file mode 100644 index 0a637bf47728..000000000000 --- a/tools/gn/README.txt +++ /dev/null @@ -1,7 +0,0 @@ -GN "Generate Ninja" - -This tool is an experimental metabuildsystem. It is not currently in a state -where it is ready for public consumption. - -It is not currently used in the build and there are currently no plans to -replace GYP. diff --git a/tools/gn/build_settings.cc b/tools/gn/build_settings.cc deleted file mode 100644 index 09b4c99589c5..000000000000 --- a/tools/gn/build_settings.cc +++ /dev/null @@ -1,44 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include "tools/gn/build_settings.h" - -#include "tools/gn/filesystem_utils.h" - -BuildSettings::BuildSettings() - : item_tree_(), - target_manager_(this), - toolchain_manager_(this) { -} - -BuildSettings::~BuildSettings() { -} - -void BuildSettings::SetSecondarySourcePath(const SourceDir& d) { - secondary_source_path_ = GetFullPath(d); -} - -void BuildSettings::SetBuildDir(const SourceDir& d) { - build_dir_ = d; - build_to_source_dir_string_ = InvertDir(d); -} - -base::FilePath BuildSettings::GetFullPath(const SourceFile& file) const { - return file.Resolve(root_path_); -} - -base::FilePath BuildSettings::GetFullPath(const SourceDir& dir) const { - return dir.Resolve(root_path_); -} - -base::FilePath BuildSettings::GetFullPathSecondary( - const SourceFile& file) const { - return file.Resolve(secondary_source_path_); -} - -base::FilePath BuildSettings::GetFullPathSecondary( - const SourceDir& dir) const { - return dir.Resolve(secondary_source_path_); -} - diff --git a/tools/gn/build_settings.h b/tools/gn/build_settings.h deleted file mode 100644 index fe0426674be0..000000000000 --- a/tools/gn/build_settings.h +++ /dev/null @@ -1,110 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#ifndef TOOLS_GN_BUILD_SETTINGS_H_ -#define TOOLS_GN_BUILD_SETTINGS_H_ - -#include "base/basictypes.h" -#include "base/callback.h" -#include "base/files/file_path.h" -#include "tools/gn/item_tree.h" -#include "tools/gn/scope.h" -#include "tools/gn/source_dir.h" -#include "tools/gn/source_file.h" -#include "tools/gn/target_manager.h" -#include "tools/gn/toolchain_manager.h" - -// Settings for one build, which is one toplevel output directory. There -// may be multiple Settings objects that refer to this, one for each toolchain. -class BuildSettings { - public: - typedef base::Callback TargetResolvedCallback; - - BuildSettings(); - ~BuildSettings(); - - // Absolute path of the source root on the local system. Everything is - // relative to this. - const base::FilePath& root_path() const { return root_path_; } - void set_root_path(const base::FilePath& r) { root_path_ = r; } - - // When nonempty, specifies a parallel directory higherarchy in which to - // search for buildfiles if they're not found in the root higherarchy. This - // allows us to keep buildfiles in a separate tree during development. - const base::FilePath& secondary_source_path() const { - return secondary_source_path_; - } - void SetSecondarySourcePath(const SourceDir& d); - - // Path of the python executable to run scripts with. - base::FilePath python_path() const { return python_path_; } - void set_python_path(const base::FilePath& p) { python_path_ = p; } - - const SourceFile& build_config_file() const { return build_config_file_; } - void set_build_config_file(const SourceFile& f) { build_config_file_ = f; } - - // The build directory is the root of all output files. The default toolchain - // files go into here, and non-default toolchains will have separate - // toolchain-specific root directories inside this. - const SourceDir& build_dir() const { return build_dir_; } - void SetBuildDir(const SourceDir& dir); - - // The inverse of relative_build_dir, ending with a separator. - // Example: relative_build_dir_ = "out/Debug/" this will be "../../" - const std::string& build_to_source_dir_string() const { - return build_to_source_dir_string_; - } - - // These accessors do not return const objects since the resulting objects - // are threadsafe. In this setting, we use constness primarily to ensure - // that the Settings object is used in a threadsafe manner. Although this - // violates the concept of logical constness, that's less important in our - // application, and actually implementing this in a way that preserves - // logical constness is cumbersome. - ItemTree& item_tree() const { return item_tree_; } - TargetManager& target_manager() const { return target_manager_; } - ToolchainManager& toolchain_manager() const { return toolchain_manager_; } - - // Returns the full absolute OS path cooresponding to the given file in the - // root source tree. - base::FilePath GetFullPath(const SourceFile& file) const; - base::FilePath GetFullPath(const SourceDir& dir) const; - - // Returns the absolute OS path inside the secondary source path. Will return - // an empty FilePath if the secondary source path is empty. When loading a - // buildfile, the GetFullPath should always be consulted first. - base::FilePath GetFullPathSecondary(const SourceFile& file) const; - base::FilePath GetFullPathSecondary(const SourceDir& dir) const; - - // This is the callback to execute when a target is marked resolved. If we - // don't need to do anything, this will be null. When a target is resolved, - // this callback should be posted to the scheduler pool so the work is - // distributed properly. - const TargetResolvedCallback& target_resolved_callback() const { - return target_resolved_callback_; - } - void set_target_resolved_callback(const TargetResolvedCallback& cb) { - target_resolved_callback_ = cb; - } - - private: - base::FilePath root_path_; - base::FilePath secondary_source_path_; - base::FilePath python_path_; - - SourceFile build_config_file_; - SourceDir build_dir_; - std::string build_to_source_dir_string_; - - TargetResolvedCallback target_resolved_callback_; - - // See getters above. - mutable ItemTree item_tree_; - mutable TargetManager target_manager_; - mutable ToolchainManager toolchain_manager_; - - DISALLOW_COPY_AND_ASSIGN(BuildSettings); -}; - -#endif // TOOLS_GN_BUILD_SETTINGS_H_ diff --git a/tools/gn/command_desc.cc b/tools/gn/command_desc.cc deleted file mode 100644 index bf91776c73fd..000000000000 --- a/tools/gn/command_desc.cc +++ /dev/null @@ -1,201 +0,0 @@ -// Copyright (c) 2013 The Chromium Authors. All rights reserved. -// Use of this source code is governed by a BSD-style license that can be -// found in the LICENSE file. - -#include -#include - -#include "tools/gn/commands.h" -#include "tools/gn/config.h" -#include "tools/gn/item.h" -#include "tools/gn/item_node.h" -#include "tools/gn/label.h" -#include "tools/gn/setup.h" -#include "tools/gn/standard_out.h" -#include "tools/gn/target.h" - -namespace { - -struct CompareTargetLabel { - bool operator()(const Target* a, const Target* b) const { - return a->label() < b->label(); - } -}; - -const Target* GetTargetForDesc(const std::vector& args) { - // Deliberately leaked to avoid expensive process teardown. - Setup* setup = new Setup; - if (!setup->DoSetup()) - return NULL; - - // FIXME(brettw): set the output dir to be a sandbox one to avoid polluting - // the real output dir with files written by the build scripts. - - // Do the actual load. This will also write out the target ninja files. - if (!setup->Run()) - return NULL; - - // Need to resolve the label after we know the default toolchain. - // TODO(brettw) find the current directory and resolve the input label - // relative to that. - Label default_toolchain = setup->build_settings().toolchain_manager() - .GetDefaultToolchainUnlocked(); - Value arg_value(NULL, args[0]); - Err err; - Label label = Label::Resolve(SourceDir(), default_toolchain, arg_value, &err); - if (err.has_error()) { - err.PrintToStdout(); - return NULL; - } - - ItemNode* node; - { - base::AutoLock lock(setup->build_settings().item_tree().lock()); - node = setup->build_settings().item_tree().GetExistingNodeLocked(label); - } - if (!node) { - Err(Location(), "", - "I don't know about this \"" + label.GetUserVisibleName(false) + - "\"").PrintToStdout(); - return NULL; - } - - const Target* target = node->item()->AsTarget(); - if (!target) { - Err(Location(), "Not a target.", - "The \"" + label.GetUserVisibleName(false) + "\" thing\n" - "is not a target. Somebody should probably implement this command for " - "other\nitem types."); - return NULL; - } - - return target; -} - -void RecursiveCollectDeps(const Target* target, std::set