Skip to content

Commit

Permalink
Improve tests for GenerateAutolinkingNewArchitecturesFileTask (#45510)
Browse files Browse the repository at this point in the history
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
  • Loading branch information
cortinico authored and facebook-github-bot committed Jul 18, 2024
1 parent aaeb7af commit fcd526d
Showing 1 changed file with 12 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,12 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
add_subdirectory(./a/directory/ aPackage_autolinked_build)
add_subdirectory(./another/directory/ anotherPackage_autolinked_build)
add_subdirectory(./another/directory/cxx/ anotherPackage_cxxmodule_autolinked_build)
set(AUTOLINKED_LIBRARIES
react_codegen_aPackage
react_codegen_anotherPackage
another_cxxModule
)
"""
.trimIndent(),
Expand Down Expand Up @@ -212,6 +214,8 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
#include "autolinking.h"
#include <aPackage.h>
#include <anotherPackage.h>
#include <react/renderer/components/anotherPackage/ComponentDescriptors.h>
#include <AnotherCxxModule.h>
namespace facebook {
namespace react {
Expand All @@ -229,12 +233,14 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
}
std::shared_ptr<TurboModule> autolinking_cxxModuleProvider(const std::string moduleName, const std::shared_ptr<CallInvoker>& jsInvoker) {
if (moduleName == AnotherCxxModule::kModuleName) {
return std::make_shared<AnotherCxxModule>(jsInvoker);
}
return nullptr;
}
void autolinking_registerProviders(std::shared_ptr<ComponentDescriptorProviderRegistry const> providerRegistry) {
providerRegistry->add(concreteComponentDescriptorProvider<AnotherPackageComponentDescriptor>());
return;
}
Expand Down Expand Up @@ -262,7 +268,10 @@ class GenerateAutolinkingNewArchitecturesFileTaskTest {
packageInstance = "new AnotherPackage()",
buildTypes = emptyList(),
libraryName = "anotherPackage",
componentDescriptors = emptyList(),
componentDescriptors = listOf("AnotherPackageComponentDescriptor"),
cmakeListsPath = "./another/directory/CMakeLists.txt",
cxxModuleCMakeListsPath = "./another/directory/cxx/CMakeLists.txt",
cxxModuleHeaderName = "AnotherCxxModule",
cxxModuleCMakeListsModuleName = "another_cxxModule",
))
}

0 comments on commit fcd526d

Please sign in to comment.