@@ -23,24 +23,36 @@ export async function resolveDependencyConfigImplAndroidAsync(
2323 const sourceDir = reactNativeConfig ?. sourceDir || 'android' ;
2424 const androidDir = path . join ( packageRoot , sourceDir ) ;
2525 const { gradle, manifest } = await findGradleAndManifestAsync ( { androidDir, isLibrary : true } ) ;
26- if ( ! manifest && ! gradle ) {
27- return null ;
28- }
2926
30- const packageName =
31- reactNativeConfig ?. packageName || ( await parsePackageNameAsync ( androidDir , manifest , gradle ) ) ;
32- if ( ! packageName ) {
27+ const isPureCxxDependency =
28+ reactNativeConfig ?. cxxModuleCMakeListsModuleName != null &&
29+ reactNativeConfig ?. cxxModuleCMakeListsPath != null &&
30+ reactNativeConfig ?. cxxModuleHeaderName != null &&
31+ ! manifest &&
32+ ! gradle ;
33+
34+ if ( ! manifest && ! gradle && ! isPureCxxDependency ) {
3335 return null ;
3436 }
35- const nativePackageClassName = await parseNativePackageClassNameAsync ( packageRoot , androidDir ) ;
36- if ( ! nativePackageClassName ) {
37- return null ;
37+
38+ let packageInstance : string | null = null ;
39+ let packageImportPath : string | null = null ;
40+ if ( ! isPureCxxDependency ) {
41+ const packageName =
42+ reactNativeConfig ?. packageName || ( await parsePackageNameAsync ( androidDir , manifest , gradle ) ) ;
43+ if ( ! packageName ) {
44+ return null ;
45+ }
46+ const nativePackageClassName = await parseNativePackageClassNameAsync ( packageRoot , androidDir ) ;
47+ if ( ! nativePackageClassName ) {
48+ return null ;
49+ }
50+ packageImportPath =
51+ reactNativeConfig ?. packageImportPath || `import ${ packageName } .${ nativePackageClassName } ;` ;
52+ packageInstance = reactNativeConfig ?. packageInstance || `new ${ nativePackageClassName } ()` ;
3853 }
3954
4055 const packageJson = JSON . parse ( await fs . readFile ( path . join ( packageRoot , 'package.json' ) , 'utf8' ) ) ;
41- const packageImportPath =
42- reactNativeConfig ?. packageImportPath || `import ${ packageName } .${ nativePackageClassName } ;` ;
43- const packageInstance = reactNativeConfig ?. packageInstance || `new ${ nativePackageClassName } ()` ;
4456 const buildTypes = reactNativeConfig ?. buildTypes || [ ] ;
4557 const dependencyConfiguration = reactNativeConfig ?. dependencyConfiguration ;
4658 const libraryName =
@@ -75,6 +87,7 @@ export async function resolveDependencyConfigImplAndroidAsync(
7587 cxxModuleCMakeListsModuleName,
7688 cxxModuleCMakeListsPath,
7789 cxxModuleHeaderName,
90+ isPureCxxDependency,
7891 } ;
7992 if ( ! result . libraryName ) {
8093 delete result . libraryName ;
0 commit comments