mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Glue all the scripts together. (#49671)
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/49671 This change refactors the script to prebuild ios dependencies by adding a script that glues all the steps together. bypass-github-export-checks ## Changelog: [INTERNAL] - Add script to orchestrate all the steps Test Plan: Tested in this `AppDelegate.mm`: Imports: ```obj-c #import "AppDelegate.h" #import <glog/logging.h> #import <double-conversion.h> #include <fmt/core.h> #include <boost/assert.hpp> #include <fast_float/fast_float.h> #include <string> #import <SocketRocket/SRWebSocket.h> ``` Code: ```obj-c - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { std::string input = "3.1416 xyz "; double_conversion::DoubleToStringConverter::EcmaScriptConverter(); LOG(INFO) << "Hello from GLOG"; fmt::print("Hello, world from FMT!\n"); BOOST_ASSERT(100 == 100); double result; fast_float::from_chars(input.data(), input.data() + input.size(), result); LOG(INFO) << "Answer :" << result; NSArray *frameworks = [NSBundle allFrameworks]; for (NSBundle *framework in frameworks) { NSString *frameworkName = framework.bundleURL.lastPathComponent; if ([frameworkName isEqualToString: @"ReactNativeDependencies.framework"]) { NSBundle *bundle = [NSBundle bundleWithURL:[framework bundleURL]]; NSURL *bundleURL = [bundle URLForResource:@"ReactNativeDependencies_glog" withExtension:@"bundle"]; NSBundle *resourceBundle = [NSBundle bundleWithURL:bundleURL]; NSURL* url = [resourceBundle URLForResource:@"PrivacyInfo" withExtension:@"xcprivacy"]; if (url == nil) { throw [NSException exceptionWithName:@"ResourceNotFoundException" reason:@"Could not find PrivacyInfo.xcprivacy in ReactNativeDependencies_glog bundle" userInfo:nil]; } break; } } return YES; } ``` Reviewed By: cortinico Differential Revision: D70175842 Pulled By: cipolleschi fbshipit-source-id: e4bb4ad5d12e7ceaaca0eeee7ce6dc7269aa7bad
This commit is contained in:
committed by
Facebook GitHub Bot
parent
2fdb6c9832
commit
8b984ca2c4
@@ -0,0 +1,78 @@
|
||||
/**
|
||||
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @flow
|
||||
* @format
|
||||
* @oncall react_native
|
||||
*/
|
||||
|
||||
const {buildDepenencies} = require('./build');
|
||||
const {getCLIConfiguration} = require('./cli');
|
||||
const {createFramework} = require('./compose-framework');
|
||||
const {cleanFolder} = require('./folders');
|
||||
const {setupDependencies} = require('./setupDependencies');
|
||||
const {createSwiftPackageFile} = require('./swift-package');
|
||||
const path = require('path');
|
||||
|
||||
require('../../babel-register').registerForScript();
|
||||
|
||||
const THIRD_PARTY_PATH = 'packages/react-native/third-party';
|
||||
const BUILD_DESTINATION = '.build';
|
||||
|
||||
const SCHEME = 'ReactNativeDependencies';
|
||||
|
||||
/**
|
||||
* Main entry point
|
||||
*/
|
||||
async function main() {
|
||||
const cli = await getCLIConfiguration();
|
||||
if (cli == null) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
const buildFolder = path.resolve(THIRD_PARTY_PATH, BUILD_DESTINATION);
|
||||
const rootFolder = path.resolve(THIRD_PARTY_PATH);
|
||||
|
||||
if (cli.tasks.setup) {
|
||||
await cleanFolder(rootFolder);
|
||||
await setupDependencies(cli.dependencies, rootFolder);
|
||||
}
|
||||
|
||||
if (cli.tasks.swiftpackage) {
|
||||
// Create Package.swift file
|
||||
await createSwiftPackageFile(SCHEME, cli.dependencies, rootFolder);
|
||||
}
|
||||
|
||||
if (cli.tasks.build) {
|
||||
await cleanFolder(buildFolder);
|
||||
await buildDepenencies(
|
||||
SCHEME,
|
||||
cli.configuration,
|
||||
cli.dependencies,
|
||||
cli.platforms,
|
||||
rootFolder,
|
||||
buildFolder,
|
||||
);
|
||||
}
|
||||
|
||||
if (cli.tasks.compose) {
|
||||
await createFramework(
|
||||
SCHEME,
|
||||
cli.configuration,
|
||||
cli.dependencies,
|
||||
rootFolder,
|
||||
buildFolder,
|
||||
);
|
||||
}
|
||||
|
||||
console.log('');
|
||||
console.log('🏁 Done!');
|
||||
}
|
||||
|
||||
if (require.main === module) {
|
||||
// eslint-disable-next-line no-void
|
||||
void main();
|
||||
}
|
||||
Reference in New Issue
Block a user