public static WrappedTask <RedirectedProcessResult, AssemblyConfig> UploadAsync(AssemblyConfig config) { var source = new CancellationTokenSource(); var token = source.Token; var args = new List <string> { config.AssemblyName, "--project_name", config.ProjectName, "--json_output", "--enable_pre_upload_check=false", }; if (config.ShouldForceUpload) { args.Add("--force"); } var task = Task.Run(async() => await RedirectedProcess .Spatial("cloud", "upload") .InDirectory(Tools.Common.SpatialProjectRootDir) .WithArgs(args.ToArray()) .RedirectOutputOptions(OutputRedirectBehaviour.RedirectStdOut | OutputRedirectBehaviour.RedirectStdErr | OutputRedirectBehaviour.ProcessSpatialOutput) .RunAsync(token)); return(new WrappedTask <RedirectedProcessResult, AssemblyConfig> { Task = task, CancelSource = source, Context = config.DeepCopy() }); }
private AssemblyConfig DrawAssemblyConfig(AssemblyConfig config) { GUILayout.Label("Assembly Upload", EditorStyles.boldLabel); var copy = config.DeepCopy(); var error = config.GetError(); using (new EditorGUILayout.VerticalScope()) { using (new EditorGUILayout.HorizontalScope()) { copy.AssemblyName = EditorGUILayout.TextField("Assembly Name", config.AssemblyName); if (GUILayout.Button("Generate", GUILayout.ExpandWidth(false))) { copy.AssemblyName = $"{projectName}_{DateTime.Now:MMdd_HHmm}"; GUI.FocusControl(null); } } copy.ShouldForceUpload = EditorGUILayout.Toggle("Force Upload", config.ShouldForceUpload); GUILayout.Space(EditorGUIUtility.standardVerticalSpacing); using (new EditorGUILayout.HorizontalScope()) { var shouldBeVertical = EditorGUIUtility.currentViewWidth < 550; /* Responsive Layout, Intuitive API! */ if (shouldBeVertical) { EditorGUILayout.BeginVertical(); } else { GUILayout.FlexibleSpace(); } using (new EditorGUI.DisabledScope(error != null)) { if (GUILayout.Button("Assign assembly name to deployments")) { foreach (var deplConfig in launcherConfig.DeploymentConfigs) { deplConfig.AssemblyName = launcherConfig.AssemblyConfig.AssemblyName; } } using (new EditorGUI.DisabledScope(manager.IsActive)) { if (GUILayout.Button("Upload assembly")) { manager.Upload(config); } } } if (shouldBeVertical) { EditorGUILayout.EndVertical(); } } if (error != null) { EditorGUILayout.HelpBox(error, MessageType.Error); } } CommonUIElements.DrawHorizontalLine(3, style.HorizontalLineColor); return(copy); }