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