blob: 1f9f25c1069fe2f656cb11f2e97647798244a5e5 [file] [log] [blame]
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +01001// 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
15package com.google.devtools.build.lib.packages;
16
17import com.google.devtools.build.lib.events.EventHandler;
18import com.google.devtools.build.lib.syntax.SkylarkEnvironment;
19import com.google.devtools.build.lib.syntax.ValidationEnvironment;
Kristina Chodorowbc4b4b12015-02-11 15:54:50 +000020import com.google.devtools.build.lib.vfs.PathFragment;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010021
Kristina Chodorowbc4b4b12015-02-11 15:54:50 +000022import java.util.List;
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010023import java.util.Map;
24
25/**
26 * The collection of the supported build rules. Provides an Environment for Skylark rule creation.
27 */
28public 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 Chodorowbc4b4b12015-02-11 15:54:50 +000048 * 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 Nienhuysd08b27f2015-02-25 16:45:20 +010053}