internal override void ExecuteInternal(IBuildConfiguration config)
        {
            if (!string.IsNullOrEmpty(JsonSecretsFilePath) && File.Exists(JsonSecretsFilePath) && File.GetAttributes(JsonSecretsFilePath).HasFlag(FileAttributes.Normal))
            {
                return;
            }

            if (config.GetSecretsConfig().Disable || config.BuildingInsideVisualStudio)
            {
                return;
            }

            var secretsFile = Path.Combine(ProjectDirectory, "secrets.json");

            if (File.Exists(secretsFile))
            {
                Log.LogMessage("A secrets file already exists. Please delete the file to regenerate the secrets");
                return;
            }

            Log.LogMessage($"Output Path: {secretsFile}");
            IGenerator generator = new BuildHostSecretsGenerator(this)
            {
                SecretsJsonFilePath = secretsFile,
            };

            generator.Execute();
        }
示例#2
0
        internal override void ExecuteInternal(IBuildConfiguration config)
        {
            if (config.GetSecretsConfig().Disable)
            {
                return;
            }

            var configJson = string.Format(Constants.SecretsJsonConfigurationFileFormat, config.BuildConfiguration.ToLower());

            var generator = new SecretsClassGenerator(config,
                                                      Path.Combine(SolutionDirectory, Constants.SecretsJsonFileName),
                                                      Path.Combine(SolutionDirectory, configJson),
                                                      Path.Combine(ProjectDirectory, Constants.SecretsJsonFileName),
                                                      Path.Combine(ProjectDirectory, configJson),
                                                      JsonSecretsFilePath)
            {
                BaseNamespace = RootNamespace,
            };

            generator.Execute();
            _generatedCodeFiles = new[] { generator.Outputs };
        }