Skip to content

Commit 35c6942

Browse files
authored
Merge pull request #14 from lytics/intermediary/interface/9-upgrade-bob
Use react-native-builder-bob 0.35.0
2 parents cd56260 + e64edf3 commit 35c6942

File tree

38 files changed

+16256
-16479
lines changed

38 files changed

+16256
-16479
lines changed

.github/actions/setup/action.yml

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ runs:
1515
with:
1616
path: |
1717
**/node_modules
18-
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}-${{ hashFiles('**/package.json') }}
18+
.yarn/install-state.gz
19+
key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }}
1920
restore-keys: |
20-
${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
21+
${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}
2122
${{ runner.os }}-yarn-
2223
2324
- name: Install dependencies
2425
if: steps.yarn-cache.outputs.cache-hit != 'true'
25-
run: |
26-
yarn install --cwd example --frozen-lockfile
27-
yarn install --frozen-lockfile
26+
run: yarn install --immutable
2827
shell: bash

.github/workflows/ci.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ jobs:
4646
uses: ./.github/actions/setup
4747

4848
- name: Build package
49-
run: yarn prepack
49+
run: yarn prepare
5050

5151
build-android:
5252
runs-on: ubuntu-latest
@@ -63,13 +63,13 @@ jobs:
6363
uses: actions/cache@v3
6464
with:
6565
path: ${{ env.TURBO_CACHE_DIR }}
66-
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('**/yarn.lock') }}
66+
key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }}
6767
restore-keys: |
6868
${{ runner.os }}-turborepo-android-
6969
7070
- name: Check turborepo cache for Android
7171
run: |
72-
TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
72+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status")
7373
7474
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
7575
echo "turbo_cache_hit=1" >> $GITHUB_ENV
@@ -117,13 +117,13 @@ jobs:
117117
uses: actions/cache@v3
118118
with:
119119
path: ${{ env.TURBO_CACHE_DIR }}
120-
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('**/yarn.lock') }}
120+
key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }}
121121
restore-keys: |
122122
${{ runner.os }}-turborepo-ios-
123123
124124
- name: Check turborepo cache for iOS
125125
run: |
126-
TURBO_CACHE_STATUS=$(node -p "($(yarn --silent turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
126+
TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status")
127127
128128
if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then
129129
echo "turbo_cache_hit=1" >> $GITHUB_ENV
@@ -143,7 +143,7 @@ jobs:
143143
- name: Install cocoapods
144144
if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true'
145145
run: |
146-
yarn example pods
146+
yarn pod-install example/ios
147147
env:
148148
NO_FLIPPER: 1
149149

.gitignore

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ buck-out/
6060
android/app/libs
6161
android/keystores/debug.keystore
6262

63+
# Yarn
64+
.yarn/*
65+
!.yarn/patches
66+
!.yarn/plugins
67+
!.yarn/releases
68+
!.yarn/sdks
69+
!.yarn/versions
70+
6371
# Expo
6472
.expo/
6573

@@ -68,3 +76,5 @@ android/keystores/debug.keystore
6876

6977
# generated by bob
7078
lib/
79+
80+
example/ios/.xcode.env.local

.yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs

Lines changed: 541 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs

Lines changed: 28 additions & 0 deletions
Large diffs are not rendered by default.

.yarn/releases/yarn-3.6.1.cjs

Lines changed: 874 additions & 0 deletions
Large diffs are not rendered by default.

.yarnrc

Lines changed: 0 additions & 3 deletions
This file was deleted.

.yarnrc.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
nodeLinker: node-modules
2+
nmHoistingLimits: workspaces
3+
4+
plugins:
5+
- path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs
6+
spec: "@yarnpkg/plugin-interactive-tools"
7+
- path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs
8+
spec: "@yarnpkg/plugin-workspace-tools"
9+
10+
yarnPath: .yarn/releases/yarn-3.6.1.cjs

android/build.gradle

Lines changed: 3 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ def isNewArchitectureEnabled() {
2121
apply plugin: "com.android.library"
2222
apply plugin: "kotlin-android"
2323

24-
25-
def appProject = rootProject.allprojects.find { it.plugins.hasPlugin('com.android.application') }
26-
2724
if (isNewArchitectureEnabled()) {
2825
apply plugin: "com.facebook.react"
2926
}
@@ -42,11 +39,7 @@ def supportsNamespace() {
4239
def minor = parsed[1].toInteger()
4340

4441
// Namespace support was added in 7.3.0
45-
if (major == 7 && minor >= 3) {
46-
return true
47-
}
48-
49-
return major >= 8
42+
return (major == 7 && minor >= 3) || major >= 8
5043
}
5144

5245
android {
@@ -65,8 +58,9 @@ android {
6558
defaultConfig {
6659
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
6760
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
68-
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
61+
6962
}
63+
7064
buildTypes {
7165
release {
7266
minifyEnabled false
@@ -81,13 +75,11 @@ android {
8175
sourceCompatibility JavaVersion.VERSION_1_8
8276
targetCompatibility JavaVersion.VERSION_1_8
8377
}
84-
8578
}
8679

8780
repositories {
8881
mavenCentral()
8982
google()
90-
maven { url 'https://jitpack.io' }
9183
}
9284

9385
def kotlin_version = getExtOrDefault("kotlinVersion")
@@ -102,10 +94,3 @@ dependencies {
10294
implementation 'com.github.lytics:android-sdk:main-SNAPSHOT'
10395
}
10496

105-
if (isNewArchitectureEnabled()) {
106-
react {
107-
jsRootDir = file("../src/")
108-
libraryName = "Sdk"
109-
codegenJavaPackageName = "com.lytics.react_native"
110-
}
111-
}

babel.config.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
module.exports = {
2-
presets: ['module:metro-react-native-babel-preset'],
2+
presets: ['module:@react-native/babel-preset'],
33
};

example/Gemfile

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,7 @@ source 'https://rubygems.org'
33
# You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
44
ruby ">= 2.6.10"
55

6-
gem 'cocoapods', '~> 1.12'
6+
# Cocoapods 1.15 introduced a bug which break the build. We will remove the upper
7+
# bound in the template on Cocoapods with next React Native release.
8+
gem 'cocoapods', '>= 1.13', '< 1.15'
9+
gem 'activesupport', '>= 6.1.7.5', '< 7.1.0'

example/android/app/build.gradle

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
apply plugin: "com.android.application"
2+
apply plugin: "org.jetbrains.kotlin.android"
23
apply plugin: "com.facebook.react"
34

45
/**
@@ -70,8 +71,8 @@ def jscFlavor = 'org.webkit:android-jsc:+'
7071

7172
android {
7273
ndkVersion rootProject.ext.ndkVersion
73-
74-
compileSdkVersion rootProject.ext.compileSdkVersion
74+
buildToolsVersion rootProject.ext.buildToolsVersion
75+
compileSdk rootProject.ext.compileSdkVersion
7576

7677
namespace "com.lytics.react_native.example"
7778
defaultConfig {
@@ -106,13 +107,8 @@ android {
106107
dependencies {
107108
// The version of react-native is set by the React Native Gradle Plugin
108109
implementation("com.facebook.react:react-android")
110+
implementation("com.facebook.react:flipper-integration")
109111

110-
debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}")
111-
debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
112-
exclude group:'com.squareup.okhttp3', module:'okhttp'
113-
}
114-
115-
debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}")
116112
if (hermesEnabled.toBoolean()) {
117113
implementation("com.facebook.react:hermes-android")
118114
} else {

example/android/app/src/debug/java/com/lytics/react_native/example/ReactNativeFlipper.java

Lines changed: 0 additions & 75 deletions
This file was deleted.

example/android/app/src/main/java/com/lytics/react_native/example/MainActivity.java

Lines changed: 0 additions & 39 deletions
This file was deleted.
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package com.lytics.react_native.example
2+
3+
import com.facebook.react.ReactActivity
4+
import com.facebook.react.ReactActivityDelegate
5+
import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6+
import com.facebook.react.defaults.DefaultReactActivityDelegate
7+
8+
class MainActivity : ReactActivity() {
9+
10+
/**
11+
* Returns the name of the main component registered from JavaScript. This is used to schedule
12+
* rendering of the component.
13+
*/
14+
override fun getMainComponentName(): String = "SdkExample"
15+
16+
/**
17+
* Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18+
* which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19+
*/
20+
override fun createReactActivityDelegate(): ReactActivityDelegate =
21+
DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22+
}

0 commit comments

Comments
 (0)