• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #include "gn/item.h"
6 
7 #include "base/logging.h"
8 #include "gn/settings.h"
9 #include "gn/build_settings.h"
10 
Item(const Settings * settings,const Label & label,const SourceFileSet & build_dependency_files)11 Item::Item(const Settings* settings,
12            const Label& label,
13            const SourceFileSet& build_dependency_files)
14     : settings_(settings),
15       label_(label),
16       build_dependency_files_(build_dependency_files),
17       defined_from_(nullptr) {
18         component = settings->build_settings()->GetOhosComponent(label.GetUserVisibleName(false));
19       }
20 
21 Item::~Item() = default;
22 
AsConfig()23 Config* Item::AsConfig() {
24   return nullptr;
25 }
AsConfig() const26 const Config* Item::AsConfig() const {
27   return nullptr;
28 }
AsPool()29 Pool* Item::AsPool() {
30   return nullptr;
31 }
AsPool() const32 const Pool* Item::AsPool() const {
33   return nullptr;
34 }
AsTarget()35 Target* Item::AsTarget() {
36   return nullptr;
37 }
AsTarget() const38 const Target* Item::AsTarget() const {
39   return nullptr;
40 }
AsToolchain()41 Toolchain* Item::AsToolchain() {
42   return nullptr;
43 }
AsToolchain() const44 const Toolchain* Item::AsToolchain() const {
45   return nullptr;
46 }
47 
GetItemTypeName() const48 std::string Item::GetItemTypeName() const {
49   if (AsConfig())
50     return "config";
51   if (AsTarget())
52     return "target";
53   if (AsToolchain())
54     return "toolchain";
55   if (AsPool())
56     return "pool";
57   NOTREACHED();
58   return "this thing that I have no idea what it is";
59 }
60 
OnResolved(Err * err)61 bool Item::OnResolved(Err* err) {
62   return true;
63 }
64