Skip to content

Commit bd2c08d

Browse files
authored
chore: Migrate Android/iOS example apps to react-native-test-app (#475)
1 parent 7814ae3 commit bd2c08d

File tree

68 files changed

+716
-2459
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

68 files changed

+716
-2459
lines changed

Diff for: .circleci/config.yml

+9-6
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ default config for macOS: &macos_defaults
2424
<<: *defaults
2525
resource_class: 'medium'
2626
macos:
27-
xcode: '11.7.0'
27+
xcode: '12.1.0'
2828

2929
default config for android apk builds: &android_defaults
3030
<<: *defaults
@@ -147,13 +147,16 @@ jobs:
147147
command: |
148148
brew bundle --file=.circleci/Brewfile.ios --no-lock
149149
touch .watchmanconfig
150-
node -v
150+
echo Node $(node --version)
151151
- save-cache: *cache_save_brew
152152
- restore-cache: *cache_restore_yarn
153153
- run:
154154
name: Installing Yarn dependencies
155155
command: yarn --pure-lockfile --non-interactive --cache-folder ~/.cache/yarn
156156
- save-cache: *cache_save_yarn
157+
- run:
158+
name: Bundle JS
159+
command: yarn bundle:ios --dev false
157160
- run:
158161
name: Install pod dependencies
159162
working_directory: example/ios
@@ -187,12 +190,12 @@ jobs:
187190

188191
# Build and test
189192
- run:
190-
name: Bundle
191-
command: mkdir example/android/app/src/main/assets && npx react-native bundle --platform android --dev false --entry-file example/index.js --bundle-output example/android/app/src/main/assets/index.android.bundle --assets-dest example/android/app/src/main/res/
193+
name: Bundle JS
194+
command: yarn bundle:android --dev false
192195
- run:
193-
name: Build Android apk
196+
name: Build APK
194197
working_directory: example/android
195-
command: ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release --max-workers 2 -x bundleReleaseJsAndAssets
198+
command: ./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release --max-workers 2
196199

197200
- persist_to_workspace:
198201
root: ~/async_storage

Diff for: .circleci/scripts/run_android_e2e.sh

+3-4
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,9 @@ MAX_RETRIES=60 # wait max 5 minutes for emu to boot
1111
build_apk() {
1212
echo
1313
echo "[Detox e2e] Building APK"
14-
eval "mkdir example/android/app/src/main/assets"
15-
eval "npx react-native bundle --platform android --dev false --entry-file example/index.js --bundle-output example/android/app/src/main/assets/index.android.bundle --assets-dest example/android/app/src/main/res/"
16-
cd "example/android"
17-
eval "./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release -x bundleReleaseJsAndAssets"
14+
yarn bundle:android --dev false
15+
cd example/android
16+
./gradlew assembleRelease assembleAndroidTest -DtestBuildType=release
1817
cd ${ROOT_DIR}
1918
}
2019

Diff for: .circleci/scripts/run_ios_e2e.sh

+2-3
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#!/bin/bash
22

3-
RESOURCE_DIR="$PWD/example/ios/build/Build/Products/Release-iphonesimulator/AsyncStorageExample.app"
3+
RESOURCE_DIR="$PWD/example/ios/build/Build/Products/Release-iphonesimulator/ReactTestApp.app"
44
ENTRY_FILE="example/index.js"
55
BUNDLE_FILE="$RESOURCE_DIR/main.jsbundle"
66
EXTRA_PACKAGER_ARGS="--entry-file=$ENTRY_FILE"
@@ -9,11 +9,10 @@ build_project() {
99
echo "[Detox e2e] Building iOS project"
1010
eval "xcodebuild \
1111
-workspace example/ios/AsyncStorageExample.xcworkspace \
12-
-scheme AsyncStorageExample \
12+
-scheme ReactTestApp \
1313
-configuration Release \
1414
-sdk iphonesimulator \
1515
-derivedDataPath example/ios/build \
16-
-UseModernBuildSystem=NO \
1716
BUNDLE_FILE=$BUNDLE_FILE \
1817
EXTRA_PACKAGER_ARGS=$EXTRA_PACKAGER_ARGS"
1918
}

Diff for: .clang-format

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
BasedOnStyle: LLVM
2+
AccessModifierOffset: -4
3+
AllowShortFunctionsOnASingleLine: None
4+
AlwaysBreakBeforeMultilineStrings: true
5+
AlwaysBreakTemplateDeclarations: true
6+
BinPackArguments: false
7+
BinPackParameters: false
8+
BreakBeforeBraces: Linux
9+
ColumnLimit: 100
10+
Cpp11BracedListStyle: true
11+
IncludeBlocks: Regroup
12+
IncludeCategories:
13+
- Regex: '"pch\.h"'
14+
Priority: -1
15+
- Regex: '^<React'
16+
Priority: 4
17+
- Regex: '^<[.a-z]+>'
18+
Priority: 2
19+
- Regex: '^<'
20+
Priority: 3
21+
- Regex: '.\*'
22+
Priority: 10
23+
IndentCaseLabels: true
24+
IndentWidth: 4
25+
NamespaceIndentation: All
26+
ObjCSpaceAfterProperty: true
27+
ObjCSpaceBeforeProtocolList: true
28+
PenaltyReturnTypeOnItsOwnLine: 100
29+
PointerAlignment: Right
30+
SpacesBeforeTrailingComments: 2
31+
SpacesInContainerLiterals: false
32+
TabWidth: 4

Diff for: android/build.gradle

+10-12
Original file line numberDiff line numberDiff line change
@@ -21,18 +21,17 @@ def safeExtGet(prop, fallback) {
2121
rootProject.ext.has(prop) ? rootProject.ext.get(prop) : fallback
2222
}
2323

24+
configurations {
25+
compileClasspath
26+
}
27+
2428
buildscript {
25-
// The Android Gradle plugin is only required when opening the android folder stand-alone.
26-
// This avoids unnecessary downloads and potential conflicts when the library is included as a
27-
// module dependency in an application project.
28-
if (project == rootProject) {
29-
repositories {
30-
google()
31-
jcenter()
32-
}
33-
dependencies {
34-
classpath 'com.android.tools.build:gradle:3.5.0'
35-
}
29+
repositories {
30+
google()
31+
jcenter()
32+
}
33+
dependencies {
34+
classpath 'com.android.tools.build:gradle:3.6.4'
3635
}
3736
}
3837

@@ -69,7 +68,6 @@ android {
6968
}
7069

7170
repositories {
72-
mavenLocal()
7371
maven {
7472
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
7573
url "${resolveModulePath("react-native")}/android"

Diff for: example/AsyncStorageExample.podspec

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
require 'json'
2+
3+
package = JSON.parse(File.read(File.join('..', 'package.json')))
4+
5+
Pod::Spec.new do |s|
6+
s.name = 'AsyncStorageExample'
7+
s.version = '0.0.1-dev'
8+
s.author = { package['author']['name'] => package['author']['email'] }
9+
s.license = package['license']
10+
s.homepage = package['homepage']
11+
s.source = { :git => package['repository']['url'] }
12+
s.summary = 'AsyncStorage example app'
13+
14+
s.ios.deployment_target = '12.0'
15+
s.osx.deployment_target = '10.14'
16+
17+
s.dependency 'React'
18+
s.dependency 'ReactTestApp-DevSupport'
19+
20+
#s.user_target_xcconfig = { 'ALWAYS_EMBED_SWIFT_STANDARD_LIBRARIES' => '$(inherited)' }
21+
22+
s.source_files = 'ios/AsyncStorageExample/**/*.{h,m,swift}'
23+
end

Diff for: example/android/app/BUCK

-55
This file was deleted.

0 commit comments

Comments
 (0)