Skip to content

Commit

Permalink
Replace test app with react-native-test-app (#120)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: Saad Najmi <[email protected]>
Co-authored-by: William Candillon <[email protected]>
  • Loading branch information
3 people authored Oct 2, 2024
1 parent 9d89d43 commit 264d40a
Show file tree
Hide file tree
Showing 177 changed files with 1,216 additions and 1,808 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ jobs:
/bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null"
- name: Install Android SDK
run: echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/paper/android/local.properties
run: echo "sdk.dir=$ANDROID_HOME" > $GITHUB_WORKSPACE/apps/example/android/local.properties

- name: Cache Gradle
if: env.turbo_cache_hit != 1
Expand All @@ -122,7 +122,7 @@ jobs:
path: |
~/.gradle/wrapper
~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/paper/android/gradle/wrapper/gradle-wrapper.properties') }}
key: ${{ runner.os }}-gradle-${{ hashFiles('./apps/example/android/gradle/wrapper/gradle-wrapper.properties') }}
restore-keys: |
${{ runner.os }}-gradle-
Expand Down
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
# Yarn
.package/.yarn/*
.yarn/*
!.yarn/patches
!.yarn/plugins
Expand Down Expand Up @@ -72,7 +73,7 @@ packages/webgpu/lib

# Cocoapods
#
apps/paper/ios/Pods
apps/example/**/Pods
# Ruby
apps/vendor/

Expand Down
4 changes: 2 additions & 2 deletions apps/paper/.eslintrc → apps/example/.eslintrc
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
{
"extends": "react-native-wcandillon",
"ignorePatterns": ["**/*/components/meshes"],
"ignorePatterns": ["**/*/components/meshes", "**/Pods/**"],
"rules": {
"no-bitwise": "off",
"@typescript-eslint/no-require-imports": "off"
}
}
}
16 changes: 16 additions & 0 deletions apps/example/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
*.binlog
*.hprof
*.xcworkspace/
*.zip
.DS_Store
.gradle/
.idea/
.vs/
.xcode.env
**/Pods/**
build/
dist/*
!dist/.gitignore
local.properties
msbuild.binlog
node_modules/
File renamed without changes.
43 changes: 43 additions & 0 deletions apps/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
buildscript {
apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/android/dependencies.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())

repositories {
mavenCentral()
google()
}

dependencies {
getReactNativeDependencies().each { dependency ->
classpath(dependency)
}
}
}

allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url({
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native/android")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native`");
}())
}
mavenCentral()
google()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,35 +7,49 @@
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html

# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
# Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m

# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# Specifies the JVM arguments used for the Gradle Daemon. The setting is
# particularly useful for configuring JVM memory settings for build performance.
# This does not affect the JVM settings for the Gradle client VM.
# The default is `-Xmx512m -XX:MaxMetaspaceSize=256m`.
org.gradle.jvmargs=-Xmx2g -XX:MaxMetaspaceSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8

# When configured, Gradle will fork up to org.gradle.workers.max JVMs to execute
# projects in parallel. To learn more about parallel task execution, see the
# section on Gradle build performance:
# https://docs.gradle.org/current/userguide/performance.html#parallel_execution.
# Default is `false`.
#org.gradle.parallel=true

# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app's APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true
# Jetifier randomly fails on these libraries
android.jetifier.ignorelist=hermes-android,react-android

# Use this property to specify which architecture you want to build.
# You can also override it from the CLI using
# ./gradlew <task> -PreactNativeArchitectures=x86_64
reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
newArchEnabled=false
hermesEnabled=true

# Use this property to enable support to the new architecture.
# This will allow you to use TurboModules and the Fabric render in
# your application. You should enable this flag either if you want
# to write custom TurboModules/Fabric components OR use libraries that
# are providing them.
newArchEnabled=false
# Note that this is incompatible with web debugging.
#newArchEnabled=true
#bridgelessEnabled=true

# Use this property to enable or disable the Hermes JS engine.
# If set to false, you will be using JSC instead.
hermesEnabled=true
# Uncomment the line below to build React Native from source.
#react.buildFromSource=true

# Version of Android NDK to build against.
#ANDROID_NDK_VERSION=26.1.10909125

# Version of Kotlin to build against.
#KOTLIN_VERSION=1.8.22
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-8.6-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.8-bin.zip
networkTimeout=10000
validateDistributionUrl=true
zipStoreBase=GRADLE_USER_HOME
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@
# Darwin, MinGW, and NonStop.
#
# (3) This script is generated from the Groovy template
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
# within the Gradle project.
#
# You can find Gradle at https://github.com/gradle/gradle/.
Expand Down
File renamed without changes.
21 changes: 21 additions & 0 deletions apps/example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
pluginManagement {
repositories {
gradlePluginPortal()
mavenCentral()
google()
}
}

rootProject.name = "Example"

apply(from: {
def searchDir = rootDir.toPath()
do {
def p = searchDir.resolve("node_modules/react-native-test-app/test-app.gradle")
if (p.toFile().exists()) {
return p.toRealPath().toString()
}
} while (searchDir = searchDir.getParent())
throw new GradleException("Could not find `react-native-test-app`");
}())
applyTestAppSettings(settings)
30 changes: 30 additions & 0 deletions apps/example/app.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"name": "Example",
"displayName": "Example",
"singleApp": "example-app",
"components": [
{
"appKey": "Example",
"displayName": "Example",
"slug": "example-app"
}
],
"resources": {
"android": [
"dist/res",
"dist/main.android.jsbundle"
],
"ios": [
"dist/assets",
"dist/main.ios.jsbundle"
],
"macos": [
"dist/assets",
"dist/main.macos.jsbundle"
],
"visionos": [
"dist/assets",
"dist/main.visionos.jsbundle"
]
}
}
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/example/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
/**
* @format
*/

