diff options
author | 2015-12-10 16:29:48 +0000 | |
---|---|---|
committer | 2015-12-10 20:15:47 +0000 | |
commit | 4bc637108cc14c85a9ceebaedb15507ea97fda4b (patch) | |
tree | c9d3379cdd4270e66c3980ef2eae41d491f070fe /src/main/java | |
parent | 12bad3af0eade9c4b79d76f9e1c950ad2e3214c2 (diff) |
Open-source a support data-structure for protocol buffers.
--
MOS_MIGRATED_REVID=109900770
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/rules/proto/SupportData.java | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/rules/proto/SupportData.java b/src/main/java/com/google/devtools/build/lib/rules/proto/SupportData.java new file mode 100644 index 0000000000..4d29a265c8 --- /dev/null +++ b/src/main/java/com/google/devtools/build/lib/rules/proto/SupportData.java @@ -0,0 +1,55 @@ +// Copyright 2015 The Bazel Authors. 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.rules.proto; + +import com.google.auto.value.AutoValue; +import com.google.common.base.Predicate; +import com.google.common.collect.ImmutableList; +import com.google.devtools.build.lib.actions.Artifact; +import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; +import com.google.devtools.build.lib.collect.nestedset.NestedSet; +import com.google.devtools.build.lib.concurrent.ThreadSafety.Immutable; + +import javax.annotation.Nullable; + +/** + * A helper class for the *Support classes containing some data from ProtoLibrary. + */ +@AutoValue +@Immutable +public abstract class SupportData { + public static SupportData create( + Predicate<TransitiveInfoCollection> nonWeakDepsPredicate, + ImmutableList<Artifact> protoSources, + NestedSet<Artifact> transitiveImports, + Artifact usedDirectDeps, + boolean hasProtoSources) { + return new AutoValue_SupportData( + nonWeakDepsPredicate, protoSources, transitiveImports, usedDirectDeps, hasProtoSources); + } + + public abstract Predicate<TransitiveInfoCollection> getNonWeakDepsPredicate(); + + public abstract ImmutableList<Artifact> getDirectProtoSources(); + + public abstract NestedSet<Artifact> getTransitiveImports(); + + @Nullable + public abstract Artifact getUsedDirectDeps(); + + public abstract boolean hasProtoSources(); + + SupportData() {} +} |