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

Codegen for Android does not output flat struct for rn-gradle-plugin #638

Closed
1 of 2 tasks
ospfranco opened this issue Sep 23, 2024 · 6 comments
Closed
1 of 2 tasks
Labels
bug Something isn't working

Comments

@ospfranco
Copy link

ospfranco commented Sep 23, 2024

Description

I'm trying to write a CPP Turbo Module. I have the following config that generates the files under android/generated:

OSP 000369

However, when I try to build my app, I get the following error:

OSP 000368

Which then throws the following error:

OSP 000370

You can see the folder structure under android/generated does not match. Am I doing something wrong?

Packages

  • create-react-native-library
  • react-native-builder-bob

Selected options

C++ Turbo Module with Vanilla app

Link to repro

Environment

System:
  OS: macOS 15.0
  CPU: (11) arm64 Apple M3 Pro
  Memory: 919.00 MB / 36.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 18.20.2
    path: ~/.local/share/mise/installs/node/18/bin/node
  Yarn:
    version: 3.6.1
    path: ~/.local/share/mise/installs/node/18/bin/yarn
  npm:
    version: 10.5.0
    path: ~/.local/share/mise/installs/node/18/bin/npm
  Watchman:
    version: 2024.06.24.00
    path: /opt/homebrew/bin/watchman
Managers:
  CocoaPods:
    version: 1.15.2
    path: /Users/osp/.local/share/mise/installs/ruby/3/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.0
      - iOS 18.0
      - macOS 15.0
      - tvOS 18.0
      - visionOS 2.0
      - watchOS 11.0
  Android SDK:
    API Levels:
      - "33"
      - "34"
    Build Tools:
      - 30.0.3
      - 33.0.0
      - 33.0.1
      - 34.0.0
      - 35.0.0
    System Images:
      - android-33 | Google Play ARM 64 v8a
    Android NDK: 26.1.10909125
IDEs:
  Android Studio: 2024.1 AI-241.19072.14.2412.12360217
  Xcode:
    version: 16.0/16A242d
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 17.0.11
    path: /usr/bin/javac
  Ruby:
    version: 3.3.1
    path: /Users/osp/.local/share/mise/installs/ruby/3/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react:
    installed: 18.3.1
    wanted: 18.3.1
  react-native:
    installed: 0.75.2
    wanted: 0.75.2
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: Not found
  newArchEnabled: Not found
@ospfranco ospfranco added the bug Something isn't working label Sep 23, 2024
@okwasniewski
Copy link
Member

Hey, outputDir is not specific to bob (PR introducing it: facebook/react-native#41782), so if you are running into issues you should probably open a PR in React Native repository.

@ospfranco
Copy link
Author

Thanks for taking a look @okwasniewski!

Yeah, after looking at the code I realized it comes from RN itself, just thought maybe bob modified the generation process further (other than patching the package). If it's not I will go spelunking myself.

Another question, what does the following object do in the package.json?

  "create-react-native-library": {
    "type": "module-new",
    "languages": "cpp",
    "version": "0.41.1"
  }

It is important somehow?

@ospfranco
Copy link
Author

Also, as a side note, this is not properly implemented in bob I believe. Pure RN allows to nos specify the path, but the patchCodegen.js script fails if no output path is specified, maybe this is messing up the generation for my use case.

@okwasniewski
Copy link
Member

Yeah, after looking at the code I realized it comes from RN itself, just thought maybe bob modified the generation process further (other than patching the package). If it's not I will go spelunking myself.

I will cc @atlj because I don't have inside knowledge about this.

Another question, what does the following object do in the package.json?

  "create-react-native-library": {
    "type": "module-new",
    "languages": "cpp",
    "version": "0.41.1"
  }

This was introduced by @atlj here: #551

It's going to be used in the future for a library upgrade helper 👀

@ospfranco
Copy link
Author

ok, I understand, thanks for clarifying. Can you give me a hand and tell me what does:

npx bob build --target codegen

do? Like, what's exactly is it calling. From what I can see in the filesystem bob is a binary of some sorts but it would be good which command it calls so I know how the codegen is being generated, much appreciated!

@ospfranco
Copy link
Author

Hmm I just re-generated my sources and everything is compiling just fine, weird. I will close this for now, re-open if necessary.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants