Update build scripts to put RN-RT files in the right places (#11183)
This commit is contained in:
parent
e5db5302ac
commit
8b3ad851fd
|
@ -20,6 +20,7 @@ const sizes = require('./plugins/sizes-plugin');
|
|||
const Stats = require('./stats');
|
||||
const syncReactDom = require('./sync').syncReactDom;
|
||||
const syncReactNative = require('./sync').syncReactNative;
|
||||
const syncReactNativeRT = require('./sync').syncReactNativeRT;
|
||||
const Packaging = require('./packaging');
|
||||
const Header = require('./header');
|
||||
const closure = require('rollup-plugin-closure-compiler-js');
|
||||
|
@ -168,7 +169,12 @@ function handleRollupWarnings(warning) {
|
|||
function updateBundleConfig(config, filename, format, bundleType, hasteName) {
|
||||
return Object.assign({}, config, {
|
||||
banner: getBanner(bundleType, hasteName, filename),
|
||||
dest: Packaging.getPackageDestination(config, bundleType, filename),
|
||||
dest: Packaging.getPackageDestination(
|
||||
config,
|
||||
bundleType,
|
||||
filename,
|
||||
hasteName
|
||||
),
|
||||
footer: getFooter(bundleType),
|
||||
format,
|
||||
interop: false,
|
||||
|
@ -503,6 +509,7 @@ rimraf('build', () => {
|
|||
const tasks = [
|
||||
Packaging.createFacebookWWWBuild,
|
||||
Packaging.createReactNativeBuild,
|
||||
Packaging.createReactNativeRTBuild,
|
||||
];
|
||||
for (const bundle of Bundles.bundles) {
|
||||
tasks.push(
|
||||
|
@ -520,6 +527,9 @@ rimraf('build', () => {
|
|||
tasks.push(() =>
|
||||
syncReactNative(join('build', 'react-native'), syncFbsource)
|
||||
);
|
||||
tasks.push(() =>
|
||||
syncReactNativeRT(join('build', 'react-native-rt'), syncFbsource)
|
||||
);
|
||||
} else if (syncWww) {
|
||||
tasks.push(() => syncReactDom(join('build', 'facebook-www'), syncWww));
|
||||
}
|
||||
|
|
|
@ -28,6 +28,11 @@ const reactNativeSrcDependencies = [
|
|||
'src/renderers/native/ReactNativeTypes.js',
|
||||
];
|
||||
|
||||
// these files need to be copied to the react-native-rt build
|
||||
const reactNativeRTSrcDependencies = [
|
||||
'src/renderers/native-rt/ReactNativeRTTypes.js',
|
||||
];
|
||||
|
||||
function getPackageName(name) {
|
||||
if (name.indexOf('/') !== -1) {
|
||||
return name.split('/')[0];
|
||||
|
@ -57,6 +62,25 @@ function createReactNativeBuild() {
|
|||
});
|
||||
}
|
||||
|
||||
function createReactNativeRTBuild() {
|
||||
// create the react-native-rt folder for FB bundles
|
||||
fs.mkdirSync(join('build', 'react-native-rt'));
|
||||
// create the react-native-rt shims folder for FB shims
|
||||
fs.mkdirSync(join('build', 'react-native-rt', 'shims'));
|
||||
|
||||
const to = join('build', 'react-native-rt', 'shims');
|
||||
|
||||
let promises = [];
|
||||
// we also need to copy over some specific files from src
|
||||
// defined in reactNativeRTSrcDependencies
|
||||
for (const srcDependency of reactNativeRTSrcDependencies) {
|
||||
promises.push(
|
||||
asyncCopyTo(resolve(srcDependency), join(to, basename(srcDependency)))
|
||||
);
|
||||
}
|
||||
return Promise.all(promises);
|
||||
}
|
||||
|
||||
function createFacebookWWWBuild() {
|
||||
// create the facebookWWW folder for FB bundles
|
||||
fs.mkdirSync(join('build', facebookWWW));
|
||||
|
@ -143,7 +167,7 @@ function createNodePackage(bundleType, packageName, filename) {
|
|||
return Promise.resolve();
|
||||
}
|
||||
|
||||
function getPackageDestination(config, bundleType, filename) {
|
||||
function getPackageDestination(config, bundleType, filename, hasteName) {
|
||||
let dest = config.destDir + filename;
|
||||
|
||||
if (bundleType === FB_DEV || bundleType === FB_PROD) {
|
||||
|
@ -151,7 +175,11 @@ function getPackageDestination(config, bundleType, filename) {
|
|||
} else if (bundleType === UMD_DEV || bundleType === UMD_PROD) {
|
||||
dest = `${config.destDir}dist/${filename}`;
|
||||
} else if (bundleType === RN_DEV || bundleType === RN_PROD) {
|
||||
dest = `${config.destDir}react-native/${filename}`;
|
||||
if (hasteName === 'ReactNativeRTFiber') {
|
||||
dest = `${config.destDir}react-native-rt/${filename}`;
|
||||
} else {
|
||||
dest = `${config.destDir}react-native/${filename}`;
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
}
|
||||
|
@ -162,4 +190,5 @@ module.exports = {
|
|||
getPackageName,
|
||||
createFacebookWWWBuild,
|
||||
createReactNativeBuild,
|
||||
createReactNativeRTBuild,
|
||||
};
|
||||
|
|
|
@ -7,6 +7,7 @@ const resolvePath = require('./utils').resolvePath;
|
|||
const DEFAULT_FB_SOURCE_PATH = '~/fbsource/';
|
||||
const DEFAULT_WWW_PATH = '~/www/';
|
||||
const RELATIVE_RN_PATH = 'xplat/js/react-native-github/Libraries/Renderer/';
|
||||
const RELATIVE_RN_RT_PATH = 'xplat/js/RKJSModules/Libraries/RT/downstream/';
|
||||
const RELATIVE_WWW_PATH = 'html/shared/react/';
|
||||
|
||||
function doSync(buildPath, destPath) {
|
||||
|
@ -46,7 +47,22 @@ function syncReactNative(buildPath, fbSourcePath) {
|
|||
return doSync(buildPath, destPath);
|
||||
}
|
||||
|
||||
function syncReactNativeRT(buildPath, fbSourcePath) {
|
||||
fbSourcePath = typeof fbSourcePath === 'string'
|
||||
? fbSourcePath
|
||||
: DEFAULT_FB_SOURCE_PATH;
|
||||
|
||||
if (fbSourcePath.charAt(fbSourcePath.length - 1) !== '/') {
|
||||
fbSourcePath += '/';
|
||||
}
|
||||
|
||||
const destPath = resolvePath(fbSourcePath + RELATIVE_RN_RT_PATH);
|
||||
|
||||
return doSync(buildPath, destPath);
|
||||
}
|
||||
|
||||
module.exports = {
|
||||
syncReactDom,
|
||||
syncReactNative,
|
||||
syncReactNativeRT,
|
||||
};
|
||||
|
|
Loading…
Reference in New Issue