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.
5 #ifndef TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_
6 #define TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_
8 #include "base/macros.h"
9 #include "base/memory/scoped_ptr.h"
10 #include "tools/gn/scope.h"
12 // ProgrammaticProvider for a scope to provide it with per-file built-in
14 class ScopePerFileProvider
: public Scope::ProgrammaticProvider
{
16 // allow_target_vars allows the target-related variables to get resolved.
17 // When allow_target_vars is unset, the target-related values will be
18 // undefined to GN script.
19 ScopePerFileProvider(Scope
* scope
, bool allow_target_vars
);
20 ~ScopePerFileProvider() override
;
22 // ProgrammaticProvider implementation.
23 const Value
* GetProgrammaticValue(const base::StringPiece
& ident
) override
;
26 const Value
* GetCurrentToolchain();
27 const Value
* GetDefaultToolchain();
28 const Value
* GetPythonPath();
29 const Value
* GetRootBuildDir();
30 const Value
* GetRootGenDir();
31 const Value
* GetRootOutDir();
32 const Value
* GetTargetGenDir();
33 const Value
* GetTargetOutDir();
35 bool allow_target_vars_
;
37 // All values are lazily created.
38 scoped_ptr
<Value
> current_toolchain_
;
39 scoped_ptr
<Value
> default_toolchain_
;
40 scoped_ptr
<Value
> python_path_
;
41 scoped_ptr
<Value
> root_build_dir_
;
42 scoped_ptr
<Value
> root_gen_dir_
;
43 scoped_ptr
<Value
> root_out_dir_
;
44 scoped_ptr
<Value
> target_gen_dir_
;
45 scoped_ptr
<Value
> target_out_dir_
;
47 DISALLOW_COPY_AND_ASSIGN(ScopePerFileProvider
);
50 #endif // TOOLS_GN_SCOPE_PER_FILE_PROVIDER_H_