/* * 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.android.processor; import static net.ltgt.gradle.incap.IncrementalAnnotationProcessorType.ISOLATING; import androidx.room.compiler.processing.XProcessingEnv; import androidx.room.compiler.processing.XProcessingStep; import androidx.room.compiler.processing.javac.JavacBasicAnnotationProcessor; import com.google.auto.service.AutoService; import com.google.common.collect.ImmutableSet; import javax.annotation.processing.Processor; import javax.lang.model.SourceVersion; import net.ltgt.gradle.incap.IncrementalAnnotationProcessor; /** * An {@linkplain javax.annotation.processing.Processor annotation processor} to verify usage of * {@code dagger.android} code. * *
Additionally, if {@code -Adagger.android.experimentalUseStringKeys} is passed to the
* compilation, a file will be generated to support obfuscated injected Android types used with
* {@code @AndroidInjectionKey}. The fact that this is generated is deliberate: not all versions of
* ProGuard/R8 support {@code -identifiernamestring}, so we can't include a ProGuard file in the
* dagger-android artifact Instead, we generate the file in {@code META-INF/proguard} only when
* users enable the flag. They should only be enabling it if their shrinker supports those files,
* and any version that does so will also support {@code -identifiernamestring}. This was added to
* R8 in May
* 2018.
*/
@IncrementalAnnotationProcessor(ISOLATING)
@AutoService(Processor.class)
public final class AndroidProcessor extends JavacBasicAnnotationProcessor {
private final DelegateAndroidProcessor delegate = new DelegateAndroidProcessor();
@Override
public void initialize(XProcessingEnv env) {
delegate.initialize(env);
}
@Override
public Iterable