Skip to content

Commit

Permalink
Merge branch 'main' into feat/met-756-improve-ux-for-the-installer
Browse files Browse the repository at this point in the history
  • Loading branch information
j03-dev authored Dec 1, 2024
2 parents 346a5ce + 0787087 commit 265bd2c
Show file tree
Hide file tree
Showing 13 changed files with 1,618 additions and 218 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
- uses: dsherret/rust-toolchain-file@v1
with:
targets: ${{ matrix.target }}
- uses: mozilla-actions/[email protected].5
- uses: mozilla-actions/[email protected].6
- run: |
# sometimes, dtolnay/rust-toolchain does not select the correct default target
rustup target add ${{ matrix.target }}
Expand Down Expand Up @@ -171,7 +171,7 @@ jobs:
- uses: WyriHaximus/[email protected]
id: latest-tag
- uses: dsherret/rust-toolchain-file@v1
- uses: mozilla-actions/[email protected].5
- uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
- shell: bash
env:
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
- shell: bash
run: |
Expand Down Expand Up @@ -129,7 +129,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
- uses: metatypedev/setup-ghjk@318209a9d215f70716a4ac89dbeb9653a2deb8bc
with:
# temporary fix
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
name: Setup sccache secrets
run: echo "RUSTC_WRAPPER=sccache" >> $GITHUB_ENV
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: mozilla-actions/[email protected].5
uses: mozilla-actions/[email protected].6
# - name: Cache deno dir
# uses: actions/cache@v4
# with:
Expand Down Expand Up @@ -314,7 +314,7 @@ jobs:
# we need secrets for coverage so we skip if not avail
# this applies to dedpendabot PRs for example
- if: ${{ env.AWS_ACCESS_KEY_ID != '' }}
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: ./coverage.lcov
Expand Down
3 changes: 2 additions & 1 deletion src/metagen/src/client_py/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,7 @@ class QueryGraph(QueryGraphBase):
{{"{node_name}": NodeDescs.{meta_method}}},
"$q"
)[0]
return {node_type}(node.node_name, node.instance_name, node.args, node.sub_nodes)
return {node_type}(node.node_name, node.instance_name, node.args, node.sub_nodes, node.files)
"#
)?;
}
Expand Down Expand Up @@ -280,6 +280,7 @@ fn render_node_metas(
Rc::new(node_metas::PyNodeMetasRenderer {
name_mapper,
named_types: named_types.clone(),
input_files: manifest.input_files.clone(),
}),
);
for &id in &manifest.node_metas {
Expand Down
33 changes: 30 additions & 3 deletions src/metagen/src/client_py/node_metas.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,20 @@
// Copyright Metatype OÜ, licensed under the Mozilla Public License Version 2.0.
// SPDX-License-Identifier: MPL-2.0

use std::fmt::Write;
use std::{collections::HashMap, fmt::Write, ops::Not};

use common::typegraph::*;

use super::utils::normalize_type_title;
use crate::{interlude::*, shared::types::*};
use crate::{
interlude::*,
shared::{files::TypePath, types::*},
};

pub struct PyNodeMetasRenderer {
pub name_mapper: Rc<super::NameMapper>,
pub named_types: Rc<std::sync::Mutex<IndexSet<u32>>>,
pub input_files: Rc<HashMap<u32, Vec<TypePath>>>,
}

impl PyNodeMetasRenderer {
Expand Down Expand Up @@ -52,6 +56,7 @@ impl PyNodeMetasRenderer {
ty_name: &str,
return_node: &str,
argument_fields: Option<IndexMap<String, Rc<str>>>,
input_files: Option<String>,
) -> std::fmt::Result {
write!(
dest,
Expand Down Expand Up @@ -84,6 +89,13 @@ impl PyNodeMetasRenderer {
}},"#
)?;
}
if let Some(input_files) = input_files {
write!(
dest,
r#"
input_files={input_files},"#
)?;
}
write!(
dest,
r#"
Expand Down Expand Up @@ -172,7 +184,22 @@ impl RenderType for PyNodeMetasRenderer {
};
let node_name = &base.title;
let ty_name = normalize_type_title(node_name).to_pascal_case();
self.render_for_func(renderer, &ty_name, &return_ty_name, props)?;
let input_files = self
.input_files
.get(&cursor.id)
.map(|files| {
files
.iter()
.map(|path| path.to_vec_str())
.collect::<Vec<_>>()
})
.and_then(|files| {
files
.is_empty()
.not()
.then_some(serde_json::to_string(&files).unwrap())
});
self.render_for_func(renderer, &ty_name, &return_ty_name, props, input_files)?;
ty_name
}
TypeNode::Object { data, base } => {
Expand Down
Loading

0 comments on commit 265bd2c

Please sign in to comment.