Skip to content

Commit 7b50fcf

Browse files
committed
add to tg_core
1 parent ea7d052 commit 7b50fcf

File tree

8 files changed

+10
-7
lines changed

8 files changed

+10
-7
lines changed

Cargo.lock

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ edition = "2021"
3838
# internal crates
3939
mt_deno = { path = "src/mt_deno/" }
4040
tg_schema = { path = "src/typegraph/schema" }
41+
tg_optimize = { path = "src/typegraph/optimize" }
4142
typegraph_core = { path = "src/typegraph/core" }
4243
substantial = { path = "src/substantial/" }
4344
metagen = { path = "src/metagen/" }

src/typegraph/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ version = "0.5.1-rc.3"
44
edition = "2021"
55

66
[dependencies]
7-
# common.workspace = true
87
tg_schema.workspace = true
8+
tg_optimize.workspace = true
99
metagen.workspace = true
1010
grpc_utils.workspace = true
1111
archive_utils.workspace = true

src/typegraph/core/src/typegraph.rs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,8 @@ pub fn serialize(params: SerializeParams) -> Result<(String, Vec<SdkArtifact>)>
241241
}
242242
.postprocess(&mut tg)?;
243243

244+
let tg = tg_optimize::optimize(tg.into());
245+
244246
let artifacts = tg
245247
.meta
246248
.artifacts

src/typegraph/optimize/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[package]
2-
name = "tg-optimize"
2+
name = "tg_optimize"
33
version.workspace = true
44
edition.workspace = true
55

src/typegraph/optimize/src/dedup.rs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ impl DedupEngine {
177177
}
178178
}
179179

180-
pub fn get_converted_typegraph(&self) -> Arc<Typegraph> {
180+
pub fn get_converted_typegraph(&self) -> Typegraph {
181181
let map = self.generate_conversion_map();
182182

183183
let types = map
@@ -234,7 +234,6 @@ impl DedupEngine {
234234
path: self.tg.path.clone(),
235235
deps: self.tg.deps.clone(),
236236
}
237-
.into()
238237
}
239238

240239
pub fn generate_conversion_map(&self) -> ConversionMap {

src/typegraph/optimize/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ impl TypeIdx {
2929
}
3030
}
3131

32-
pub fn optimize(tg: Arc<Typegraph>) -> Arc<Typegraph> {
32+
pub fn optimize(tg: Arc<Typegraph>) -> Typegraph {
3333
let mut k = Kosaraju::new(tg);
3434
k.run();
3535

src/typegraph/optimize/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ fn main() -> color_eyre::eyre::Result<()> {
1010
std::io::stdin().read_line(&mut buffer)?;
1111
let tg: Typegraph = serde_json::from_str(&buffer)?;
1212
let opt_tg = tg_optimize::optimize(Arc::new(tg));
13-
println!("{}", serde_json::to_string(opt_tg.as_ref())?);
13+
println!("{}", serde_json::to_string(&opt_tg)?);
1414

1515
Ok(())
1616
}

0 commit comments

Comments
 (0)