Skip to content

Commit

Permalink
ascent wip
Browse files Browse the repository at this point in the history
  • Loading branch information
StuartHarris committed Oct 27, 2024
1 parent b3a540a commit cab10c1
Show file tree
Hide file tree
Showing 5 changed files with 281 additions and 41 deletions.
145 changes: 143 additions & 2 deletions Cargo.lock

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

1 change: 1 addition & 0 deletions crux_cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ path = "src/main.rs"

[dependencies]
anyhow.workspace = true
ascent = "0.7.0"
clap = { version = "4.4.18", features = ["derive"] }
console = "0.15.8"
guppy = "0.17.4"
Expand Down
3 changes: 0 additions & 3 deletions crux_cli/codegen.fish
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
cargo build

for d in ../examples/hello_world
echo ""
echo "---------------"
echo "Public API for $d"
pushd $d
../../target/debug/crux codegen --lib shared
popd
Expand Down
21 changes: 14 additions & 7 deletions crux_cli/src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,19 @@ pub async fn codegen(args: &CodegenArgs) -> Result<()> {
bail!("Could not find workspace package with path {}", args.lib)
};

let json_path = rustdoc_json::Builder::default()
.toolchain("nightly")
.manifest_path(lib.manifest_path())
.build()?;
// let json_path = rustdoc_json::Builder::default()
// .toolchain("nightly")
// .manifest_path(lib.manifest_path())
// .build()?;
let json_path = lib
.manifest_path()
.parent()
.unwrap()
.parent()
.unwrap()
.join("target")
.join("doc")
.join("shared.json");

let crate_: Crate = spawn_blocking(move || -> Result<Crate> {
let file = File::open(json_path)?;
Expand All @@ -29,9 +38,7 @@ pub async fn codegen(args: &CodegenArgs) -> Result<()> {
})
.await??;

println!("Parsing rustdoc JSON, version {}", crate_.format_version);
let out = parser::parse(&crate_)?;
println!("{}", out);
parser::parse(&crate_)?;

Ok(())
}
Loading

0 comments on commit cab10c1

Please sign in to comment.