Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 10 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[workspace]
resolver = "3"
members = ["crates/*", "crates/workshop/desktop", "crates/workshop/server", "crates/workshop/server-api", "crates/workshop/gateway", "crates/workshop/gateway-discovery", "crates/workshop/menu", "crates/workshop/protocol", "crates/workshop/registry", "crates/workshop/status", "crates/workshop/support", "crates/workshop/user-state", "crates/workshop/workspace", "crates/workshop/run-log", "crates/workshop/agents", "crates/workshop/plugin-std", "crates/workshop/plugin-bashkit", "crates/workshop/plugin-web"]
members = ["crates/*", "crates/workshop/desktop", "crates/workshop/server", "crates/workshop/server-api", "crates/workshop/gateway", "crates/workshop/gateway-discovery", "crates/workshop/menu", "crates/workshop/protocol", "crates/workshop/registry", "crates/workshop/status", "crates/workshop/support", "crates/workshop/user-state", "crates/workshop/workspace", "crates/workshop/run-log", "crates/workshop/agents", "crates/workshop/plugin-std", "crates/workshop/plugin-bashkit", "crates/workshop/plugin-web", "crates/workshop/plugin-urls"]
# crates/workshop is a manifestless container holding Workshop's crates.
# Cargo prunes excluded subtrees from member globs, so a "crates/workshop/*"
# glob beside the exclude below would match nothing; the container crates
Expand All @@ -10,7 +10,7 @@ exclude = ["crates/workshop"]
# the server it embeds, and the server's facade: the rest compile on a
# fresh macOS or Linux clone with no Node install and no Tauri system
# packages. The desktop app is an explicit choice: `cargo build -p workshop`.
default-members = ["crates/build-ui", "crates/build-workshop", "crates/build-xtask", "crates/workshop/gateway", "crates/workshop/gateway-discovery", "crates/workshop/menu", "crates/workshop/protocol", "crates/workshop/registry", "crates/workshop/status", "crates/workshop/support", "crates/workshop/user-state", "crates/workshop/workspace", "crates/workshop/run-log", "crates/workshop/agents", "crates/workshop/plugin-std", "crates/workshop/plugin-bashkit", "crates/workshop/plugin-web"]
default-members = ["crates/build-ui", "crates/build-workshop", "crates/build-xtask", "crates/workshop/gateway", "crates/workshop/gateway-discovery", "crates/workshop/menu", "crates/workshop/protocol", "crates/workshop/registry", "crates/workshop/status", "crates/workshop/support", "crates/workshop/user-state", "crates/workshop/workspace", "crates/workshop/run-log", "crates/workshop/agents", "crates/workshop/plugin-std", "crates/workshop/plugin-bashkit", "crates/workshop/plugin-web", "crates/workshop/plugin-urls"]

