Skip to content

Commit 1468851

Browse files
authored
refactor(example): upgrade to react native 0.75.4 (#1302)
* chore: upgrade dependencies * refactor(example): upgrade to react native 0.75.4 * chore: integrate android sdk v14 snapshot * ci: install cocoapods 1.14 * ci: upgrade xcode to 15.4 * chore: remove .xcode.env.local * ci: install cocoapods into usr/local/bin * ci: fix empty jacoco report issue
1 parent 1dc56b5 commit 1468851

30 files changed

+4813
-3992
lines changed

.circleci/config.yml

+11-5
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,12 @@ commands:
4646
type: boolean
4747
default: false
4848
steps:
49+
- run:
50+
name: Uninstall Existing CocoaPods
51+
command: gem uninstall -x cocoapods
52+
- run:
53+
name: Install CocoaPods
54+
command: gem install cocoapods:1.14.0
4955
- restore_cache:
5056
name: Restore Pods Cache
5157
keys:
@@ -252,7 +258,7 @@ jobs:
252258
# ios/upload_sourcemap.sh files respectively.
253259
sync_generated_files:
254260
macos:
255-
xcode: 13.4.1
261+
xcode: 15.4.0
256262
resource_class: macos.m1.medium.gen1
257263
steps:
258264
- advanced-checkout/shallow-checkout
@@ -275,7 +281,7 @@ jobs:
275281
type: boolean
276282
default: false
277283
macos:
278-
xcode: 13.4.1
284+
xcode: 15.4.0
279285
resource_class: macos.m1.medium.gen1
280286
working_directory: ~/project/examples/default
281287
environment:
@@ -295,7 +301,7 @@ jobs:
295301
-scheme InstabugExample \
296302
-resultBundlePath coverage/result.xcresult \
297303
-sdk iphonesimulator \
298-
-destination 'platform=iOS Simulator,name=iPhone 13 Pro Max,OS=15.5' \
304+
-destination 'platform=iOS Simulator,name=iPhone 15 Pro Max,OS=17.5' \
299305
test | xcpretty
300306
- when:
301307
condition: << parameters.collect_coverage >>
@@ -315,7 +321,7 @@ jobs:
315321
type: steps
316322
default: []
317323
macos:
318-
xcode: 13.4.1
324+
xcode: 15.4.0
319325
resource_class: macos.m1.medium.gen1
320326
environment:
321327
INSTABUG_SOURCEMAPS_UPLOAD_DISABLE: true
@@ -414,7 +420,7 @@ jobs:
414420

415421
publish:
416422
macos:
417-
xcode: 13.4.1
423+
xcode: 15.4.0
418424
resource_class: macos.m1.medium.gen1
419425
working_directory: '~'
420426
steps:

android/build.gradle

+14
Original file line numberDiff line numberDiff line change
@@ -79,3 +79,17 @@ dependencies {
7979
testImplementation "org.mockito:mockito-android:3.4.0"
8080
testImplementation 'junit:junit:4.13.2'
8181
}
82+
83+
rootProject.allprojects {
84+
repositories {
85+
google()
86+
jcenter()
87+
maven {
88+
url "https://mvn.instabug.com/nexus/repository/instabug-internal/"
89+
credentials {
90+
username "instabug"
91+
password System.getenv('INSTABUG_REPOSITORY_PASSWORD')
92+
}
93+
}
94+
}
95+
}

android/jacoco.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ task jacocoTestReport(type: JacocoReport) {
3737
'**/*Binding.*'
3838
]
3939

40-
def jClasses = "${project.buildDir}/intermediates/javac/debug/classes"
40+
def jClasses = "${project.buildDir}/intermediates/javac/debug/compileDebugJavaWithJavac/classes"
4141
def javaClasses = fileTree(dir: jClasses, excludes: excludes)
4242
def sourceDirs = ["${project.projectDir}/src/main/java"]
4343
classDirectories.from = files(javaClasses)

android/native.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
project.ext.instabug = [
2-
version: '13.4.1'
2+
version: '14.0.0.6273213-SNAPSHOT'
33
]
44

55
dependencies {

examples/default/android/app/build.gradle

+14-57
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,22 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34
apply from: project(':react-native-config').projectDir.getPath() + "/dotenv.gradle"
45

5-
import com.android.build.OutputFile
6-
76
/**
87
* This is the configuration block to customize your React Native Android app.
98
* By default you don't need to apply any configuration, just uncomment the lines you need.
109
*/
1110
react {
1211
/* Folders */
13-
// The root of your project, i.e. where "package.json" lives. Default is '..'
14-
// root = file("../")
15-
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
16-
// reactNativeDir = file("../node_modules/react-native")
17-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
18-
// codegenDir = file("../node_modules/react-native-codegen")
19-
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
20-
// cliFile = file("../node_modules/react-native/cli.js")
12+
// The root of your project, i.e. where "package.json" lives. Default is '../..'
13+
// root = file("../../")
14+
// The folder where the react-native NPM package is. Default is ../../node_modules/react-native
15+
// reactNativeDir = file("../../node_modules/react-native")
16+
// The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
17+
// codegenDir = file("../../node_modules/@react-native/codegen")
18+
// The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
19+
// cliFile = file("../../node_modules/react-native/cli.js")
2120

2221
/* Variants */
2322
// The list of variants to that are debuggable. For those we're going to
@@ -51,6 +50,9 @@ react {
5150
//
5251
// The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
5352
// hermesFlags = ["-O", "-output-source-map"]
53+
54+
/* Autolinking */
55+
autolinkLibrariesWithApp()
5456
}
5557

5658
project.ext.vectoricons = [
@@ -59,14 +61,6 @@ project.ext.vectoricons = [
5961

6062
apply from: "../../node_modules/react-native-vector-icons/fonts.gradle"
6163

62-
/**
63-
* Set this to true to create four separate APKs instead of one,
64-
* one for each native architecture. This is useful if you don't
65-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
66-
* and want to have separate APKs to upload to the Play Store.
67-
*/
68-
def enableSeparateBuildPerCPUArchitecture = false
69-
7064
/**
7165
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
7266
*/
@@ -85,20 +79,10 @@ def enableProguardInReleaseBuilds = false
8579
*/
8680
def jscFlavor = 'org.webkit:android-jsc:+'
8781

88-
/**
89-
* Private function to get the list of Native Architectures you want to build.
90-
* This reads the value from reactNativeArchitectures in your gradle.properties
91-
* file and works together with the --active-arch-only flag of react-native run-android.
92-
*/
93-
def reactNativeArchitectures() {
94-
def value = project.getProperties().get("reactNativeArchitectures")
95-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
96-
}
97-
9882
android {
9983
ndkVersion rootProject.ext.ndkVersion
100-
101-
compileSdkVersion rootProject.ext.compileSdkVersion
84+
buildToolsVersion rootProject.ext.buildToolsVersion
85+
compileSdk rootProject.ext.compileSdkVersion
10286

10387
namespace "com.instabug.react.example"
10488
defaultConfig {
@@ -111,15 +95,6 @@ android {
11195
testBuildType System.getProperty('testBuildType', 'debug') // This will later be used to control the test apk build type
11296
testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
11397
}
114-
115-
splits {
116-
abi {
117-
reset()
118-
enable enableSeparateBuildPerCPUArchitecture
119-
universalApk false // If true, also generate a universal APK
120-
include (*reactNativeArchitectures())
121-
}
122-
}
12398
signingConfigs {
12499
debug {
125100
storeFile file('debug.keystore')
@@ -141,22 +116,6 @@ android {
141116
proguardFile "${rootProject.projectDir}/../node_modules/detox/android/detox/proguard-rules-app.pro"
142117
}
143118
}
144-
145-
// applicationVariants are e.g. debug, release
146-
applicationVariants.all { variant ->
147-
variant.outputs.each { output ->
148-
// For each separate APK per architecture, set a unique version code as described here:
149-
// https://developer.android.com/studio/build/configure-apk-splits.html
150-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
151-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
152-
def abi = output.getFilter(OutputFile.ABI)
153-
if (abi != null) { // null for the universal-debug, universal-release variants
154-
output.versionCodeOverride =
155-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
156-
}
157-
158-
}
159-
}
160119
externalNativeBuild {
161120
cmake {
162121
path file('src/main/cpp/CMakeLists.txt')
@@ -181,5 +140,3 @@ dependencies {
181140
androidTestImplementation('com.wix:detox:+') { transitive = true }
182141
androidTestImplementation 'junit:junit:4.12'
183142
}
184-
185-
apply from: file("../../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesAppBuildGradle(project)

examples/default/android/app/src/debug/AndroidManifest.xml

+1-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,5 @@
77
<application
88
android:usesCleartextTraffic="true"
99
tools:targetApi="28"
10-
tools:ignore="GoogleAppIndexingWarning">
11-
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" android:exported="false" />
12-
</application>
10+
tools:ignore="GoogleAppIndexingWarning"/>
1311
</manifest>

examples/default/android/app/src/main/AndroidManifest.xml

+1
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
android:roundIcon="@mipmap/ic_launcher_round"
1010
android:allowBackup="false"
1111
android:theme="@style/AppTheme"
12+
android:supportsRtl="true"
1213
android:networkSecurityConfig="@xml/network_security_config">
1314
<activity
1415
android:name=".MainActivity"

examples/default/android/app/src/main/java/com/instabug/react/example/MainActivity.java

-41
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.instabug.react.example
2+
3+
import com.facebook.react.ReactActivity
4+
import com.facebook.react.ReactActivityDelegate
5+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6+
import com.facebook.react.defaults.DefaultReactActivityDelegate
7+
8+
class MainActivity : ReactActivity() {
9+
10+
/**
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
13+
*/
14+
override fun getMainComponentName(): String = "InstabugExample"
15+
16+
/**
17+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19+
*/
20+
override fun createReactActivityDelegate(): ReactActivityDelegate =
21+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22+
}

examples/default/android/app/src/main/java/com/instabug/react/example/MainApplication.java

-60
This file was deleted.

0 commit comments

Comments
 (0)