Beispiel #1
0
        /// <summary>
        /// This method deserializes the deployment-manifest file and returns a list of absolute paths of directories at which different CDK
        /// deployment projects are stored. The custom recipe snapshots are stored in this directory.
        /// <param name="targetApplicationFullPath">The absolute path to the target application csproj or fsproj file</param>
        /// </summary>
        /// <returns> A list containing absolute directory paths for CDK deployment projects.</returns>
        public async Task <List <string> > GetRecipeDefinitionPaths(string targetApplicationFullPath)
        {
            var recipeDefinitionPaths          = new List <string>();
            var deploymentManifestFilePath     = GetDeploymentManifestFilePath(targetApplicationFullPath);
            var targetApplicationDirectoryPath = _directoryManager.GetDirectoryInfo(targetApplicationFullPath).Parent.FullName;

            if (_fileManager.Exists(deploymentManifestFilePath))
            {
                var deploymentManifestModel = await ReadManifestFile(deploymentManifestFilePath);

                if (deploymentManifestModel.DeploymentProjects == null)
                {
                    return(recipeDefinitionPaths);
                }
                foreach (var entry in deploymentManifestModel.DeploymentProjects)
                {
                    var saveCdkDirectoryRelativePath = entry.SaveCdkDirectoryRelativePath;
                    if (string.IsNullOrEmpty(saveCdkDirectoryRelativePath))
                    {
                        continue;
                    }

                    var saveCdkDirectoryAbsolutePath = _directoryManager.GetAbsolutePath(targetApplicationDirectoryPath, saveCdkDirectoryRelativePath);

                    if (_directoryManager.Exists(saveCdkDirectoryAbsolutePath))
                    {
                        recipeDefinitionPaths.Add(saveCdkDirectoryAbsolutePath);
                    }
                }
            }

            return(recipeDefinitionPaths);
        }