Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 2 | // |
| 3 | // Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | // you may not use this file except in compliance with the License. |
| 5 | // You may obtain a copy of the License at |
| 6 | // |
| 7 | // http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | // |
| 9 | // Unless required by applicable law or agreed to in writing, software |
| 10 | // distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | // See the License for the specific language governing permissions and |
| 13 | // limitations under the License. |
| 14 | package com.google.devtools.build.lib.skyframe; |
| 15 | |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 16 | import com.google.auto.value.AutoValue; |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 17 | import com.google.common.collect.Iterables; |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 18 | import com.google.devtools.build.lib.analysis.TopLevelArtifactContext; |
| 19 | import com.google.devtools.build.lib.skyframe.AspectValue.AspectKey; |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 20 | import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec; |
| 21 | import com.google.devtools.build.skyframe.SkyFunctionName; |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 22 | import com.google.devtools.build.skyframe.SkyKey; |
| 23 | import com.google.devtools.build.skyframe.SkyValue; |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 24 | import java.util.Collection; |
| 25 | |
| 26 | /** |
| 27 | * The value of an AspectCompletion. Currently this just stores an Aspect. |
| 28 | */ |
| 29 | public class AspectCompletionValue implements SkyValue { |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 30 | @AutoCodec static final AspectCompletionValue INSTANCE = new AspectCompletionValue(); |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 31 | |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 32 | private AspectCompletionValue() {} |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 33 | |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 34 | public static Iterable<SkyKey> keys( |
| 35 | Collection<AspectValue> targets, final TopLevelArtifactContext ctx) { |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 36 | return Iterables.transform( |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 37 | targets, aspectValue -> AspectCompletionKey.create(aspectValue.getKey(), ctx)); |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 38 | } |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 39 | |
tomlu | 6ed4fd5 | 2018-04-03 10:01:10 -0700 | [diff] [blame] | 40 | /** The key of an AspectCompletionValue. */ |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 41 | @AutoValue |
tomlu | 6ed4fd5 | 2018-04-03 10:01:10 -0700 | [diff] [blame] | 42 | public abstract static class AspectCompletionKey implements SkyKey { |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 43 | public static AspectCompletionKey create( |
| 44 | AspectKey aspectKey, TopLevelArtifactContext topLevelArtifactContext) { |
| 45 | return new AutoValue_AspectCompletionValue_AspectCompletionKey( |
| 46 | aspectKey, topLevelArtifactContext); |
| 47 | } |
| 48 | |
| 49 | public abstract AspectKey aspectKey(); |
| 50 | public abstract TopLevelArtifactContext topLevelArtifactContext(); |
janakr | 5fb2a48 | 2018-03-02 17:48:57 -0800 | [diff] [blame] | 51 | |
| 52 | @Override |
| 53 | public SkyFunctionName functionName() { |
| 54 | return SkyFunctions.ASPECT_COMPLETION; |
| 55 | } |
Googler | bfd4e24 | 2016-07-15 22:23:37 +0000 | [diff] [blame] | 56 | } |
Dmitry Lomov | e2033b1 | 2015-08-19 16:57:49 +0000 | [diff] [blame] | 57 | } |