Skip to content
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

[0.71] Gradle task ":app:generateCodegenArtifactsFromSchema" is being skipped #35874

Closed
atar9500 opened this issue Jan 18, 2023 · 3 comments
Closed
Labels
💻CLI Impact: Bug The issue represents a bug somewhere Resolution: Fixed A PR that fixes this issue has been merged. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)

Comments

@atar9500
Copy link

atar9500 commented Jan 18, 2023

Description

As according to React Native's documentation, I'm trying to generate a TurboModules follows:

cd MyApp
yarn add ../RTNCalculator
cd android
./gradlew generateCodegenArtifactsFromSchema

When running ./gradlew generateCodegenArtifactsFromSchema it passes successfully, but no code is being generated in MyApp/node_modules/rtn-calculator/android/build/generated/source/codegen.

When running :app:generateCodegenArtifactsFromSchemathrough Android Studio I get these logs:

> Task :react-native-gradle-plugin:compileKotlin UP-TO-DATE
> Task :react-native-gradle-plugin:compileJava NO-SOURCE
> Task :react-native-gradle-plugin:pluginDescriptors UP-TO-DATE
> Task :react-native-gradle-plugin:processResources UP-TO-DATE
> Task :react-native-gradle-plugin:classes UP-TO-DATE
> Task :react-native-gradle-plugin:inspectClassesForKotlinIC UP-TO-DATE
> Task :react-native-gradle-plugin:jar UP-TO-DATE
> Task :app:buildCodegenCLI SKIPPED
> Task :app:generateCodegenSchemaFromJavaScript SKIPPED
> Task :app:generateCodegenArtifactsFromSchema SKIPPED

BUILD SUCCESSFUL in 2s
5 actionable tasks: 5 up-to-date

When running ./gradlew generateCodegenArtifactsFromSchema -d I get these logs:

2023-01-18T13:33:35.715+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:buildCodegenCLI' started
2023-01-18T13:33:35.715+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 
2023-01-18T13:33:35.715+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :app:buildCodegenCLI SKIPPED
2023-01-18T13:33:35.716+0100 [INFO] [org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter] Skipping task ':app:buildCodegenCLI' as task onlyIf is false.
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Task :app:buildCodegenCLI'
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:buildCodegenCLI' completed
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :app:buildCodegenCLI completed, executed: true
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :app:buildCodegenCLI finished executing
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on state of build :
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on task execution for build :
2023-01-18T13:33:35.716+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:buildCodegenCLI (Thread[included builds,5,main]) completed. Took 0.002 secs.
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on worker lease
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on state of build :
2023-01-18T13:33:35.716+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on task execution for build :
2023-01-18T13:33:35.720+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] Resolve mutations for :app:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 5,5,main]) started.
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node Resolve mutations for :app:generateCodegenSchemaFromJavaScript completed, executed: true
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node Resolve mutations for :app:generateCodegenSchemaFromJavaScript finished executing
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: released lock on state of build :
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: released lock on task execution for build :
2023-01-18T13:33:35.725+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] Resolve mutations for :app:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 5,5,main]) completed. Took 0.004 secs.
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on state of build :
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: acquired lock on task execution for build :
2023-01-18T13:33:35.725+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 5,5,main]) started.
2023-01-18T13:33:35.725+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:generateCodegenSchemaFromJavaScript' started
2023-01-18T13:33:35.727+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 2: acquired lock on worker lease
2023-01-18T13:33:35.727+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] No node could be selected, nodes ready: false
2023-01-18T13:33:35.727+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 2: released lock on worker lease
2023-01-18T13:33:35.729+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on worker lease
2023-01-18T13:33:35.725+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 
2023-01-18T13:33:35.725+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :app:generateCodegenSchemaFromJavaScript SKIPPED
2023-01-18T13:33:35.729+0100 [INFO] [org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter] Skipping task ':app:generateCodegenSchemaFromJavaScript' as task onlyIf is false.
2023-01-18T13:33:35.730+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Task :app:generateCodegenSchemaFromJavaScript'
2023-01-18T13:33:35.730+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:generateCodegenSchemaFromJavaScript' completed
2023-01-18T13:33:35.730+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :app:generateCodegenSchemaFromJavaScript completed, executed: true
2023-01-18T13:33:35.730+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node :app:generateCodegenSchemaFromJavaScript finished executing
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: released lock on state of build :
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 5: released lock on task execution for build :
2023-01-18T13:33:35.731+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:generateCodegenSchemaFromJavaScript (Thread[Execution worker Thread 5,5,main]) completed. Took 0.005 secs.
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on worker lease
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on state of build :
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on task execution for build :
2023-01-18T13:33:35.731+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] Resolve mutations for :app:generateCodegenArtifactsFromSchema (Thread[included builds,5,main]) started.
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 6: acquired lock on worker lease
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] No node could be selected, nodes ready: false
2023-01-18T13:33:35.731+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 6: released lock on worker lease
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node Resolve mutations for :app:generateCodegenArtifactsFromSchema completed, executed: true
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node Resolve mutations for :app:generateCodegenArtifactsFromSchema finished executing
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on state of build :
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: released lock on task execution for build :
2023-01-18T13:33:35.732+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] Resolve mutations for :app:generateCodegenArtifactsFromSchema (Thread[included builds,5,main]) completed. Took 0.0 secs.
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on state of build :
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] included builds: acquired lock on task execution for build :
2023-01-18T13:33:35.732+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] :app:generateCodegenArtifactsFromSchema (Thread[included builds,5,main]) started.
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:generateCodegenArtifactsFromSchema' started
2023-01-18T13:33:35.732+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] 
2023-01-18T13:33:35.732+0100 [LIFECYCLE] [class org.gradle.internal.buildevents.TaskExecutionLogger] > Task :app:generateCodegenArtifactsFromSchema SKIPPED
2023-01-18T13:33:35.732+0100 [INFO] [org.gradle.api.internal.tasks.execution.SkipOnlyIfTaskExecuter] Skipping task ':app:generateCodegenArtifactsFromSchema' as task onlyIf is false.
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Completing Build operation 'Task :app:generateCodegenArtifactsFromSchema'
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.operations.DefaultBuildOperationRunner] Build operation 'Task :app:generateCodegenArtifactsFromSchema' completed
2023-01-18T13:33:35.732+0100 [DEBUG] [org.gradle.internal.resources.AbstractTrackedResourceLock] Execution worker Thread 2: acquired lock on worker lease
2023-01-18T13:33:35.733+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] producer locations for task group 0 (Thread[Execution worker Thread 2,5,main]) started.
2023-01-18T13:33:35.733+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node producer locations for task group 0 completed, executed: true
2023-01-18T13:33:35.733+0100 [DEBUG] [org.gradle.execution.plan.DefaultExecutionPlan] Node producer locations for task group 0 finished executing
2023-01-18T13:33:35.733+0100 [INFO] [org.gradle.execution.plan.DefaultPlanExecutor] producer locations for task group 0 (Thread[Execution worker Thread 2,5,main]) completed. Took 0.0 secs.

Version

0.71.0

Output of npx react-native info

System:
    OS: macOS 13.1
    CPU: (8) arm64 Apple M1
    Memory: 90.75 MB / 16.00 GB
    Shell: 5.8.1 - /bin/zsh
  Binaries:
    Node: 19.4.0 - /opt/homebrew/bin/node
    Yarn: 1.22.19 - /opt/homebrew/bin/yarn
    npm: 9.2.0 - /opt/homebrew/bin/npm
    Watchman: 2023.01.09.00 - /opt/homebrew/bin/watchman
  Managers:
    CocoaPods: 1.11.3 - /usr/local/bin/pod
  SDKs:
    iOS SDK:
      Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
    Android SDK:
      API Levels: 31, 33, 33
      Build Tools: 30.0.3, 33.0.0, 33.0.1
      System Images: android-31 | ARM 64 v8a, android-31 | Google APIs ARM 64 v8a, android-31 | Google Play ARM 64 v8a
      Android NDK: Not Found
  IDEs:
    Android Studio: 2021.3 AI-213.7172.25.2113.9123335
    Xcode: 14.2/14C18 - /usr/bin/xcodebuild
  Languages:
    Java: 11.0.17 - /usr/bin/javac
  npmPackages:
    @react-native-community/cli: Not Found
    react: 18.2.0 => 18.2.0 
    react-native: 0.71.0 => 0.71.0 
    react-native-macos: Not Found
  npmGlobalPackages:
    *react-native*: Not Found

