Skip to content

Commit

Permalink
Merge branch 'main' into feature/modular-player-system
Browse files Browse the repository at this point in the history
  • Loading branch information
tristanpoland authored Dec 12, 2024
2 parents cdc6896 + 9030827 commit 578983e
Show file tree
Hide file tree
Showing 68 changed files with 81 additions and 3,329 deletions.
4 changes: 3 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,4 +28,6 @@ voronoi_edges.txt
load_test.db-journal
/deps
/.cargo
Cargo.lock
Cargo.lock

.DS_Store
22 changes: 11 additions & 11 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
# Want to help us make this template better? Share your feedback here: https://forms.gle/ybq9Krt8jtBL3iCk7

ARG RUST_VERSION=1.82.0
ARG APP_NAME=horizon
ARG APP_NAME=horizon-server

################################################################################
# Create a stage for building the application.
Expand All @@ -27,17 +27,17 @@ RUN apk add --no-cache clang lld musl-dev git
# Leverage a bind mount to the src directory to avoid having to copy the
# source code into the container. Once built, copy the executable to an
# output directory before the cache mounted /app/target is unmounted.
RUN --mount=type=bind,source=src,target=src \
--mount=type=bind,source=plugin-api,target=plugin-api,readonly=false \
--mount=type=bind,source=plugins,target=plugins \
--mount=type=bind,source=config.yml,target=config.yml \
--mount=type=bind,source=Cargo.toml,target=Cargo.toml \
--mount=type=bind,source=Cargo.lock,target=Cargo.lock \
RUN --mount=type=bind,source=./server/src,target=/app/server/src \
--mount=type=bind,source=./plugin_api,target=/app/plugin_api,readonly=false \
--mount=type=bind,source=./plugins,target=/app/plugins \
--mount=type=bind,source=./server/server_config.json,target=/app/server/server_config.json \
--mount=type=bind,source=./server/Cargo.toml,target=/app/server/Cargo.toml \
--mount=type=cache,target=/app/target/ \
--mount=type=cache,target=/usr/local/cargo/git/db \
--mount=type=cache,target=/usr/local/cargo/registry/ \
cargo build --locked --release && \
cp ./target/release/$APP_NAME /bin/server
cd ./server && cargo build --release

RUN cp /app/server/target/release/horizon-server /bin/horizon-server

################################################################################
# Create a new stage for running the application that contains the minimal
Expand Down Expand Up @@ -65,10 +65,10 @@ RUN adduser \
USER appuser

# Copy the executable from the "build" stage.
COPY --from=build /bin/server /bin/
COPY --from=build /bin/$APP_NAME /bin/

# Expose the port that the application listens on.
EXPOSE 3000

# What the container should run when it is started.
CMD ["/bin/server"]
CMD ["/bin/horizon-server"]
6 changes: 2 additions & 4 deletions plugin_api/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@ horizon_data_types = "0.4.0"
tokio = { version = "1.41.1", features = ["rt", "net", "rt-multi-thread"] }
uuid = "1.11.0"
socketioxide = "0.15.0"
horizon-plugin-api = "0.1.11"
horizon-plugin-api = "0.2.0"
#
#
#
#
###### BEGIN AUTO-GENERATED PLUGIN DEPENDENCIES - DO NOT EDIT THIS SECTION ######
chronos_plugin = { path = "../plugins/chronos_plugin", version = "0.1.0" }
pebblevault_plugin = { path = "../plugins/pebblevault_plugin", version = "0.1.0" }
player_lib = { path = "../plugins/player_lib", version = "0.1.0" }
stars_beyond_plugin = { path = "../plugins/stars_beyond", version = "0.1.0" }
unreal_adapter = { path = "../plugins/unreal_adapter", version = "0.1.0" }
unreal_adapter_horizon = { path = "../plugins/unreal_adapter_horizon", version = "0.1.0" }
###### END AUTO-GENERATED PLUGIN DEPENDENCIES ######
14 changes: 8 additions & 6 deletions plugin_api/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -110,10 +110,9 @@ fn update_cargo_toml(plugin_paths: &[(String, String, String)]) -> std::io::Resu

