mirror of
https://github.com/clockworklabs/SpacetimeDB.git
synced 2026-05-06 07:26:43 -04:00
CI - Move the DLL updating code into a function (#4868)
# Description of Changes Just moving code into functions so it can be reused, no functional changes. # API and ABI breaking changes None. CI only. # Expected complexity level and risk 1 # Testing None --------- Co-authored-by: Zeke Foppa <bfops@users.noreply.github.com>
This commit is contained in:
+79
-73
@@ -300,6 +300,84 @@ fn tracked_rs_files_under(path: &str) -> Result<Vec<PathBuf>> {
|
||||
.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#"<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="Local SpacetimeDB.BSATN.Runtime" value="{}" />
|
||||
<add key="Local SpacetimeDB.Runtime" value="{}" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceMapping>
|
||||
<packageSource key="Local SpacetimeDB.BSATN.Runtime">
|
||||
<package pattern="SpacetimeDB.BSATN.Runtime" />
|
||||
</packageSource>
|
||||
<packageSource key="Local SpacetimeDB.Runtime">
|
||||
<package pattern="SpacetimeDB.Runtime" />
|
||||
</packageSource>
|
||||
<packageSource key="nuget.org">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
</configuration>
|
||||
"#,
|
||||
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#"<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<packageSources>
|
||||
<clear />
|
||||
<add key="Local SpacetimeDB.BSATN.Runtime" value="{}" />
|
||||
<add key="Local SpacetimeDB.Runtime" value="{}" />
|
||||
<add key="nuget.org" value="https://api.nuget.org/v3/index.json" />
|
||||
</packageSources>
|
||||
<packageSourceMapping>
|
||||
<packageSource key="Local SpacetimeDB.BSATN.Runtime">
|
||||
<package pattern="SpacetimeDB.BSATN.Runtime" />
|
||||
</packageSource>
|
||||
<packageSource key="Local SpacetimeDB.Runtime">
|
||||
<package pattern="SpacetimeDB.Runtime" />
|
||||
</packageSource>
|
||||
<packageSource key="nuget.org">
|
||||
<package pattern="*" />
|
||||
</packageSource>
|
||||
</packageSourceMapping>
|
||||
</configuration>
|
||||
"#,
|
||||
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)) => {
|
||||
|
||||
Reference in New Issue
Block a user