forked from lugg/react-native-config
-
Notifications
You must be signed in to change notification settings - Fork 1
/
react-native-config.podspec
57 lines (47 loc) · 1.96 KB
/
react-native-config.podspec
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# frozen_string_literal: true
require 'json'
package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
Pod::Spec.new do |s|
s.name = 'react-native-config'
s.version = package['version']
s.summary = 'Expose config variables to React Native apps'
s.author = 'Pedro Belo'
s.homepage = 'https://github.com/luggit/react-native-config'
s.license = 'MIT'
s.ios.deployment_target = '9.0'
s.tvos.deployment_target = '9.0'
s.source = { git: 'https://github.com/luggit/react-native-config.git', tag: "v#{s.version.to_s}" }
s.script_phase = {
name: 'Config codegen',
script: %(
set -ex
HOST_PATH="$SRCROOT/../.."
"${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig/BuildDotenvConfig.rb" "$HOST_PATH" "${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig"
),
execution_position: :before_compile,
input_files: ['$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/BuildDotenvConfig.rb'],
output_files: ['$BUILD_DIR/GeneratedInfoPlistDotEnv.h', '$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/GeneratedDotEnv.m']
}
s.requires_arc = true
s.default_subspec = 'App'
s.subspec 'App' do |app|
app.source_files = 'ios/**/*.{h,m}'
app.dependency 'React-Core'
end
# Use this subspec for iOS extensions that cannot use React dependency
s.subspec 'Extension' do |ext|
# Had to duplicate the script_phase since it wasn't being passed down. Not sure why
ext.script_phase = {
name: 'Config codegen',
script: %(
set -ex
HOST_PATH="$SRCROOT/../.."
"${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig/BuildDotenvConfig.rb" "$HOST_PATH" "${PODS_TARGET_SRCROOT}/ios/ReactNativeConfig"
),
execution_position: :before_compile,
input_files: ['$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/BuildDotenvConfig.rb'],
output_files: ['$PODS_TARGET_SRCROOT/ios/ReactNativeConfig/GeneratedDotEnv.m']
}
ext.source_files = ['ios/**/RNCConfig.{h,m}', 'ios/**/GeneratedDotEnv.m']
end
end