mirror of
https://github.com/rojo-rbx/rojo.git
synced 2026-04-20 12:45:05 +00:00
* Add Flipper * Remove old UI * Add boilerplate UI * Change plugin version * Merge upstream * Bunch of new UI changes Too lazy to list them all in individual commits * Touch ripple for buttons and a few other things * Make the close button on the PluginGui work * Set button state to guiEnabled * Implement Connecting, NotConnected; add Header; don't update plugin button on render * Replace mapLerpColor with mapLerp * Update blendAlpha to be 0 without any values * Add ActionFillTransparency to Theme.Button * Suffix all Theme entries * Update Flipper * Add disconnect button * Remove cancel button * Add settings page * Add scrollbar and dark theme support to settings * Include settings in startSession * Set context default value to nil I always thought this was the name, lol... * Add Error page * Fix preloadAssets * Fix preloadAssets import * Update checkbox colors a little * Add setting descriptions * Fix scrolling frame in settings panel * Remove .vscode * Rename Throbber to Spinner * Update merge * Move Spinner images to assets * Change casing of directories * Remove old directories * Add comments to getDerivedStateFromProps * Account for offset in host TextBox size * Turn width variables into constants * Attempt to fix the comments * Add a missing comma in Settings * Remove a double space * Remove Dummy object * Move most of the Studio logic out of render * Don't truncate port input * Replace merge with Dictionary.merge * Replace "Got it!" with "Okay" * Add projectName to setStatus call * Add Flipper to build.rs
78 lines
2.6 KiB
Rust
78 lines
2.6 KiB
Rust
use std::{
|
|
env, io,
|
|
path::{Path, PathBuf},
|
|
};
|
|
|
|
use fs_err as fs;
|
|
use fs_err::File;
|
|
use maplit::hashmap;
|
|
use memofs::VfsSnapshot;
|
|
|
|
fn snapshot_from_fs_path(path: &Path) -> io::Result<VfsSnapshot> {
|
|
println!("cargo:rerun-if-changed={}", path.display());
|
|
|
|
if path.is_dir() {
|
|
let mut children = Vec::new();
|
|
|
|
for entry in fs::read_dir(path)? {
|
|
let entry = entry?;
|
|
|
|
let file_name = entry.file_name().to_str().unwrap().to_owned();
|
|
|
|
// We can skip any TestEZ test files since they aren't necessary for
|
|
// the plugin to run.
|
|
if file_name.ends_with(".spec.lua") {
|
|
continue;
|
|
}
|
|
|
|
let child_snapshot = snapshot_from_fs_path(&entry.path())?;
|
|
children.push((file_name, child_snapshot));
|
|
}
|
|
|
|
Ok(VfsSnapshot::dir(children))
|
|
} else {
|
|
let content = fs::read_to_string(path)?;
|
|
|
|
Ok(VfsSnapshot::file(content))
|
|
}
|
|
}
|
|
|
|
fn main() -> Result<(), anyhow::Error> {
|
|
let out_dir = env::var_os("OUT_DIR").unwrap();
|
|
|
|
let root_dir = env::var_os("CARGO_MANIFEST_DIR").unwrap();
|
|
let plugin_root = PathBuf::from(root_dir).join("plugin");
|
|
|
|
let plugin_modules = plugin_root.join("modules");
|
|
|
|
let snapshot = VfsSnapshot::dir(hashmap! {
|
|
"default.project.json" => snapshot_from_fs_path(&plugin_root.join("default.project.json"))?,
|
|
"fmt" => snapshot_from_fs_path(&plugin_root.join("fmt"))?,
|
|
"http" => snapshot_from_fs_path(&plugin_root.join("http"))?,
|
|
"log" => snapshot_from_fs_path(&plugin_root.join("log"))?,
|
|
"rbx_dom_lua" => snapshot_from_fs_path(&plugin_root.join("rbx_dom_lua"))?,
|
|
"src" => snapshot_from_fs_path(&plugin_root.join("src"))?,
|
|
"modules" => VfsSnapshot::dir(hashmap! {
|
|
"roact" => VfsSnapshot::dir(hashmap! {
|
|
"src" => snapshot_from_fs_path(&plugin_modules.join("roact").join("src"))?
|
|
}),
|
|
"promise" => VfsSnapshot::dir(hashmap! {
|
|
"lib" => snapshot_from_fs_path(&plugin_modules.join("promise").join("lib"))?
|
|
}),
|
|
"t" => VfsSnapshot::dir(hashmap! {
|
|
"lib" => snapshot_from_fs_path(&plugin_modules.join("t").join("lib"))?
|
|
}),
|
|
"flipper" => VfsSnapshot::dir(hashmap! {
|
|
"src" => snapshot_from_fs_path(&plugin_modules.join("flipper").join("src"))?
|
|
}),
|
|
}),
|
|
});
|
|
|
|
let out_path = Path::new(&out_dir).join("plugin.bincode");
|
|
let out_file = File::create(&out_path)?;
|
|
|
|
bincode::serialize_into(out_file, &snapshot)?;
|
|
|
|
Ok(())
|
|
}
|