diff options
author | 2015-08-24 08:35:26 +0000 | |
---|---|---|
committer | 2015-08-24 14:02:49 +0000 | |
commit | 11f5587e6140fc6a805444e45f644c76f10b9a03 (patch) | |
tree | 5bd00ddac86e2deb783379fe1cd757deb103fc83 /src/main/java/com | |
parent | c3151a31cb6aa40e0a7ea792a5d17b5f8ec01768 (diff) |
Remove the some calls to AnalysisEnvironment.getDerivedArtifact() and add a big fat warning that that
method shouldn't be used anymore.
Ideally, I'd mark it as deprecated, but it's legitimately used by RuleContext. I could just forbid access to AnalysisEnvironment to rule implementations, but, sadly, almost every method on it is called at a few oddball places in implementations of various rules, so we can't do it just yet.
--
MOS_MIGRATED_REVID=101345484
Diffstat (limited to 'src/main/java/com')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java | 10 | ||||
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java | 2 |
2 files changed, 8 insertions, 4 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java index 07f7a02190..7429bd95d0 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/AnalysisEnvironment.java @@ -44,12 +44,16 @@ public interface AnalysisEnvironment extends ActionRegistry { /** * Returns the artifact for the derived file {@code rootRelativePath}. * + * <p><b>DO NOT USE</b> in rule implementations. Use + * {@link RuleContext#getPackageRelativeArtifact(PathFragment, Root)} or + * {@link RuleContext#getUniqueDirectoryArtifact(String, PathFragment, Root)}, or, if there is + * really no other way, {@link RuleContext#getShareableArtifact(PathFragment, Root)} instead. + * * <p>Creates the artifact if necessary and sets the root of that artifact to {@code root}. * * <p>This method can create artifacts anywhere in the output tree, thus making it possible for - * artifacts generated by two different rules to clash. To avoid this, use the methods - * {@code getUniqueDirectoryArtifact} and {@code getPackageRelativeArtifact} on - * {@link RuleContext}. + * artifacts generated by two different rules to clash. To avoid this, use the artifact creation + * method on {@link RuleContext} mentioned above. */ Artifact getDerivedArtifact(PathFragment rootRelativePath, Root root); diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java index d597465366..7902cbfeb1 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/SolibSymlinkAction.java @@ -169,7 +169,7 @@ public final class SolibSymlinkAction extends AbstractAction { // Ignore libraries that are already represented by the symlinks. Root root = configuration.getBinDirectory(); - Artifact symlink = ruleContext.getAnalysisEnvironment().getDerivedArtifact(symlinkName, root); + Artifact symlink = ruleContext.getShareableArtifact(symlinkName, root); ruleContext.registerAction( new SolibSymlinkAction(ruleContext.getActionOwner(), library, symlink)); return LinkerInputs.solibLibraryToLink(symlink, library); |