From 0a7427f5990fc501932a8086591e445a036b6e66 Mon Sep 17 00:00:00 2001 From: Jonathan Keljo Date: Tue, 14 Mar 2017 11:07:54 -0700 Subject: [PATCH] Migrate ReactAndroid to use Buck's new java_annotation_processor rule Reviewed By: asp2insp Differential Revision: D4654756 fbshipit-source-id: d98d55786d84cf02234699a260e8750305982267 --- ReactAndroid/DEFS | 22 +++++-------------- .../com/facebook/react/module/processing/BUCK | 16 ++++++++++---- .../java/com/facebook/react/processing/BUCK | 16 ++++++++++---- 3 files changed, 30 insertions(+), 24 deletions(-) diff --git a/ReactAndroid/DEFS b/ReactAndroid/DEFS index 632167ab7..d54f4a601 100644 --- a/ReactAndroid/DEFS +++ b/ReactAndroid/DEFS @@ -46,38 +46,28 @@ original_android_library=android_library def android_library( name, deps=[], - annotation_processors=[], - annotation_processor_deps=[], + plugins=[] *args, **kwargs): if react_native_target('java/com/facebook/react/uimanager/annotations:annotations') in deps and name != 'processing': - react_property_processors = [ - 'com.facebook.react.processing.ReactPropertyProcessor', - ] - react_property_processor_deps = [ + react_property_plugins = [ react_native_target('java/com/facebook/react/processing:processing'), ] - annotation_processors = list(set(annotation_processors + react_property_processors)) - annotation_processor_deps = list(set(annotation_processor_deps + react_property_processor_deps)) + plugins = list(set(plugins + react_property_plugins)) if react_native_target('java/com/facebook/react/module/annotations:annotations') in deps and name != 'processing': - react_module_processors = [ - 'com.facebook.react.module.processing.ReactModuleSpecProcessor', - ] - react_module_processor_deps = [ + react_module_plugins = [ react_native_target('java/com/facebook/react/module/processing:processing'), ] - annotation_processors = list(set(annotation_processors + react_module_processors)) - annotation_processor_deps = list(set(annotation_processor_deps + react_module_processor_deps)) + plugins = list(set(plugins + react_module_plugins)) original_android_library( name=name, deps=deps, - annotation_processors=annotation_processors, - annotation_processor_deps=annotation_processor_deps, + plugins=plugins, *args, **kwargs) diff --git a/ReactAndroid/src/main/java/com/facebook/react/module/processing/BUCK b/ReactAndroid/src/main/java/com/facebook/react/module/processing/BUCK index bed89ebeb..92ee442d7 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/module/processing/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/module/processing/BUCK @@ -1,13 +1,21 @@ include_defs("//ReactAndroid/DEFS") -java_library( +java_annotation_processor( name = "processing", - srcs = glob(["*.java"]), - source = "7", - target = "7", + processor_class = "com.facebook.react.module.processing.ReactModuleSpecProcessor", visibility = [ "PUBLIC", ], + deps = [ + ":processing-lib", + ], +) + +java_library( + name = "processing-lib", + srcs = glob(["*.java"]), + source = "7", + target = "7", deps = [ react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/javapoet:javapoet"), diff --git a/ReactAndroid/src/main/java/com/facebook/react/processing/BUCK b/ReactAndroid/src/main/java/com/facebook/react/processing/BUCK index b2d3f6dba..7f7c396dd 100644 --- a/ReactAndroid/src/main/java/com/facebook/react/processing/BUCK +++ b/ReactAndroid/src/main/java/com/facebook/react/processing/BUCK @@ -1,13 +1,21 @@ include_defs("//ReactAndroid/DEFS") -java_library( +java_annotation_processor( name = "processing", - srcs = glob(["*.java"]), - source = "7", - target = "7", + processor_class = "com.facebook.react.processing.ReactPropertyProcessor", visibility = [ "PUBLIC", ], + deps = [ + ":processing-lib", + ], +) + +java_library( + name = "processing-lib", + srcs = glob(["*.java"]), + source = "7", + target = "7", deps = [ react_native_dep("third-party/java/infer-annotations:infer-annotations"), react_native_dep("third-party/java/javapoet:javapoet"),