diff options
author | 2015-06-01 14:33:27 +0000 | |
---|---|---|
committer | 2015-06-01 15:50:26 +0000 | |
commit | 14b437bf749baf0488cfc7e4ed7589dc4af9bec3 (patch) | |
tree | 5dd4e93cd9cb341df0bb2543b95627cac31d23c3 /src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java | |
parent | f4a3d4f0a6a5f2194bf3f53ecf2aae913eff01fa (diff) |
Implement smart negation for target pattern sequences
This change uses the types of target patterns, and the order they
appear in the sequence, to construct a more efficiently processable
sequence of target pattern keys. Redundant patterns are eliminated and
negated TargetsBelowDirectory patterns are excluded from higher-up
positive patterns.
--
MOS_MIGRATED_REVID=94909360
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java b/src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java new file mode 100644 index 0000000000..034f35e5cc --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SignedPattern.java @@ -0,0 +1,40 @@ +// Copyright 2015 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.skyframe; + +import com.google.devtools.build.lib.cmdline.TargetPattern; + +final class SignedPattern { + + private final boolean positive; + private final TargetPattern pattern; + + SignedPattern(boolean positive, TargetPattern pattern) { + this.positive = positive; + this.pattern = pattern; + } + + boolean isPositive() { + return positive; + } + + TargetPattern getPattern() { + return pattern; + } + + @Override + public String toString() { + return (positive ? "" : "-") + pattern.getOriginalPattern(); + } +} |