Skip to content

Commit cab816f

Browse files
authored
Flaten project structure (#20)
1 parent 8f6b5bc commit cab816f

File tree

24 files changed

+168
-89
lines changed

24 files changed

+168
-89
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -7,46 +7,14 @@ on:
77
pull_request:
88
branches:
99
- main
10-
# change to repeat for two directories ./infc_compiler and ./infc
1110
jobs:
12-
build_infc_compiler:
13-
name: Build and test infc_compiler
14-
runs-on: ubuntu-latest
15-
strategy:
16-
matrix:
17-
toolchain:
18-
- nightly
19-
defaults:
20-
run:
21-
working-directory: ./infc_compiler
22-
steps:
23-
- name: Setup Rust
24-
uses: actions/checkout@v4.1.3
25-
- name: Update Rust
26-
run: rustup update ${{ matrix.toolchain }} && rustup default ${{ matrix.toolchain }}
27-
- name: Install clippy nightly
28-
run: rustup component add clippy-preview
29-
- name: Install Cargo audit
30-
run: cargo install cargo-audit
31-
- name: Build
32-
run: cargo build --verbose
33-
- name: Test
34-
run: cargo test --verbose
35-
- name: Clippy
36-
run: cargo clippy --verbose -- -D warnings
37-
- name: Audit
38-
run: cargo audit
39-
40-
build_infc:
11+
build:
4112
name: Build and test infc
4213
runs-on: ubuntu-latest
4314
strategy:
4415
matrix:
4516
toolchain:
4617
- nightly
47-
defaults:
48-
run:
49-
working-directory: ./infc
5018
steps:
5119
- name: Setup Rust
5220
uses: actions/checkout@v4.1.3

.vscode/settings.json

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,11 @@
11
{
22
"rust-analyzer.linkedProjects": [
3-
"./infc_compiler/Cargo.toml",
4-
"./infc/Cargo.toml",
5-
"./tests/Cargo.toml"
3+
"./inference/Cargo.toml",
4+
"./ast/Cargo.toml",
5+
"./cli/Cargo.toml",
6+
"./wasm-coq-translator/Cargo.toml",
7+
"./wat-codegen/Cargo.toml",
8+
"./tests/Cargo.toml",
9+
"./playground-server/Cargo.toml"
610
]
711
}

Cargo.toml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
[workspace]
2+
3+
resolver = "2"
4+
5+
members = [
6+
"ast",
7+
"cli",
8+
"wasm-coq-translator",
9+
"wat-codegen",
10+
"inference",
11+
"tests",
12+
"playground-server",
13+
]
14+
15+
exclude = ["riscv-runtime"]
16+
17+
[workspace.package]
18+
version = "0.0.1"
19+
edition = "2021"
20+
license = "GPL-3.0"
21+
homepage = "https://inferara.com"
22+
repository = "https://github.com/Inferara/inference"
23+
24+
[workspace.dependencies]
25+
inference = { path = "./inference", version = "0.0.1" }
26+
inference-ast = { path = "./ast", version = "0.0.1" }
27+
inference-cli = { path = "./cli", version = "0.0.1" }
28+
inference-wasm-coq-translator = { path = "./wasm-coq-translator", version = "0.0.1" }
29+
inference-wat-codegen = { path = "./wat-codegen", version = "0.0.1" }
30+
inference-tests = { path = "./tests", version = "0.0.1" }
31+
inference-playground-server = { path = "./playground-server", version = "0.0.1" }
32+
tree-sitter = ">=0.22.6"
33+
tree-sitter-inference = "0.0.28"

ast/Cargo.toml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
[package]
2+
name = "inference-ast"
3+
version = { workspace = true }
4+
edition = { workspace = true }
5+
license = { workspace = true }
6+
homepage = { workspace = true }
7+
repository = { workspace = true }
8+
9+
[dependencies]
10+
tree-sitter = ">=0.22.6"
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
#![warn(clippy::pedantic)]
22

3-
use crate::ast::types::{
3+
use crate::types::{
44
ArrayIndexAccessExpression, ArrayLiteral, AssertStatement, AssignExpression, BinaryExpression,
55
Block, BoolLiteral, BreakStatement, ConstantDefinition, Definition, EnumDefinition, Expression,
66
ExpressionStatement, ExternalFunctionDefinition, FunctionCallExpression, FunctionDefinition,

cli/Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[package]
2+
name = "inrence-cli"
3+
version = { workspace = true }
4+
edition = { workspace = true }
5+
license = { workspace = true }
6+
homepage = { workspace = true }
7+
repository = { workspace = true }
8+
9+
[dependencies]
10+
clap = { version = "4.5.15", features = ["derive"] }
11+
walkdir = "2.5.0"
12+
tempfile = "3"
13+
tree-sitter.workspace = true
14+
tree-sitter-inference.workspace = true
15+
inference-ast.workspace = true
16+
inference-wasm-coq-translator.workspace = true

infc/src/main.rs renamed to cli/src/main.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,8 @@
3030
3131
mod parser;
3232
use clap::Parser;
33-
use infc_compiler::ast::{builder::build_ast, types::SourceFile};
34-
use infc_compiler::wasm_to_coq_translator;
35-
use infc_compiler::wasm_to_coq_translator::translator::WasmModuleParseError;
33+
use inference_ast::{builder::build_ast, types::SourceFile};
34+
use inference_wasm_coq_translator::translator::WasmModuleParseError;
3635
use parser::Cli;
3736
use std::{fs, path::Path, process};
3837
use walkdir::WalkDir;
@@ -134,7 +133,8 @@ fn wasm_bytes_to_coq_file(
134133
sub_path: Option<&Path>,
135134
filename: &String,
136135
) -> Result<String, String> {
137-
let coq = wasm_to_coq_translator::wasm_parser::translate_bytes(filename, bytes.as_slice());
136+
let coq =
137+
inference_wasm_coq_translator::wasm_parser::translate_bytes(filename, bytes.as_slice());
138138

139139
if let Err(e) = coq {
140140
let WasmModuleParseError::UnsupportedOperation(error_message) = e;
@@ -180,7 +180,7 @@ mod test {
180180

181181
let bytes = std::fs::read(absolute_path).unwrap();
182182
let mod_name = String::from("index");
183-
let coq = crate::wasm_to_coq_translator::wasm_parser::translate_bytes(
183+
let coq = inference_wasm_coq_translator::wasm_parser::translate_bytes(
184184
&mod_name,
185185
bytes.as_slice(),
186186
);

0 commit comments

Comments
 (0)