Damien Martin-Guillerez | f88f4d8 | 2015-09-25 13:56:55 +0000 | [diff] [blame] | 1 | // Copyright 2014 The Bazel Authors. All rights reserved. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [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.pkgcache; |
| 15 | |
Ulf Adams | de3e9d5 | 2016-02-10 12:07:44 +0000 | [diff] [blame] | 16 | import com.google.common.base.Preconditions; |
| 17 | import com.google.common.collect.ImmutableSet; |
Lukacs Berki | 6e91eb9 | 2015-09-21 09:12:37 +0000 | [diff] [blame] | 18 | import com.google.devtools.build.lib.cmdline.Label; |
Klaus Aehlig | 949b7b5 | 2017-02-27 13:56:15 +0000 | [diff] [blame] | 19 | import com.google.devtools.build.lib.events.ExtendedEventHandler; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 20 | |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 21 | /** |
| 22 | * This event is fired after the loading phase is complete. |
| 23 | */ |
Klaus Aehlig | 949b7b5 | 2017-02-27 13:56:15 +0000 | [diff] [blame] | 24 | public final class LoadingPhaseCompleteEvent implements ExtendedEventHandler.Postable { |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 25 | private final ImmutableSet<Label> labels; |
| 26 | private final ImmutableSet<Label> filteredLabels; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 27 | |
| 28 | /** |
| 29 | * Construct the event. |
| 30 | * |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 31 | * @param labels the set of active targets that remain |
| 32 | * @param filteredLabels the set of filtered targets |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 33 | */ |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 34 | public LoadingPhaseCompleteEvent( |
| 35 | ImmutableSet<Label> labels, |
| 36 | ImmutableSet<Label> filteredLabels) { |
| 37 | this.labels = Preconditions.checkNotNull(labels); |
| 38 | this.filteredLabels = Preconditions.checkNotNull(filteredLabels); |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 39 | } |
| 40 | |
| 41 | /** |
| 42 | * @return The set of active target labels remaining, which is a subset of the |
| 43 | * targets we attempted to load. |
| 44 | */ |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 45 | public ImmutableSet<Label> getLabels() { |
| 46 | return labels; |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 47 | } |
| 48 | |
| 49 | /** |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 50 | * @return The set of filtered targets. |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 51 | */ |
ulfjack | 8483758 | 2018-07-24 05:19:34 -0700 | [diff] [blame] | 52 | public ImmutableSet<Label> getFilteredLabels() { |
| 53 | return filteredLabels; |
| 54 | } |
Han-Wen Nienhuys | d08b27f | 2015-02-25 16:45:20 +0100 | [diff] [blame] | 55 | } |