Skip to content

Commit 7b1f6a9

Browse files
abueideclaude
andauthored
feat(examples): add devbox integration for e2e-compat (#1265)
* feat(examples): add devbox integration for e2e-compat and example app Add mobile-devtools plugin with Nix-managed Android/iOS SDKs for reproducible builds. Includes device definitions and env-var-driven SDK version resolution in gradle files. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(devbox): add nodejs 22 to avoid nix insecure node 20 error The react-native plugin pulls nodejs 20 which is now marked insecure by nixpkgs (EOL). Explicitly add nodejs 22 to override. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e-compat): resolve devbox build issues and add version info - Pin watchman to 2024.11.18.00 (latest has folly build failure on nixpkgs) - Add uuid to metro blocklist (v14 at root is ESM-only, incompatible with RN 0.72 Metro) - Write .xcode.env.local in build:ios to inject devbox node path for Xcode - Add max device definitions and update lock files - Show RN version and platform in Stats panel Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * fix(e2e-compat): use pre-bundled JS for iOS release builds The xcodebuild bundle phase fails in monorepo environments because metro falls back to internal defaults and resolves entry-file against the repo root. Fix by building native code with SKIP_BUNDLING=1 then bundling JS separately via the RN CLI which correctly uses metro.config.js. Also updates Home.tsx with improved error diagnostics (network vs server errors with trace display) and adds reports/ to gitignore. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
1 parent 6746d63 commit 7b1f6a9

22 files changed

Lines changed: 306 additions & 54 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -102,3 +102,7 @@ AGENTS.md
102102

103103
# Notes and research (not for commit)
104104
notes/
105+
106+
# Devbox
107+
.devbox/
108+
devbox.lock

examples/AnalyticsReactNativeExample/android/build.gradle

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,18 @@
11
buildscript {
22
ext {
3-
buildToolsVersion = "35.0.0"
3+
def compileSdkEnv = System.getenv("ANDROID_COMPILE_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "35"
4+
def targetSdkEnv = System.getenv("ANDROID_TARGET_SDK") ?: System.getenv("ANDROID_MAX_API") ?: "35"
5+
buildToolsVersion = System.getenv("ANDROID_BUILD_TOOLS_VERSION") ?: "35.0.0"
46
minSdkVersion = 24
5-
compileSdkVersion = 35
6-
targetSdkVersion = 34
7-
ndkVersion = "26.1.10909125"
8-
kotlinVersion = "1.9.24"
7+
compileSdkVersion = compileSdkEnv.toInteger()
8+
targetSdkVersion = targetSdkEnv.toInteger()
9+
kotlinVersion = "2.1.20"
10+
def ndkVersionEnv = System.getenv("ANDROID_NDK_VERSION")
11+
if (ndkVersionEnv) {
12+
ndkVersion = ndkVersionEnv
13+
} else {
14+
ndkVersion = "26.1.10909125"
15+
}
916
}
1017
repositories {
1118
google()
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"devices": [
3+
{
4+
"name": "medium_phone_api36",
5+
"api": 36,
6+
"device": "medium_phone",
7+
"tag": "google_apis"
8+
}
9+
],
10+
"checksum": "e1a32475f99e1b20d5f0a20076f5ccade1803a8fe88af3bbad56e3e89ba332b7"
11+
}
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"name": "medium_phone_api36",
3+
"api": 36,
4+
"device": "medium_phone",
5+
"tag": "google_apis"
6+
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
{
2+
"devices": [
3+
{
4+
"name": "iPhone 17",
5+
"runtime": "26.2"
6+
}
7+
],
8+
"checksum": "7d4b3ac2354a9fd80740d7f9ab5313b3e39fc87d59174e154e04c4996c332186"
9+
}
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
{
2+
"name": "iPhone 17",
3+
"runtime": "26.2"
4+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"$schema": "https://raw.githubusercontent.com/jetify-com/devbox/0.14.2/.schema/devbox.schema.json",
3+
"include": [
4+
"github:segment-integrations/mobile-devtools?dir=plugins/react-native&ref=main"
5+
],
6+
"packages": {
7+
"yarn-berry": "latest"
8+
},
9+
"env": {
10+
"ANDROID_APP_APK": "android/app/build/outputs/apk/debug/app-debug.apk",
11+
"IOS_APP_ARTIFACT": "ios/build/Build/Products/Debug-iphonesimulator/*.app"
12+
},
13+
"shell": {
14+
"scripts": {
15+
"install": ["yarn install --no-immutable"],
16+
"install:pods": ["cd ios && pod install && cd .."],
17+
"build:android": ["cd android && ./gradlew assembleDebug && cd .."],
18+
"build:ios": [
19+
"xcodebuild -workspace ios/AnalyticsReactNativeExample.xcworkspace -scheme AnalyticsReactNativeExample -configuration Debug -sdk iphonesimulator -derivedDataPath ios/build build"
20+
]
21+
}
22+
}
23+
}

examples/e2e-compat/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ yarn-error.log
6464

6565
# testing
6666
/coverage
67+
68+
# devbox/segkit reports
69+
/reports/

examples/e2e-compat/.yarnrc.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
approvedGitRepositories:
2+
- '**'
3+
4+
enableScripts: true

examples/e2e-compat/android/app/build.gradle

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ android {
7373

7474
compileSdkVersion rootProject.ext.compileSdkVersion
7575

76+
lint {
77+
checkReleaseBuilds false
78+
}
79+
7680
namespace "com.AnalyticsReactNativeE2E"
7781
defaultConfig {
7882
applicationId "com.AnalyticsReactNativeE2E"

0 commit comments

Comments
 (0)