Add RunContext support for script outputs (#765)

Resolves #667

This PR:

- Introduces a new field in the project file: `scriptType` which has the
default value of `Class` (in parity with previous versions), but can
also be `RunContext`.
- This is then passed to `InstanceContext` from the `Project` struct.
- This then changes the RunContext in the lua `snapshot_middleware`

---------

Co-authored-by: Micah <dekkonot@rocketmail.com>
This commit is contained in:
Sasial
2023-09-24 06:28:09 +10:00
committed by GitHub
parent 539cd0d418
commit bb8dd1402d
56 changed files with 602 additions and 95 deletions

View File

@@ -12,7 +12,7 @@ use crate::{
},
};
use super::snapshot_from_vfs;
use super::{emit_legacy_scripts_default, snapshot_from_vfs};
pub fn snapshot_project(
context: &InstanceContext,
@@ -30,6 +30,12 @@ pub fn snapshot_project(
});
context.add_path_ignore_rules(rules);
context.set_emit_legacy_scripts(
project
.emit_legacy_scripts
.or_else(emit_legacy_scripts_default)
.unwrap(),
);
match snapshot_project_node(&context, path, &project.name, &project.tree, vfs, None)? {
Some(found_snapshot) => {
@@ -77,7 +83,7 @@ pub fn snapshot_project_node(
let name = Cow::Owned(instance_name.to_owned());
let mut properties = HashMap::new();
let mut children = Vec::new();
let mut metadata = InstanceMetadata::default();
let mut metadata = InstanceMetadata::new().context(context);
if let Some(path_node) = &node.path {
let path = path_node.path();