diff --git a/CHANGELOG.md b/CHANGELOG.md index 7360a54cf4..b23fd94358 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ The format of this Changelog is based on [Keep a Changelog](https://keepachangel and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased-`x.y.z`] - 2019-xx-xx +- You can now launch cloud deployments in China by specifying the `CN` region in the Deployment Launcher. +- Setup.bat and Setup.sh both accept --china which is required for running spatial commands the CN region. ## [`0.6.2`] - 2019-10-10 diff --git a/Setup.bat b/Setup.bat index d17758a503..6a36693695 100644 --- a/Setup.bat +++ b/Setup.bat @@ -57,7 +57,10 @@ call :MarkStartOfBlock "Setup variables" set SCHEMA_COPY_DIR=%~dp0..\..\..\spatial\schema\unreal\gdk set SCHEMA_STD_COPY_DIR=%~dp0..\..\..\spatial\build\dependencies\schema\standard_library set SPATIAL_DIR=%~dp0..\..\..\spatial - + set DOMAIN_ENVIRONMENT_VAR= + for %%A in (%*) do ( + if "%%A"=="--china" set DOMAIN_ENVIRONMENT_VAR=--domain spatialoschina.com --environment cn-production + ) call :MarkEndOfBlock "Setup variables" call :MarkStartOfBlock "Clean folders" @@ -86,15 +89,15 @@ call :MarkStartOfBlock "Create folders" call :MarkEndOfBlock "Create folders" call :MarkStartOfBlock "Retrieve dependencies" - spatial package retrieve tools schema_compiler-x86_64-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\tools\schema_compiler-x86_64-win32.zip" - spatial package retrieve schema standard_library %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\schema\standard_library.zip" - spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-msvc_md-win32.zip" - spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-msvc_md-win32.zip" - spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc_libstdcpp-linux.zip" - spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang_libcpp-ios.zip" - spatial package retrieve worker_sdk core-dynamic-x86_64-linux %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\core-dynamic-x86_64-linux.zip" - spatial package retrieve worker_sdk csharp %PINNED_CORE_SDK_VERSION% "%CORE_SDK_DIR%\worker_sdk\csharp.zip" - spatial package retrieve spot spot-win64 %PINNED_SPOT_VERSION% "%BINARIES_DIR%\Programs\spot.exe" + spatial package retrieve tools schema_compiler-x86_64-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\tools\schema_compiler-x86_64-win32.zip" + spatial package retrieve schema standard_library %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\schema\standard_library.zip" + spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86-msvc_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-msvc_md-win32.zip" + spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-dynamic-x86_64-gcc_libstdcpp-linux.zip" + spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\c-static-fullylinked-arm-clang_libcpp-ios.zip" + spatial package retrieve worker_sdk core-dynamic-x86_64-linux %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\core-dynamic-x86_64-linux.zip" + spatial package retrieve worker_sdk csharp %PINNED_CORE_SDK_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%CORE_SDK_DIR%\worker_sdk\csharp.zip" + spatial package retrieve spot spot-win64 %PINNED_SPOT_VERSION% %DOMAIN_ENVIRONMENT_VAR% "%BINARIES_DIR%\Programs\spot.exe" call :MarkEndOfBlock "Retrieve dependencies" call :MarkStartOfBlock "Unpack dependencies" diff --git a/Setup.sh b/Setup.sh index 46b30c4e9b..bd57b15e8f 100755 --- a/Setup.sh +++ b/Setup.sh @@ -67,6 +67,10 @@ markStartOfBlock "Setup variables" BINARIES_DIR="$(dirname "$0")/SpatialGDK/Binaries/ThirdParty/Improbable" SCHEMA_COPY_DIR="$(dirname "$0")/../../../spatial/schema/unreal/gdk" SCHEMA_STD_COPY_DIR="$(dirname "$0")/../../../spatial/build/dependencies/schema/standard_library" + DOMAIN_ENVIRONMENT_VAR= + if [[ "$*" == "--china" ]]; then + DOMAIN_ENVIRONMENT_VAR=--domain spatialoschina.com --environment cn-production + fi markEndOfBlock "Setup variables" markStartOfBlock "Clean folders" @@ -86,15 +90,15 @@ markStartOfBlock "Create folders" markEndOfBlock "Create folders" markStartOfBlock "Retrieve dependencies" - spatial package retrieve tools schema_compiler-x86_64-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/tools/schema_compiler-x86_64-win32.zip - spatial package retrieve schema standard_library $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/schema/standard_library.zip - spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86-msvc_md-win32.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-msvc_md-win32.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-gcc_libstdcpp-linux.zip - spatial package retrieve worker_sdk c-dynamic-x86_64-clang_libcpp-macos $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-clang_libcpp-macos.zip - spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/c-static-fullylinked-arm-clang_libcpp-ios.zip - spatial package retrieve worker_sdk core-dynamic-x86_64-linux $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/core-dynamic-x86_64-linux.zip - spatial package retrieve worker_sdk csharp $PINNED_CORE_SDK_VERSION $CORE_SDK_DIR/worker_sdk/csharp.zip + spatial package retrieve tools schema_compiler-x86_64-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/tools/schema_compiler-x86_64-win32.zip + spatial package retrieve schema standard_library $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/schema/standard_library.zip + spatial package retrieve worker_sdk c-dynamic-x86-msvc_md-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86-msvc_md-win32.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-msvc_md-win32 $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-msvc_md-win32.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-gcc_libstdcpp-linux $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-gcc_libstdcpp-linux.zip + spatial package retrieve worker_sdk c-dynamic-x86_64-clang_libcpp-macos $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-dynamic-x86_64-clang_libcpp-macos.zip + spatial package retrieve worker_sdk c-static-fullylinked-arm-clang_libcpp-ios $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/c-static-fullylinked-arm-clang_libcpp-ios.zip + spatial package retrieve worker_sdk core-dynamic-x86_64-linux $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/core-dynamic-x86_64-linux.zip + spatial package retrieve worker_sdk csharp $PINNED_CORE_SDK_VERSION $DOMAIN_ENVIRONMENT_VAR $CORE_SDK_DIR/worker_sdk/csharp.zip markEndOfBlock "Retrieve dependencies" markStartOfBlock "Unpack dependencies" diff --git a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs index d85ef32607..f187b931ff 100644 --- a/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs +++ b/SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/DeploymentLauncher/DeploymentLauncher.cs @@ -1,17 +1,18 @@ // Copyright (c) Improbable Worlds Ltd, All Rights Reserved -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net; -using System.Security.Cryptography; using Google.LongRunning; using Google.Protobuf.WellKnownTypes; using Improbable.SpatialOS.Deployment.V1Alpha1; +using Improbable.SpatialOS.Platform.Common; using Improbable.SpatialOS.PlayerAuth.V2Alpha1; using Improbable.SpatialOS.Snapshot.V1Alpha1; using Newtonsoft.Json.Linq; +using System.Collections.Generic; +using System.IO; +using System.Linq; +using System.Net; +using System.Security.Cryptography; +using System; namespace Improbable { @@ -22,6 +23,9 @@ internal class DeploymentLauncher private const string CoordinatorWorkerName = "SimulatedPlayerCoordinator"; + private const string CHINA_ENDPOINT_URL = "platform-cn-production.api.spatialoschina.com"; + private const int CHINA_ENDPOINT_PORT = 443; + private static string UploadSnapshot(SnapshotServiceClient client, string snapshotPath, string projectName, string deploymentName) { @@ -77,6 +81,15 @@ private static string UploadSnapshot(SnapshotServiceClient client, string snapsh return confirmUploadResponse.Snapshot.Id; } + + private static PlatformApiEndpoint GetApiEndpoint(string region) + { + if (region == "CN") + { + return new PlatformApiEndpoint(CHINA_ENDPOINT_URL, CHINA_ENDPOINT_PORT); + } + return null; // Use default + } private static int CreateDeployment(string[] args) { @@ -109,7 +122,7 @@ private static int CreateDeployment(string[] args) try { - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(mainDeploymentRegion)); if (DeploymentExists(deploymentServiceClient, projectName, mainDeploymentName)) { @@ -220,7 +233,7 @@ private static void StopDeploymentByName(DeploymentServiceClient deploymentServi private static Operation CreateMainDeploymentAsync(DeploymentServiceClient deploymentServiceClient, bool launchSimPlayerDeployment, string projectName, string assemblyName, string mainDeploymentName, string mainDeploymentJsonPath, string mainDeploymentSnapshotPath, string regionCode) { - var snapshotServiceClient = SnapshotServiceClient.Create(); + var snapshotServiceClient = SnapshotServiceClient.Create(GetApiEndpoint(regionCode)); // Upload snapshots. var mainSnapshotId = UploadSnapshot(snapshotServiceClient, mainDeploymentSnapshotPath, projectName, @@ -268,7 +281,7 @@ private static Operation CreateMainDeploym private static Operation CreateSimPlayerDeploymentAsync(DeploymentServiceClient deploymentServiceClient, string projectName, string assemblyName, string mainDeploymentName, string simDeploymentName, string simDeploymentJsonPath, string regionCode, int simNumPlayers) { - var playerAuthServiceClient = PlayerAuthServiceClient.Create(); + var playerAuthServiceClient = PlayerAuthServiceClient.Create(GetApiEndpoint(regionCode)); // Create development authentication token used by the simulated players. var dat = playerAuthServiceClient.CreateDevelopmentAuthenticationToken( @@ -356,8 +369,9 @@ private static Operation CreateSimPlayerDe private static int StopDeployments(string[] args) { var projectName = args[1]; + var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); if (args.Length == 3) { @@ -407,8 +421,9 @@ private static void StopDeploymentById(DeploymentServiceClient client, string pr private static int ListDeployments(string[] args) { var projectName = args[1]; + var regionCode = args[2]; - var deploymentServiceClient = DeploymentServiceClient.Create(); + var deploymentServiceClient = DeploymentServiceClient.Create(GetApiEndpoint(regionCode)); var activeDeployments = ListLaunchedActiveDeployments(deploymentServiceClient, projectName); foreach (var deployment in activeDeployments) @@ -462,11 +477,11 @@ private static void ShowUsage() { Console.WriteLine("Usage:"); Console.WriteLine("DeploymentLauncher create [ ]"); - Console.WriteLine($" Starts a cloud deployment, with optionally a simulated player deployment. The deployments can be started in different regions ('EU', 'US' and 'AP')."); - Console.WriteLine("DeploymentLauncher stop [deployment-id]"); + Console.WriteLine($" Starts a cloud deployment, with optionally a simulated player deployment. The deployments can be started in different regions ('EU', 'US', 'AP' and 'CN')."); + Console.WriteLine("DeploymentLauncher stop [deployment-id]"); Console.WriteLine(" Stops the specified deployment within the project."); Console.WriteLine(" If no deployment id argument is specified, all active deployments started by the deployment launcher in the project will be stopped."); - Console.WriteLine("DeploymentLauncher list "); + Console.WriteLine("DeploymentLauncher list "); Console.WriteLine(" Lists all active deployments within the specified project that are started by the deployment launcher."); } @@ -474,8 +489,8 @@ private static int Main(string[] args) { if (args.Length == 0 || args[0] == "create" && (args.Length != 11 && args.Length != 7) || - args[0] == "stop" && (args.Length != 2 && args.Length != 3) || - args[0] == "list" && args.Length != 2) + args[0] == "stop" && (args.Length != 3 && args.Length != 4) || + args[0] == "list" && args.Length != 3) { ShowUsage(); return 1; diff --git a/SpatialGDK/Extras/spot.version b/SpatialGDK/Extras/spot.version index 5729794af5..41e6f4ad6b 100644 --- a/SpatialGDK/Extras/spot.version +++ b/SpatialGDK/Extras/spot.version @@ -1 +1 @@ -20190626.145947.9ed060f1af \ No newline at end of file +20191029.144741.87a7d78768 \ No newline at end of file diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp index 87ab7fc1b6..c4c4433c24 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorCloudLauncher.cpp @@ -50,7 +50,10 @@ bool SpatialGDKCloudStop() const USpatialGDKEditorSettings* SpatialGDKSettings = GetDefault(); const FString CmdExecutable = TEXT("cmd.exe"); - const FString LauncherCmdArguments = TEXT("/c DeploymentLauncher.exe stop"); + const FString LauncherCmdArguments = FString::Printf( + TEXT("/c DeploymentLauncher.exe stop %s"), + *SpatialGDKSettings->GetPrimaryRegionCode().ToString() + ); FProcHandle DeploymentLauncherProcHandle = FPlatformProcess::CreateProc( *CmdExecutable, *LauncherCmdArguments, true, false, false, nullptr, 0, diff --git a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp index 53a7708456..47e45cf161 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp +++ b/SpatialGDK/Source/SpatialGDKEditor/Private/SpatialGDKEditorSettings.cpp @@ -26,6 +26,7 @@ USpatialGDKEditorSettings::USpatialGDKEditorSettings(const FObjectInitializer& O , PrimaryDeploymentRegionCode(ERegionCode::US) , SimulatedPlayerLaunchConfigPath(FSpatialGDKServicesModule::GetSpatialGDKPluginDirectory(TEXT("SpatialGDK/Build/Programs/Improbable.Unreal.Scripts/WorkerCoordinator/SpatialConfig/cloud_launch_sim_player_deployment.json"))) , SimulatedPlayerDeploymentRegionCode(ERegionCode::US) + , ServicesRegion(EServicesRegion::Default) { SpatialOSLaunchConfig.FilePath = GetSpatialOSLaunchConfig(); SpatialOSSnapshotFile = GetSpatialOSSnapshotFile(); diff --git a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h index 35de44d74e..91ced1bf26 100644 --- a/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h +++ b/SpatialGDK/Source/SpatialGDKEditor/Public/SpatialGDKEditorSettings.h @@ -207,6 +207,17 @@ namespace ERegionCode US = 1, EU, AP, + CN + }; +} + +UENUM() +namespace EServicesRegion +{ + enum Type + { + Default, + CN }; } @@ -297,7 +308,10 @@ class SPATIALGDKEDITOR_API USpatialGDKEditorSettings : public UObject UPROPERTY(EditAnywhere, config, Category = "Simulated Players", meta = (EditCondition = "bSimulatedPlayersIsEnabled", ConfigRestartRequired = false, DisplayName = "Number of simulated players")) uint32 NumberOfSimulatedPlayers; - + + UPROPERTY(EditAnywhere, Config, Category = "Region settings", meta = (ConfigRestartRequired = true, DisplayName = "Region where services are located")) + TEnumAsByte ServicesRegion; + static bool IsAssemblyNameValid(const FString& Name); static bool IsProjectNameValid(const FString& Name); static bool IsDeploymentNameValid(const FString& Name); @@ -452,4 +466,6 @@ class SPATIALGDKEDITOR_API USpatialGDKEditorSettings : public UObject } bool IsDeploymentConfigurationValid() const; + + FORCEINLINE bool IsRunningInChina() const { return ServicesRegion == EServicesRegion::CN; } }; diff --git a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp index d982ff5f42..7aad6273ee 100644 --- a/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp +++ b/SpatialGDK/Source/SpatialGDKEditorToolbar/Private/SpatialGDKEditorToolbar.cpp @@ -73,6 +73,7 @@ void FSpatialGDKEditorToolbarModule::StartupModule() FSpatialGDKServicesModule& GDKServices = FModuleManager::GetModuleChecked("SpatialGDKServices"); LocalDeploymentManager = GDKServices.GetLocalDeploymentManager(); LocalDeploymentManager->SetAutoDeploy(GetDefault()->bAutoStartLocalDeployment); + LocalDeploymentManager->SetInChina(GetDefault()->IsRunningInChina()); // Bind the play button delegate to starting a local spatial deployment. if (!UEditorEngine::TryStartSpatialDeployment.IsBound() && GetDefault()->bAutoStartLocalDeployment) diff --git a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp index 52b4d642f9..b78bedae90 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp +++ b/SpatialGDK/Source/SpatialGDKServices/Private/LocalDeploymentManager.cpp @@ -20,7 +20,20 @@ DEFINE_LOG_CATEGORY(LogSpatialDeploymentManager); static const FString SpatialExe(TEXT("spatial.exe")); -static const FString SpatialServiceVersion(TEXT("20190716.094149.1b6d448edd")); +static const FString SpatialServiceVersion(TEXT("20191128.003423.475a3c1edb")); + +namespace +{ + FString GetDomainEnvironmentStr(bool bIsInChina) + { + FString DomainEnvironmentStr; + if (bIsInChina) + { + DomainEnvironmentStr = TEXT("--domain=spatialoschina.com --environment=cn-production"); + } + return DomainEnvironmentStr; + } +} // anonymous namespace FLocalDeploymentManager::FLocalDeploymentManager() : bLocalDeploymentRunning(false) @@ -57,6 +70,11 @@ FLocalDeploymentManager::FLocalDeploymentManager() #endif } +void FLocalDeploymentManager::SetInChina(bool bChinaEnabled) +{ + bIsInChina = bChinaEnabled; +} + const FString FLocalDeploymentManager::GetSpotExe() { return FSpatialGDKServicesModule::GetSpatialGDKPluginDirectory(TEXT("SpatialGDK/Binaries/ThirdParty/Improbable/Programs/spot.exe")); @@ -122,7 +140,7 @@ void FLocalDeploymentManager::WorkerBuildConfigAsync() { AsyncTask(ENamedThreads::AnyBackgroundThreadNormalTask, [this] { - FString BuildConfigArgs = TEXT("worker build build-config"); + FString BuildConfigArgs = FString::Printf(TEXT("worker build build-config %s"), *GetDomainEnvironmentStr(bIsInChina)); FString WorkerBuildConfigResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, BuildConfigArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), WorkerBuildConfigResult, ExitCode); @@ -368,7 +386,7 @@ bool FLocalDeploymentManager::TryStartSpatialService() bStartingSpatialService = true; - FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s"), *SpatialServiceVersion); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service start --version=%s %s"), *SpatialServiceVersion, *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStartResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStartResult, ExitCode); @@ -400,7 +418,7 @@ bool FLocalDeploymentManager::TryStopSpatialService() { bStoppingSpatialService = true; - FString SpatialServiceStartArgs = TEXT("service stop"); + FString SpatialServiceStartArgs = FString::Printf(TEXT("service stop %s"), *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStopResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStartArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStopResult, ExitCode); @@ -490,7 +508,7 @@ bool FLocalDeploymentManager::GetLocalDeploymentStatus() bool FLocalDeploymentManager::GetServiceStatus() { - FString SpatialServiceStatusArgs = TEXT("service status"); + FString SpatialServiceStatusArgs = FString::Printf(TEXT("service status %s"), *GetDomainEnvironmentStr(bIsInChina)); FString ServiceStatusResult; int32 ExitCode; ExecuteAndReadOutput(SpatialExe, SpatialServiceStatusArgs, FSpatialGDKServicesModule::GetSpatialOSDirectory(), ServiceStatusResult, ExitCode); diff --git a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h index 936838b2da..96fb82cd90 100644 --- a/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h +++ b/SpatialGDK/Source/SpatialGDKServices/Public/LocalDeploymentManager.h @@ -17,6 +17,8 @@ class FLocalDeploymentManager public: FLocalDeploymentManager(); + void SPATIALGDKSERVICES_API SetInChina(bool IsInChina); + void SPATIALGDKSERVICES_API RefreshServiceStatus(); bool SPATIALGDKSERVICES_API TryStartLocalDeployment(FString LaunchConfig, FString LaunchArgs); @@ -83,4 +85,5 @@ class FLocalDeploymentManager bool bRedeployRequired = false; bool bAutoDeploy = false; + bool bIsInChina = false; };