Initial packer project

Summary:
This is a tool (right now more a script, really) for splitting a Flipper distribution into smaller chunks that can be individually cached, hashed and downloaded. It's incomplete but can already bundle up Mac apps into smaller chunks that can be merged back again into one app.

It takes a config file that specifies how to slice the inputs up and comes with a default copy bundled in. That's in line with the general "design" where it tries to make the right assumptions, for instance defaulting to the normal dist output directory.

Reviewed By: jknoxville

Differential Revision: D21302551

fbshipit-source-id: b22670ff4825ce526dd0f20320f87080c058cd93
This commit is contained in:
Pascal Hartig
2020-05-01 03:59:12 -07:00
committed by Facebook GitHub Bot
parent de5147a516
commit 155a8c6952
8 changed files with 695 additions and 0 deletions

40
packer/src/error.rs Normal file
View File

@@ -0,0 +1,40 @@
/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
use crate::types::{PackType, Platform};
use std::fmt;
use std::io;
use std::path::PathBuf;
#[derive(Debug)]
pub enum Error {
IOError(io::Error),
MissingPackFile(Platform, PackType, PathBuf),
}
impl From<io::Error> for Error {
fn from(e: io::Error) -> Self {
Error::IOError(e)
}
}
impl fmt::Display for Error {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
use Error::*;
match self {
IOError(e) => write!(f, "IO Error: {}", e),
Error::MissingPackFile(platform, pack_type, path) => write!(
f,
"Couldn't open file to pack for platform {:?} and type {:?}: {}",
platform,
pack_type,
path.to_string_lossy()
),
}
}
}