You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: examples/rn-app/README.md
+69-2Lines changed: 69 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -6,8 +6,18 @@ This is a demonstrator application for the Ottrelite project, showcasing how to
6
6
-[Getting Started](#getting-started)
7
7
-[Step 1: Start Metro](#step-1-start-metro)
8
8
-[Step 2: Build and run the app](#step-2-build-and-run-the-app)
9
+
-[Build types](#build-types)
10
+
-[Debug build](#debug-build)
11
+
-[Release build](#release-build)
12
+
-[Profiling build](#profiling-build)
9
13
-[Android](#android)
14
+
-[Debug build](#debug-build-1)
15
+
-[Release build](#release-build-1)
16
+
-[Profiling build](#profiling-build-1)
10
17
-[iOS](#ios)
18
+
-[Debug build](#debug-build-2)
19
+
-[Release build](#release-build-2)
20
+
-[Profiling build](#profiling-build-2)
11
21
-[Step 3: Trace the application](#step-3-trace-the-application)
12
22
13
23
---
@@ -30,12 +40,57 @@ pnpm start
30
40
31
41
With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
32
42
43
+
### Build types
44
+
45
+
46
+
#### Debug build
47
+
48
+
The `debug` build variant (Android) or `Debug` configuration (iOS) will build the app in debug mode, with tracing enabled by default.
49
+
50
+
```sh
51
+
pnpm android
52
+
```
53
+
54
+
#### Release build
55
+
56
+
The `release` build variant (Android) or `Release` configuration (iOS) will build the app in release mode with the env var `DISABLE_TRACING` set to `true`, causing Ottrelite tracing to be disabled at runtime.
57
+
58
+
**Please note** that disabling of tracing at runtime happens only via `pnpm {android,ios}:release` script, not if building from Android Studio or Xcode, in which case tracing will be disabled. This is just the exemplary setup for this demo, in a usual case you'd likely want the inverted logic, in which case tracing is disabled by default and you only enable it when the env var is set instead. Handling of this env var is done by Babel plugin `transform-inline-environment-variables` and the `pnpm {android,ios}:release` script which passes the proper value of `DISABLE_TRACING` env var.
59
+
60
+
```sh
61
+
pnpm android:release
62
+
```
63
+
64
+
#### Profiling build
65
+
66
+
The `profiling` build variant (Android) or `Profiling` configuration (iOS) inherits everything from the `release` build variant and will build the app in profiling mode. This is the perfect mode that gives reliable performance behaviour after all compile-time optimizations.
67
+
68
+
```sh
69
+
pnpm android:profiling
70
+
```
71
+
33
72
### Android
34
73
74
+
The script [`android/app/build.gradle`](android/app/build.gradle) configures Ottrelite's Gradle plugin to inject tracing instrumentation for RN internals only for the `profiling` variant.
75
+
76
+
#### Debug build
77
+
35
78
```sh
36
79
pnpm android
37
80
```
38
81
82
+
#### Release build
83
+
84
+
```sh
85
+
pnpm android:release
86
+
```
87
+
88
+
#### Profiling build
89
+
90
+
```sh
91
+
pnpm android:profiling
92
+
```
93
+
39
94
### iOS
40
95
41
96
For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
@@ -54,13 +109,25 @@ bundle exec pod install
54
109
55
110
For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
56
111
112
+
#### Debug build
113
+
57
114
```sh
58
115
pnpm ios
59
116
```
60
117
61
-
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
118
+
#### Release build
119
+
120
+
```sh
121
+
pnpm ios:release
122
+
```
123
+
124
+
#### Profiling build
62
125
63
-
This is one way to run the app — you can also build it directly from Android Studio or Xcode.
126
+
```sh
127
+
pnpm ios:profiling
128
+
```
129
+
130
+
If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
0 commit comments