From d3e8e2a0e9818445e92ac07b237178835cfc481a Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 27 Apr 2023 13:52:55 +0100 Subject: [PATCH 01/25] Add naive start of config file implementation --- .../features/fixtures/app/scenario_js/app/App.js | 2 ++ .../fixtures/reactnative/module/BugsnagModule.java | 9 +++++++++ 2 files changed, 11 insertions(+) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index 9747702722..e1fd1aa677 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -13,6 +13,8 @@ import { export default class App extends Component { constructor (props) { super(props) + var config = NativeModules.BugsnagTestInterface.getFixtureConfig() + console.log(config) this.state = { currentScenario: '', scenarioMetaData: '', diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 802d286536..0c9eea607b 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -119,6 +119,15 @@ public void d(String msg, Throwable throwable) { promise.resolve(true); } + @ReactMethod + public String getFixtureConfig() { + Int configFileTimeout = 5000; + File externalFilesDir = reactContext.getExternalFilesDir(null); + File configFile = new File(externalFilesDir, "fixture_config.json"); + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file"); + return("Hello"); + } + private Configuration createConfiguration(ReadableMap options) { Configuration config = new Configuration(options.getString("apiKey")); config.setAutoTrackSessions(options.getBoolean("autoTrackSessions")); From 965ed4fdfcf42ecbaf6e7b60e3c2723c70182d41 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 27 Apr 2023 14:00:17 +0100 Subject: [PATCH 02/25] Move implementation into kotlin for simplicity --- .../fixtures/app/scenario_js/app/App.js | 2 +- .../reactnative/module/BugsnagModule.java | 9 ++--- .../reactnative/module/ConfigFileReader.kt | 34 +++++++++++++++++++ 3 files changed, 38 insertions(+), 7 deletions(-) create mode 100644 test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index e1fd1aa677..cb5f452f59 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -13,7 +13,7 @@ import { export default class App extends Component { constructor (props) { super(props) - var config = NativeModules.BugsnagTestInterface.getFixtureConfig() + var address = NativeModules.BugsnagTestInterface.getMazeRunnerAddress() console.log(config) this.state = { currentScenario: '', diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 0c9eea607b..50156e7568 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -120,12 +120,9 @@ public void d(String msg, Throwable throwable) { } @ReactMethod - public String getFixtureConfig() { - Int configFileTimeout = 5000; - File externalFilesDir = reactContext.getExternalFilesDir(null); - File configFile = new File(externalFilesDir, "fixture_config.json"); - Log.i("Bugsnag", "Attempting to read Maze Runner address from config file"); - return("Hello"); + public String getMazeRunnerAddress() { + ConfigFileReader configReader = new ConfigFileReader(); + return configReader.getMazeRunnerAddress(reactContext) } private Configuration createConfiguration(ReadableMap options) { diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt new file mode 100644 index 0000000000..45f90db88d --- /dev/null +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -0,0 +1,34 @@ +package com.reactnative.module + +import android.content.Context + +class ConfigFileReader { + + fun getMazeRunnerAddress(context: Context): String { + val externalFilesDir = context.getExternalFilesDir(null) + val configFile = File(externalFilesDir, "fixture_config.json") + log("Attempting to read Maze Runner address from config file ${configFile.path}") + + // Poll for the fixture config file + val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT + while (System.currentTimeMillis() < pollEnd) { + if (configFile.exists()) { + val fileContents = configFile.readText() + val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() + mazeAddress = getStringSafely(fixtureConfig, "maze_address") + if (!mazeAddress.isNullOrBlank()) { + log("Maze Runner address set from config file: $mazeAddress") + break + } + } + + Thread.sleep(250) + } + if (mazeAddress.isNullOrBlank()) { + log("Failed to read Maze Runner address from config file, reverting to legacy address") + mazeAddress = "bs-local.com:9339" + } + return mazeAddress + } + +} From 992ced337915b7cbc9c96b9ebc1d3315dd6fff9a Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 27 Apr 2023 16:01:29 +0100 Subject: [PATCH 03/25] Slight refactor for testing --- .../features/fixtures/app/scenario_js/app/App.js | 4 ++-- .../features/fixtures/ios-module/BugsnagModule.m | 7 +++++++ 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index cb5f452f59..ab50b43d8d 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -19,8 +19,8 @@ export default class App extends Component { currentScenario: '', scenarioMetaData: '', apiKey: '12312312312312312312312312312312', - notifyEndpoint: 'http://bs-local.com:9339/notify', - sessionsEndpoint: 'http://bs-local.com:9339/sessions' + notifyEndpoint: 'http://' + address + '/notify', + sessionsEndpoint: 'http://' + address + '/sessions' } } diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index a2f55ced49..082e34f31f 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -47,6 +47,13 @@ @implementation BugsnagModule resolve(nil); } +RCT_EXPORT_METHOD(getMazeRunnerAddress + resolve:(RCTPromiseResolveBlock)resolve + reject:(RCTPromiseRejectBlock)reject) +{ + +} + @end BugsnagConfiguration *createConfiguration(NSDictionary * options) { From 039dea8282c920536349de0797d3a2ae3fc3f256 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 27 Apr 2023 16:04:52 +0100 Subject: [PATCH 04/25] Cut pipeline right down for testing --- .buildkite/pipeline.yml | 114 ++++++++++++++++++++-------------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 79fde3f2c2..73b419a410 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -102,19 +102,19 @@ steps: run: ci command: "npm run test:types" - - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: BROWSER STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - depends_on: "package-js" - commands: - - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml + # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: BROWSER STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + # depends_on: "package-js" + # commands: + # - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml - - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: ELECTRON STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - commands: - - buildkite-agent pipeline upload .buildkite/electron-pipeline.yml + # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: ELECTRON STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + # commands: + # - buildkite-agent pipeline upload .buildkite/electron-pipeline.yml - - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: NODE STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - depends_on: "package-js" - commands: - - buildkite-agent pipeline upload .buildkite/node-pipeline.yml + # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: NODE STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + # depends_on: "package-js" + # commands: + # - buildkite-agent pipeline upload .buildkite/node-pipeline.yml - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (ANDROID) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" depends_on: @@ -123,49 +123,49 @@ steps: commands: - buildkite-agent pipeline upload .buildkite/react-native-android-pipeline.yml - - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (IOS) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - depends_on: - - "publish-js" - commands: - - buildkite-agent pipeline upload .buildkite/react-native-ios-pipeline.yml - - - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE CLI STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - depends_on: - - "publish-js" - - "android-builder-base" - commands: - - buildkite-agent pipeline upload .buildkite/react-native-cli-pipeline.yml - - - label: "@bugsnag/expo latest" - depends_on: "publish-js" - trigger: "bugsnag-expo" - build: - # don't specify 'branch' here so we build the default branch in the expo - # repo, which should be the most up-to-date @bugsnag/expo version - env: - BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # a branch name that's safe to use as a docker cache identifier - BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" - - - label: "@bugsnag/expo v46-next" - depends_on: "publish-js" - trigger: "bugsnag-expo" - build: - branch: "v46-next" - env: - BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # a branch name that's safe to use as a docker cache identifier - BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" - - - label: "@bugsnag/expo v45-next" - depends_on: "publish-js" - trigger: "bugsnag-expo" - build: - branch: "v45-next" - env: - BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # a branch name that's safe to use as a docker cache identifier - BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (IOS) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + # depends_on: + # - "publish-js" + # commands: + # - buildkite-agent pipeline upload .buildkite/react-native-ios-pipeline.yml + + # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE CLI STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + # depends_on: + # - "publish-js" + # - "android-builder-base" + # commands: + # - buildkite-agent pipeline upload .buildkite/react-native-cli-pipeline.yml + + # - label: "@bugsnag/expo latest" + # depends_on: "publish-js" + # trigger: "bugsnag-expo" + # build: + # # don't specify 'branch' here so we build the default branch in the expo + # # repo, which should be the most up-to-date @bugsnag/expo version + # env: + # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # # a branch name that's safe to use as a docker cache identifier + # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + + # - label: "@bugsnag/expo v46-next" + # depends_on: "publish-js" + # trigger: "bugsnag-expo" + # build: + # branch: "v46-next" + # env: + # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # # a branch name that's safe to use as a docker cache identifier + # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + + # - label: "@bugsnag/expo v45-next" + # depends_on: "publish-js" + # trigger: "bugsnag-expo" + # build: + # branch: "v45-next" + # env: + # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # # a branch name that's safe to use as a docker cache identifier + # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" From 9b65c4460b89e93b030e9e85238f4c3b0ffdbef1 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 27 Apr 2023 17:11:59 +0100 Subject: [PATCH 05/25] Add missing imports and variables --- .../features/fixtures/reactnative/module/ConfigFileReader.kt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt index 45f90db88d..2b4f2e5863 100644 --- a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -1,12 +1,16 @@ package com.reactnative.module import android.content.Context +import org.json.JSONObject +import java.io.File +import java.io.IOException class ConfigFileReader { fun getMazeRunnerAddress(context: Context): String { val externalFilesDir = context.getExternalFilesDir(null) val configFile = File(externalFilesDir, "fixture_config.json") + var mazeAddress: String? = null log("Attempting to read Maze Runner address from config file ${configFile.path}") // Poll for the fixture config file From a16e8f23df2aa06a265893cd90e891621d794405 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 28 Apr 2023 09:35:18 +0100 Subject: [PATCH 06/25] Work around missing references --- .../fixtures/reactnative/module/ConfigFileReader.kt | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt index 2b4f2e5863..f24b3ac367 100644 --- a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -5,13 +5,15 @@ import org.json.JSONObject import java.io.File import java.io.IOException +const val CONFIG_FILE_TIMEOUT = 5000 + class ConfigFileReader { fun getMazeRunnerAddress(context: Context): String { val externalFilesDir = context.getExternalFilesDir(null) val configFile = File(externalFilesDir, "fixture_config.json") var mazeAddress: String? = null - log("Attempting to read Maze Runner address from config file ${configFile.path}") + Log.i("Bugsnag", "Attempting to read Maze Runner address from config file ${configFile.path}") // Poll for the fixture config file val pollEnd = System.currentTimeMillis() + CONFIG_FILE_TIMEOUT @@ -21,7 +23,7 @@ class ConfigFileReader { val fixtureConfig = runCatching { JSONObject(fileContents) }.getOrNull() mazeAddress = getStringSafely(fixtureConfig, "maze_address") if (!mazeAddress.isNullOrBlank()) { - log("Maze Runner address set from config file: $mazeAddress") + Log.i("Bugsnag", "Maze Runner address set from config file: $mazeAddress") break } } @@ -29,10 +31,14 @@ class ConfigFileReader { Thread.sleep(250) } if (mazeAddress.isNullOrBlank()) { - log("Failed to read Maze Runner address from config file, reverting to legacy address") + Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") mazeAddress = "bs-local.com:9339" } return mazeAddress } + private fun getStringSafely(jsonObject: JSONObject?, key: String): String { + return jsonObject?.optString(key) ?: "" + } + } From a06848e1bc4a6599b8e252c6ccfee2e06928a8e0 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 28 Apr 2023 11:07:14 +0100 Subject: [PATCH 07/25] Add log import --- .../features/fixtures/reactnative/module/ConfigFileReader.kt | 1 + 1 file changed, 1 insertion(+) diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt index f24b3ac367..f1dbd4d592 100644 --- a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -1,6 +1,7 @@ package com.reactnative.module import android.content.Context +import android.util.Log import org.json.JSONObject import java.io.File import java.io.IOException From a0bda9b26c6b6a1ef1c2f8ca60cd5405945d15cf Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 28 Apr 2023 11:57:06 +0100 Subject: [PATCH 08/25] Fix syntax error --- .../features/fixtures/reactnative/module/BugsnagModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 50156e7568..ed80330d38 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -122,7 +122,7 @@ public void d(String msg, Throwable throwable) { @ReactMethod public String getMazeRunnerAddress() { ConfigFileReader configReader = new ConfigFileReader(); - return configReader.getMazeRunnerAddress(reactContext) + return configReader.getMazeRunnerAddress(reactContext); } private Configuration createConfiguration(ReadableMap options) { From 10d1931a676e05b6a4c3d97bc4f88ad214a09311 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 28 Apr 2023 14:22:54 +0100 Subject: [PATCH 09/25] Remove invalid log --- test/react-native/features/fixtures/app/scenario_js/app/App.js | 1 - 1 file changed, 1 deletion(-) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index ab50b43d8d..e1007e2141 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -14,7 +14,6 @@ export default class App extends Component { constructor (props) { super(props) var address = NativeModules.BugsnagTestInterface.getMazeRunnerAddress() - console.log(config) this.state = { currentScenario: '', scenarioMetaData: '', From 0d123fb11bcb86a0d5704d063433dec3164aa5f1 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 28 Apr 2023 15:00:02 +0100 Subject: [PATCH 10/25] Add debug log --- test/react-native/features/fixtures/app/scenario_js/app/App.js | 1 + 1 file changed, 1 insertion(+) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index e1007e2141..171e734cbc 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -14,6 +14,7 @@ export default class App extends Component { constructor (props) { super(props) var address = NativeModules.BugsnagTestInterface.getMazeRunnerAddress() + console.log(address) this.state = { currentScenario: '', scenarioMetaData: '', From 7d8b85dc9fb04f3f940c64eca10f6d11b9ac3f68 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 2 May 2023 13:18:00 +0100 Subject: [PATCH 11/25] Add more debugging --- .../features/fixtures/reactnative/module/BugsnagModule.java | 4 +++- .../features/fixtures/reactnative/module/ConfigFileReader.kt | 1 + 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index ed80330d38..301b0b8bfa 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -122,7 +122,9 @@ public void d(String msg, Throwable throwable) { @ReactMethod public String getMazeRunnerAddress() { ConfigFileReader configReader = new ConfigFileReader(); - return configReader.getMazeRunnerAddress(reactContext); + String mazeAddress = configReader.getMazeRunnerAddress(reactContext); + Log.i("Bugsnag", "Got maze address ") + return mazeAddress; } private Configuration createConfiguration(ReadableMap options) { diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt index f1dbd4d592..6578c3787b 100644 --- a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -35,6 +35,7 @@ class ConfigFileReader { Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") mazeAddress = "bs-local.com:9339" } + Log.i("Bugsnag", "Returning mazeAddress $mazeAddress") return mazeAddress } From d029426a2131d382ea980fc10e65bdd70c47b5ed Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 2 May 2023 15:22:28 +0100 Subject: [PATCH 12/25] Add more debugging --- .../features/fixtures/reactnative/module/BugsnagModule.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 301b0b8bfa..c09db078ad 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -123,7 +123,7 @@ public void d(String msg, Throwable throwable) { public String getMazeRunnerAddress() { ConfigFileReader configReader = new ConfigFileReader(); String mazeAddress = configReader.getMazeRunnerAddress(reactContext); - Log.i("Bugsnag", "Got maze address ") + Log.i("Bugsnag", "Got maze address "); return mazeAddress; } From acbe0fe4b5e9bd087f531b2970cae5a47d8ef30e Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 2 May 2023 15:44:29 +0100 Subject: [PATCH 13/25] Use proper async await to return maze-runner address --- .../features/fixtures/app/scenario_js/app/App.js | 7 +++++-- .../fixtures/reactnative/module/BugsnagModule.java | 4 ++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index 171e734cbc..71e496b8d3 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -13,8 +13,7 @@ import { export default class App extends Component { constructor (props) { super(props) - var address = NativeModules.BugsnagTestInterface.getMazeRunnerAddress() - console.log(address) + address = this.getDefaultEndpoint() this.state = { currentScenario: '', scenarioMetaData: '', @@ -24,6 +23,10 @@ export default class App extends Component { } } + getDefaultEndpoint = async() => { + return await NativeModules.BugsnagTestInterface.getMazeRunnerAddress() + } + setScenarioMetaData = newScenarioMetaData => { this.setState(() => ({ scenarioMetaData: newScenarioMetaData })) } diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index c09db078ad..e617706f0e 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -120,11 +120,11 @@ public void d(String msg, Throwable throwable) { } @ReactMethod - public String getMazeRunnerAddress() { + public void getMazeRunnerAddress(Promise promise) { ConfigFileReader configReader = new ConfigFileReader(); String mazeAddress = configReader.getMazeRunnerAddress(reactContext); Log.i("Bugsnag", "Got maze address "); - return mazeAddress; + promise.resolve(mazeAddress); } private Configuration createConfiguration(ReadableMap options) { From 509c2fb23ebbf4471da9470c744a716ae2668108 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 2 May 2023 18:25:42 +0100 Subject: [PATCH 14/25] Naive implementation of cocoa file reading --- .buildkite/pipeline.yml | 10 ++--- .../fixtures/app/scenario_js/app/App.js | 1 + .../fixtures/ios-module/BugsnagModule.m | 8 ++-- .../ConfigFileReader-Bridging-Header.h | 2 + .../ios-module/ConfigFileReader.swift | 45 +++++++++++++++++++ .../reactnative/module/BugsnagModule.java | 1 - .../reactnative/module/ConfigFileReader.kt | 1 - .../ios/reactnative.xcodeproj/project.pbxproj | 8 ++++ .../xcshareddata/IDEWorkspaceChecks.plist | 8 ++++ 9 files changed, 73 insertions(+), 11 deletions(-) create mode 100644 test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h create mode 100644 test/react-native/features/fixtures/ios-module/ConfigFileReader.swift create mode 100644 test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 73b419a410..18eb2a8ce1 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -123,11 +123,11 @@ steps: commands: - buildkite-agent pipeline upload .buildkite/react-native-android-pipeline.yml - # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (IOS) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - # depends_on: - # - "publish-js" - # commands: - # - buildkite-agent pipeline upload .buildkite/react-native-ios-pipeline.yml + - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (IOS) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + depends_on: + - "publish-js" + commands: + - buildkite-agent pipeline upload .buildkite/react-native-ios-pipeline.yml # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE CLI STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" # depends_on: diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index 71e496b8d3..dbc0430b51 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -14,6 +14,7 @@ export default class App extends Component { constructor (props) { super(props) address = this.getDefaultEndpoint() + console.log(address) this.state = { currentScenario: '', scenarioMetaData: '', diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 082e34f31f..48644a2ba1 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -10,6 +10,7 @@ #import #import "BugsnagModule.h" +#import "ConfigFileReader-Bridging-Header.h" #import "Scenario.h" @implementation BugsnagModule @@ -47,11 +48,10 @@ @implementation BugsnagModule resolve(nil); } -RCT_EXPORT_METHOD(getMazeRunnerAddress - resolve:(RCTPromiseResolveBlock)resolve - reject:(RCTPromiseRejectBlock)reject) +RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getMazeRunnerAddress) { - + ConfigFileReader *configReader = [ConfigFileReader alloc] + return [configReader loadMazeRunnerAddress] } @end diff --git a/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h b/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h new file mode 100644 index 0000000000..a68088f700 --- /dev/null +++ b/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h @@ -0,0 +1,2 @@ +// CalendarManager-Bridging-Header.h +#import \ No newline at end of file diff --git a/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift b/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift new file mode 100644 index 0000000000..9c6514b68b --- /dev/null +++ b/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift @@ -0,0 +1,45 @@ +import UIKit +import os + +class FixtureConfig: Codable { + var maze_address: String +} + +class ConfigFileReader { + func loadMazeRunnerAddress() -> String { + + let bsAddress = "http://bs-local.com:9339" + + // Only iOS 12 and above will run on BitBar for now + if #available(iOS 12.0, *) {} else { + return bsAddress; + } + + for _ in 1...60 { + let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] + +// log("Reading Maze Runner address from fixture_config.json") + do { + let fileUrl = URL(fileURLWithPath: "fixture_config", + relativeTo: documentsUrl).appendingPathExtension("json") + let savedData = try Data(contentsOf: fileUrl) + if let contents = String(data: savedData, encoding: .utf8) { + let decoder = JSONDecoder() + let jsonData = contents.data(using: .utf8) + let config = try decoder.decode(FixtureConfig.self, from: jsonData!) + let address = "http://" + config.maze_address +// log("Using Maze Runner address: " + address) + return address + } + } + catch let error as NSError { +// log("Failed to read fixture_config.json: \(error)") + } +// log("Waiting for fixture_config.json to appear") + sleep(1) + } + +// log("Unable to read from fixture_config.json, defaulting to BrowserStack environment") + return bsAddress; + } +} diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index e617706f0e..101252e431 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -123,7 +123,6 @@ public void d(String msg, Throwable throwable) { public void getMazeRunnerAddress(Promise promise) { ConfigFileReader configReader = new ConfigFileReader(); String mazeAddress = configReader.getMazeRunnerAddress(reactContext); - Log.i("Bugsnag", "Got maze address "); promise.resolve(mazeAddress); } diff --git a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt index 6578c3787b..f1dbd4d592 100644 --- a/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt +++ b/test/react-native/features/fixtures/reactnative/module/ConfigFileReader.kt @@ -35,7 +35,6 @@ class ConfigFileReader { Log.i("Bugsnag", "Failed to read Maze Runner address from config file, reverting to legacy address") mazeAddress = "bs-local.com:9339" } - Log.i("Bugsnag", "Returning mazeAddress $mazeAddress") return mazeAddress } diff --git a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj index 335c977894..078b17ef15 100644 --- a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj +++ b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj @@ -36,6 +36,8 @@ A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36524BCEE0200394C5D /* AppNativeUnhandledScenario.m */; }; A1BFB36924BCEE0200394C5D /* AppNativeHandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */; }; A1CC9DE424B3D76A002A4760 /* HandledNativeErrorScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */; }; + A1CDDB372A0162C8002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */; }; + A1CDDB382A0162C8002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */; }; A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */; }; A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CB24C6192500C30B50 /* MetadataNativeScenario.m */; }; A1F389CF24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CE24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m */; }; @@ -114,6 +116,8 @@ A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppNativeHandledScenario.m; sourceTree = ""; }; A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HandledNativeErrorScenario.m; sourceTree = ""; }; A1CC9DE324B3D76A002A4760 /* HandledNativeErrorScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandledNativeErrorScenario.h; sourceTree = ""; }; + A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConfigFileReader.swift; path = "../../ios-module/ConfigFileReader.swift"; sourceTree = ""; }; + A1CDDB392A017E27002C8872 /* ConfigFileReader-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ConfigFileReader-Bridging-Header.h"; path = "../../ios-module/ConfigFileReader-Bridging-Header.h"; sourceTree = ""; }; A1E567A824BE167800886226 /* ContextNativeCustomScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextNativeCustomScenario.h; sourceTree = ""; }; A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContextNativeCustomScenario.m; sourceTree = ""; }; A1F389CA24C6192500C30B50 /* MetadataNativeScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataNativeScenario.h; sourceTree = ""; }; @@ -188,6 +192,8 @@ 13B07FAE1A68108700A75B9A /* reactnative */ = { isa = PBXGroup; children = ( + A1CDDB392A017E27002C8872 /* ConfigFileReader-Bridging-Header.h */, + A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */, A145176724A7A1F500C6FC6E /* Scenarios */, A145176424A7A1F000C6FC6E /* BugsnagModule.h */, A145176524A7A1F000C6FC6E /* BugsnagModule.m */, @@ -683,6 +689,7 @@ A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */, A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */, A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */, + A1CDDB372A0162C8002C8872 /* ConfigFileReader.swift in Sources */, A1BFB36324BC6D3400394C5D /* UnhandledNativeErrorScenario.m in Sources */, 6591A4D62511602C0040A5FA /* NativeStackUnhandledScenario.m in Sources */, A181223C24C0BF5B0073596F /* BreadcrumbsNativeManualScenario.m in Sources */, @@ -696,6 +703,7 @@ buildActionMask = 2147483647; files = ( 0186104E257900FF00FCB626 /* NativeStackHandledScenario.swift in Sources */, + A1CDDB382A0162C8002C8872 /* ConfigFileReader.swift in Sources */, 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 0154E1FF2806DFEE009044E4 /* RCTFatalScenario.m in Sources */, 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, diff --git a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist new file mode 100644 index 0000000000..18d981003d --- /dev/null +++ b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist @@ -0,0 +1,8 @@ + + + + + IDEDidComputeMac32BitWarning + + + From 65a26371d0000064dadc373c139bf7fc62714a1a Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Tue, 2 May 2023 19:30:07 +0100 Subject: [PATCH 15/25] More debugging --- test/react-native/features/fixtures/app/scenario_js/app/App.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index dbc0430b51..7b01e70bbd 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -14,7 +14,7 @@ export default class App extends Component { constructor (props) { super(props) address = this.getDefaultEndpoint() - console.log(address) + console.log(`Got address: ${address}`) this.state = { currentScenario: '', scenarioMetaData: '', From 96e81f9bc6b9f1780a4dbcc3f5935c28f8fccb69 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 13:56:32 +0100 Subject: [PATCH 16/25] Don't pass address back up to JS --- .../fixtures/app/scenario_js/app/App.js | 22 +++-- .../fixtures/ios-module/BugsnagModule.m | 22 ++--- .../ios-module/ConfigFileReader.swift | 80 ++++++++++--------- .../reactnative/module/BugsnagModule.java | 14 ++-- .../ios/reactnative.xcodeproj/project.pbxproj | 14 ++-- 5 files changed, 79 insertions(+), 73 deletions(-) diff --git a/test/react-native/features/fixtures/app/scenario_js/app/App.js b/test/react-native/features/fixtures/app/scenario_js/app/App.js index 7b01e70bbd..5210022cec 100644 --- a/test/react-native/features/fixtures/app/scenario_js/app/App.js +++ b/test/react-native/features/fixtures/app/scenario_js/app/App.js @@ -13,34 +13,32 @@ import { export default class App extends Component { constructor (props) { super(props) - address = this.getDefaultEndpoint() - console.log(`Got address: ${address}`) this.state = { currentScenario: '', scenarioMetaData: '', apiKey: '12312312312312312312312312312312', - notifyEndpoint: 'http://' + address + '/notify', - sessionsEndpoint: 'http://' + address + '/sessions' + notifyEndpoint: '', + sessionsEndpoint: '' } } - getDefaultEndpoint = async() => { - return await NativeModules.BugsnagTestInterface.getMazeRunnerAddress() - } - setScenarioMetaData = newScenarioMetaData => { this.setState(() => ({ scenarioMetaData: newScenarioMetaData })) } getConfiguration = () => { - return { + var config = { apiKey: this.state.apiKey, - endpoints: { + autoTrackSessions: false + } + + if (this.state.notifyEndpoint && this.state.sessionsEndpoint) { + config.endpoints = { notify: this.state.notifyEndpoint, sessions: this.state.sessionsEndpoint - }, - autoTrackSessions: false + } } + return config } setScenario = newScenario => { diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 48644a2ba1..0f82972561 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -9,8 +9,8 @@ #import #import +#import #import "BugsnagModule.h" -#import "ConfigFileReader-Bridging-Header.h" #import "Scenario.h" @implementation BugsnagModule @@ -48,12 +48,6 @@ @implementation BugsnagModule resolve(nil); } -RCT_EXPORT_BLOCKING_SYNCHRONOUS_METHOD(getMazeRunnerAddress) -{ - ConfigFileReader *configReader = [ConfigFileReader alloc] - return [configReader loadMazeRunnerAddress] -} - @end BugsnagConfiguration *createConfiguration(NSDictionary * options) { @@ -62,10 +56,18 @@ @implementation BugsnagModule NSLog(@"key: %@, value: %@ \n", key, [options objectForKey:key]); } BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithApiKey:options[@"apiKey"]]; - NSDictionary *endpointsIn = options[@"endpoints"]; - NSString *notifyEndpoint = endpointsIn[@"notify"]; - NSString *sessionsEndpoint = endpointsIn[@"sessions"]; + if (options[@"endpoints"] != nil) { + NSDictionary *endpointsIn = options[@"endpoints"]; + NSString *notifyEndpoint = endpointsIn[@"notify"]; + NSString *sessionsEndpoint = endpointsIn[@"sessions"]; + } else { + ConfigFileReader *fileReader = [ConfigFileReader alloc]; + NSString *baseAddress = [fileReader loadMazeRunnerAddress]; + NSString *notifyEndpoint = [NSString stringWithFormat:@"http://%@/notify", baseAddress]; + NSString *notifyEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; + } BugsnagEndpointConfiguration *endpoints = [[BugsnagEndpointConfiguration alloc] initWithNotify:notifyEndpoint sessions:sessionsEndpoint]; + [config setEndpoints:endpoints]; [config setAutoTrackSessions:[[options objectForKey:@"autoTrackSessions"]boolValue]]; config.enabledErrorTypes.ooms = NO; // Set by default, will add an override as required diff --git a/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift b/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift index 9c6514b68b..c54ec252da 100644 --- a/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift +++ b/test/react-native/features/fixtures/ios-module/ConfigFileReader.swift @@ -1,45 +1,51 @@ -import UIKit -import os +// +// ConfigFileReader.swift +// reactnative +// +// Created by Alex Moinet on 04/05/2023. +// Copyright © 2023 Facebook. All rights reserved. +// + +import Foundation class FixtureConfig: Codable { var maze_address: String } -class ConfigFileReader { - func loadMazeRunnerAddress() -> String { - - let bsAddress = "http://bs-local.com:9339" - - // Only iOS 12 and above will run on BitBar for now - if #available(iOS 12.0, *) {} else { - return bsAddress; - } - - for _ in 1...60 { - let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] +class ConfigFileReader:NSObject { + func loadMazeRunnerAddress() -> String { + let bsAddress = "http://bs-local.com:9339" + + // Only iOS 12 and above will run on BitBar for now + if #available(iOS 12.0, *) {} else { + return bsAddress; + } + + for _ in 1...60 { + let documentsUrl = FileManager.default.urls(for: .documentDirectory, in: .userDomainMask)[0] -// log("Reading Maze Runner address from fixture_config.json") - do { - let fileUrl = URL(fileURLWithPath: "fixture_config", - relativeTo: documentsUrl).appendingPathExtension("json") - let savedData = try Data(contentsOf: fileUrl) - if let contents = String(data: savedData, encoding: .utf8) { - let decoder = JSONDecoder() - let jsonData = contents.data(using: .utf8) - let config = try decoder.decode(FixtureConfig.self, from: jsonData!) - let address = "http://" + config.maze_address -// log("Using Maze Runner address: " + address) - return address - } - } - catch let error as NSError { -// log("Failed to read fixture_config.json: \(error)") - } -// log("Waiting for fixture_config.json to appear") - sleep(1) - } + NSLog("Reading Maze Runner address from fixture_config.json") + do { + let fileUrl = URL(fileURLWithPath: "fixture_config", + relativeTo: documentsUrl).appendingPathExtension("json") + let savedData = try Data(contentsOf: fileUrl) + if let contents = String(data: savedData, encoding: .utf8) { + let decoder = JSONDecoder() + let jsonData = contents.data(using: .utf8) + let config = try decoder.decode(FixtureConfig.self, from: jsonData!) + let address = "http://" + config.maze_address + NSLog("Using Maze Runner address: " + address) + return address + } + } + catch let error as NSError { + NSLog("Failed to read fixture_config.json: \(error)") + } + NSLog("Waiting for fixture_config.json to appear") + sleep(1) + } -// log("Unable to read from fixture_config.json, defaulting to BrowserStack environment") - return bsAddress; - } + NSLog("Unable to read from fixture_config.json, defaulting to BrowserStack environment") + return bsAddress; + } } diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 101252e431..7536ba2ef6 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -121,8 +121,7 @@ public void d(String msg, Throwable throwable) { @ReactMethod public void getMazeRunnerAddress(Promise promise) { - ConfigFileReader configReader = new ConfigFileReader(); - String mazeAddress = configReader.getMazeRunnerAddress(reactContext); + promise.resolve(mazeAddress); } @@ -130,12 +129,15 @@ private Configuration createConfiguration(ReadableMap options) { Configuration config = new Configuration(options.getString("apiKey")); config.setAutoTrackSessions(options.getBoolean("autoTrackSessions")); - if (options.hasKey("endpoint")) { - config.setEndpoints(new EndpointConfiguration(options.getString("endpoint"), options.getString("endpoint"))); - } - else if (options.hasKey("endpoints")) { + if (options.hasKey("endpoints")) { ReadableMap endpoints = options.getMap("endpoints"); config.setEndpoints(new EndpointConfiguration(endpoints.getString("notify"), endpoints.getString("sessions"))); + } else { + ConfigFileReader configReader = new ConfigFileReader(); + String mazeAddress = configReader.getMazeRunnerAddress(reactContext); + String notifyEndpoint = "http://" + mazeAddress + "/notify"; + String sessionEndpoint = "http://" + mazeAddress + "/sessions"; + config.setEndpoints(new EndpointConfiguration(notifyEndpoint, sessionEndpoint)); } if (options.hasKey("appVersion")) { diff --git a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj index 078b17ef15..418ef4f337 100644 --- a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj +++ b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj @@ -36,8 +36,8 @@ A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36524BCEE0200394C5D /* AppNativeUnhandledScenario.m */; }; A1BFB36924BCEE0200394C5D /* AppNativeHandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */; }; A1CC9DE424B3D76A002A4760 /* HandledNativeErrorScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */; }; - A1CDDB372A0162C8002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */; }; - A1CDDB382A0162C8002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */; }; + A1CDDB3E2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */; }; + A1CDDB3F2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */; }; A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */; }; A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CB24C6192500C30B50 /* MetadataNativeScenario.m */; }; A1F389CF24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CE24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m */; }; @@ -116,8 +116,7 @@ A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppNativeHandledScenario.m; sourceTree = ""; }; A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HandledNativeErrorScenario.m; sourceTree = ""; }; A1CC9DE324B3D76A002A4760 /* HandledNativeErrorScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandledNativeErrorScenario.h; sourceTree = ""; }; - A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; name = ConfigFileReader.swift; path = "../../ios-module/ConfigFileReader.swift"; sourceTree = ""; }; - A1CDDB392A017E27002C8872 /* ConfigFileReader-Bridging-Header.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = "ConfigFileReader-Bridging-Header.h"; path = "../../ios-module/ConfigFileReader-Bridging-Header.h"; sourceTree = ""; }; + A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ConfigFileReader.swift; path = "../../ios-module/ConfigFileReader.swift"; sourceTree = ""; }; A1E567A824BE167800886226 /* ContextNativeCustomScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextNativeCustomScenario.h; sourceTree = ""; }; A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContextNativeCustomScenario.m; sourceTree = ""; }; A1F389CA24C6192500C30B50 /* MetadataNativeScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataNativeScenario.h; sourceTree = ""; }; @@ -192,11 +191,10 @@ 13B07FAE1A68108700A75B9A /* reactnative */ = { isa = PBXGroup; children = ( - A1CDDB392A017E27002C8872 /* ConfigFileReader-Bridging-Header.h */, - A1CDDB362A0162C8002C8872 /* ConfigFileReader.swift */, A145176724A7A1F500C6FC6E /* Scenarios */, A145176424A7A1F000C6FC6E /* BugsnagModule.h */, A145176524A7A1F000C6FC6E /* BugsnagModule.m */, + A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */, 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.m */, @@ -689,7 +687,7 @@ A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */, A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */, A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */, - A1CDDB372A0162C8002C8872 /* ConfigFileReader.swift in Sources */, + A1CDDB3E2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */, A1BFB36324BC6D3400394C5D /* UnhandledNativeErrorScenario.m in Sources */, 6591A4D62511602C0040A5FA /* NativeStackUnhandledScenario.m in Sources */, A181223C24C0BF5B0073596F /* BreadcrumbsNativeManualScenario.m in Sources */, @@ -703,7 +701,7 @@ buildActionMask = 2147483647; files = ( 0186104E257900FF00FCB626 /* NativeStackHandledScenario.swift in Sources */, - A1CDDB382A0162C8002C8872 /* ConfigFileReader.swift in Sources */, + A1CDDB3F2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */, 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 0154E1FF2806DFEE009044E4 /* RCTFatalScenario.m in Sources */, 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, From bc1fba82b40fe636008b89c39feaf13d30c10efd Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 14:26:13 +0100 Subject: [PATCH 17/25] Remove superfluous function --- .../features/fixtures/reactnative/module/BugsnagModule.java | 6 ------ 1 file changed, 6 deletions(-) diff --git a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java index 7536ba2ef6..2641ccbe25 100644 --- a/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java +++ b/test/react-native/features/fixtures/reactnative/module/BugsnagModule.java @@ -119,12 +119,6 @@ public void d(String msg, Throwable throwable) { promise.resolve(true); } - @ReactMethod - public void getMazeRunnerAddress(Promise promise) { - - promise.resolve(mazeAddress); - } - private Configuration createConfiguration(ReadableMap options) { Configuration config = new Configuration(options.getString("apiKey")); config.setAutoTrackSessions(options.getBoolean("autoTrackSessions")); From a7544035e271784791692c3a3fc77207b9d77ee6 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 14:27:21 +0100 Subject: [PATCH 18/25] Remove invalid import --- test/react-native/features/fixtures/ios-module/BugsnagModule.m | 1 - .../fixtures/ios-module/ConfigFileReader-Bridging-Header.h | 2 -- 2 files changed, 3 deletions(-) delete mode 100644 test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 0f82972561..b2e1b2f198 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -9,7 +9,6 @@ #import #import -#import #import "BugsnagModule.h" #import "Scenario.h" diff --git a/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h b/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h deleted file mode 100644 index a68088f700..0000000000 --- a/test/react-native/features/fixtures/ios-module/ConfigFileReader-Bridging-Header.h +++ /dev/null @@ -1,2 +0,0 @@ -// CalendarManager-Bridging-Header.h -#import \ No newline at end of file From fc30da39c1ff4f28d873b4c8957ac3f90e45b0d5 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 15:47:08 +0100 Subject: [PATCH 19/25] Fix redeclaration error --- .../features/fixtures/ios-module/BugsnagModule.m | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index b2e1b2f198..d0ddff5b95 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -55,15 +55,17 @@ @implementation BugsnagModule NSLog(@"key: %@, value: %@ \n", key, [options objectForKey:key]); } BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithApiKey:options[@"apiKey"]]; + NSString *notifyEndpoint; + NSString *sessionsEndpoint; if (options[@"endpoints"] != nil) { NSDictionary *endpointsIn = options[@"endpoints"]; - NSString *notifyEndpoint = endpointsIn[@"notify"]; - NSString *sessionsEndpoint = endpointsIn[@"sessions"]; + notifyEndpoint = endpointsIn[@"notify"]; + sessionsEndpoint = endpointsIn[@"sessions"]; } else { ConfigFileReader *fileReader = [ConfigFileReader alloc]; NSString *baseAddress = [fileReader loadMazeRunnerAddress]; - NSString *notifyEndpoint = [NSString stringWithFormat:@"http://%@/notify", baseAddress]; - NSString *notifyEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; + notifyEndpoint = [NSString stringWithFormat:@"http://%@/notify", baseAddress]; + notifyEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; } BugsnagEndpointConfiguration *endpoints = [[BugsnagEndpointConfiguration alloc] initWithNotify:notifyEndpoint sessions:sessionsEndpoint]; From 9c3b0d34c71593abbe19b4412de25f0e9aa01f80 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 15:57:18 +0100 Subject: [PATCH 20/25] Add general bridging header import --- test/react-native/features/fixtures/ios-module/BugsnagModule.m | 1 + 1 file changed, 1 insertion(+) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index d0ddff5b95..fb4314bc22 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -11,6 +11,7 @@ #import #import "BugsnagModule.h" #import "Scenario.h" +#import "reactnative-swift.h" @implementation BugsnagModule From 521fd6f74d12703e669ca88ce8aaaf756c067f2e Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Thu, 4 May 2023 17:04:51 +0100 Subject: [PATCH 21/25] Add separate interface for config loader --- .../features/fixtures/ios-module/BugsnagModule.m | 1 - .../features/fixtures/ios-module/Scenarios/Scenario.h | 5 +++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index fb4314bc22..d0ddff5b95 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -11,7 +11,6 @@ #import #import "BugsnagModule.h" #import "Scenario.h" -#import "reactnative-swift.h" @implementation BugsnagModule diff --git a/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h b/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h index d6481ae6cd..7913582936 100644 --- a/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h +++ b/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h @@ -22,4 +22,9 @@ NS_ASSUME_NONNULL_BEGIN @end +@interface ConfigFileReader : NSObject +- (instancetype)init; +- (NSString *)loadMazeRunnerAddress; +@end + NS_ASSUME_NONNULL_END From dc63d5e92db6f48a7131d4cf43497849cbae7c82 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Fri, 5 May 2023 10:35:59 +0100 Subject: [PATCH 22/25] Attempt to use seperate bridging header location --- .../features/fixtures/ios-module/BugsnagModule.h | 5 +++++ .../features/fixtures/ios-module/BugsnagModule.m | 1 + .../features/fixtures/ios-module/Scenarios/Scenario.h | 5 ----- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.h b/test/react-native/features/fixtures/ios-module/BugsnagModule.h index 8d6ec2f75f..86dda5652b 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.h +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.h @@ -17,5 +17,10 @@ BugsnagConfiguration *createConfiguration(NSDictionary * options); @end +@interface ConfigFileReader : NSObject +- (instancetype)init; +- (NSString *)loadMazeRunnerAddress; +@end + #endif /* BugsnagModule_h */ diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index d0ddff5b95..532f45776e 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -9,6 +9,7 @@ #import #import +#import "reactnative-Swift.h" #import "BugsnagModule.h" #import "Scenario.h" diff --git a/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h b/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h index 7913582936..d6481ae6cd 100644 --- a/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h +++ b/test/react-native/features/fixtures/ios-module/Scenarios/Scenario.h @@ -22,9 +22,4 @@ NS_ASSUME_NONNULL_BEGIN @end -@interface ConfigFileReader : NSObject -- (instancetype)init; -- (NSString *)loadMazeRunnerAddress; -@end - NS_ASSUME_NONNULL_END From f01e03245da686f8e9aff6c418f762acae56c6a2 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Wed, 10 May 2023 08:35:07 +0100 Subject: [PATCH 23/25] Remove config reading from iOS RN test fixtures due to build issues --- .../features/fixtures/ios-module/BugsnagModule.h | 6 ------ .../features/fixtures/ios-module/BugsnagModule.m | 3 +-- .../rn0.60/ios/reactnative.xcodeproj/project.pbxproj | 6 ------ 3 files changed, 1 insertion(+), 14 deletions(-) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.h b/test/react-native/features/fixtures/ios-module/BugsnagModule.h index 86dda5652b..25a4de378c 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.h +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.h @@ -17,10 +17,4 @@ BugsnagConfiguration *createConfiguration(NSDictionary * options); @end -@interface ConfigFileReader : NSObject -- (instancetype)init; -- (NSString *)loadMazeRunnerAddress; -@end - - #endif /* BugsnagModule_h */ diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 532f45776e..3fa563aa89 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -63,8 +63,7 @@ @implementation BugsnagModule notifyEndpoint = endpointsIn[@"notify"]; sessionsEndpoint = endpointsIn[@"sessions"]; } else { - ConfigFileReader *fileReader = [ConfigFileReader alloc]; - NSString *baseAddress = [fileReader loadMazeRunnerAddress]; + NSString *baseAddress = @"bs-local.com:9339"; notifyEndpoint = [NSString stringWithFormat:@"http://%@/notify", baseAddress]; notifyEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; } diff --git a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj index 418ef4f337..335c977894 100644 --- a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj +++ b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcodeproj/project.pbxproj @@ -36,8 +36,6 @@ A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36524BCEE0200394C5D /* AppNativeUnhandledScenario.m */; }; A1BFB36924BCEE0200394C5D /* AppNativeHandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */; }; A1CC9DE424B3D76A002A4760 /* HandledNativeErrorScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */; }; - A1CDDB3E2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */; }; - A1CDDB3F2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */ = {isa = PBXBuildFile; fileRef = A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */; }; A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */; }; A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CB24C6192500C30B50 /* MetadataNativeScenario.m */; }; A1F389CF24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m in Sources */ = {isa = PBXBuildFile; fileRef = A1F389CE24C73B6000C30B50 /* MetadataNativeUnhandledScenario.m */; }; @@ -116,7 +114,6 @@ A1BFB36724BCEE0200394C5D /* AppNativeHandledScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppNativeHandledScenario.m; sourceTree = ""; }; A1CC9DE224B3D76A002A4760 /* HandledNativeErrorScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = HandledNativeErrorScenario.m; sourceTree = ""; }; A1CC9DE324B3D76A002A4760 /* HandledNativeErrorScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HandledNativeErrorScenario.h; sourceTree = ""; }; - A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = ConfigFileReader.swift; path = "../../ios-module/ConfigFileReader.swift"; sourceTree = ""; }; A1E567A824BE167800886226 /* ContextNativeCustomScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ContextNativeCustomScenario.h; sourceTree = ""; }; A1E567A924BE167800886226 /* ContextNativeCustomScenario.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ContextNativeCustomScenario.m; sourceTree = ""; }; A1F389CA24C6192500C30B50 /* MetadataNativeScenario.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MetadataNativeScenario.h; sourceTree = ""; }; @@ -194,7 +191,6 @@ A145176724A7A1F500C6FC6E /* Scenarios */, A145176424A7A1F000C6FC6E /* BugsnagModule.h */, A145176524A7A1F000C6FC6E /* BugsnagModule.m */, - A1CDDB3D2A03E0F0002C8872 /* ConfigFileReader.swift */, 008F07F21AC5B25A0029DE68 /* main.jsbundle */, 13B07FAF1A68108700A75B9A /* AppDelegate.h */, 13B07FB01A68108700A75B9A /* AppDelegate.m */, @@ -687,7 +683,6 @@ A1E567AA24BE167800886226 /* ContextNativeCustomScenario.m in Sources */, A1F389CC24C6192500C30B50 /* MetadataNativeScenario.m in Sources */, A1BFB36824BCEE0200394C5D /* AppNativeUnhandledScenario.m in Sources */, - A1CDDB3E2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */, A1BFB36324BC6D3400394C5D /* UnhandledNativeErrorScenario.m in Sources */, 6591A4D62511602C0040A5FA /* NativeStackUnhandledScenario.m in Sources */, A181223C24C0BF5B0073596F /* BreadcrumbsNativeManualScenario.m in Sources */, @@ -701,7 +696,6 @@ buildActionMask = 2147483647; files = ( 0186104E257900FF00FCB626 /* NativeStackHandledScenario.swift in Sources */, - A1CDDB3F2A03E0F0002C8872 /* ConfigFileReader.swift in Sources */, 2D02E4BF1E0B4AB3006451C7 /* main.m in Sources */, 0154E1FF2806DFEE009044E4 /* RCTFatalScenario.m in Sources */, 2D02E4BC1E0B4A80006451C7 /* AppDelegate.m in Sources */, From 3e1b604ab89c59e1300aaee6bba84a83c436d785 Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Wed, 10 May 2023 10:00:34 +0100 Subject: [PATCH 24/25] Add feedback and extra guards against missing endpoints --- .../features/fixtures/ios-module/BugsnagModule.m | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 3fa563aa89..831f7cdc3d 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -58,15 +58,17 @@ @implementation BugsnagModule BugsnagConfiguration *config = [[BugsnagConfiguration alloc] initWithApiKey:options[@"apiKey"]]; NSString *notifyEndpoint; NSString *sessionsEndpoint; - if (options[@"endpoints"] != nil) { + if (options[@"endpoints"] != nil && options[@"endpoints"][@"notify"] != nil && options[@"endpoints"][@"sessions"] != nil) { NSDictionary *endpointsIn = options[@"endpoints"]; notifyEndpoint = endpointsIn[@"notify"]; sessionsEndpoint = endpointsIn[@"sessions"]; } else { NSString *baseAddress = @"bs-local.com:9339"; notifyEndpoint = [NSString stringWithFormat:@"http://%@/notify", baseAddress]; - notifyEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; + sessionsEndpoint = [NSString stringWithFormat:@"http://%@/sessions", baseAddress]; } + NSLog(@"Notify endpoint set to: %@\n", notifyEndpoint); + NSLog(@"Sessions endpoint set to: %@\n", sessionsEndpoint); BugsnagEndpointConfiguration *endpoints = [[BugsnagEndpointConfiguration alloc] initWithNotify:notifyEndpoint sessions:sessionsEndpoint]; [config setEndpoints:endpoints]; From 3cdd0df3e90ed9387e2dc711fd24ffe6f2ebd59a Mon Sep 17 00:00:00 2001 From: Alex Moinet Date: Wed, 10 May 2023 12:07:43 +0100 Subject: [PATCH 25/25] Revert changes to buildkite pipeline --- .buildkite/pipeline.yml | 102 +++++++++--------- .../fixtures/ios-module/BugsnagModule.m | 1 - .../xcshareddata/IDEWorkspaceChecks.plist | 8 -- 3 files changed, 51 insertions(+), 60 deletions(-) delete mode 100644 test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist diff --git a/.buildkite/pipeline.yml b/.buildkite/pipeline.yml index 18eb2a8ce1..79fde3f2c2 100644 --- a/.buildkite/pipeline.yml +++ b/.buildkite/pipeline.yml @@ -102,19 +102,19 @@ steps: run: ci command: "npm run test:types" - # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: BROWSER STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - # depends_on: "package-js" - # commands: - # - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml + - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: BROWSER STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + depends_on: "package-js" + commands: + - buildkite-agent pipeline upload .buildkite/browser-pipeline.yml - # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: ELECTRON STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - # commands: - # - buildkite-agent pipeline upload .buildkite/electron-pipeline.yml + - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: ELECTRON STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + commands: + - buildkite-agent pipeline upload .buildkite/electron-pipeline.yml - # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: NODE STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - # depends_on: "package-js" - # commands: - # - buildkite-agent pipeline upload .buildkite/node-pipeline.yml + - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: NODE STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + depends_on: "package-js" + commands: + - buildkite-agent pipeline upload .buildkite/node-pipeline.yml - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE (ANDROID) STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" depends_on: @@ -129,43 +129,43 @@ steps: commands: - buildkite-agent pipeline upload .buildkite/react-native-ios-pipeline.yml - # - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE CLI STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" - # depends_on: - # - "publish-js" - # - "android-builder-base" - # commands: - # - buildkite-agent pipeline upload .buildkite/react-native-cli-pipeline.yml - - # - label: "@bugsnag/expo latest" - # depends_on: "publish-js" - # trigger: "bugsnag-expo" - # build: - # # don't specify 'branch' here so we build the default branch in the expo - # # repo, which should be the most up-to-date @bugsnag/expo version - # env: - # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # # a branch name that's safe to use as a docker cache identifier - # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" - - # - label: "@bugsnag/expo v46-next" - # depends_on: "publish-js" - # trigger: "bugsnag-expo" - # build: - # branch: "v46-next" - # env: - # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # # a branch name that's safe to use as a docker cache identifier - # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" - - # - label: "@bugsnag/expo v45-next" - # depends_on: "publish-js" - # trigger: "bugsnag-expo" - # build: - # branch: "v45-next" - # env: - # BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" - # BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" - # # a branch name that's safe to use as a docker cache identifier - # BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + - label: ":large_blue_circle: :large_blue_circle: :large_blue_circle: REACT NATIVE CLI STEPS :large_blue_circle: :large_blue_circle: :large_blue_circle:" + depends_on: + - "publish-js" + - "android-builder-base" + commands: + - buildkite-agent pipeline upload .buildkite/react-native-cli-pipeline.yml + + - label: "@bugsnag/expo latest" + depends_on: "publish-js" + trigger: "bugsnag-expo" + build: + # don't specify 'branch' here so we build the default branch in the expo + # repo, which should be the most up-to-date @bugsnag/expo version + env: + BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # a branch name that's safe to use as a docker cache identifier + BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + + - label: "@bugsnag/expo v46-next" + depends_on: "publish-js" + trigger: "bugsnag-expo" + build: + branch: "v46-next" + env: + BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # a branch name that's safe to use as a docker cache identifier + BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" + + - label: "@bugsnag/expo v45-next" + depends_on: "publish-js" + trigger: "bugsnag-expo" + build: + branch: "v45-next" + env: + BUGSNAG_JS_BRANCH: "${BUILDKITE_BRANCH}" + BUGSNAG_JS_COMMIT: "${BUILDKITE_COMMIT}" + # a branch name that's safe to use as a docker cache identifier + BUGSNAG_JS_CACHE_SAFE_BRANCH_NAME: "${BRANCH_NAME}" diff --git a/test/react-native/features/fixtures/ios-module/BugsnagModule.m b/test/react-native/features/fixtures/ios-module/BugsnagModule.m index 831f7cdc3d..97887f8282 100644 --- a/test/react-native/features/fixtures/ios-module/BugsnagModule.m +++ b/test/react-native/features/fixtures/ios-module/BugsnagModule.m @@ -9,7 +9,6 @@ #import #import -#import "reactnative-Swift.h" #import "BugsnagModule.h" #import "Scenario.h" diff --git a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003d..0000000000 --- a/test/react-native/features/fixtures/rn0.60/ios/reactnative.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ - - - - - IDEDidComputeMac32BitWarning - - -