Skip to content

Commit fcd526d

Browse files
cortinicofacebook-github-bot
authored andcommitted
Improve tests for GenerateAutolinkingNewArchitecturesFileTask (#45510)
Summary: Pull Request resolved: #45510 This is just a quality of life improvement, where we test the C++ autolinking code generation a bit more. Changelog: [Internal] [Changed] - Improve tests for GenerateAutolinkingNewArchitecturesFileTask Reviewed By: blakef Differential Revision: D59907847 fbshipit-source-id: e6367cc3b1c01700310437b73bc984e3666b3499
1 parent aaeb7af commit fcd526d

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

packages/gradle-plugin/react-native-gradle-plugin/src/test/kotlin/com/facebook/react/tasks/GenerateAutolinkingNewArchitecturesFileTaskTest.kt

+12-3
Original file line numberDiff line numberDiff line change
@@ -139,10 +139,12 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
139139
140140
add_subdirectory(./a/directory/ aPackage_autolinked_build)
141141
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
142+
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)
142143
143144
set(AUTOLINKED_LIBRARIES
144145
react_codegen_aPackage
145146
react_codegen_anotherPackage
147+
another_cxxModule
146148
)
147149
"""
148150
.trimIndent(),
@@ -212,6 +214,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
212214
#include "autolinking.h"
213215
#include <aPackage.h>
214216
#include <anotherPackage.h>
217+
#include <react/renderer/components/anotherPackage/ComponentDescriptors.h>
218+
#include <AnotherCxxModule.h>
215219
216220
namespace facebook {
217221
namespace react {
@@ -229,12 +233,14 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
229233
}
230234
231235
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker) {
232-
236+
if (moduleName == AnotherCxxModule::kModuleName) {
237+
return std::make_shared<AnotherCxxModule>(jsInvoker);
238+
}
233239
return nullptr;
234240
}
235241
236242
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry) {
237-
243+
providerRegistry->add(concreteComponentDescriptorProvider<AnotherPackageComponentDescriptor>());
238244
return;
239245
}
240246
@@ -262,7 +268,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
262268
packageInstance = "new AnotherPackage()",
263269
buildTypes = emptyList(),
264270
libraryName = "anotherPackage",
265-
componentDescriptors = emptyList(),
271+
componentDescriptors = listOf("AnotherPackageComponentDescriptor"),
266272
cmakeListsPath = "./another/directory/CMakeLists.txt",
273+
cxxModuleCMakeListsPath = "./another/directory/cxx/CMakeLists.txt",
274+
cxxModuleHeaderName = "AnotherCxxModule",
275+
cxxModuleCMakeListsModuleName = "another_cxxModule",
267276
))
268277
}

0 commit comments

Comments
 (0)