-
Notifications
You must be signed in to change notification settings - Fork 24.7k
Enable module annotation processor with gradle #25922
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
janicduplessis
wants to merge
18
commits into
facebook:main
from
janicduplessis:annotations-compiler
Closed
Changes from all commits
Commits
Show all changes
18 commits
Select commit
Hold shift + click to select a range
f22b014
Enable module annotation processor in OSS
janicduplessis 75eb573
Update to Java 11
janicduplessis be53dbd
Update template/android/settings.gradle
janicduplessis 47dc67e
Update template/android/settings.gradle
janicduplessis bf6b6b9
Fix template settings.gradle
janicduplessis 591e39b
Use includeBuild for annotations processor
janicduplessis 56d262a
Test kapt
janicduplessis 1c1cac3
Revert "Test kapt"
janicduplessis 9d3c1e2
Update packages/annotations-compiler/annotations/src/main/java/com/fa…
janicduplessis d5345e5
Update packages/annotations-compiler/compiler/build.gradle
janicduplessis a4bbf85
Update packages/annotations-compiler/annotations/build.gradle
janicduplessis a9dbe63
Update packages/annotations-compiler/annotations/src/main/java/com/fa…
janicduplessis 01e8c9c
Update ReactAndroid/src/main/third-party/java/javapoet/BUCK
janicduplessis 5b98d3e
Update ReactAndroid/src/main/third-party/java/infer-annotations/BUCK
janicduplessis c489008
Remove dep substitution
janicduplessis 9cb21c3
Update packages/annotations-compiler/annotations/src/main/java/com/fa…
janicduplessis 2fa1a6a
Update packages/annotations-compiler/annotations/src/main/java/com/fa…
janicduplessis 1249eed
fix
janicduplessis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 3 additions & 6 deletions
9
ReactAndroid/src/main/java/com/facebook/react/module/annotations/BUCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_android_library") | ||
load("//tools/build_defs/oss:rn_defs.bzl", "rn_android_library") | ||
|
||
rn_android_library( | ||
name = "annotations", | ||
srcs = glob(["**/*.java"]), | ||
autoglob = False, | ||
labels = ["supermodule:xplat/default/public.react_native.infra"], | ||
required_for_source_only_abi = True, | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
react_native_dep("third-party/java/infer-annotations:infer-annotations"), | ||
react_native_dep("third-party/java/jsr-305:jsr-305"), | ||
react_native_target("java/com/facebook/react/bridge:interfaces"), | ||
exported_deps = [ | ||
"//packages/annotations-compiler/annotations/src/main/java/com/facebook/react/module/annotations:annotations", | ||
], | ||
) |
7 changes: 3 additions & 4 deletions
7
ReactAndroid/src/main/java/com/facebook/react/module/model/BUCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,13 @@ | ||
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "rn_android_library") | ||
load("//tools/build_defs/oss:rn_defs.bzl", "rn_android_library") | ||
|
||
rn_android_library( | ||
name = "model", | ||
srcs = glob(["**/*.java"]), | ||
autoglob = False, | ||
labels = ["supermodule:xplat/default/public.react_native.infra"], | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
react_native_dep("third-party/java/jsr-305:jsr-305"), | ||
exported_deps = [ | ||
"//packages/annotations-compiler/annotations/src/main/java/com/facebook/react/module/model:model", | ||
], | ||
) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
32 changes: 32 additions & 0 deletions
32
packages/annotations-compiler/annotations-compiler/build.gradle
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
repositories { | ||
google() | ||
mavenCentral() | ||
} | ||
|
||
apply plugin: 'java' | ||
|
||
group = "com.facebook.react" | ||
|
||
sourceSets.configureEach { sourceSet -> | ||
tasks.named(sourceSet.compileJavaTaskName).configure { | ||
options.annotationProcessorGeneratedSourcesDirectory = file("$buildDir/generated/sources/annotationProcessor/java/${sourceSet.name}") | ||
} | ||
} | ||
|
||
java { | ||
sourceCompatibility(JavaVersion.VERSION_11) | ||
targetCompatibility(JavaVersion.VERSION_11) | ||
} | ||
|
||
dependencies { | ||
implementation('com.squareup:javapoet:1.13.0') | ||
implementation('com.facebook.infer.annotation:infer-annotation:0.18.0') | ||
implementation('com.facebook.react:annotations') | ||
} |
20 changes: 20 additions & 0 deletions
20
...ons-compiler/annotations-compiler/src/main/java/com/facebook/react/module/processing/BUCK
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
load("//tools/build_defs/oss:rn_defs.bzl", "react_native_dep", "react_native_target", "rn_java_library") | ||
|
||
rn_java_library( | ||
name = "processing-lib", | ||
srcs = glob(["*.java"]), | ||
labels = ["supermodule:xplat/default/public.react_native.infra"], | ||
source = "8", | ||
target = "8", | ||
visibility = [ | ||
"PUBLIC", | ||
], | ||
deps = [ | ||
react_native_dep("third-party/java/infer-annotations:infer-annotations"), | ||
react_native_dep("third-party/java/javapoet:javapoet"), | ||
react_native_dep("third-party/java/jsr-305:jsr-305"), | ||
react_native_target("java/com/facebook/react/module/annotations:annotations"), | ||
react_native_target("java/com/facebook/react/module/model:model"), | ||
react_native_target("java/com/facebook/react/turbomodule/core/interfaces:interfaces"), | ||
], | ||
) |
File renamed without changes.
1 change: 1 addition & 0 deletions
1
...tions-compiler/src/main/resources/META-INF/services/javax.annotation.processing.Processor
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
com.facebook.react.module.processing.ReactModuleSpecProcessor |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
/* | ||
* Copyright (c) Meta Platforms, Inc. and affiliates. | ||
* | ||
* This source code is licensed under the MIT license found in the | ||
* LICENSE file in the root directory of this source tree. | ||
*/ | ||
|
||
apply plugin: 'java' | ||
|
||
group = "com.facebook.react" | ||
|
||
dependencies { | ||
|
||
} | ||
|
||
java { | ||
sourceCompatibility(JavaVersion.VERSION_11) | ||
targetCompatibility(JavaVersion.VERSION_11) | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.