Skip to content

Commit f60aecd

Browse files
WIP! Upgrade to 0.72 sdk, android sample
1 parent d7401ac commit f60aecd

File tree

15 files changed

+1211
-2034
lines changed

15 files changed

+1211
-2034
lines changed

RNSentry.podspec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ Pod::Spec.new do |s|
1919
s.preserve_paths = '*.js'
2020

2121
s.dependency 'React-Core'
22-
s.dependency 'Sentry/HybridSDK', '8.3.3'
22+
# s.dependency 'Sentry/HybridSDK', '8.3.3'
2323

2424
s.source_files = 'ios/**/*.{h,mm}'
2525
s.public_header_files = 'ios/RNSentry.h'

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@
7272
"jest-environment-jsdom": "^29.4.1",
7373
"prettier": "^2.0.5",
7474
"react": "18.2.0",
75-
"react-native": "0.71.0",
75+
"react-native": "0.72.0-rc.0",
7676
"replace-in-file": "^6.0.0",
7777
"rimraf": "^4.1.1",
7878
"ts-jest": "^29.0.5",

sample-new-architecture/.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module.exports = {
22
root: true,
3-
extends: '@react-native-community',
3+
extends: '@react-native',
44
parser: '@typescript-eslint/parser',
55
plugins: ['@typescript-eslint'],
66
overrides: [

sample-new-architecture/android/app/build.gradle

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@ apply plugin: "com.android.application"
22
apply plugin: "com.facebook.react"
33
apply plugin: "io.sentry.android.gradle"
44

5-
import com.android.build.OutputFile
6-
75
sentry {
86
// Disables or enables the automatic configuration of Native Symbols
97
// for Sentry. This executes sentry-cli automatically so
@@ -24,8 +22,8 @@ react {
2422
// root = file("../")
2523
// The folder where the react-native NPM package is. Default is ../node_modules/react-native
2624
// reactNativeDir = file("../node_modules/react-native")
27-
// The folder where the react-native Codegen package is. Default is ../node_modules/react-native-codegen
28-
// codegenDir = file("../node_modules/react-native-codegen")
25+
// The folder where the react-native Codegen package is. Default is ../node_modules/@react-native/codegen
26+
// codegenDir = file("../node_modules/@react-native/codegen")
2927
// The cli.js file which is the React Native CLI entrypoint. Default is ../node_modules/react-native/cli.js
3028
// cliFile = file("../node_modules/react-native/cli.js")
3129
/* Variants */
@@ -71,14 +69,6 @@ project.ext.sentryCli = [
7169

7270
apply from: "../../../sentry.gradle"
7371

74-
/**
75-
* Set this to true to create four separate APKs instead of one,
76-
* one for each native architecture. This is useful if you don't
77-
* use App Bundles (https://developer.android.com/guide/app-bundle/)
78-
* and want to have separate APKs to upload to the Play Store.
79-
*/
80-
def enableSeparateBuildPerCPUArchitecture = false
81-
8272
/**
8373
* Set this to true to Run Proguard on Release builds to minify the Java bytecode.
8474
*/
@@ -97,14 +87,6 @@ def enableProguardInReleaseBuilds = true
9787
*/
9888
def jscFlavor = 'org.webkit:android-jsc:+'
9989

100-
/**
101-
* Architectures to build native code for.
102-
*/
103-
def reactNativeArchitectures() {
104-
def value = project.getProperties().get("reactNativeArchitectures")
105-
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
106-
}
107-
10890
android {
10991
ndkVersion rootProject.ext.ndkVersion
11092

@@ -119,14 +101,6 @@ android {
119101
versionName "1.0"
120102
}
121103

122-
splits {
123-
abi {
124-
reset()
125-
enable enableSeparateBuildPerCPUArchitecture
126-
universalApk false // If true, also generate a universal APK
127-
include (*reactNativeArchitectures())
128-
}
129-
}
130104
signingConfigs {
131105
debug {
132106
storeFile file('debug.keystore')
@@ -148,23 +122,6 @@ android {
148122
}
149123
}
150124

151-
// applicationVariants are e.g. debug, release
152-
applicationVariants.all { variant ->
153-
variant.outputs.each { output ->
154-
// For each separate APK per architecture, set a unique version code as described here:
155-
// https://developer.android.com/studio/build/configure-apk-splits.html
156-
// Example: versionCode 1 will generate 1001 for armeabi-v7a, 1002 for x86, etc.
157-
def versionCodes = ["armeabi-v7a": 1, "x86": 2, "arm64-v8a": 3, "x86_64": 4]
158-
def abi = output.getFilter(OutputFile.ABI)
159-
if (abi != null) { // null for the universal-debug, universal-release variants
160-
output.versionCodeOverride =
161-
defaultConfig.versionCode * 1000 + versionCodes.get(abi)
162-
}
163-
164-
}
165-
}
166-
167-
168125
}
169126

170127
dependencies {

sample-new-architecture/android/app/src/main/java/com/samplenewarchitecture/MainActivity.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,9 +28,7 @@ protected ReactActivityDelegate createReactActivityDelegate() {
2828
this,
2929
getMainComponentName(),
3030
// If you opted-in for the New Architecture, we enable the Fabric Renderer.
31-
DefaultNewArchitectureEntryPoint.getFabricEnabled(), // fabricEnabled
32-
// If you opted-in for the New Architecture, we enable Concurrent React (i.e. React 18).
33-
DefaultNewArchitectureEntryPoint.getConcurrentReactEnabled() // concurrentRootEnabled
31+
DefaultNewArchitectureEntryPoint.getFabricEnabled()
3432
);
3533
}
3634

sample-new-architecture/android/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ buildscript {
1515
mavenCentral()
1616
}
1717
dependencies {
18-
classpath("com.android.tools.build:gradle:7.3.1")
18+
classpath("com.android.tools.build:gradle")
1919
classpath("com.facebook.react:react-native-gradle-plugin")
2020
classpath("io.sentry:sentry-android-gradle-plugin:3.4.2")
2121
}
Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
distributionBase=GRADLE_USER_HOME
22
distributionPath=wrapper/dists
3-
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5.1-all.zip
3+
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0.1-all.zip
4+
networkTimeout=10000
45
zipStoreBase=GRADLE_USER_HOME
56
zipStorePath=wrapper/dists

sample-new-architecture/android/gradlew

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
# Darwin, MinGW, and NonStop.
5656
#
5757
# (3) This script is generated from the Groovy template
58-
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
58+
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
5959
# within the Gradle project.
6060
#
6161
# You can find Gradle at https://github.com/gradle/gradle/.
@@ -80,10 +80,10 @@ do
8080
esac
8181
done
8282

83-
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
84-
85-
APP_NAME="Gradle"
83+
# This is normally unused
84+
# shellcheck disable=SC2034
8685
APP_BASE_NAME=${0##*/}
86+
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
8787

8888
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
8989
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
@@ -143,12 +143,16 @@ fi
143143
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
144144
case $MAX_FD in #(
145145
max*)
146+
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
147+
# shellcheck disable=SC3045
146148
MAX_FD=$( ulimit -H -n ) ||
147149
warn "Could not query maximum file descriptor limit"
148150
esac
149151
case $MAX_FD in #(
150152
'' | soft) :;; #(
151153
*)
154+
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
155+
# shellcheck disable=SC3045
152156
ulimit -n "$MAX_FD" ||
153157
warn "Could not set maximum file descriptor limit to $MAX_FD"
154158
esac
@@ -205,6 +209,12 @@ set -- \
205209
org.gradle.wrapper.GradleWrapperMain \
206210
"$@"
207211

212+
# Stop when "xargs" is not available.
213+
if ! command -v xargs >/dev/null 2>&1
214+
then
215+
die "xargs is not available"
216+
fi
217+
208218
# Use "xargs" to parse quoted args.
209219
#
210220
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.

sample-new-architecture/android/gradlew.bat

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
@rem limitations under the License.
1515
@rem
1616

17-
@if "%DEBUG%" == "" @echo off
17+
@if "%DEBUG%"=="" @echo off
1818
@rem ##########################################################################
1919
@rem
2020
@rem Gradle startup script for Windows
@@ -25,7 +25,8 @@
2525
if "%OS%"=="Windows_NT" setlocal
2626

2727
set DIRNAME=%~dp0
28-
if "%DIRNAME%" == "" set DIRNAME=.
28+
if "%DIRNAME%"=="" set DIRNAME=.
29+
@rem This is normally unused
2930
set APP_BASE_NAME=%~n0
3031
set APP_HOME=%DIRNAME%
3132

@@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
4041

4142
set JAVA_EXE=java.exe
4243
%JAVA_EXE% -version >NUL 2>&1
43-
if "%ERRORLEVEL%" == "0" goto execute
44+
if %ERRORLEVEL% equ 0 goto execute
4445

4546
echo.
4647
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
@@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
7576

7677
:end
7778
@rem End local scope for the variables with windows NT shell
78-
if "%ERRORLEVEL%"=="0" goto mainEnd
79+
if %ERRORLEVEL% equ 0 goto mainEnd
7980

8081
:fail
8182
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
8283
rem the _cmd.exe /c_ return code!
83-
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
84-
exit /b 1
84+
set EXIT_CODE=%ERRORLEVEL%
85+
if %EXIT_CODE% equ 0 set EXIT_CODE=1
86+
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
87+
exit /b %EXIT_CODE%
8588

8689
:mainEnd
8790
if "%OS%"=="Windows_NT" endlocal
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
rootProject.name = 'sampleNewArchitecture'
22
apply from: file("../node_modules/@react-native-community/cli-platform-android/native_modules.gradle"); applyNativeModulesSettingsGradle(settings)
33
include ':app'
4-
includeBuild('../node_modules/react-native-gradle-plugin')
4+
includeBuild('../node_modules/@react-native/gradle-plugin')

sample-new-architecture/ios/Podfile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,9 @@ target 'sampleNewArchitecture' do
5454
# Pods for testing
5555
end
5656

57+
pod 'Sentry/HybridSDK', :path => '../../../sentry-cocoa'
58+
pod 'SentryPrivate', :path => '../../../sentry-cocoa/SentryPrivate.podspec'
59+
5760
post_install do |installer|
5861
react_native_post_install(
5962
installer,

sample-new-architecture/package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,21 +15,21 @@
1515
},
1616
"dependencies": {
1717
"@react-native-community/cli-platform-android": "^10.1.3",
18+
"@react-native/eslint-config": "^0.73.0",
1819
"@react-navigation/native": "^6.1.2",
1920
"@react-navigation/stack": "^6.3.11",
2021
"react": "18.2.0",
21-
"react-native": "0.71.1",
22+
"react-native": "0.72.0-rc.0",
2223
"react-native-gesture-handler": "^2.9.0",
2324
"react-native-safe-area-context": "^4.5.0",
2425
"react-native-screens": "^3.19.0",
2526
"react-redux": "^8.0.5",
2627
"redux": "^4.2.0"
2728
},
2829
"devDependencies": {
29-
"@babel/core": "^7.20.0",
30-
"@babel/preset-env": "^7.20.0",
30+
"@babel/core": "^7.21.4",
31+
"@babel/preset-env": "^7.21.4",
3132
"@babel/runtime": "^7.20.0",
32-
"@react-native-community/eslint-config": "^3.0.0",
3333
"@tsconfig/react-native": "^2.0.2",
3434
"@types/jest": "^29.2.1",
3535
"@types/react-test-renderer": "^18.0.0",
@@ -41,7 +41,7 @@
4141
"eslint-plugin-ft-flow": "^2.0.3",
4242
"eslint-plugin-jest": "^27.2.1",
4343
"jest": "^29.2.1",
44-
"metro-react-native-babel-preset": "^0.73.7",
44+
"metro-react-native-babel-preset": "^0.76.0",
4545
"prettier": "^2.4.1",
4646
"react-test-renderer": "18.2.0",
4747
"typescript": "4.8.4"

sample-new-architecture/src/Screens/HomeScreen.tsx

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,16 @@ const HomeScreen = (props: Props) => {
156156
});
157157
}}
158158
/>
159+
<Button
160+
title="Capture HTTP Client Error"
161+
onPress={async () => {
162+
try {
163+
fetch('http://localhost:8081/not-found');
164+
} catch (error) {
165+
//ignore the error, it will be send to Sentry
166+
}
167+
}}
168+
/>
159169
<Button
160170
title="Auto Tracing Example"
161171
onPress={() => {

0 commit comments

Comments
 (0)