blob: 6781d56e549c0c53a94f63411580769e81a27153 [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;
20
21import java.util.Map;
22
23/**
24 * The collection of the supported build rules. Provides an Environment for Skylark rule creation.
25 */
26public 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 Berkie753ecf2015-06-15 07:12:46 +000046 * 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 Chodorowbc4b4b12015-02-11 15:54:50 +000050 */
Lukacs Berkie753ecf2015-06-15 07:12:46 +000051 String getDefaultWorkspaceFile();
Han-Wen Nienhuysd08b27f2015-02-25 16:45:20 +010052}