|
@@ -0,0 +1,32 @@
|
|
1
|
+#!/usr/bin/env ruby
|
|
2
|
+
|
|
3
|
+require 'pathname'
|
|
4
|
+
|
|
5
|
+$LOAD_PATH.unshift(__dir__ + "/../node_modules/detox/scripts/Xcodeproj/lib")
|
|
6
|
+$LOAD_PATH.unshift(__dir__ + "/../node_modules/detox/scripts/Nanaimo/lib")
|
|
7
|
+
|
|
8
|
+require 'xcodeproj'
|
|
9
|
+
|
|
10
|
+isAlwaysDebug = ARGV.count > 0 && ARGV[0].to_s.eql?('debug')
|
|
11
|
+
|
|
12
|
+project = Xcodeproj::Project.open(__dir__ + "/../node_modules/react-native/React/React.xcodeproj")
|
|
13
|
+
|
|
14
|
+debug_preprocessor_macros = project.build_configuration_list['Debug'].build_settings['GCC_PREPROCESSOR_DEFINITIONS']
|
|
15
|
+release_preprocessor_macros = project.build_configuration_list['Release'].build_settings['GCC_PREPROCESSOR_DEFINITIONS']
|
|
16
|
+
|
|
17
|
+unless debug_preprocessor_macros.kind_of?(Array)
|
|
18
|
+ debug_preprocessor_macros = [debug_preprocessor_macros]
|
|
19
|
+end
|
|
20
|
+unless release_preprocessor_macros.kind_of?(Array)
|
|
21
|
+ release_preprocessor_macros = [release_preprocessor_macros]
|
|
22
|
+end
|
|
23
|
+
|
|
24
|
+if isAlwaysDebug then
|
|
25
|
+ release_preprocessor_macros = release_preprocessor_macros | debug_preprocessor_macros
|
|
26
|
+else
|
|
27
|
+ release_preprocessor_macros = release_preprocessor_macros - debug_preprocessor_macros
|
|
28
|
+end
|
|
29
|
+
|
|
30
|
+project.build_configuration_list['Release'].build_settings['GCC_PREPROCESSOR_DEFINITIONS'] = release_preprocessor_macros
|
|
31
|
+
|
|
32
|
+raise "Error: Unable to save Xcode project" unless project.save()
|