Skip to content

Commit

Permalink
Automated rollback of commit 743dc14f9f30b80d6d821612f77186afb025477d.
Browse files Browse the repository at this point in the history
*** Reason for rollback ***

Rollforward with a fix

*** Original change description ***

Automated rollback of commit 0ee3aa6.

*** Reason for rollback ***

Likely causing artifact conflicts for middleman artifacts in some cases due to accidental change of getMiddlemanDir() to getBinDir() in RunfilesSupport.createManifestMiddleman.

*** Original change description ***

Cleanup ActionConstructionContext.

Do not expose the underlying Rule.

RELNOTES: None.
PiperOrigin-RevId: 169241011
  • Loading branch information
dslomov authored and laszlocsomor committed Sep 19, 2017
1 parent 3ab171a commit fd62e76
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
import com.google.devtools.build.lib.analysis.configuredtargets.RuleConfiguredTarget.Mode;
import com.google.devtools.build.lib.analysis.fileset.FilesetProvider;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.cmdline.RepositoryName;
import com.google.devtools.build.lib.collect.ImmutableSortedKeyListMultimap;
import com.google.devtools.build.lib.collect.nestedset.NestedSet;
import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable;
Expand Down Expand Up @@ -239,7 +240,20 @@ private void parseFeatures(Iterable<String> features, Set<String> enabled, Set<S
}
}

public RepositoryName getRepository() {
return rule.getRepository();
}

@Override
public Root getBinDirectory() {
return getConfiguration().getBinDirectory(rule.getRepository());
}

@Override
public Root getMiddlemanDirectory() {
return getConfiguration().getMiddlemanDirectory(rule.getRepository());
}

public Rule getRule() {
return rule;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ private Artifact createArtifactsMiddleman(ActionConstructionContext context,
Iterable<Artifact> allRunfilesArtifacts) {
return context.getAnalysisEnvironment().getMiddlemanFactory().createRunfilesMiddleman(
context.getActionOwner(), owningExecutable, allRunfilesArtifacts,
context.getConfiguration().getMiddlemanDirectory(context.getRule().getRepository()),
context.getMiddlemanDirectory(),
"runfiles_artifacts");
}

Expand All @@ -276,7 +276,7 @@ private Artifact createRunfilesMiddleman(ActionConstructionContext context,
return context.getAnalysisEnvironment().getMiddlemanFactory().createRunfilesMiddleman(
context.getActionOwner(), owningExecutable,
ImmutableList.of(artifactsMiddleman, outputManifest),
context.getConfiguration().getMiddlemanDirectory(context.getRule().getRepository()),
context.getMiddlemanDirectory(),
"runfiles");
}

Expand Down Expand Up @@ -308,7 +308,7 @@ private Artifact createRunfilesAction(ActionConstructionContext context, Runfile

BuildConfiguration config = context.getConfiguration();
Artifact outputManifest = context.getDerivedArtifact(
outputManifestPath, config.getBinDirectory(context.getRule().getRepository()));
outputManifestPath, context.getBinDirectory());
context
.getAnalysisEnvironment()
.registerAction(
Expand Down Expand Up @@ -338,7 +338,7 @@ private Artifact createManifestMiddleman(ActionConstructionContext context, Runf
}
return context.getAnalysisEnvironment().getMiddlemanFactory().createRunfilesMiddleman(
context.getActionOwner(), owningExecutable, SourceManifestAction.getDependencies(runfiles),
context.getConfiguration().getMiddlemanDirectory(context.getRule().getRepository()),
context.getMiddlemanDirectory(),
"runfiles_manifest");
}

Expand All @@ -356,7 +356,7 @@ private Artifact createSourceManifest(ActionConstructionContext context, Runfile
executablePath.getBaseName() + ".runfiles.SOURCES");
Artifact sourceOnlyManifest = context.getDerivedArtifact(
sourcesManifestPath,
context.getConfiguration().getBinDirectory(context.getRule().getRepository()));
context.getBinDirectory());
context.getAnalysisEnvironment().registerAction(SourceManifestAction.forRunfiles(
ManifestType.SOURCES_ONLY, context.getActionOwner(), sourceOnlyManifest, runfiles));
return sourceOnlyManifest;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,23 @@
import com.google.devtools.build.lib.actions.Root;
import com.google.devtools.build.lib.analysis.AnalysisEnvironment;
import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
import com.google.devtools.build.lib.packages.Rule;
import com.google.devtools.build.lib.vfs.PathFragment;

/**
* A temporary interface to allow migration from RuleConfiguredTarget to RuleContext. It bundles
* the items commonly needed to construct action instances.
*/
public interface ActionConstructionContext {
/** The rule for which the actions are constructed. */
Rule getRule();

/**
* Returns the bin directory for constructed actions.
*/
Root getBinDirectory();

/**
* Returns the internal directory (used for middlemen) for constructed actions.
*/
Root getMiddlemanDirectory();

/** Returns the action owner that should be used for actions. */
ActionOwner getActionOwner();
Expand Down

0 comments on commit fd62e76

Please sign in to comment.