create one headless file for all platforms

Summary: We are distributing a single package via fbpkg containing the headless version linux and macOS. This changes the build process to only create a single zip-file containing these binaries.

Reviewed By: passy

Differential Revision: D14042031

fbshipit-source-id: 88992f17501353a70bc21799c6bd2957576268a3
This commit is contained in:
Daniel Büchele
2019-02-12 06:15:51 -08:00
committed by Facebook Github Bot
parent c28ef62f07
commit 825bfffd21

View File

@@ -32,31 +32,30 @@ function preludeBundle(dir, versionNumber) {
} }
async function createZip(buildDir, distDir, targets) { async function createZip(buildDir, distDir, targets) {
return Promise.all( return new Promise((resolve, reject) => {
targets.map( const zip = new yazl.ZipFile();
target =>
new Promise((resolve, reject) => { // add binaries for each target
const zip = new yazl.ZipFile(); targets.forEach(target => {
const binary = `flipper-${target === 'mac' ? 'macos' : target}`; const binary = `flipper-${target === 'mac' ? 'macos' : target}`;
zip.addFile(path.join(buildDir, binary), binary); zip.addFile(path.join(buildDir, binary), binary);
const pluginDir = path.join(buildDir, PLUGINS_FOLDER_NAME); });
fs.readdirSync(pluginDir).forEach(file => {
zip.addFile( // add plugins
path.join(pluginDir, file), const pluginDir = path.join(buildDir, PLUGINS_FOLDER_NAME);
path.join(PLUGINS_FOLDER_NAME, file), fs.readdirSync(pluginDir).forEach(file => {
); zip.addFile(
}); path.join(pluginDir, file),
zip.outputStream path.join(PLUGINS_FOLDER_NAME, file),
.pipe( );
fs.createWriteStream( });
path.join(distDir, `Flipper-headless-${target}.zip`),
), // write zip file
) zip.outputStream
.on('close', resolve); .pipe(fs.createWriteStream(path.join(distDir, `Flipper-headless.zip`)))
zip.end(); .on('close', resolve);
}), zip.end();
), });
);
} }
(async () => { (async () => {