Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Commit

Permalink
prepare 6.0.0 release (#115)
Browse files Browse the repository at this point in the history
  • Loading branch information
LaunchDarklyReleaseBot authored Feb 10, 2022
1 parent 3f84e87 commit 0142bf2
Show file tree
Hide file tree
Showing 74 changed files with 24,091 additions and 2,584 deletions.
174 changes: 99 additions & 75 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,81 +1,117 @@
version: 2.1

orbs:
android: circleci/android@1.0
node: circleci/node@4.8.0

aliases:
- &use_local_sdk
name: Set hello application to use local SDK and RN version
command: |
cd ../hello-react-native
TEMP_FILE=`mktemp -u` || exit 1
sed 's/"launchdarkly-react-native-client-sdk" *: *"[^"]*" *, *$/"launchdarkly-react-native-client-sdk": "file:..\/project"\,/' 'package.json' > $TEMP_FILE
mv $TEMP_FILE 'package.json'
jobs:
android:
# This job simulates integrating the SDK into a freshly created React Native project template and
# then builds Android and iOS applications using the template.
build-applications-using-template:
parameters:
hello-app-branch:
rn-version:
description: The React Native project template version
type: string
xcode-version:
description: The Xcode version to build with
type: string

executor:
name: android/android-machine
resource-class: large
macos:
xcode: <<parameters.xcode-version>>
resource_class: macos.x86.medium.gen2

environment:
ANDROID_SDK_ROOT: "/tmp/Android"

steps:
- checkout

- run: cd .. && git clone --depth 1 https://github.com/launchdarkly/hello-react-native.git -b <<parameters.hello-app-branch>>
- run: *use_local_sdk
- node/install:
lts: true
install-yarn: true
- run:
name: Build bundle
name: Download Android command line tools
command: |
cd ../hello-react-native
npx yarn install
npx react-native bundle --entry-file index.js --platform android --bundle-output android/main.jsbundle --assets-dest android
mkdir -p $ANDROID_SDK_ROOT/cmdline-tools/latest
curl https://dl.google.com/android/repository/commandlinetools-mac-8092744_latest.zip -o cmdline-tools.zip
unzip cmdline-tools.zip
mv cmdline-tools/* $ANDROID_SDK_ROOT/cmdline-tools/latest/
yes | $ANDROID_SDK_ROOT/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null || true
- run:
name: Setup debug keystore
name: Setup Android debug keystore
command: |
keytool -genkey -v -keystore debug.keystore -storepass android -alias androiddebugkey -keypass android -keyalg RSA -keysize 2048 -validity 10000 -dname "cn=Unknown, ou=Unknown, o=Unknown, c=Unknown"
cp debug.keystore ../hello-react-native/android/app/
mkdir -p ~/.android
cp debug.keystore ~/.android/
- run: cd ../hello-react-native/android && ./gradlew packageDebug
ios:
parameters:
hello-app-branch:
type: string
macos:
xcode: "12.4.0"
steps:
- checkout
- run: cd .. && git clone --depth 1 https://github.com/launchdarkly/hello-react-native.git -b <<parameters.hello-app-branch>>
- run: *use_local_sdk
- run: cd ../hello-react-native && npx yarn install
- restore_cache:
name: Restore RN project template from cache
key: v1-rn-template-cache-<<parameters.rn-version>>

- run:
name: Create CI test application for RN <<parameters.rn-version>>
command: |
[ -d "CITest" ] || npx react-native init CITest --version <<parameters.rn-version>> --skip-install
- save_cache:
name: Save RN project template to cache
key: v1-rn-template-cache-<<parameters.rn-version>>
paths:
- CITest

# See the `patches` directory
- run:
name: Build bundle
name: Do any necessary patching
command: |
cd ../hello-react-native
npx yarn install
npx react-native bundle --entry-file index.js --platform ios --bundle-output ios/main.jsbundle --assets-dest ios
if [ -d ".circleci/patches/<<parameters.rn-version>>" ]; then cp -r .circleci/patches/<<parameters.rn-version>>/* CITest/; fi
if [ -x "CITest/patch.sh" ] ; then cd CITest && ./patch.sh; fi
- run:
name: Add LaunchDarkly dependency
command: cd CITest && npx yarn add file:..

- restore_cache:
name: Restore gem cache
key: v1-gem-cache-<<parameters.xcode-version>>-

# Newer cocoapods fixes Swift library auto-linking errors
- run:
name: Build application
name: Update CocoaPods
command: |
cd ../hello-react-native/ios
# Newer cocoapods required for following pod install
sudo gem install cocoapods
# RN 0.64 has an issue with embedding absolute paths in the cocoapods generated build files, so must regenerate.
# https://github.com/facebook/react-native/issues/31121
pod update
pod install
xcodebuild build -workspace HelloReactNative.xcworkspace -configuration Release -scheme HelloReactNative -sdk iphonesimulator -arch x86_64 CODE_SIGN_IDENTITY=
sudo gem cleanup
# Used as cache key to prevent storing redundant caches
gem list > /tmp/cache-key.txt
common:
- save_cache:
name: Save gem cache
key: v1-gem-cache-<<parameters.xcode-version>>-{{ checksum "/tmp/cache-key.txt" }}
paths:
- ~/.gem

- run:
name: Install iOS Pods
command: cd CITest/ios && pod install

- run:
name: Build application for iOS (Release)
command: |
mkdir -p artifacts
cd CITest/ios
xcodebuild -workspace CITest.xcworkspace -scheme CITest build -configuration Release -destination "generic/platform=iOS" CODE_SIGNING_ALLOWED=NO GCC_WARN_INHIBIT_ALL_WARNINGS=YES | tee '../../artifacts/xcb-<<parameters.rn-version>>.txt' | xcpretty
- when:
# We only care to build Android application and debug iOS Build for a single XCode version
condition:
equal: [ 13.2.1, << parameters.xcode-version >> ]
steps:
- run:
name: Build application for iOS (Debug)
command: |
cd CITest/ios
xcodebuild -workspace CITest.xcworkspace -scheme CITest build -configuration Debug -destination "generic/platform=iOS" CODE_SIGNING_ALLOWED=NO GCC_WARN_INHIBIT_ALL_WARNINGS=YES | tee '../../artifacts/xcb-<<parameters.rn-version>>.txt' | xcpretty
- run:
name: Build application for Android
command: cd CITest/android && ./gradlew packageRelease

- store_artifacts:
path: artifacts

test-javascript:
docker:
- image: cimg/node:current
steps:
Expand All @@ -95,26 +131,14 @@ jobs:

workflows:
version: 2
android-ios:
all-tests:
jobs:
- common
- android:
name: Android + RN 0.63
hello-app-branch: rn-0.63
requires:
- common
- ios:
name: iOS + RN 0.63
hello-app-branch: rn-0.63
requires:
- common
- android:
name: Android + RN 0.64
hello-app-branch: rn-0.64
requires:
- common
- ios:
name: iOS + RN 0.64
hello-app-branch: rn-0.64
- test-javascript
- build-applications-using-template:
name: rn<<matrix.rn-version>>-xc<<matrix.xcode-version>>-build-apps-using-template
matrix:
parameters:
rn-version: ["0.64.3", "0.65.2", "0.66.4", "0.67.2"]
xcode-version: ["12.2.0", "12.5.1", "13.2.1"]
requires:
- common
- test-javascript
5 changes: 5 additions & 0 deletions .circleci/patches/0.65.2/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
## Patch for React Native project template 0.65.2

After XCode 12.5, the `RCT-Folly` transitive dependency causes build errors. This patch overrides
some of `RCT-Folly`'s build configurations by patching the template's `Podfile`. See
[facebook/folly#1470](https://github.com/facebook/folly/issues/1470) for more details.
3 changes: 3 additions & 0 deletions .circleci/patches/0.65.2/patch.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
#!/bin/bash

patch -p0 -u < podfile.patch
16 changes: 16 additions & 0 deletions .circleci/patches/0.65.2/podfile.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
--- ios/Podfile
+++ ios/Podfile
@@ -25,5 +25,13 @@

post_install do |installer|
react_native_post_install(installer)
+ installer.pods_project.targets.each do |target|
+ if target.name == "RCT-Folly"
+ target.build_configurations.each do |config|
+ config.build_settings['IPHONEOS_DEPLOYMENT_TARGET'] = '10.0'
+ config.build_settings['GCC_PREPROCESSOR_DEFINITIONS'] ||= ['$(inherited)', 'FOLLY_HAVE_CLOCK_GETTIME=1']
+ end
+ end
+ end
end
end
14 changes: 14 additions & 0 deletions .circleci/patches/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
## Patches for running React Native application templates in CI

Some versions of the React Native project templates no longer function without modification with
newer XCode. We verify this library builds against supported versions of React Native in the
[CircleCI configuration](../.circleci/config.yml) by building the project templates with the SDK
added as a dependency. This directory contains the required files to patch each project template
that we are testing that does not work without modification.

Before installing the dependencies and integrating the SDK into the project, the CI jobs checks here
for a directory with the name of the React Native project template version that is being tested. If
the directory exists, the files are copied into the project. Then, if an executable file called
`patch.sh` now exists in the project template, it is run.

Further details of what patching is required is included in each version's subdirectory.
13 changes: 8 additions & 5 deletions .ldrelease/config.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
version: 2

repo:
public: react-native-client-sdk
private: react-native-client-sdk-private
Expand All @@ -6,13 +8,14 @@ publications:
- url: https://www.npmjs.com/package/launchdarkly-react-native-client-sdk
description: npm

template:
name: npm
skip:
- test
jobs:
- docker:
image: node:16-buster
template:
name: npm

documentation:
githubPages: true
gitHubPages: true
title: LaunchDarkly Client-Side SDK for React Native

sdk:
Expand Down
7 changes: 0 additions & 7 deletions .ldrelease/update-version.sh

This file was deleted.

24 changes: 17 additions & 7 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,23 @@ Build instructions

### Prerequisites

This SDK requires that you have [`npm`](https://www.npmjs.com/) and [`react-native-cli`](https://www.npmjs.com/package/react-native-cli) installed in order to develop with it.
Follow the [React Native development environment setup guide](https://reactnative.dev/docs/environment-setup) to install all required tools for contributing to the project.

### Building and running
### Building and testing

You can modify and verify changes by developing within the LaunchDarkly React Native SDK sample application (`hello-react-native`).
First, install the dependencies by running:
```
npm install
```

1. Clone and setup the [`hello-react-native`](https://github.com/launchdarkly/hello-react-native) repository.
2. In your `hello-react-native` directory, copy your `react-native-client-sdk` directory into `node_modules` as `launchdarkly-react-native-client-sdk`. Alternatively, you can use [wml](https://github.com/wix/wml) to monitor and copy files.
3. Launch your emulator (`emulator -avd <NAME>` for Android) or connect your device.
4. Test your changes in `hello-react-native` by running either `react-native run-ios` or `react-native run-android` depending on your desired runtime environment.
To run tests of the JavaScript portion of the implementation:
```
npm test
```

To validate the TypeScript module definition, run:
```
npm run check-typescript
```

Testing the native module implementation must be done by integrating the SDK into an application, such as one created with `npx react-native init`.
6 changes: 6 additions & 0 deletions ManualTestApp/.buckconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@

[android]
target = Google Inc.:Google APIs:23

[maven_repositories]
central = https://repo1.maven.org/maven2
4 changes: 4 additions & 0 deletions ManualTestApp/.eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
module.exports = {
root: true,
extends: '@react-native-community',
};
65 changes: 65 additions & 0 deletions ManualTestApp/.flowconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
[ignore]
; We fork some components by platform
.*/*[.]android.js

; Ignore "BUCK" generated dirs
<PROJECT_ROOT>/\.buckd/

; Ignore polyfills
node_modules/react-native/Libraries/polyfills/.*

; Flow doesn't support platforms
.*/Libraries/Utilities/LoadingView.js

[untyped]
.*/node_modules/@react-native-community/cli/.*/.*

[include]

[libs]
node_modules/react-native/interface.js
node_modules/react-native/flow/

[options]
emoji=true

exact_by_default=true

format.bracket_spacing=false

module.file_ext=.js
module.file_ext=.json
module.file_ext=.ios.js

munge_underscores=true

module.name_mapper='^react-native/\(.*\)$' -> '<PROJECT_ROOT>/node_modules/react-native/\1'
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> '<PROJECT_ROOT>/node_modules/react-native/Libraries/Image/RelativeImageStub'

suppress_type=$FlowIssue
suppress_type=$FlowFixMe
suppress_type=$FlowFixMeProps
suppress_type=$FlowFixMeState

[lints]
sketchy-null-number=warn
sketchy-null-mixed=warn
sketchy-number=warn
untyped-type-import=warn
nonstrict-import=warn
deprecated-type=warn
unsafe-getters-setters=warn
unnecessary-invariant=warn
signature-verification-failure=warn

[strict]
deprecated-type
nonstrict-import
sketchy-null
unclear-type
unsafe-getters-setters
untyped-import
untyped-type-import

[version]
^0.162.0
Loading

0 comments on commit 0142bf2

Please sign in to comment.