-
Notifications
You must be signed in to change notification settings - Fork 4.1k
/
ProjectFile.java
67 lines (61 loc) · 2.6 KB
/
ProjectFile.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
// Copyright 2014 The Bazel Authors. All rights reserved.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package com.google.devtools.build.lib.runtime;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.util.AbruptExitException;
import com.google.devtools.build.lib.vfs.Path;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.lib.vfs.Root;
import com.google.devtools.common.options.OptionsParser;
import com.google.devtools.common.options.OptionsParsingException;
import java.util.List;
/**
* A file that describes a project - for large source trees that are worked on by multiple
* independent teams, it is useful to have a larger unit than a package which combines a set of
* target patterns and a set of corresponding options.
*/
public interface ProjectFile {
/**
* A provider for a project file - we generally expect the provider to cache parsed files
* internally and return a cached version if it can ascertain that that is still correct.
*
* <p>Note in particular that packages may be moved between different package path entries, which
* should lead to cache invalidation.
*/
interface Provider {
/**
* Returns an (optionally cached) project file instance. If there is no such file, or if the
* file cannot be parsed, then it throws an exception.
*/
ProjectFile getProjectFile(
Path workingDirectory,
List<Root> packagePath,
PathFragment path,
OptionsParser optionsParser)
throws OptionsParsingException, InterruptedException;
}
/**
* A string name of the project file that is reported to the user. It should be in such a format
* that passing it back in on the command line works.
*/
String getName();
/**
* A list of strings that are parsed into the options for the command.
*
* @param command An action from the command line, e.g. "build" or "test".
* @throws AbruptExitException if an unknown command is passed.
*/
List<String> getCommandLineFor(String command, EventHandler eventHandler)
throws AbruptExitException;
}