Loading Android.mk +34 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ EXCLUDE_FILES := \ EXCLUDE_FILES += \ $(BASE_DIR)/contacts/common/format/testing/SpannedTestUtils.java # Exclude rootcomponentgenerator EXCLUDE_FILES += \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/processor) # Exclude build variants for now EXCLUDE_FILES += \ $(BASE_DIR)/dialer/constants/googledialer/ConstantsImpl.java \ Loading Loading @@ -147,10 +151,10 @@ LOCAL_ANNOTATION_PROCESSORS := \ dialer-guava \ dialer-javax-annotation-api \ dialer-javax-inject \ dialer-rootcomponentprocessor LOCAL_ANNOTATION_PROCESSOR_CLASSES := \ com.google.auto.value.processor.AutoValueProcessor,dagger.internal.codegen.ComponentProcessor,com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor com.google.auto.value.processor.AutoValueProcessor,dagger.internal.codegen.ComponentProcessor,com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor,com.android.dialer.rootcomponentgenerator.processor.RootComponentProcessor # Begin Bug: 37077388 LOCAL_DX_FLAGS := --multi-dex Loading Loading @@ -208,6 +212,8 @@ LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \ dialer-javax-annotation-api:../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar \ dialer-javax-inject:../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar \ dialer-javapoet:../../../prebuilts/tools/common/m2/repository/com/squareup/javapoet/1.8.0/javapoet-1.8.0.jar \ dialer-auto-service:../../../prebuilts/tools/common/m2/repository/com/google/auto/service/auto-service/1.0-rc2/auto-service-1.0-rc2.jar \ dialer-auto-common:../../../prebuilts/tools/common/m2/repository/com/google/auto/auto-common/0.9/auto-common-0.9.jar \ include $(BUILD_HOST_PREBUILT) Loading Loading @@ -425,3 +431,29 @@ include $(BUILD_PREBUILT) include $(CLEAR_VARS) LOCAL_MODULE := dialer-rootcomponentprocessor LOCAL_MODULE_CLASS := JAVA_LIBRARIES LOCAL_IS_HOST_MODULE := true BASE_DIR := java/com/android LOCAL_SRC_FILES := \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/annotation) \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/processor) LOCAL_STATIC_JAVA_LIBRARIES := \ dialer-guava \ dialer-dagger2 \ dialer-javapoet \ dialer-auto-service \ dialer-auto-common \ dialer-javax-annotation-api \ dialer-javax-inject $(info $(LOCAL_STATIC_JAVA_LIBRARIES)) LOCAL_JAVA_LANGUAGE_VERSION := 1.8 include $(BUILD_HOST_JAVA_LIBRARY) include $(CLEAR_VARS) java/com/android/dialer/rootcomponentgenerator/annotation/DialerComponent.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Annotates a type equivalent to {@link dagger.Subcomponent}. * * <p>The annotation processor will generate a new type file with some prefix, which contains public * static XXX get(Context context) method and HasComponent interface like: * * <p> * * <pre> * <code> * public static SimulatorComponent get(Context context) { * HasRootComponent hasRootComponent = (HasRootComponent) context.getApplicationContext(); * return ((HasComponent)(hasRootComponent.component()).simulatorComponent(); * } * public interface HasComponent { * SimulatorComponent simulatorComponent(); * } * </code> * </pre> */ @Target(ElementType.TYPE) public @interface DialerComponent { Class<?>[] modules() default {}; } java/com/android/dialer/rootcomponentgenerator/annotation/DialerRootComponent.java 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotates the place with this annotation when a RootComponent is needed. * * <p>Usually users put this annotation on application class that is root of dependencies (the last * thing to compile). The annotation processor will figure out what it needs to generate a variant * root through dependencies. * * <p>Example: * * <pre> * <code> * @DialerRootComponent(variant = DialerVariant.DIALER_AOSP) * public class RootDialerAosp {} * </code> * </pre> */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) public @interface DialerRootComponent { DialerVariant variant(); } java/com/android/dialer/rootcomponentgenerator/annotation/DialerVariant.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; /** Represents all dialer variants. */ public enum DialerVariant { // AOSP Dialer variants DIALER_AOSP("DialerAosp"), DIALER_AOSP_ESPRESSO("DialerAospEspresso"), DIALER_ROBOLECTRIC("DialerRobolectric"), // TEST variant will be used in situations where we need create in-test application class which // doesn't belong to any variants listed above DIALER_TEST("DialerTest"); private final String variant; DialerVariant(String variant) { this.variant = variant; } @Override public String toString() { return variant; } } java/com/android/dialer/rootcomponentgenerator/annotation/InstallIn.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Annotation for {@link dagger.Module dagger.Modules} which causes them to be installed in the * specified variants. * * <p>It has a parameter for users to enter on which variants annotated module will be installed and * also must be non-empty. Example: * * <pre> * <code> * @InstallIn(variants = {DialerVariant.DIALER_AOSP, DialerVariant.DIALER_TEST}) * public class Module1 {} * * </code> * </pre> */ @Target(ElementType.TYPE) public @interface InstallIn { DialerVariant[] variants(); } Loading
Android.mk +34 −2 Original line number Diff line number Diff line Loading @@ -37,6 +37,10 @@ EXCLUDE_FILES := \ EXCLUDE_FILES += \ $(BASE_DIR)/contacts/common/format/testing/SpannedTestUtils.java # Exclude rootcomponentgenerator EXCLUDE_FILES += \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/processor) # Exclude build variants for now EXCLUDE_FILES += \ $(BASE_DIR)/dialer/constants/googledialer/ConstantsImpl.java \ Loading Loading @@ -147,10 +151,10 @@ LOCAL_ANNOTATION_PROCESSORS := \ dialer-guava \ dialer-javax-annotation-api \ dialer-javax-inject \ dialer-rootcomponentprocessor LOCAL_ANNOTATION_PROCESSOR_CLASSES := \ com.google.auto.value.processor.AutoValueProcessor,dagger.internal.codegen.ComponentProcessor,com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor com.google.auto.value.processor.AutoValueProcessor,dagger.internal.codegen.ComponentProcessor,com.bumptech.glide.annotation.compiler.GlideAnnotationProcessor,com.android.dialer.rootcomponentgenerator.processor.RootComponentProcessor # Begin Bug: 37077388 LOCAL_DX_FLAGS := --multi-dex Loading Loading @@ -208,6 +212,8 @@ LOCAL_PREBUILT_STATIC_JAVA_LIBRARIES := \ dialer-javax-annotation-api:../../../prebuilts/tools/common/m2/repository/javax/annotation/javax.annotation-api/1.2/javax.annotation-api-1.2.jar \ dialer-javax-inject:../../../prebuilts/tools/common/m2/repository/javax/inject/javax.inject/1/javax.inject-1.jar \ dialer-javapoet:../../../prebuilts/tools/common/m2/repository/com/squareup/javapoet/1.8.0/javapoet-1.8.0.jar \ dialer-auto-service:../../../prebuilts/tools/common/m2/repository/com/google/auto/service/auto-service/1.0-rc2/auto-service-1.0-rc2.jar \ dialer-auto-common:../../../prebuilts/tools/common/m2/repository/com/google/auto/auto-common/0.9/auto-common-0.9.jar \ include $(BUILD_HOST_PREBUILT) Loading Loading @@ -425,3 +431,29 @@ include $(BUILD_PREBUILT) include $(CLEAR_VARS) LOCAL_MODULE := dialer-rootcomponentprocessor LOCAL_MODULE_CLASS := JAVA_LIBRARIES LOCAL_IS_HOST_MODULE := true BASE_DIR := java/com/android LOCAL_SRC_FILES := \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/annotation) \ $(call all-java-files-under, $(BASE_DIR)/dialer/rootcomponentgenerator/processor) LOCAL_STATIC_JAVA_LIBRARIES := \ dialer-guava \ dialer-dagger2 \ dialer-javapoet \ dialer-auto-service \ dialer-auto-common \ dialer-javax-annotation-api \ dialer-javax-inject $(info $(LOCAL_STATIC_JAVA_LIBRARIES)) LOCAL_JAVA_LANGUAGE_VERSION := 1.8 include $(BUILD_HOST_JAVA_LIBRARY) include $(CLEAR_VARS)
java/com/android/dialer/rootcomponentgenerator/annotation/DialerComponent.java 0 → 100644 +45 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Annotates a type equivalent to {@link dagger.Subcomponent}. * * <p>The annotation processor will generate a new type file with some prefix, which contains public * static XXX get(Context context) method and HasComponent interface like: * * <p> * * <pre> * <code> * public static SimulatorComponent get(Context context) { * HasRootComponent hasRootComponent = (HasRootComponent) context.getApplicationContext(); * return ((HasComponent)(hasRootComponent.component()).simulatorComponent(); * } * public interface HasComponent { * SimulatorComponent simulatorComponent(); * } * </code> * </pre> */ @Target(ElementType.TYPE) public @interface DialerComponent { Class<?>[] modules() default {}; }
java/com/android/dialer/rootcomponentgenerator/annotation/DialerRootComponent.java 0 → 100644 +44 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; import java.lang.annotation.Target; /** * Annotates the place with this annotation when a RootComponent is needed. * * <p>Usually users put this annotation on application class that is root of dependencies (the last * thing to compile). The annotation processor will figure out what it needs to generate a variant * root through dependencies. * * <p>Example: * * <pre> * <code> * @DialerRootComponent(variant = DialerVariant.DIALER_AOSP) * public class RootDialerAosp {} * </code> * </pre> */ @Target(ElementType.TYPE) @Retention(RetentionPolicy.SOURCE) public @interface DialerRootComponent { DialerVariant variant(); }
java/com/android/dialer/rootcomponentgenerator/annotation/DialerVariant.java 0 → 100644 +42 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; /** Represents all dialer variants. */ public enum DialerVariant { // AOSP Dialer variants DIALER_AOSP("DialerAosp"), DIALER_AOSP_ESPRESSO("DialerAospEspresso"), DIALER_ROBOLECTRIC("DialerRobolectric"), // TEST variant will be used in situations where we need create in-test application class which // doesn't belong to any variants listed above DIALER_TEST("DialerTest"); private final String variant; DialerVariant(String variant) { this.variant = variant; } @Override public String toString() { return variant; } }
java/com/android/dialer/rootcomponentgenerator/annotation/InstallIn.java 0 → 100644 +40 −0 Original line number Diff line number Diff line /* * Copyright (C) 2018 The Android Open Source Project * * 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 com.android.dialer.rootcomponentgenerator.annotation; import java.lang.annotation.ElementType; import java.lang.annotation.Target; /** * Annotation for {@link dagger.Module dagger.Modules} which causes them to be installed in the * specified variants. * * <p>It has a parameter for users to enter on which variants annotated module will be installed and * also must be non-empty. Example: * * <pre> * <code> * @InstallIn(variants = {DialerVariant.DIALER_AOSP, DialerVariant.DIALER_TEST}) * public class Module1 {} * * </code> * </pre> */ @Target(ElementType.TYPE) public @interface InstallIn { DialerVariant[] variants(); }