Steps to reproduce

  1. Create your Turbo Module according to documentation.
  2. Run the following:
cd MyApp
yarn add ../RTNCalculator
cd android
./gradlew generateCodegenArtifactsFromSchema

Snack, code example, screenshot, or link to a repository

https://github.com/atar9500/NewArchitectureDemo

@atar9500 atar9500 added Needs: Triage 🔍 Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules) labels Jan 18, 2023
@cortinico
Copy link
Contributor

Thanks for reporting this.
This is a bug in the CLI: react-native-community/cli#1800
(cc @thymikee)

The current workaround for you is the following:

cd MyApp && touch ../RTNCalculator/android/src/main/AndroidManifest.xml && yarn add ../RNTCalculator

Also to provide you context, it's ok that :app:generateCodegenArtifactsFromSchema is skipped (as the app is not declaring any turbomodules itself), while the task that should execute is :rtn-calculator:generateCodegenArtifactsFromSchema:

:app:buildCodegenCLI SKIPPED
:app:generateCodegenSchemaFromJavaScript SKIPPED
:app:generateCodegenArtifactsFromSchema SKIPPED
:rtn-calculator:buildCodegenCLI SKIPPED
:rtn-calculator:generateCodegenSchemaFromJavaScript
:rtn-calculator:generateCodegenArtifactsFromSchema

@cortinico cortinico added 💻CLI Impact: Bug The issue represents a bug somewhere and removed Needs: Triage 🔍 labels Jan 18, 2023
@atar9500
Copy link
Author

Thanks for reporting this. This is a bug in the CLI: react-native-community/cli#1800 (cc @thymikee)

The current workaround for you is the following:

cd MyApp && touch ../RTNCalculator/android/src/main/AndroidManifest.xml && yarn add ../RNTCalculator

Also to provide you context, it's ok that :app:generateCodegenArtifactsFromSchema is skipped (as the app is not declaring any turbomodules itself), while the task that should execute is :rtn-calculator:generateCodegenArtifactsFromSchema:

:app:buildCodegenCLI SKIPPED
:app:generateCodegenSchemaFromJavaScript SKIPPED
:app:generateCodegenArtifactsFromSchema SKIPPED
:rtn-calculator:buildCodegenCLI SKIPPED
:rtn-calculator:generateCodegenSchemaFromJavaScript
:rtn-calculator:generateCodegenArtifactsFromSchema

Thanks for letting me know.

Also, this workaround worked for me only when I added inside the AndroidMnifest.xml:

<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.rtncalculator">
</manifest>

@cortinico cortinico added the Resolution: Fixed A PR that fixes this issue has been merged. label Jan 19, 2023
@asdfv
Copy link

asdfv commented Dec 18, 2024

I had a similar issue when I followed Fabric guadline - build-folder was not generated in node-modules/my-package-name/android and generateCodegenArtifactsFromSchema was skipped.
The problem was that I mistakenly put the build.gradle file not in android folder of my package, but in the root (one level higher).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💻CLI Impact: Bug The issue represents a bug somewhere Resolution: Fixed A PR that fixes this issue has been merged. Type: New Architecture Issues and PRs related to new architecture (Fabric/Turbo Modules)
Projects
None yet
Development

No branches or pull requests

3 participants