Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 1 | // Copyright 2014 Google Inc. All rights reserved. |
| 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | |
| 15 | package com.google.devtools.build.lib.packages; |
| 16 | |
| 17 | import com.google.devtools.build.lib.events.EventHandler; |
| 18 | import com.google.devtools.build.lib.syntax.SkylarkEnvironment; |
| 19 | import com.google.devtools.build.lib.syntax.ValidationEnvironment; |
Kristina Chodorow | bc4b4b1 | 2015-02-11 15:54:50 +0000 | [diff] [blame] | 20 | import com.google.devtools.build.lib.vfs.PathFragment; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | |
Kristina Chodorow | bc4b4b1 | 2015-02-11 15:54:50 +0000 | [diff] [blame] | 22 | import java.util.List; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 23 | import java.util.Map; |
| 24 | |
| 25 | /** |
| 26 | * The collection of the supported build rules. Provides an Environment for Skylark rule creation. |
| 27 | */ |
| 28 | public interface RuleClassProvider { |
| 29 | /** |
| 30 | * Returns a map from rule names to rule class objects. |
| 31 | */ |
| 32 | Map<String, RuleClass> getRuleClassMap(); |
| 33 | |
| 34 | /** |
| 35 | * Returns a new Skylark Environment instance for rule creation. Implementations need to be |
| 36 | * thread safe. |
| 37 | */ |
| 38 | SkylarkEnvironment createSkylarkRuleClassEnvironment( |
| 39 | EventHandler eventHandler, String astFileContentHashCode); |
| 40 | |
| 41 | /** |
| 42 | * Returns a validation environment for static analysis of skylark files. |
| 43 | * The environment has to contain all built-in functions and objects. |
| 44 | */ |
| 45 | ValidationEnvironment getSkylarkValidationEnvironment(); |
| 46 | |
| 47 | /** |
Kristina Chodorow | bc4b4b1 | 2015-02-11 15:54:50 +0000 | [diff] [blame] | 48 | * Returns paths to the WORKSPACE files needed to provide external dependencies for built-in |
| 49 | * rules. The PathFragments are relative to Bazel's install directory. Returns an empty list if |
| 50 | * there are none defined. |
| 51 | */ |
| 52 | List<PathFragment> getWorkspaceFiles(); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 53 | } |