forked from rojo-rbx/rojo
Mark project file as instigating source for top-level instances
This commit is contained in:
@@ -51,11 +51,18 @@ impl SnapshotMiddleware for SnapshotProject {
|
|||||||
// unwrap is safe.
|
// unwrap is safe.
|
||||||
let mut snapshot = snapshot_project_node(&project.name, &project.tree, imfs)?.unwrap();
|
let mut snapshot = snapshot_project_node(&project.name, &project.tree, imfs)?.unwrap();
|
||||||
|
|
||||||
// If the project file updates, we want to trigger a snapshot of the
|
// Setting the instigating source to the project file path is a little
|
||||||
// entire project tree. We're overwriting the "instigating path" for the
|
// coarse.
|
||||||
// root instance of the project, since we want to snapshot the project
|
//
|
||||||
// file and not the snapshot's original instigating path, or else we
|
// Ideally, we'd only snapshot the project file if the project file
|
||||||
// won't pick up new changes from the project file.
|
// actually changed. Because Rojo only has the concept of one
|
||||||
|
// relevant path -> snapshot path mapping per instance, we pick the more
|
||||||
|
// conservative approach of snapshotting the project file if any
|
||||||
|
// relevant paths changed.
|
||||||
|
snapshot.metadata.instigating_source = Some(entry.path().to_path_buf().into());
|
||||||
|
|
||||||
|
// Mark this snapshot (the root node of the project file) as being
|
||||||
|
// related to the project file.
|
||||||
//
|
//
|
||||||
// We SHOULD NOT mark the project file as a relevant path for any
|
// We SHOULD NOT mark the project file as a relevant path for any
|
||||||
// nodes that aren't roots. They'll be updated as part of the project
|
// nodes that aren't roots. They'll be updated as part of the project
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/hello.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/hello.project.json
|
- /foo/hello.project.json
|
||||||
name: direct-project
|
name: direct-project
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
name: indirect-project
|
name: indirect-project
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/other.project.json
|
- /foo/other.project.json
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
name: children
|
name: children
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/other.project.json
|
- /foo/other.project.json
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/other.project.json
|
- /foo/other.project.json
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: false
|
ignore_unknown_instances: false
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/other.txt
|
- /foo/other.txt
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
name: resolved-properties
|
name: resolved-properties
|
||||||
|
|||||||
@@ -5,6 +5,8 @@ expression: instance_snapshot
|
|||||||
snapshot_id: ~
|
snapshot_id: ~
|
||||||
metadata:
|
metadata:
|
||||||
ignore_unknown_instances: true
|
ignore_unknown_instances: true
|
||||||
|
instigating_source:
|
||||||
|
Path: /foo/default.project.json
|
||||||
relevant_paths:
|
relevant_paths:
|
||||||
- /foo/default.project.json
|
- /foo/default.project.json
|
||||||
name: unresolved-properties
|
name: unresolved-properties
|
||||||
|
|||||||
Reference in New Issue
Block a user