| commit | cfdeb4d4737a73e38aabfbd2fca31f018a2c19e9 | [log] [tgz] |
|---|---|---|
| author | Googler <noreply@google.com> | Thu Feb 08 07:13:33 2018 -0800 |
| committer | Copybara-Service <copybara-piper@google.com> | Thu Feb 08 07:15:39 2018 -0800 |
| tree | 34583ecf6d27c796b6a0853d12abe03892952a45 | |
| parent | d855d8133f4efb73ebd5e82c54a9afb4c7565d46 [diff] [blame] |
Suppress ThinLTO indexing for testonly targets Applies ThinLTO scalability fix https://github.com/bazelbuild/bazel/commit/8c5e290dfab3cab378a9ca107ecdd6267403cd4b to targets (e.g. cc_binary) marked "testonly = 1". RELNOTES: None PiperOrigin-RevId: 184991176
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java index 73fb629..994ef13 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java
@@ -1327,6 +1327,11 @@ return TargetUtils.isTestRule(getTarget()); } + /** Returns true if the testonly attribute is set on this context. */ + public boolean isTestOnlyTarget() { + return attributes().has("testonly", Type.BOOLEAN) && attributes().get("testonly", Type.BOOLEAN); + } + /** * @return true if {@code rule} is visible from {@code prerequisite}. *