Skip to content

Commit d8c34e0

Browse files
authored
Merge pull request #2410 from bugsnag/PLAT-14057/react-native-079
Support React Native 0.79
2 parents 0d457a3 + 80815df commit d8c34e0

16 files changed

Lines changed: 200 additions & 23 deletions

.buildkite/basic/react-native-android-full-pipeline.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ steps:
102102
- "0.74"
103103
- "0.76"
104104
- "0.77"
105+
- "0.78"
105106
retry:
106107
automatic:
107108
- exit_status: "*"
@@ -133,6 +134,7 @@ steps:
133134
- "0.74"
134135
- "0.76"
135136
- "0.77"
137+
- "0.78"
136138

137139
- label: ':android: Build react-native-navigation {{matrix}} test fixture APK (Old Arch)'
138140
key: "build-react-native-navigation-android-fixture-old-arch"
@@ -293,6 +295,7 @@ steps:
293295
- "0.74"
294296
- "0.76"
295297
- "0.77"
298+
- "0.78"
296299

297300
# current latest version (v7.40.1) of react-native-navigation's autolinking tool doesn't support RN 0.73+,
298301
# causing a build failure - see https://github.com/wix/react-native-navigation/issues/7821
@@ -335,6 +338,7 @@ steps:
335338
- "0.74"
336339
- "0.76"
337340
- "0.77"
341+
- "0.78"
338342

339343
- label: ":bitbar: :android: react-native-navigation {{matrix}} Android 12 (Old Arch) end-to-end tests"
340344
depends_on: "build-react-native-navigation-android-fixture-old-arch"

.buildkite/basic/react-native-android-pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ steps:
2323
- "bundle install"
2424
- "node scripts/generate-react-native-fixture.js"
2525
matrix:
26-
- "0.78"
26+
- "0.79"
2727
retry:
2828
automatic:
2929
- exit_status: "*"
@@ -51,7 +51,7 @@ steps:
5151
- exit_status: "*"
5252
limit: 1
5353
matrix:
54-
- "0.78"
54+
- "0.79"
5555

5656
#
5757
# End-to-end tests
@@ -90,7 +90,7 @@ steps:
9090
concurrency_group: "bitbar"
9191
concurrency_method: eager
9292
matrix:
93-
- "0.78"
93+
- "0.79"
9494

9595
- label: ":bitbar: :android: RN {{matrix}} Android 12 (New Arch) end-to-end tests"
9696
depends_on: "build-react-native-android-fixture-new-arch"
@@ -126,5 +126,5 @@ steps:
126126
concurrency_group: "bitbar"
127127
concurrency_method: eager
128128
matrix:
129-
- "0.78"
129+
- "0.79"
130130

.buildkite/basic/react-native-cli-pipeline.yml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@ steps:
2525
- "bundle install"
2626
- "bundle exec maze-runner features/build-app-tests/build-android-app.feature"
2727
matrix:
28+
- "0.79"
29+
- "0.78"
2830
- "0.77"
29-
- "0.76"
30-
- "0.75"
3131
retry:
3232
automatic:
3333
- exit_status: "*"
@@ -54,9 +54,9 @@ steps:
5454
- "bundle install"
5555
- "bundle exec maze-runner features/build-app-tests/build-ios-app.feature"
5656
matrix:
57+
- "0.79"
58+
- "0.78"
5759
- "0.77"
58-
- "0.76"
59-
- "0.75"
6060
retry:
6161
automatic:
6262
- exit_status: "*"
@@ -92,9 +92,9 @@ steps:
9292
concurrency_group: "browserstack-app"
9393
concurrency_method: eager
9494
matrix:
95+
- "0.79"
96+
- "0.78"
9597
- "0.77"
96-
- "0.76"
97-
- "0.75"
9898

9999
- label: ":browserstack: :mac: RN CLI - {{matrix}} iOS end-to-end tests"
100100
depends_on: "build-react-native-cli-ios-fixture"
@@ -123,6 +123,6 @@ steps:
123123
concurrency_group: "browserstack-app"
124124
concurrency_method: eager
125125
matrix:
126+
- "0.79"
127+
- "0.78"
126128
- "0.77"
127-
- "0.76"
128-
- "0.75"

.buildkite/basic/react-native-ios-full-pipeline.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ steps:
6767
- "0.74"
6868
- "0.76"
6969
- "0.77"
70+
- "0.78"
7071
retry:
7172
automatic:
7273
- exit_status: "*"
@@ -94,6 +95,7 @@ steps:
9495
- "0.74"
9596
- "0.76"
9697
- "0.77"
98+
- "0.78"
9799
retry:
98100
automatic:
99101
- exit_status: "*"
@@ -254,6 +256,7 @@ steps:
254256
- "0.74"
255257
- "0.76"
256258
- "0.77"
259+
- "0.78"
257260

