1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
use crate::common::*;
use moon_common::Id;
use moon_config::{DependencyConfig, ProjectConfig};
use rustc_hash::FxHashMap;
use schematic::Schema;
use warpgate_api::{api_struct, VirtualPath};

// METADATA

api_struct!(
    /// Input passed to the `register_toolchain` function.
    pub struct ToolchainMetadataInput {
        /// ID of the toolchain, as it was configured.
        pub id: String,
    }
);

api_struct!(
    /// Output returned from the `register_toolchain` function.
    pub struct ToolchainMetadataOutput {
        /// Schema shape of the tool's configuration.
        #[serde(default, skip_serializing_if = "Option::is_none")]
        pub config_schema: Option<Schema>,

        /// Version of the plugin.
        pub plugin_version: String,
    }
);

// SYNC WORKSPACE

api_struct!(
    /// Input passed to the `sync_workspace` function.
    pub struct SyncWorkspaceInput {
        /// Current moon context.
        pub context: MoonContext,
    }
);

api_struct!(
    /// Output returned from the `sync_workspace` function.
    pub struct SyncWorkspaceOutput {
        /// Operations to perform.
        pub operations: Vec<Operation>,
    }
);

// SYNC PROJECT

api_struct!(
    pub struct SyncProjectRecord {
        pub config: ProjectConfig,
        pub dependencies: Vec<DependencyConfig>,
        pub id: Id,
        pub root: VirtualPath,
        pub source: String,
    }
);

api_struct!(
    /// Input passed to the `sync_project` function.
    pub struct SyncProjectInput {
        /// Current moon context.
        pub context: MoonContext,

        /// Other projects that the project being synced depends on.
        pub dependencies: FxHashMap<Id, SyncProjectRecord>,

        /// The project being synced.
        pub project: SyncProjectRecord,
    }
);