feat: add metadata field to .workspace.json#238
feat: add metadata field to .workspace.json#238vytautas-astrauskas-sensmetry merged 5 commits intomainfrom
Conversation
7a6dc58 to
c4dab0a
Compare
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
c4dab0a to
bcf27f3
Compare
| in the workspace. When set, individual projects must **not** also set | ||
| `metamodel` in their `.meta.json` — doing so will produce an error. |
There was a problem hiding this comment.
I wonder if at some point other tools might start generating/editing .meta.json files on their own. Could be a good idea to just demand that the metamodels are the same.
Not urgent though, feel free to ignore.
core/src/commands/build.rs
Outdated
|
|
||
| let mut result = Vec::new(); | ||
| for project in workspace.projects() { | ||
| for project_info in workspace.projects() { |
There was a problem hiding this comment.
Should name this project_root, it's not a path of .project.json.
There was a problem hiding this comment.
Or project_path
| #[serde(skip_serializing_if = "Option::is_none")] | ||
| #[serde(default)] | ||
| pub meta: Option<WorkspaceMetaG<Iri>>, |
There was a problem hiding this comment.
Why have #[serde(default)] here? AFAIK serde defaults Option to None anyway if the field is missing.
core/src/commands/build.rs
Outdated
| if let Some(ws_mm) = ws_metamodel { | ||
| let project_meta = project.get_meta().map_err(KParBuildError::ProjectRead)?; | ||
| if let Some(meta) = &project_meta | ||
| && meta.metamodel.is_some() | ||
| { | ||
| return Err(KParBuildError::WorkspaceMetamodelConflict { | ||
| workspace_metamodel: ws_mm.to_string(), | ||
| project_path: project_info.path.clone(), | ||
| }); | ||
| } | ||
| } |
There was a problem hiding this comment.
Move this check into do_build_kpar_inner, where meta is available.
andrius-puksta-sensmetry
left a comment
There was a problem hiding this comment.
Aside from the nits above, this looks good.
|
In the near future it would be nice to merge |
core/src/commands/build.rs
Outdated
| if let Some(ws_metamodel) = workspace_metamodel | ||
| && meta.metamodel.is_none() | ||
| { | ||
| meta.metamodel = Some(ws_metamodel.to_string()); | ||
| use crate::project::ProjectMut; | ||
| local_project | ||
| .put_meta(&meta, true) | ||
| .map_err(KParBuildError::from)?; | ||
| } |
There was a problem hiding this comment.
Merge this with the conflict check, this will also eliminate redundant metamodel.is_none().
Co-authored-by: Andrius Pukšta <andrius.puksta@sensmetry.com> Signed-off-by: vytautas-astrauskas-sensmetry <vytautas.astrauskas@sensmetry.com>
…ta and workspace Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
Signed-off-by: Vytautas Astrauskas <vytautas.astrauskas@sensmetry.com>
cfc0427 to
d5bac73
Compare
The time is coming when the new version of SysML standard libraries will have to be released. Since the release will have breaking changes in the metamodel, we need to ensure that the metamodel field is properly set so that tools know what they are loading. This PR adds a metamodel field to
.workspace.jsonto enable Pilot CI to build.kpars with the updated metamodel field.Note: the workspaces are still an experimental feature and we are still keeping the right to completely rewrite it in non-backward compatible ways or even to remove it.