258261
- label: ":bitbar: :mac: RN {{matrix}} iOS (New Arch) end-to-end tests"
259262
depends_on: "build-react-native-ios-fixture-new-arch-full"
@@ -292,6 +295,7 @@ steps:
292295
- "0.74"
293296
- "0.76"
294297
- "0.77"
298+
- "0.78"
295299

296300
# current latest version (v7.40.1) of react-native-navigation's autolinking tool doesn't currently support RN 0.73+,
297301
# causing a build failure - see https://github.com/wix/react-native-navigation/issues/7821

.buildkite/basic/react-native-ios-pipeline.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ steps:
2727
- "bundle install"
2828
- "node scripts/generate-react-native-fixture.js"
2929
matrix:
30-
- "0.78"
30+
- "0.79"
3131
retry:
3232
automatic:
3333
- exit_status: "*"
@@ -51,7 +51,7 @@ steps:
5151
- "bundle install"
5252
- "node scripts/generate-react-native-fixture.js"
5353
matrix:
54-
- "0.78"
54+
- "0.79"
5555
retry:
5656
automatic:
5757
- exit_status: "*"
@@ -92,7 +92,7 @@ steps:
9292
concurrency_group: "bitbar"
9393
concurrency_method: eager
9494
matrix:
95-
- "0.78"
95+
- "0.79"
9696

9797
- label: ":bitbar: :mac: RN {{matrix}} iOS (New Arch) end-to-end tests"
9898
depends_on: "build-react-native-ios-fixture-new-arch"
@@ -127,5 +127,5 @@ steps:
127127
concurrency_group: "bitbar"
128128
concurrency_method: eager
129129
matrix:
130-
- "0.78"
130+
- "0.79"
131131

