/* * Copyright (C) 2017 The Dagger Authors. * * 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 dagger.internal.codegen; import static com.google.auto.common.MoreElements.asType; import static com.google.common.collect.Sets.union; import static dagger.internal.codegen.base.ComponentAnnotation.rootComponentAnnotations; import static dagger.internal.codegen.binding.ComponentCreatorAnnotation.rootComponentCreatorAnnotations; import static java.util.Collections.disjoint; import com.google.auto.common.MoreElements; import com.google.common.collect.ImmutableSet; import dagger.internal.codegen.base.SourceFileGenerator; import dagger.internal.codegen.binding.BindingGraph; import dagger.internal.codegen.binding.ComponentDescriptor; import dagger.internal.codegen.binding.ComponentDescriptorFactory; import dagger.internal.codegen.validation.ComponentCreatorValidator; import dagger.internal.codegen.validation.ComponentValidator; import dagger.internal.codegen.validation.TypeCheckingProcessingStep; import dagger.internal.codegen.validation.ValidationReport; import java.lang.annotation.Annotation; import java.util.Set; import javax.annotation.processing.Messager; import javax.inject.Inject; import javax.lang.model.element.TypeElement; /** * A processing step that emits the API of a generated component, without any actual implementation. * *
When compiling a header jar (hjar), Bazel needs to run annotation processors that generate * API, like Dagger, to see what code they might output. Full {@link BindingGraph} analysis is * costly and unnecessary from the perspective of the header compiler; it's sole goal is to pass * along a slimmed down version of what will be the jar for a particular compilation, whether or not * that compilation succeeds. If it does not, the compilation pipeline will fail, even if header * compilation succeeded. * *
The components emitted by this processing step include all of the API elements exposed by the
* normal step. Method bodies are omitted as Turbine ignores them entirely.
*/
final class ComponentHjarProcessingStep extends TypeCheckingProcessingStep