Skip to content

Commit fe58737

Browse files
serjooosatya164
andauthored
fix(template): Add missing configutation for nitro-modules (#862)
### Summary While creating a nitro-module using `npx create-react-native-library@latest` and debugging issues I ran to, I [noticed](mrousavy/nitro#696 (comment)) there are missing configurations in the podspec. Mainly the following was missing when building a nitro-module: ```ruby s.source_files = [ # Implementation (Swift) "ios/**/*.{swift}", # Autolinking/Registration (Objective-C++) "ios/**/*.{m,mm}", # Implementation (C++ objects) "cpp/**/*.{hpp,cpp}", ] s.pod_target_xcconfig = { # C++ compiler flags, mainly for folly. "GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES" } s.dependency 'React-jsi' s.dependency 'React-callinvoker' ``` This fixes the compilation errors around not finding Folly, or the module not compiling. ### Test plan I tested this locally by running the tool and having the correct generated file. --------- Co-authored-by: Satyajit Sahoo <satyajit.happy@gmail.com>
1 parent 2233957 commit fe58737

File tree

1 file changed

+17
-1
lines changed

1 file changed

+17
-1
lines changed

packages/create-react-native-library/templates/native-common/{%- project.name %}.podspec

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,17 +13,33 @@ Pod::Spec.new do |s|
1313
s.platforms = { :ios => min_ios_version_supported }
1414
s.source = { :git => "<%- repo -%>.git", :tag => "#{s.version}" }
1515

16+
<% if (project.moduleConfig !== "nitro-modules") { -%>
1617
<% if (project.swift) { -%>
1718
s.source_files = "ios/**/*.{h,m,mm,swift}"
1819
<% } else { -%>
1920
s.source_files = "ios/**/*.{h,m,mm,cpp}"
2021
s.private_header_files = "ios/**/*.h"
2122
<% } -%>
23+
<% } -%>
24+
2225
<% if (project.moduleConfig === "nitro-modules") { -%>
26+
s.source_files = [
27+
"ios/**/*.{swift}",=
28+
"ios/**/*.{m,mm}",
29+
"cpp/**/*.{hpp,cpp}",
30+
]
31+
32+
s.pod_target_xcconfig = {
33+
# C++ compiler flags, mainly for folly.
34+
"GCC_PREPROCESSOR_DEFINITIONS" => "$(inherited) FOLLY_NO_CONFIG FOLLY_CFG_NO_COROUTINES"
35+
}
36+
37+
s.dependency 'React-jsi'
38+
s.dependency 'React-callinvoker'
2339
2440
load 'nitrogen/generated/ios/<%- project.name -%>+autolinking.rb'
2541
add_nitrogen_files(s)
2642
<% } -%>
2743
28-
install_modules_dependencies(s)
44+
install_modules_dependencies(s)
2945
end

0 commit comments

Comments
 (0)