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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
|
// Copyright 2014 Google Inc. 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.analysis;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableSet;
import com.google.devtools.build.lib.actions.Action;
import com.google.devtools.build.lib.actions.ActionRegistry;
import com.google.devtools.build.lib.actions.Artifact;
import com.google.devtools.build.lib.actions.MiddlemanFactory;
import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.buildinfo.BuildInfoFactory.BuildInfoKey;
import com.google.devtools.build.lib.events.EventHandler;
import com.google.devtools.build.lib.vfs.PathFragment;
import com.google.devtools.build.skyframe.SkyFunction;
/**
* The set of services that are provided to {@link ConfiguredTarget} objects
* during initialization.
*/
public interface AnalysisEnvironment extends ActionRegistry {
/**
* Returns a callback to be used in this build for reporting analysis errors.
*/
EventHandler getEventHandler();
/**
* Returns whether any errors were reported to this instance.
*/
boolean hasErrors();
/**
* Returns the artifact for the derived file {@code rootRelativePath}.
*
* <p>Creates the artifact if necessary and sets the root of that artifact to {@code root}.
*/
Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root);
/**
* Returns an artifact for the derived file {@code rootRelativePath} whose changes do not cause
* a rebuild.
*
* <p>Creates the artifact if necessary and sets the root of that artifact to {@code root}.
*
* <p>This is useful for files that store data that changes very frequently (e.g. current time)
* but does not substantially affect the result of the build.
*/
Artifact getConstantMetadataArtifact(PathFragment rootRelativePath,
Root root);
/**
* Returns the artifact for the derived file {@code rootRelativePath},
* creating it if necessary, and setting the root of that artifact to
* {@code root}. The artifact will represent the output directory of a {@code Fileset}.
*/
Artifact getFilesetArtifact(PathFragment rootRelativePath, Root root);
/**
* Returns the artifact for the specified tool.
*/
Artifact getEmbeddedToolArtifact(String embeddedPath);
/**
* Returns the middleman factory associated with the build.
*/
// TODO(bazel-team): remove this method and replace it with delegate methods.
MiddlemanFactory getMiddlemanFactory();
/**
* Returns the generating action for the given local artifact.
*
* If the artifact was created in another analysis environment (e.g. by a different configured
* target instance) or the artifact is a source artifact, it returns null.
*/
Action getLocalGeneratingAction(Artifact artifact);
/**
* Returns the actions that were registered so far with this analysis environment, that is, all
* the actions that were created by the current target being analyzed.
*/
Iterable<Action> getRegisteredActions();
/**
* Returns the Skyframe SkyFunction.Environment if available. Otherwise, null.
*
* <p>If you need to use this for something other than genquery, please think long and hard
* about that.
*/
SkyFunction.Environment getSkyframeEnv();
/**
* Returns the Artifact that is used to hold the non-volatile workspace status for the current
* build request.
*/
Artifact getStableWorkspaceStatusArtifact();
/**
* Returns the Artifact that is used to hold the volatile workspace status (e.g. build
* changelist) for the current build request.
*/
Artifact getVolatileWorkspaceStatusArtifact();
/**
* Returns the Artifacts that contain the workspace status for the current build request.
*
* @param ruleContext the rule to use for error reporting and to determine the
* configuration
*/
ImmutableList<Artifact> getBuildInfo(RuleContext ruleContext, BuildInfoKey key);
/**
* Returns the set of orphan Artifacts (i.e. Artifacts without generating action). Should only be
* called after the ConfiguredTarget is created.
*/
ImmutableSet<Artifact> getOrphanArtifacts();
}
|