Browse Source

fixing react debug detox, verbose travis build

Daniel Zlotin 7 years ago
parent
commit
1c51df8d84
3 changed files with 37 additions and 3 deletions
  1. 1
    0
      .travis.yml
  2. 32
    0
      playground/scripts/detoxDebugFix.rb
  3. 4
    3
      playground/scripts/e2e.ios.js

+ 1
- 0
.travis.yml View File

@@ -39,6 +39,7 @@ install:
39 39
   - yarn install
40 40
 
41 41
 script:
42
+  - set -x
42 43
   - yarn run lint
43 44
   - yarn run test-js
44 45
   - ./scripts/installAndroidSDK.sh

+ 32
- 0
playground/scripts/detoxDebugFix.rb View File

@@ -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()

+ 4
- 3
playground/scripts/e2e.ios.js View File

@@ -13,15 +13,15 @@ function hackReactXcodeScript() {
13 13
 
14 14
 function buildProjForDetox() {
15 15
   const scheme = release ? `playground_release_Detox` : `playground_Detox`;
16
-  const args = release ? '' : `GCC_PREPROCESSOR_DEFINITIONS="DEBUG=1 RCT_DEBUG=1 RCT_DEV=1 RCT_NSASSERT=1"`;
16
+
17
+  shellUtils.exec.execSync(`./scripts/detoxDebugFix.rb ${release ? '' : 'debug'}`);
17 18
 
18 19
   shellUtils.exec.execSync(`RCT_NO_LAUNCH_PACKAGER=true
19 20
           cd ios && xcodebuild
20 21
             -scheme ${scheme} build
21 22
             -project playground.xcodeproj
22 23
             -sdk iphonesimulator
23
-            -derivedDataPath ./DerivedData/playground
24
-            ${args}`);
24
+            -derivedDataPath ./DerivedData/playground`);
25 25
 }
26 26
 
27 27
 function e2e() {
@@ -38,6 +38,7 @@ function e2e() {
38 38
                                 --recursive
39 39
                                 --compilers js:babel-register`);
40 40
   } finally {
41
+    shellUtils.exec.execSync(`./scripts/detoxDebugFix.rb`);
41 42
     shellUtils.exec.kill(`detox-server`);
42 43
     if (release) {
43 44
       shellUtils.exec.kill(`Simulator`);