import {AppRegistry} from 'react-native';
import App from './src/App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);
13 changes: 13 additions & 0 deletions apps/example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
ws_dir = Pathname.new(__dir__)
ws_dir = ws_dir.parent until
File.exist?("#{ws_dir}/node_modules/react-native-test-app/test_app.rb") ||
ws_dir.expand_path.to_s == '/'
require "#{ws_dir}/node_modules/react-native-test-app/test_app.rb"

workspace 'Example.xcworkspace'

options = {
:hermes_enabled => true
}

use_test_app! options
60 changes: 49 additions & 11 deletions apps/paper/ios/Podfile.lock → apps/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -935,7 +935,7 @@ PODS:
- React-Mapbuffer (0.74.2):
- glog
- React-debug
- react-native-safe-area-context (4.10.9):
- react-native-safe-area-context (4.11.0):
- React-Core
- react-native-wgpu (0.1.7):
- DoubleConversion
Expand Down Expand Up @@ -1187,7 +1187,33 @@ PODS:
- React-logger (= 0.74.2)
- React-perflogger (= 0.74.2)
- React-utils (= 0.74.2)
- RNGestureHandler (2.18.1):
- ReactNativeHost (0.5.0):
- DoubleConversion
- glog
- hermes-engine
- RCT-Folly (= 2024.01.01.00)
- RCTRequired
- RCTTypeSafety
- React-Codegen
- React-Core
- React-cxxreact
- React-debug
- React-Fabric
- React-featureflags
- React-graphics
- React-ImageManager
- React-NativeModulesApple
- React-RCTFabric
- React-rendererdebug
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- ReactTestApp-DevSupport (3.10.8):
- React-Core
- React-jsi
- ReactTestApp-Resources (1.0.0-dev)
- RNGestureHandler (2.19.0):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1208,7 +1234,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNReanimated (3.15.1):
- RNReanimated (3.15.2):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1228,10 +1254,10 @@ PODS:
- React-utils
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- RNReanimated/reanimated (= 3.15.1)
- RNReanimated/worklets (= 3.15.1)
- RNReanimated/reanimated (= 3.15.2)
- RNReanimated/worklets (= 3.15.2)
- Yoga
- RNReanimated/reanimated (3.15.1):
- RNReanimated/reanimated (3.15.2):
- DoubleConversion
- glog
- hermes-engine
Expand All @@ -1252,7 +1278,7 @@ PODS:
- ReactCommon/turbomodule/bridging
- ReactCommon/turbomodule/core
- Yoga
- RNReanimated/worklets (3.15.1):
- RNReanimated/worklets (3.15.2):
- DoubleConversion
- glog
- hermes-engine
Expand Down Expand Up @@ -1356,6 +1382,9 @@ DEPENDENCIES:
- React-runtimescheduler (from `../../../node_modules/react-native/ReactCommon/react/renderer/runtimescheduler`)
- React-utils (from `../../../node_modules/react-native/ReactCommon/react/utils`)
- ReactCommon/turbomodule/core (from `../../../node_modules/react-native/ReactCommon`)
- "ReactNativeHost (from `../../../node_modules/@rnx-kit/react-native-host`)"
- ReactTestApp-DevSupport (from `../../../node_modules/react-native-test-app`)
- ReactTestApp-Resources (from `..`)
- RNGestureHandler (from `../../../node_modules/react-native-gesture-handler`)
- RNReanimated (from `../../../node_modules/react-native-reanimated`)
- RNScreens (from `../../../node_modules/react-native-screens`)
Expand Down Expand Up @@ -1477,6 +1506,12 @@ EXTERNAL SOURCES:
:path: "../../../node_modules/react-native/ReactCommon/react/utils"
ReactCommon:
:path: "../../../node_modules/react-native/ReactCommon"
ReactNativeHost:
:path: "../../../node_modules/@rnx-kit/react-native-host"
ReactTestApp-DevSupport:
:path: "../../../node_modules/react-native-test-app"
ReactTestApp-Resources:
:path: ".."
RNGestureHandler:
:path: "../../../node_modules/react-native-gesture-handler"
RNReanimated:
Expand Down Expand Up @@ -1517,7 +1552,7 @@ SPEC CHECKSUMS:
React-jsitracing: 0fa7f78d8fdda794667cb2e6f19c874c1cf31d7e
React-logger: 29fa3e048f5f67fe396bc08af7606426d9bd7b5d
React-Mapbuffer: bf56147c9775491e53122a94c423ac201417e326
react-native-safe-area-context: ab8f4a3d8180913bd78ae75dd599c94cce3d5e9a
react-native-safe-area-context: 851c62c48dce80ccaa5637b6aa5991a1bc36eca9
react-native-wgpu: ab1d9f4a982e04d37e1330ee2b950d482186a879
React-nativeconfig: 9f223cd321823afdecf59ed00861ab2d69ee0fc1
React-NativeModulesApple: ff7efaff7098639db5631236cfd91d60abff04c0
Expand All @@ -1542,12 +1577,15 @@ SPEC CHECKSUMS:
React-runtimescheduler: 56b642bf605ba5afa500d35790928fc1d51565ad
React-utils: 4476b7fcbbd95cfd002f3e778616155241d86e31
ReactCommon: ecad995f26e0d1e24061f60f4e5d74782f003f12
RNGestureHandler: efed690b8493a00b99654043daeb1335276ac4a2
RNReanimated: abb16e70ea4fbd72c667946caa3abd0f962897f6
ReactNativeHost: 76fb17eac13a9a2200f659deffc91c054731a7e2
ReactTestApp-DevSupport: 690d06567b7ecae4f2f98dff5e4881c8d25be8e2
ReactTestApp-Resources: 857244f3a23f2b3157b364fa06cf3e8866deff9c
RNGestureHandler: 67e78f16895947f7e57ab91e75e914d3e9ef7239
RNReanimated: 4c72fc2c0f4c6a9c36932e653cd68e4521b6c4ac
RNScreens: aa943ad421c3ced3ef5a47ede02b0cbfc43a012e
SocketRocket: abac6f5de4d4d62d24e11868d7a2f427e0ef940d
Yoga: ae3c32c514802d30f687a04a6a35b348506d411f

PODFILE CHECKSUM: 6a64c4e2f4165ecd7371d7daca36d1c129d3e06d
PODFILE CHECKSUM: 21851af42ab33f67696cf6469097d79f1cc68181

COCOAPODS: 1.15.2
File renamed without changes.
9 changes: 9 additions & 0 deletions apps/example/macos/Podfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
ws_dir = Pathname.new(__dir__)
ws_dir = ws_dir.parent until
File.exist?("#{ws_dir}/node_modules/react-native-test-app/macos/test_app.rb") ||
ws_dir.expand_path.to_s == '/'
require "#{ws_dir}/node_modules/react-native-test-app/macos/test_app.rb"

workspace 'Example.xcworkspace'

use_test_app!
Loading

0 comments on commit 264d40a

Please sign in to comment.