Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve RCT-Folly so that other dependencies don't have to specify the folly flags (#49812) #49969

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/actions/setup-xcode-build-cache/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@ runs:
uses: actions/cache@v4
with:
path: packages/rn-tester/Podfile.lock
key: v11-podfilelock-${{ github.job }}-${{ inputs.architecture }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-${{ inputs.ruby-version }}-${{ hashfiles('packages/rn-tester/Podfile') }}-${{ inputs.hermes-version }}
key: v12-podfilelock-${{ github.job }}-${{ inputs.architecture }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-${{ inputs.ruby-version }}-${{ hashfiles('packages/rn-tester/Podfile') }}-${{ inputs.hermes-version }}
- name: Cache cocoapods
uses: actions/cache@v4
with:
path: packages/rn-tester/Pods
key: v13-cocoapods-${{ github.job }}-${{ inputs.architecture }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-${{ inputs.ruby-version }}-${{ hashfiles('packages/rn-tester/Podfile.lock') }}-${{ hashfiles('packages/rn-tester/Podfile') }}-${{ inputs.hermes-version}}
key: v14-cocoapods-${{ github.job }}-${{ inputs.architecture }}-${{ inputs.jsengine }}-${{ inputs.flavor }}-${{ inputs.use-frameworks }}-${{ inputs.ruby-version }}-${{ hashfiles('packages/rn-tester/Podfile.lock') }}-${{ hashfiles('packages/rn-tester/Podfile') }}-${{ inputs.hermes-version}}
13 changes: 12 additions & 1 deletion packages/react-native/scripts/cocoapods/helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,18 @@ class Constants
@@folly_config = {
:version => '2024.11.18.00',
:git => 'https://github.com/facebook/folly.git',
:compiler_flags => '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32',
:compiler_flags => '-DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -DFOLLY_CFG_NO_COROUTINES=1 -DFOLLY_HAVE_CLOCK_GETTIME=1 -Wno-comma -Wno-shorten-64-to-32',
:config_file => [
"#pragma once",
"",
"#define FOLLY_MOBILE 1",
"#define FOLLY_USE_LIBCPP 1",
"#define FOLLY_HAVE_PTHREAD 1",
"#define FOLLY_CFG_NO_COROUTINES 1",
"#define FOLLY_HAVE_CLOCK_GETTIME 1",
"",
'#pragma clang diagnostic ignored "-Wcomma"',
],
:dep_name => 'RCT-Folly/Fabric'
}

Expand Down
5 changes: 3 additions & 2 deletions packages/react-native/third-party-podspecs/RCT-Folly.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# LICENSE file in the root directory of this source tree.

folly_config = get_folly_config()
folly_compiler_flags = folly_config[:compiler_flags]
folly_config_file = folly_config[:config_file]
folly_release_version = folly_config[:version]
folly_git_url = folly_config[:git]

Expand All @@ -19,13 +19,14 @@ Pod::Spec.new do |spec|
spec.source = { :git => folly_git_url,
:tag => "v#{folly_release_version}" }
spec.module_name = 'folly'
spec.prepare_command = "echo '#{folly_config_file.join("\n")}' > folly/folly-config.h"
spec.header_mappings_dir = '.'
spec.dependency "boost"
spec.dependency "DoubleConversion"
spec.dependency "glog"
spec.dependency "fast_float", "8.0.0"
spec.dependency "fmt", "11.0.2"
spec.compiler_flags = folly_compiler_flags + ' -DFOLLY_HAVE_PTHREAD=1 -Wno-documentation -faligned-new'
spec.compiler_flags = '-Wno-documentation -faligned-new'
spec.source_files = 'folly/String.cpp',
'folly/Conv.cpp',
'folly/Demangle.cpp',
Expand Down
8 changes: 6 additions & 2 deletions scripts/releases/ios-prebuild/cli.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,9 @@ async function getCLIConfiguration() /*: Promise<?{|
rs => !platforms.includes(rs),
);
if (invalidPlatforms.length > 0) {
console.error(`Invalid platform specified: ${invalidPlatforms.join(', ')}`);
console.error(
`Invalid platform specified: ${invalidPlatforms.join(', ')}\nValid platforms are: ${platforms.join(', ')}`,
);
return undefined;
}

Expand All @@ -116,7 +118,9 @@ async function getCLIConfiguration() /*: Promise<?{|
);
if (invalidDependencies.length > 0) {
console.error(
`Invalid dependency specified: ${invalidDependencies.join(', ')}`,
`Invalid dependency specified: ${invalidDependencies.join(', ')}.\nValid dependencies are: ${dependencies
.map(d => d.name)
.join(', ')}`,
);
return undefined;
}
Expand Down
4 changes: 0 additions & 4 deletions scripts/releases/ios-prebuild/compose-framework.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,14 +88,12 @@ function copyBundles(
frameworkPaths /*:Array<string>*/,
) {
console.log('Copying bundles to the framework...');

// Let's precalculate the target folder. It is the xcframework's output folder with
// all its targets.
const targetArchFolders = fs
.readdirSync(outputFolder)
.map(p => path.join(outputFolder, p))
.filter(p => fs.statSync(p).isDirectory());

// For each framework (in frameworkPaths), copy the bundles from the source folder.
// A bundle is the name of the framework + _ + target name + .bundle. We can
// check if the target has a bundle by checking if it defines one or more resources.
Expand All @@ -105,7 +103,6 @@ function copyBundles(
if (!resources || resources.length === 0) {
return;
}

// Get bundle source folder
const bundleName = `${scheme}_${dep.name}.bundle`;
const sourceBundlePath = path.join(frameworkPath, bundleName);
Expand All @@ -125,7 +122,6 @@ function copyBundles(
if (!fs.existsSync(path.dirname(sourceBundlePath))) {
console.warn("Source bundle doesn't exist", sourceBundlePath);
}

// A bundle is a directory, so we need to copy the whole directory
execSync(`cp -r ${sourceBundlePath} ${targetBundlePath}`);
});
Expand Down
11 changes: 3 additions & 8 deletions scripts/releases/ios-prebuild/configuration.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ const dependencies /*: $ReadOnlyArray<Dependency> */ = [
settings: {
publicHeaderFiles: './',
headerSearchPaths: ['./'],
compilerFlags: ['-Wno-everything'],
compilerFlags: ['-Wno-everything', '-Wno-documentation'],
},
},
{
Expand Down Expand Up @@ -164,7 +164,8 @@ const dependencies /*: $ReadOnlyArray<Dependency> */ = [
{
name: 'folly',
version: '0.9.0',
disabled: false,
prepareScript:
'echo "#pragma once\n\n#define FOLLY_MOBILE 1\n#define FOLLY_HAVE_PTHREAD 1\n#define FOLLY_USE_LIBCPP 1\n#define FOLLY_CFG_NO_COROUTINES 1\n#define FOLLY_HAVE_CLOCK_GETTIME 1 \n\n#pragma clang diagnostic ignored \\""-Wcomma\\""" > ./folly/folly-config.h',
url: new URL(
'https://github.com/facebook/folly/archive/refs/tags/v2024.11.18.00.tar.gz',
),
Expand Down Expand Up @@ -268,12 +269,6 @@ const dependencies /*: $ReadOnlyArray<Dependency> */ = [
defines: [
{name: 'USE_HEADERMAP', value: 'NO'},
{name: 'DEFINES_MODULE', value: 'YES'},
{name: 'FOLLY_NO_CONFIG'},
{name: 'FOLLY_MOBILE', value: '1'},
{name: 'FOLLY_HAVE_PTHREAD', value: '1'},
{name: 'FOLLY_USE_LIBCPP', value: '1'},
{name: 'FOLLY_CFG_NO_COROUTINES', value: '1'},
{name: 'FOLLY_HAVE_CLOCK_GETTIME', value: '1'},
],
linkedLibraries: ['c++abi'],
linkerSettings: ['-Wl,-U,_jump_fcontext', '-Wl,-U,_make_fcontext'],
Expand Down
Loading