From 4e8526c82924186090797936c7a7c080a5b3a97d Mon Sep 17 00:00:00 2001 From: Riccardo Cipolleschi Date: Tue, 29 Nov 2022 08:53:50 -0800 Subject: [PATCH] Add CircleCI tests for use frameworks (#35497) Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/35497 In 0.71.0-RC.2, we had a regression in `use_frameworks!`. This adds some CircleCI jobs to make sure we do not regress on those. It also updates the template to support these tests. ## Changelog [iOS][Added] - CircleCI jobs to keep the use_framework! setup in check for the Old Arch Reviewed By: cortinico Differential Revision: D41551288 fbshipit-source-id: 531fabb1a7b6aceab2926bb83cf2887129df1776 --- .circleci/config.yml | 28 ++++++++++++++++++++++++++++ template/ios/Podfile | 6 ++++++ 2 files changed, 34 insertions(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index e1aaca0b9d..3999bfb780 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -817,6 +817,11 @@ jobs: description: Whether Flipper is enabled. Must be one of "WithFlipper", "WithoutFlipper". type: enum enum: ["WithFlipper", "WithoutFlipper"] + use_frameworks: + default: "StaticLibraries" + description: Which kind of option we want to use for `use_frameworks!` + type: enum + enum: ["StaticLibraries", "StaticFrameworks"] #TODO: Add "DynamicFrameworks" environment: - PROJECT_NAME: "iOSTemplateProject" - HERMES_WS_DIR: *hermes_workspace_root @@ -831,6 +836,24 @@ jobs: steps: - run: command: circleci-agent step halt # this interrupts the job successfully. + # use_frameworks! does not works with Flipper enabled + - when: + condition: + and: + - equal: [ << parameters.use_frameworks >>, "StaticFrameworks"] + - equal: [ << parameters.flipper >>, "WithFlipper" ] + steps: + - run: + command: circleci-agent step halt # this interrupts the job successfully. + # use_frameworks! does not works with the New Architecture enabled + - when: + condition: + and: + - equal: [ << parameters.use_frameworks >>, "StaticFrameworks"] + - equal: [ << parameters.architecture >>, "NewArch" ] + steps: + - run: + command: circleci-agent step halt # this interrupts the job successfully. # Valid configuration, we can continue - checkout_code_with_cache - run_yarn @@ -878,6 +901,10 @@ jobs: export NO_FLIPPER=1 fi + if [[ << parameters.use_frameworks >> == "StaticFrameworks" ]]; then + export USE_FRAMEWORKS=static + fi + bundle exec pod install - run: name: Build template project @@ -1565,6 +1592,7 @@ workflows: flavor: ["Debug", "Release"] jsengine: ["Hermes", "JSC"] flipper: ["WithFlipper", "WithoutFlipper"] + use_frameworks: [ "StaticLibraries", "StaticFrameworks" ] #TODO: make it works with DynamicFrameworks - test_ios_rntester: requires: - build_hermes_macos diff --git a/template/ios/Podfile b/template/ios/Podfile index 579715789c..72b98d9244 100644 --- a/template/ios/Podfile +++ b/template/ios/Podfile @@ -6,6 +6,12 @@ prepare_react_native_project! flipper_config = ENV['NO_FLIPPER'] == "1" ? FlipperConfiguration.disabled : FlipperConfiguration.enabled +linkage = ENV['USE_FRAMEWORKS'] +if linkage != nil + Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green + use_frameworks! :linkage => linkage.to_sym +end + target 'HelloWorld' do config = use_native_modules!