.buildkite/package_manifest.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,10 @@
138138
{
139139
"pipeline": ".buildkite/basic/react-native-cli-pipeline.yml",
140140
"block": ".buildkite/block/react-native-cli-pipeline.block.yml",
141-
"paths": []
141+
"paths": [
142+
"test/react-native-cli",
143+
"packages/react-native-cli"
144+
]
142145
},
143146
{
144147
"pipeline": ".buildkite/basic/expo-pipeline.yml",

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
- (react-native-cli) Update insert command for 0.79 projects [#2410](https://github.com/bugsnag/bugsnag-js/pull/2410)
6+
37
## [8.3.1] - 2025-04-09
48

59
### Changed

packages/react-native-cli/src/lib/Insert.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ const COCOA_OBJ_C_APP_LAUNCH_REGEX = /(-\s*\(BOOL\)\s*application:\s*\(UIApplica
1616

1717
const BUGSNAG_COCOA_SWIFT_IMPORT = 'import Bugsnag'
1818
const BUGSNAG_COCOA_SWIFT_INIT = 'Bugsnag.start()'
19-
const COCOA_SWIFT_APP_LAUNCH_REGEX = /(override func application\s*\(\s*_ application:\s*UIApplication,\s*didFinishLaunchingWithOptions launchOptions:\s*\[UIApplication\.LaunchOptionsKey\s*:\s*Any\]\?\s*=\s*nil\)\s*->\s*Bool\s*\{\s)/
19+
const COCOA_SWIFT_APP_LAUNCH_REGEX = /((?:override )?func application\s*\(\s*_\s+application:\s*UIApplication,\s*didFinishLaunchingWithOptions\s+launchOptions:\s*\[UIApplication\.LaunchOptionsKey\s*:?\s*Any\]\?\s*(?:=\s*nil)?\s*\)\s*->\s*Bool\s*\{\s)/
2020

2121
const BUGSNAG_JAVA_IMPORT = 'import com.bugsnag.android.Bugsnag;'
2222
const BUGSNAG_JAVA_INIT = 'Bugsnag.start(this);'

packages/react-native-cli/src/lib/__test__/Insert.test.ts

Lines changed: 51 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -94,15 +94,15 @@ test('insertIos(): success', async () => {
9494
)
9595
})
9696

97-
test('insertIos(): success (swift)', async () => {
97+
test('insertIos(): success (swift 0.78)', async () => {
9898
type readdir = (path: string) => Promise<string[]>
9999
const readdirMock = fs.readdir as unknown as jest.MockedFunction<readdir>
100100

101101
readdirMock
102102
.mockResolvedValueOnce(['BugsnagReactNativeCliTest.xcodeproj'])
103103
.mockResolvedValueOnce(['a', 'b', 'AppDelegate.swift', 'c', 'd'])
104104

105-
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-before.swift'))
105+
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-before-078.swift'))
106106
const readFileMock = fs.readFile as jest.MockedFunction<typeof fs.readFile>
107107
readFileMock.mockResolvedValue(appDelegate)
108108

@@ -113,7 +113,31 @@ test('insertIos(): success (swift)', async () => {
113113
expect(readFileMock).toHaveBeenCalledWith('/random/path/ios/BugsnagReactNativeCliTest/AppDelegate.swift', 'utf8')
114114
expect(writeFileMock).toHaveBeenCalledWith(
115115
'/random/path/ios/BugsnagReactNativeCliTest/AppDelegate.swift',
116-
await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after.swift')),
116+
await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after-078.swift')),
117+
'utf8'
118+
)
119+
})
120+
121+
test('insertIos(): success (swift 0.79+)', async () => {
122+
type readdir = (path: string) => Promise<string[]>
123+
const readdirMock = fs.readdir as unknown as jest.MockedFunction<readdir>
124+
125+
readdirMock
126+
.mockResolvedValueOnce(['BugsnagReactNativeCliTest.xcodeproj'])
127+
.mockResolvedValueOnce(['a', 'b', 'AppDelegate.swift', 'c', 'd'])
128+
129+
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-before-079.swift'))
130+
const readFileMock = fs.readFile as jest.MockedFunction<typeof fs.readFile>
131+
readFileMock.mockResolvedValue(appDelegate)
132+
133+
const writeFileMock = fs.writeFile as jest.MockedFunction<typeof fs.writeFile>
134+
writeFileMock.mockResolvedValue()
135+
136+
await insertIos('/random/path', logger)
137+
expect(readFileMock).toHaveBeenCalledWith('/random/path/ios/BugsnagReactNativeCliTest/AppDelegate.swift', 'utf8')
138+
expect(writeFileMock).toHaveBeenCalledWith(
139+
'/random/path/ios/BugsnagReactNativeCliTest/AppDelegate.swift',
140+
await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after-079.swift')),
117141
'utf8'
118142
)
119143
})
@@ -140,15 +164,37 @@ test('insertIos(): already present', async () => {
140164
expect(logger.warn).toHaveBeenCalledWith('Bugsnag is already included, skipping')
141165
})
142166

143-
test('insertIos(): already present (swift)', async () => {
167+
test('insertIos(): already present (swift 0.78)', async () => {
168+
type readdir = (path: string) => Promise<string[]>
169+
const readdirMock = fs.readdir as unknown as jest.MockedFunction<readdir>
170+
171+
readdirMock
172+
.mockResolvedValueOnce(['BugsnagReactNativeCliTest.xcodeproj'])
173+
.mockResolvedValueOnce(['a', 'b', 'AppDelegate.swift', 'c', 'd'])
174+
175+
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after-078.swift'))
176+
const readFileMock = fs.readFile as jest.MockedFunction<typeof fs.readFile>
177+
readFileMock.mockResolvedValue(appDelegate)
178+
179+
const writeFileMock = fs.writeFile as jest.MockedFunction<typeof fs.writeFile>
180+
writeFileMock.mockResolvedValue()
181+
182+
await insertIos('/random/path', logger)
183+
expect(readFileMock).toHaveBeenCalledWith('/random/path/ios/BugsnagReactNativeCliTest/AppDelegate.swift', 'utf8')
184+
expect(writeFileMock).not.toHaveBeenCalled()
185+
186+
expect(logger.warn).toHaveBeenCalledWith('Bugsnag is already included, skipping')
187+
})
188+
189+
test('insertIos(): already present (swift 0.79+)', async () => {
144190
type readdir = (path: string) => Promise<string[]>
145191
const readdirMock = fs.readdir as unknown as jest.MockedFunction<readdir>
146192

147193
readdirMock
148194
.mockResolvedValueOnce(['BugsnagReactNativeCliTest.xcodeproj'])
149195
.mockResolvedValueOnce(['a', 'b', 'AppDelegate.swift', 'c', 'd'])
150196

151-
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after.swift'))
197+
const appDelegate = await loadFixture(path.join(__dirname, 'fixtures', 'AppDelegate-after-079.swift'))
152198
const readFileMock = fs.readFile as jest.MockedFunction<typeof fs.readFile>
153199
readFileMock.mockResolvedValue(appDelegate)
154200

packages/react-native-cli/src/lib/__test__/fixtures/AppDelegate-after.swift renamed to packages/react-native-cli/src/lib/__test__/fixtures/AppDelegate-after-078.swift

File renamed without changes.

0 commit comments

Comments
 (0)