remove pointless async runtime
This commit is contained in:
parent
38230ee0c6
commit
97a41578a1
3 changed files with 7 additions and 13 deletions
|
@ -16,13 +16,9 @@ features = ["js-esbuild"]
|
|||
|
||||
[dependencies.mlua]
|
||||
version = "0.6.3"
|
||||
features = ["async", "lua54", "macros", "serialize", "send"]
|
||||
features = ["luajit", "macros", "serialize"]
|
||||
|
||||
[dependencies.serde]
|
||||
version = "1.0.130"
|
||||
features = ["derive"]
|
||||
|
||||
[dependencies.tokio]
|
||||
version = "1.11.0"
|
||||
features = ["rt-multi-thread", "macros", "fs"]
|
||||
|
||||
|
|
|
@ -10,16 +10,14 @@ struct Opt {
|
|||
infile: PathBuf,
|
||||
}
|
||||
|
||||
#[tokio::main]
|
||||
async fn main() -> anyhow::Result<()> {
|
||||
fn main() -> anyhow::Result<()> {
|
||||
let opt = Opt::from_args();
|
||||
|
||||
let s_data = script::run_buildscript(opt.infile).await?;
|
||||
let s_data = script::run_buildscript(opt.infile)?;
|
||||
let path = s_data.outfile.clone();
|
||||
let rendered = renderer::render(s_data)?;
|
||||
|
||||
tokio::fs::write(path, rendered)
|
||||
.await
|
||||
std::fs::write(path, rendered)
|
||||
.context("failed to write outfile")?;
|
||||
|
||||
Ok(())
|
||||
|
|
|
@ -2,12 +2,12 @@ use mlua::{Lua, LuaSerdeExt};
|
|||
use serde::{Deserialize, Serialize};
|
||||
use std::path::PathBuf;
|
||||
|
||||
pub async fn run_buildscript(infile: PathBuf) -> anyhow::Result<ScriptData> {
|
||||
let script = tokio::fs::read(infile).await?;
|
||||
pub fn run_buildscript(infile: PathBuf) -> anyhow::Result<ScriptData> {
|
||||
let script = std::fs::read(infile)?;
|
||||
|
||||
// required to allow C lua libs
|
||||
let lua = unsafe { Lua::unsafe_new() };
|
||||
lua.load(&script).exec_async().await?;
|
||||
lua.load(&script).exec()?;
|
||||
|
||||
let sdata = lua.from_value_with(
|
||||
mlua::Value::Table(lua.globals()),
|
||||
|
|
Loading…
Reference in a new issue