diff --git a/tools/ci/src/main.rs b/tools/ci/src/main.rs index fd6c9ec4238..89507335753 100644 --- a/tools/ci/src/main.rs +++ b/tools/ci/src/main.rs @@ -300,6 +300,84 @@ fn tracked_rs_files_under(path: &str) -> Result> { .collect()) } +fn run_dlls() -> Result<()> { + ensure_repo_root()?; + + cmd!( + "dotnet", + "pack", + "crates/bindings-csharp/BSATN.Runtime", + "-c", + "Release" + ) + .run()?; + cmd!("dotnet", "pack", "crates/bindings-csharp/Runtime", "-c", "Release").run()?; + + let repo_root = env::current_dir()?; + let bsatn_source = repo_root.join("crates/bindings-csharp/BSATN.Runtime/bin/Release"); + let runtime_source = repo_root.join("crates/bindings-csharp/Runtime/bin/Release"); + + let nuget_config_dir = tempfile::tempdir()?; + let nuget_config_path = nuget_config_dir.path().join("nuget.config"); + let nuget_config_contents = format!( + r#" + + + + + + + + + + + + + + + + + + + + "#, + bsatn_source.display(), + runtime_source.display(), + ); + fs::write(&nuget_config_path, nuget_config_contents)?; + + let nuget_config_path_str = nuget_config_path.to_string_lossy().to_string(); + + clear_restored_package_dirs("spacetimedb.bsatn.runtime")?; + clear_restored_package_dirs("spacetimedb.runtime")?; + + cmd!( + "dotnet", + "restore", + "SpacetimeDB.ClientSDK.csproj", + "--configfile", + &nuget_config_path_str, + ) + .dir("sdks/csharp") + .run()?; + + overlay_unity_meta_skeleton("spacetimedb.bsatn.runtime")?; + overlay_unity_meta_skeleton("spacetimedb.runtime")?; + + cmd!( + "dotnet", + "pack", + "SpacetimeDB.ClientSDK.csproj", + "-c", + "Release", + "--no-restore" + ) + .dir("sdks/csharp") + .run()?; + + Ok(()) +} + fn main() -> Result<()> { env_logger::init(); @@ -463,79 +541,7 @@ fn main() -> Result<()> { } Some(CiCmd::Dlls) => { - ensure_repo_root()?; - - cmd!( - "dotnet", - "pack", - "crates/bindings-csharp/BSATN.Runtime", - "-c", - "Release" - ) - .run()?; - cmd!("dotnet", "pack", "crates/bindings-csharp/Runtime", "-c", "Release").run()?; - - let repo_root = env::current_dir()?; - let bsatn_source = repo_root.join("crates/bindings-csharp/BSATN.Runtime/bin/Release"); - let runtime_source = repo_root.join("crates/bindings-csharp/Runtime/bin/Release"); - - let nuget_config_dir = tempfile::tempdir()?; - let nuget_config_path = nuget_config_dir.path().join("nuget.config"); - let nuget_config_contents = format!( - r#" - - - - - - - - - - - - - - - - - - - - "#, - bsatn_source.display(), - runtime_source.display(), - ); - fs::write(&nuget_config_path, nuget_config_contents)?; - - let nuget_config_path_str = nuget_config_path.to_string_lossy().to_string(); - - clear_restored_package_dirs("spacetimedb.bsatn.runtime")?; - clear_restored_package_dirs("spacetimedb.runtime")?; - - cmd!( - "dotnet", - "restore", - "SpacetimeDB.ClientSDK.csproj", - "--configfile", - &nuget_config_path_str, - ) - .dir("sdks/csharp") - .run()?; - - overlay_unity_meta_skeleton("spacetimedb.bsatn.runtime")?; - overlay_unity_meta_skeleton("spacetimedb.runtime")?; - - cmd!( - "dotnet", - "pack", - "SpacetimeDB.ClientSDK.csproj", - "-c", - "Release", - "--no-restore" - ) - .dir("sdks/csharp") - .run()?; + run_dlls()?; } Some(CiCmd::Smoketests(args)) => {