/// <summary> /// Verify that the Cloud SDK is installed and at the right version. Optionally also verify that the given /// component is installed. /// </summary> /// <param name="component">The component to check, optional.</param> /// <returns>True if the Cloud SDK installation is valid.</returns> public static async Task <bool> VerifyGCloudDependencies(GCloudComponent component = GCloudComponent.None) { var result = await GCloudWrapper.ValidateGCloudAsync(component); if (result.IsValid) { return(true); } if (!result.IsCloudSdkInstalled) { LinkPromptDialogWindow.PromptUser( Resources.GcloudMissingGcloudErrorTitle, Resources.GcloudMissingCloudSdkErrorMessage, new LinkInfo(link: "https://cloud.google.com/sdk/", caption: Resources.GcloudInstallLinkCaption)); } else if (!result.IsCloudSdkUpdated) { UserPromptUtils.ErrorPrompt( message: String.Format( Resources.GCloudWrapperUtilsOldCloudSdkMessage, result.CloudSdkVersion, GCloudWrapper.GCloudSdkMinimumVersion), title: Resources.GCloudWrapperUtilsOldCloudSdkTitle); } else { UserPromptUtils.ErrorPrompt( message: String.Format(Resources.GcloudMissingComponentErrorMessage, component), title: Resources.GcloudMissingComponentTitle); } return(false); }
/// <summary> /// This method stages the application into the <paramref name="stageDirectory"/> by invoking the WebPublish target /// present in all Web projects. It publishes to the staging directory by using the FileSystem method. /// </summary> private static async Task <bool> CreateAppBundleAsync( IParsedProject project, string stageDirectory, IToolsPathProvider toolsPathProvider, Action <string> outputAction) { var arguments = $@"""{project.FullPath}""" + " " + "/p:Configuration=Release " + "/p:Platform=AnyCPU " + "/t:WebPublish " + "/p:WebPublishMethod=FileSystem " + "/p:DeleteExistingFiles=True " + $@"/p:publishUrl=""{stageDirectory}"""; outputAction($"msbuild.exe {arguments}"); bool result = await ProcessUtils.RunCommandAsync(toolsPathProvider.GetMsbuildPath(), arguments, (o, e) => outputAction(e.Line)); // We perform this check here because it is not required to have gcloud installed in order to deploy // ASP.NET 4.x apps to GCE VMs. Therefore nothing would have checked for the presence of gcloud before // getting here. var gcloudValidation = await GCloudWrapper.ValidateGCloudAsync(); Debug.WriteLineIf(!gcloudValidation.IsValid, "Skipping creating context, gcloud is not installed."); if (gcloudValidation.IsValid) { await GCloudWrapper.GenerateSourceContext(project.DirectoryPath, stageDirectory); } return(result); }