Support custom android_package_name in module codegen

Summary:
## Changes
All `rn_library(codegen_modules = True)` must now also specify native_module_android_package_name, like so:

```
rn_library(
  name = "FBAuth"
  codegen_modules = True,
  native_module_spec_name = "Foo",
  native_module_android_package_name = "com.facebook.fbreact.specs",
)
```

This will generate the FBAuth Java spec files under the appropriate directory: "com/facebook/fbreact/specs". It will also make the code-generated specs have the appropriate package name: "com.facebook.fbreact.specs".

Changelog: [Internal]

Reviewed By: shergin

Differential Revision: D25723176

fbshipit-source-id: 6efec1cbee43d70110c0ef23e2422e08609b61d4
This commit is contained in:
Ramanpreet Nara
2020-12-29 13:04:36 -08:00
committed by Facebook GitHub Bot
parent 6740b22ab0
commit 4c734d1e8d
12 changed files with 61 additions and 15 deletions
@@ -371,11 +371,12 @@ module.exports = {
packageName?: string,
): FilesOutput {
const files = new Map();
const normalizedPackageName =
packageName != null ? packageName : 'com.facebook.fbreact.specs';
const outputDir = `java/${normalizedPackageName.replace(/\./g, '/')}`;
const nativeModules = getModules(schema);
const normalizedPackageName =
packageName == null ? 'com.facebook.fbreact.specs' : packageName;
const outputDir = `java/${normalizedPackageName.replace(/\./g, '/')}`;
Object.keys(nativeModules).forEach(hasteModuleName => {
const {
aliases,