Skip to content

Commit

Permalink
Print the actual set of artifacts built for each target on the comman…
Browse files Browse the repository at this point in the history
…d line on stderr (or is it stdout?).

This results in the removal of ~40 lines of code, yay.

--
MOS_MIGRATED_REVID=86176505
  • Loading branch information
lberki authored and hanwen committed Feb 12, 2015
1 parent b0e387b commit d54960e
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 42 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ private TopLevelArtifactHelper() {
}

/** Returns command-specific artifacts which may exist for a given target and build command. */
public static final Iterable<Artifact> getCommandArtifacts(TransitiveInfoCollection target,
private static final Iterable<Artifact> getCommandArtifacts(TransitiveInfoCollection target,
String buildCommand) {
TopLevelArtifactProvider provider = target.getProvider(TopLevelArtifactProvider.class);
if (provider != null
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,12 @@
import com.google.devtools.build.lib.actions.cache.ActionCache;
import com.google.devtools.build.lib.analysis.BuildView;
import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult;
import com.google.devtools.build.lib.analysis.CompilationPrerequisitesProvider;
import com.google.devtools.build.lib.analysis.ConfiguredTarget;
import com.google.devtools.build.lib.analysis.FileProvider;
import com.google.devtools.build.lib.analysis.FilesToCompileProvider;
import com.google.devtools.build.lib.analysis.InputFileConfiguredTarget;
import com.google.devtools.build.lib.analysis.OutputFileConfiguredTarget;
import com.google.devtools.build.lib.analysis.TempsProvider;
import com.google.devtools.build.lib.analysis.TopLevelArtifactContext;
import com.google.devtools.build.lib.analysis.TopLevelArtifactHelper;
import com.google.devtools.build.lib.analysis.TransitiveInfoCollection;
import com.google.devtools.build.lib.analysis.ViewCreationFailedException;
Expand Down Expand Up @@ -670,13 +669,14 @@ private void showBuildResult(BuildRequest request, BuildResult result,

OutErr outErr = request.getOutErr();

TopLevelArtifactContext context = request.getTopLevelArtifactContext();
for (ConfiguredTarget target : succeeded) {
Label label = target.getLabel();
// For up-to-date targets report generated artifacts, but only
// if they have associated action and not middleman artifacts.
boolean headerFlag = true;
for (Artifact artifact : getFilesToBuild(target, request)) {
if (!artifact.isSourceArtifact()) {
for (Artifact artifact : TopLevelArtifactHelper.getAllArtifactsToBuild(target, context)) {
if (!artifact.isSourceArtifact() && !artifact.isMiddlemanArtifact()) {
if (headerFlag) {
outErr.printErr("Target " + label + " up-to-date:\n");
headerFlag = false;
Expand Down Expand Up @@ -713,43 +713,6 @@ private void showBuildResult(BuildRequest request, BuildResult result,
}
}

/**
* Gets all the files to build for a given target and build request.
* There may be artifacts that should be built which are not represented in the
* configured target graph. Currently, this only occurs when "--save_temps" is on.
*
* @param target configured target
* @param request the build request
* @return artifacts to build
*/
private static Collection<Artifact> getFilesToBuild(ConfiguredTarget target,
BuildRequest request) {
ImmutableSet.Builder<Artifact> result = ImmutableSet.builder();
if (request.getBuildOptions().compileOnly) {
FilesToCompileProvider provider = target.getProvider(FilesToCompileProvider.class);
if (provider != null) {
result.addAll(provider.getFilesToCompile());
}
} else if (request.getBuildOptions().compilationPrerequisitesOnly) {
CompilationPrerequisitesProvider provider =
target.getProvider(CompilationPrerequisitesProvider.class);
if (provider != null) {
result.addAll(provider.getCompilationPrerequisites());
}
} else {
FileProvider provider = target.getProvider(FileProvider.class);
if (provider != null) {
result.addAll(provider.getFilesToBuild());
}
}
TempsProvider tempsProvider = target.getProvider(TempsProvider.class);
if (tempsProvider != null) {
result.addAll(tempsProvider.getTemps());
}

return result.build();
}

private ActionCache getActionCache() throws LocalEnvironmentException {
try {
return runtime.getPersistentActionCache();
Expand Down

0 comments on commit d54960e

Please sign in to comment.