[workspace.package]
version = "0.3.1"
Expand Down Expand Up @@ -54,6 +54,13 @@ bashkit-plugin = { package = "plugin-bashkit", version = "0.1.0", git = "https:/
# crate's own library has the name of the file Workshop ships,
# `plugin_web`.
web-plugin = { package = "plugin-web", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-web", rev = "9409b2c8070fc43883c8b286a56015eb4747fa20", default-features = false }
# The urls Plugin, from its own repository, pinned by commit and built
# against the same contract commit. default-features off drops its own
# export of `runvil_plugin`, which `workshop-plugin-urls` makes instead.
# The key is `urls-plugin` for the reason std's is `std-plugin`: the
# crate's own library has the name of the file Workshop ships,
# `plugin_urls`.
urls-plugin = { package = "plugin-urls", version = "0.1.0", git = "https://github.com/cppalliance/runvil-plugin-urls", rev = "5133069dc11ee99fdc10b4568388d8252d43dab4", default-features = false }
workshop-gateway-discovery = { path = "crates/workshop/gateway-discovery" }
workshop-server = { path = "crates/workshop/server" }
workshop-server-api = { path = "crates/workshop/server-api" }
Expand All @@ -70,6 +77,7 @@ workshop-user-state = { path = "crates/workshop/user-state" }
workshop-plugin-std = { path = "crates/workshop/plugin-std" }
workshop-plugin-bashkit = { path = "crates/workshop/plugin-bashkit" }
workshop-plugin-web = { path = "crates/workshop/plugin-web" }
workshop-plugin-urls = { path = "crates/workshop/plugin-urls" }
# default-features off: build-xtask's doctest scan reads only the core
# event stream, never the `html` renderer or the `getopts` binary.
pulldown-cmark = { version = "0.12", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions crates/build-workshop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ Three library Plugins ship with Workshop, each a dynamic library whose code is i
- The std Plugin, from [cppalliance/runvil-plugin-std](https://github.com/cppalliance/runvil-plugin-std), holds the file tools. Its library is `plugin_std.dll`, `libplugin_std.so`, or `libplugin_std.dylib`.
- The bashkit Plugin, from [cppalliance/runvil-plugin-bashkit](https://github.com/cppalliance/runvil-plugin-bashkit), holds the shell. Its library is `plugin_bashkit.dll`, `libplugin_bashkit.so`, or `libplugin_bashkit.dylib`.
- The web Plugin, from [cppalliance/runvil-plugin-web](https://github.com/cppalliance/runvil-plugin-web), holds the web tools. Its library is `plugin_web.dll`, `libplugin_web.so`, or `libplugin_web.dylib`.
- The urls Plugin, from [cppalliance/runvil-plugin-urls](https://github.com/cppalliance/runvil-plugin-urls), holds the `urls` native prelude. Its library is `plugin_urls.dll`, `libplugin_urls.so`, or `libplugin_urls.dylib`.

Nothing here builds them by name: the Workshop server depends on `workshop-plugin-std`, `workshop-plugin-bashkit`, and `workshop-plugin-web`, so Cargo writes each library to `deps` in the profile's directory whenever it builds Workshop. Each mode takes the libraries from there. A build copies them into `plugins` beside Workshop in the target directory. A macOS or Linux bundle build has Tauri copy them into Workshop's bundle, at `Runvil.app/Contents/Resources/plugins` or at `usr/lib/runvil/plugins` in the AppImage, so the updater, which replaces only that bundle, replaces the libraries with it. The bundle build fails when the bundle Tauri built does not hold each library. A Workshop run with plain `cargo run -p workshop` has no Plugin directory, so its agents have no file tools, no shell, and no web tools; run `cargo workshop` once to place the libraries. Plain Cargo builds do not refresh the placed copies, so run `cargo workshop` again after a pin or the contract version changes.

Expand Down
10 changes: 6 additions & 4 deletions crates/build-workshop/src/main/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,12 @@ pub(crate) const APPIMAGE_PLUGIN_PARENT: &str = "usr/lib/runvil";

/// The library of each Plugin Workshop ships, as its `workshop-plugin-*`
/// crate names it: the std Plugin's, which holds the file tools, the
/// bashkit Plugin's, which holds the shell, and the web Plugin's, which
/// holds the web tools. `installer.nsi` and the install tests in
/// `cppalliance/runvil` name the same three.
pub(crate) const LIBRARIES: [&str; 3] = ["plugin_std", "plugin_bashkit", "plugin_web"];
/// bashkit Plugin's, which holds the shell, the web Plugin's, which holds
/// the web tools, and the urls Plugin's, which holds the `urls` native
/// prelude. `installer.nsi` and the install tests in `cppalliance/runvil`
/// name the same four.
pub(crate) const LIBRARIES: [&str; 4] =
["plugin_std", "plugin_bashkit", "plugin_web", "plugin_urls"];

/// The file name Cargo gives each shipped library for `target`, in the
/// order of [`LIBRARIES`].
Expand Down
4 changes: 4 additions & 0 deletions crates/build-workshop/src/main/tests/bundle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ pub(super) fn bundled_plugins(environment: &BuildEnvironment, target: &str) -> V
"libplugin_std.dylib",
"libplugin_bashkit.dylib",
"libplugin_web.dylib",
"libplugin_urls.dylib",
],
)
} else {
Expand All @@ -87,6 +88,7 @@ pub(super) fn bundled_plugins(environment: &BuildEnvironment, target: &str) -> V
"libplugin_std.so",
"libplugin_bashkit.so",
"libplugin_web.so",
"libplugin_urls.so",
],
)
};
Expand All @@ -104,6 +106,7 @@ fn plugin_config(environment: &BuildEnvironment, target: &str) -> Option<String>
"Resources/plugins/libplugin_bashkit.dylib":
deps.join("libplugin_bashkit.dylib"),
"Resources/plugins/libplugin_web.dylib": deps.join("libplugin_web.dylib"),
"Resources/plugins/libplugin_urls.dylib": deps.join("libplugin_urls.dylib"),
} } }
})
} else if target.contains("linux") {
Expand All @@ -113,6 +116,7 @@ fn plugin_config(environment: &BuildEnvironment, target: &str) -> Option<String>
"/usr/lib/runvil/plugins/libplugin_bashkit.so":
deps.join("libplugin_bashkit.so"),
"/usr/lib/runvil/plugins/libplugin_web.so": deps.join("libplugin_web.so"),
"/usr/lib/runvil/plugins/libplugin_urls.so": deps.join("libplugin_urls.so"),
} } } }
})
} else {
Expand Down
31 changes: 26 additions & 5 deletions crates/build-workshop/src/main/tests/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,18 +12,29 @@ fn each_library_is_named_as_cargo_names_it_for_each_target() {
for (target, names) in [
(
"x86_64-pc-windows-msvc",
["plugin_std.dll", "plugin_bashkit.dll", "plugin_web.dll"],
[
"plugin_std.dll",
"plugin_bashkit.dll",
"plugin_web.dll",
"plugin_urls.dll",
],
),
(
"aarch64-pc-windows-msvc",
["plugin_std.dll", "plugin_bashkit.dll", "plugin_web.dll"],
[
"plugin_std.dll",
"plugin_bashkit.dll",
"plugin_web.dll",
"plugin_urls.dll",
],
),
(
"x86_64-apple-darwin",
[
"libplugin_std.dylib",
"libplugin_bashkit.dylib",
"libplugin_web.dylib",
"libplugin_urls.dylib",
],
),
(
Expand All @@ -32,6 +43,7 @@ fn each_library_is_named_as_cargo_names_it_for_each_target() {
"libplugin_std.dylib",
"libplugin_bashkit.dylib",
"libplugin_web.dylib",
"libplugin_urls.dylib",
],
),
(
Expand All @@ -40,6 +52,7 @@ fn each_library_is_named_as_cargo_names_it_for_each_target() {
"libplugin_std.so",
"libplugin_bashkit.so",
"libplugin_web.so",
"libplugin_urls.so",
],
),
(
Expand All @@ -48,6 +61,7 @@ fn each_library_is_named_as_cargo_names_it_for_each_target() {
"libplugin_std.so",
"libplugin_bashkit.so",
"libplugin_web.so",
"libplugin_urls.so",
],
),
] {
Expand Down Expand Up @@ -83,7 +97,7 @@ fn a_host_build_places_each_library_in_the_plugin_directory_beside_workshop() {
.expect("Workshop build");

let plugins = environment.target_root.join("debug").join("plugins");
for library in ["plugin_std", "plugin_bashkit", "plugin_web"] {
for library in ["plugin_std", "plugin_bashkit", "plugin_web", "plugin_urls"] {
assert_eq!(
std::fs::read(plugins.join(format!("{library}.dll"))).expect("the placed library"),
plugin_bytes(library, None, "debug"),
Expand All @@ -92,7 +106,7 @@ fn a_host_build_places_each_library_in_the_plugin_directory_beside_workshop() {
}
assert_eq!(
std::fs::read_dir(&plugins).expect("plugins").count(),
3,
4,
"the copies leave no other file behind"
);
}
Expand Down Expand Up @@ -123,7 +137,7 @@ fn a_build_for_a_named_target_places_each_library_under_that_target_and_replaces
)
.expect("Workshop build");

for library in ["plugin_std", "plugin_bashkit", "plugin_web"] {
for library in ["plugin_std", "plugin_bashkit", "plugin_web", "plugin_urls"] {
assert_eq!(
std::fs::read(plugins.join(format!("lib{library}.so"))).expect("the placed library"),
plugin_bytes(library, Some(triple), "release"),
Expand All @@ -146,6 +160,7 @@ fn a_build_that_left_a_library_out_fails_naming_the_file_and_places_nothing() {
("plugin_std", "libplugin_std.so"),
("plugin_bashkit", "libplugin_bashkit.so"),
("plugin_web", "libplugin_web.so"),
("plugin_urls", "libplugin_urls.so"),
] {
let test_environment = environment();
let environment = &test_environment.environment;
Expand Down Expand Up @@ -195,6 +210,7 @@ fn the_bundle_configuration_copies_each_library_into_each_platform_s_bundle() {
deps.join("libplugin_std.dylib"),
deps.join("libplugin_bashkit.dylib"),
deps.join("libplugin_web.dylib"),
deps.join("libplugin_urls.dylib"),
];
assert_eq!(
plugin::bundle_config(System::MacOs, &dylibs),
Expand All @@ -204,6 +220,7 @@ fn the_bundle_configuration_copies_each_library_into_each_platform_s_bundle() {
"Resources/plugins/libplugin_std.dylib": dylibs[0],
"Resources/plugins/libplugin_bashkit.dylib": dylibs[1],
"Resources/plugins/libplugin_web.dylib": dylibs[2],
"Resources/plugins/libplugin_urls.dylib": dylibs[3],
} } }
})
.to_string()
Expand All @@ -214,6 +231,7 @@ fn the_bundle_configuration_copies_each_library_into_each_platform_s_bundle() {
deps.join("libplugin_std.so"),
deps.join("libplugin_bashkit.so"),
deps.join("libplugin_web.so"),
deps.join("libplugin_urls.so"),
];
assert_eq!(
plugin::bundle_config(System::Linux, &sos),
Expand All @@ -223,6 +241,7 @@ fn the_bundle_configuration_copies_each_library_into_each_platform_s_bundle() {
"/usr/lib/runvil/plugins/libplugin_std.so": sos[0],
"/usr/lib/runvil/plugins/libplugin_bashkit.so": sos[1],
"/usr/lib/runvil/plugins/libplugin_web.so": sos[2],
"/usr/lib/runvil/plugins/libplugin_urls.so": sos[3],
} } } }
})
.to_string()
Expand All @@ -233,6 +252,7 @@ fn the_bundle_configuration_copies_each_library_into_each_platform_s_bundle() {
deps.join("plugin_std.dll"),
deps.join("plugin_bashkit.dll"),
deps.join("plugin_web.dll"),
deps.join("plugin_urls.dll"),
];
assert_eq!(
plugin::bundle_config(System::Windows, &dlls),
Expand All @@ -254,6 +274,7 @@ fn a_bundle_tauri_left_without_a_library_fails_the_bundle_build() {
(0, "libplugin_std."),
(1, "libplugin_bashkit."),
(2, "libplugin_web."),
(3, "libplugin_urls."),
] {
let test_environment = environment();
let environment = &test_environment.environment;
Expand Down
1 change: 1 addition & 0 deletions crates/build-xtask/src/tidy-tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ fn tier_table_grants_each_tier_only_lower_tiers() {
"workshop-plugin-std",
"workshop-plugin-bashkit",
"workshop-plugin-web",
"workshop-plugin-urls",
] {
assert_eq!(
allowed_dependencies(plugin),
Expand Down
1 change: 1 addition & 0 deletions crates/build-xtask/src/tidy.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ const PLUGINS: &[Tiered] = &[
("workshop-plugin-std", "plugin-std"),
("workshop-plugin-bashkit", "plugin-bashkit"),
("workshop-plugin-web", "plugin-web"),
("workshop-plugin-urls", "plugin-urls"),
];
/// Tier 1: domain services. Depend on vocabulary crates only.
const SERVICES: &[Tiered] = &[
Expand Down
1 change: 1 addition & 0 deletions crates/workshop/desktop/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ Each installer puts three libraries there, each from a repository of its own, pi
- The std Plugin, which holds the file tools: `plugin_std.dll`, `libplugin_std.dylib`, or `libplugin_std.so`, from [cppalliance/runvil-plugin-std](https://github.com/cppalliance/runvil-plugin-std).
- The bashkit Plugin, which holds the shell: `plugin_bashkit.dll`, `libplugin_bashkit.dylib`, or `libplugin_bashkit.so`, from [cppalliance/runvil-plugin-bashkit](https://github.com/cppalliance/runvil-plugin-bashkit).
- The web Plugin, which holds the web tools: `plugin_web.dll`, `libplugin_web.dylib`, or `libplugin_web.so`, from [cppalliance/runvil-plugin-web](https://github.com/cppalliance/runvil-plugin-web).
- The urls Plugin, which holds the `urls` native prelude: `plugin_urls.dll`, `libplugin_urls.dylib`, or `libplugin_urls.so`, from [cppalliance/runvil-plugin-urls](https://github.com/cppalliance/runvil-plugin-urls).

A Workshop with no Plugin directory, or one whose std library does not load, refuses an agent that requires `std` and says that `runvil/std` is not installed. It does the same for `bash` and the bashkit library, and for `web` and the web library.

Expand Down
4 changes: 4 additions & 0 deletions crates/workshop/desktop/installer.nsi
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ ${StrLoc}
!searchreplace STDPLUGINSRCPATH "${MAINBINARYSRCPATH}" "${MAINBINARYNAME}.exe" "deps\plugin_std.dll"
!searchreplace BASHKITPLUGINSRCPATH "${MAINBINARYSRCPATH}" "${MAINBINARYNAME}.exe" "deps\plugin_bashkit.dll"
!searchreplace WEBPLUGINSRCPATH "${MAINBINARYSRCPATH}" "${MAINBINARYNAME}.exe" "deps\plugin_web.dll"
!searchreplace URLSPLUGINSRCPATH "${MAINBINARYSRCPATH}" "${MAINBINARYNAME}.exe" "deps\plugin_urls.dll"
; A main executable under another name would leave the path unchanged, and
; the setup would install the executable as each Plugin.
!if "${STDPLUGINSRCPATH}" == "${MAINBINARYSRCPATH}"
Expand Down Expand Up @@ -753,6 +754,7 @@ Section "Runvil Workshop" SecWorkshop
File "/oname=plugins\plugin_std.dll" "${STDPLUGINSRCPATH}"
File "/oname=plugins\plugin_bashkit.dll" "${BASHKITPLUGINSRCPATH}"
File "/oname=plugins\plugin_web.dll" "${WEBPLUGINSRCPATH}"
File "/oname=plugins\plugin_urls.dll" "${URLSPLUGINSRCPATH}"

; Copy resources
{{#each resources_dirs}}
Expand Down Expand Up @@ -907,6 +909,7 @@ Section "-Finalize"
!insertmacro DeleteComponentPayloadIfDeclined ${SecWorkshop} $INSTDIR\plugins\plugin_std.dll
!insertmacro DeleteComponentPayloadIfDeclined ${SecWorkshop} $INSTDIR\plugins\plugin_bashkit.dll
!insertmacro DeleteComponentPayloadIfDeclined ${SecWorkshop} $INSTDIR\plugins\plugin_web.dll
!insertmacro DeleteComponentPayloadIfDeclined ${SecWorkshop} $INSTDIR\plugins\plugin_urls.dll
; Without /r, RMDir removes the Plugin directory only when it is empty,
; which it is only after the lines above deleted the three libraries in it.
RMDir "$INSTDIR\plugins"
Expand Down Expand Up @@ -993,6 +996,7 @@ Section "un.Workshop"
Delete "$INSTDIR\plugins\plugin_std.dll"
Delete "$INSTDIR\plugins\plugin_bashkit.dll"
Delete "$INSTDIR\plugins\plugin_web.dll"
Delete "$INSTDIR\plugins\plugin_urls.dll"
RMDir "$INSTDIR\plugins"

; Delete resources
Expand Down
Loading
Loading