// Find the boundaries of the auto-generated section
let start_idx = contents.find(AUTO_GENERATED_START);
let end_idx = contents.find(AUTO_GENERATED_END);

let base_contents = match (start_idx, end_idx) {
(Some(start), Some(end)) => {
let base_contents = match start_idx {
Some(start) => {
// If an existing section is found, take everything before it
contents[..start].trim_end().to_string()
}
Expand Down Expand Up @@ -174,14 +173,17 @@ fn generate_imports_file(plugin_paths: &[(String, String, String)], out_dir: &Pa
// Write the header
writeln!(file, "// This file is automatically generated by build.rs")?;
writeln!(file, "// Do not edit this file manually!\n")?;
writeln!(file, "use horizon_plugin_api::{{Pluginstate, LoadedPlugin, Plugin}};")?;
writeln!(file, "use std::collections::HashMap;\n")?;
for (i, (name, _, _)) in plugin_paths.iter().enumerate() {

for (_i, (name, _, _)) in plugin_paths.iter().enumerate() {
writeln!(file, "#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]")?;
write!(file, "pub use {};\n", name)?;
writeln!(file, "#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]")?;
write!(file, "pub use {}::*;\n", name)?;
writeln!(file, "#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]")?;
write!(file, "pub use {}::Plugin as {}_plugin;\n", name, name)?;
}
writeln!(file, "\n");
writeln!(file, "\n")?;


// Use the macro with discovered plugins
Expand Down
51 changes: 0 additions & 51 deletions plugin_api/src/components.rs

This file was deleted.

10 changes: 1 addition & 9 deletions plugin_api/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,16 +1,8 @@
use std::collections::HashMap;
pub use horizon_plugin_api::{Plugin, Pluginstate, Version, get_plugin, LoadedPlugin};
pub use horizon_plugin_api::{Plugin, Pluginstate, Version, get_plugin, get_type_from_plugin, LoadedPlugin};

pub mod plugin_macro;
pub mod plugin_imports;

// Define the current plugin version
const PLUGIN_API_VERSION: Version = Version {
major: 0,
minor: 1,
hotfix: 0
};

#[derive(Clone)]
pub struct PluginManager {
plugins: HashMap<String,(Pluginstate,Plugin)>
Expand Down
26 changes: 12 additions & 14 deletions plugin_api/src/plugin_imports.rs
Original file line number Diff line number Diff line change
@@ -1,34 +1,32 @@
// This file is automatically generated by build.rs
// Do not edit this file manually!

use horizon_plugin_api::{Pluginstate, LoadedPlugin, Plugin};
use std::collections::HashMap;

#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use chronos_plugin;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use chronos_plugin::*;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use chronos_plugin::Plugin as chronos_plugin_plugin;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use pebblevault_plugin;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use pebblevault_plugin::*;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use pebblevault_plugin::Plugin as pebblevault_plugin_plugin;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use player_lib;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use player_lib::*;
#[allow(ambiguous_glob_reexports, unused_imports, unused_variables)]
pub use player_lib::Plugin as player_lib_plugin;
pub use stars_beyond_plugin;
pub use stars_beyond_plugin::*;
pub use stars_beyond_plugin::Plugin as stars_beyond_plugin_plugin;
pub use unreal_adapter;
pub use unreal_adapter::*;
pub use unreal_adapter::Plugin as unreal_adapter_plugin;
pub use unreal_adapter_horizon;
pub use unreal_adapter_horizon::*;
pub use unreal_adapter_horizon::Plugin as unreal_adapter_horizon_plugin;


// Invoke the macro with all discovered plugins
pub fn load_plugins() -> HashMap<String, (Pluginstate, Plugin)> {
let plugins = crate::load_plugins!(
chronos_plugin,
player_lib,
stars_beyond_plugin,
unreal_adapter,
unreal_adapter_horizon
);
plugins
}
Empty file removed plugin_api/src/plugin_macro.rs
Empty file.
14 changes: 0 additions & 14 deletions plugins/_old/core/.gitignore

This file was deleted.

6 changes: 0 additions & 6 deletions plugins/_old/core/Cargo.toml

This file was deleted.

Loading

0 comments on commit 578983e

Please sign in to comment.