blob: a4732eddff36e40c218a0d09f92ac8547a292ac8 [file] [log] [blame]
shreyaxdcae7dc2018-10-02 12:56:15 -07001// Copyright 2018 The Bazel Authors. All rights reserved.
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.
14package com.google.devtools.build.lib.skyframe;
15
16import com.google.auto.value.AutoValue;
17import com.google.common.collect.Interner;
18import com.google.devtools.build.lib.cmdline.PackageIdentifier;
19import com.google.devtools.build.lib.concurrent.BlazeInterners;
20import com.google.devtools.build.lib.skyframe.serialization.autocodec.AutoCodec;
21import com.google.devtools.build.skyframe.SkyFunctionName;
22import com.google.devtools.build.skyframe.SkyKey;
23import com.google.devtools.build.skyframe.SkyValue;
24
25/** Dummy {@link SkyValue} for {@link CollectTestSuitesInPackageFunction}. */
26public class CollectTestSuitesInPackageValue implements SkyValue {
27 @AutoCodec
28 public static final CollectTestSuitesInPackageValue INSTANCE =
29 new CollectTestSuitesInPackageValue();
30
31 private CollectTestSuitesInPackageValue() {}
32
33 /**
34 * Creates a key for evaluation of {@link CollectTargetsInPackageFunction}. See that class's
35 * comment for what callers should have done beforehand.
36 */
37 public static Key key(PackageIdentifier packageId) {
38 return Key.create(packageId);
39 }
40
41 /** {@link SkyKey} argument. */
42 @AutoValue
43 @AutoCodec
44 public abstract static class Key implements SkyKey {
45 private static final Interner<Key> interner = BlazeInterners.newWeakInterner();
46
47 @AutoCodec.VisibleForSerialization
48 @AutoCodec.Instantiator
49 static Key create(PackageIdentifier packageId) {
50 return interner.intern(new AutoValue_CollectTestSuitesInPackageValue_Key(packageId));
51 }
52
53 public abstract PackageIdentifier getPackageId();
54
55 @Override
56 public SkyFunctionName functionName() {
57 return SkyFunctions.COLLECT_TEST_SUITES_IN_PACKAGE;
58 }
59 }
60}