Skip to content

Commit

Permalink
Merge pull request #1 from sasial-dev/docs
Browse files Browse the repository at this point in the history
Add WASM Support
  • Loading branch information
jackdotink authored Dec 16, 2023
2 parents ff71aad + 49e130c commit 8bfa9e4
Show file tree
Hide file tree
Showing 23 changed files with 258 additions and 129 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ jobs:
profile: minimal

- name: Build Release
run: cargo build --release --locked --verbose --target ${{ matrix.target }}
run: cargo build --release --locked --verbose --target ${{ matrix.target }} --package cli
env:
# Build into a known directory so we can find our build artifact more
# easily.
Expand Down
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,7 @@

# Zap Input & Output
/network
net.zap
net.zap

# WASM
zap/pkg
86 changes: 81 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

18 changes: 2 additions & 16 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,16 +1,2 @@
[package]
name = "zap"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[build-dependencies]
lalrpop = "0.20.0"

[dependencies]
clap = { version = "4.4.11", features = ["derive"] }
lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] }
num-traits = "0.2.17"
[workspace]
members = ["zap", "cli"]
17 changes: 17 additions & 0 deletions cli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
[package]
name = "cli"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[dependencies]
anyhow = "1.0"
clap = { version = "4.4.11", features = ["derive"] }
zap = { path = "../zap" }

[[bin]]
name = "zap"
path = "src/main.rs"
32 changes: 32 additions & 0 deletions cli/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
use std::path::PathBuf;

use anyhow::Result;
use clap::Parser;
use zap::run;

#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
struct Args {
#[arg(default_value = "net.zap")]
config: Option<PathBuf>,

#[arg(short, long, default_value = "network")]
output: Option<PathBuf>,
}

fn main() -> Result<()> {
let args = Args::parse();

let config_path = args.config.unwrap();
let output_dir_path = args.output.unwrap();

let config = std::fs::read_to_string(config_path)?;

let code = run(config.as_str())?;

std::fs::create_dir_all(&output_dir_path)?;
std::fs::write(output_dir_path.join("server.luau"), code.server)?;
std::fs::write(output_dir_path.join("client.luau"), code.client)?;

Ok(())
}
18 changes: 0 additions & 18 deletions src/lib.rs

This file was deleted.

40 changes: 0 additions & 40 deletions src/main.rs

This file was deleted.

20 changes: 20 additions & 0 deletions zap/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
[package]
name = "zap"
authors = ["Redblox Organization"]
description = "A blazingly fast networking solution for Roblox."
version = "0.1.0"
edition = "2021"

# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html

[lib]
crate-type = ["lib", "cdylib"]

[build-dependencies]
lalrpop = "0.20.0"

[dependencies]
lalrpop-util = { version = "0.20.0", features = ["lexer", "unicode"] }
num-traits = "0.2.17"
thiserror = "1.0"
wasm-bindgen = "0.2"
File renamed without changes.
Loading

0 comments on commit 8bfa9e4

Please sign in to comment.