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; |
| 20 | |
| 21 | import java.util.Map; |
| 22 | |
| 23 | /** |
| 24 | * The collection of the supported build rules. Provides an Environment for Skylark rule creation. |
| 25 | */ |
| 26 | public interface RuleClassProvider { |
| 27 | /** |
| 28 | * Returns a map from rule names to rule class objects. |
| 29 | */ |
| 30 | Map<String, RuleClass> getRuleClassMap(); |
| 31 | |
| 32 | /** |
| 33 | * Returns a new Skylark Environment instance for rule creation. Implementations need to be |
| 34 | * thread safe. |
| 35 | */ |
| 36 | SkylarkEnvironment createSkylarkRuleClassEnvironment( |
| 37 | EventHandler eventHandler, String astFileContentHashCode); |
| 38 | |
| 39 | /** |
| 40 | * Returns a validation environment for static analysis of skylark files. |
| 41 | * The environment has to contain all built-in functions and objects. |
| 42 | */ |
| 43 | ValidationEnvironment getSkylarkValidationEnvironment(); |
| 44 | |
| 45 | /** |
Lukacs Berki | e753ecf | 2015-06-15 07:12:46 +0000 | [diff] [blame^] | 46 | * Returns the default content of the WORKSPACE file. |
| 47 | * |
| 48 | * <p>Used to provide external dependencies for built-in rules. Rules defined here can be |
| 49 | * overwritten in the WORKSPACE file in the actual workspace. |
Kristina Chodorow | bc4b4b1 | 2015-02-11 15:54:50 +0000 | [diff] [blame] | 50 | */ |
Lukacs Berki | e753ecf | 2015-06-15 07:12:46 +0000 | [diff] [blame^] | 51 | String getDefaultWorkspaceFile(); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 52 | } |