private static void NormalizeArgs(ProjectBuildArgs args, TemplateInfo templateInfo) { if (args.TemplateName.IsNullOrEmpty()) { args.TemplateName = templateInfo.Name; } }
public async Task <ProjectBuildResult> BuildAsync(ProjectBuildArgs args) { var moduleInfo = await GetModuleInfoAsync(args); var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Module, args.Version ); var context = new ProjectBuildContext( null, moduleInfo, templateFile, args ); ModuleProjectBuildPipelineBuilder.Build(context).Execute(); if (!moduleInfo.DocumentUrl.IsNullOrEmpty()) { Logger.LogInformation("Check out the documents at " + moduleInfo.DocumentUrl); } // Exclude unwanted or known options. var options = args.ExtraProperties .Where(x => !x.Key.Equals(CliConsts.Command, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.OutputFolder.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase)) .Select(x => x.Key).ToList(); return(new ProjectBuildResult(context.Result.ZipContent, args.TemplateName)); }
public async Task <ProjectBuildResult> BuildAsync(ProjectBuildArgs args) { var templateInfo = GetTemplateInfo(); NormalizeArgs(args, templateInfo); var templateFile = await SourceCodeStore.GetAsync( args.TemplateName, SourceCodeTypes.Template, args.Version ); // 项目构建上下文 var context = new ProjectBuildContext( templateInfo, null, templateFile, args ); TemplateProjectBuildPipelineBuilder.Build(context).Execute(); if (!templateInfo.DocumentUrl.IsNullOrEmpty()) { Logger.LogInformation("Check out the documents at " + templateInfo.DocumentUrl); } // Exclude unwanted or known options. var options = args.ExtraProperties .Where(x => !x.Key.Equals(CliConsts.Command, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals("tiered", StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.DatabaseProvider.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.DatabaseProvider.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.OutputFolder.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.OutputFolder.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.UiFramework.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.UiFramework.Short, StringComparison.InvariantCultureIgnoreCase)) .Where(x => !x.Key.Equals(NewCommand.Options.Version.Long, StringComparison.InvariantCultureIgnoreCase) && !x.Key.Equals(NewCommand.Options.Version.Short, StringComparison.InvariantCultureIgnoreCase)) .Select(x => x.Key).ToList(); return(new ProjectBuildResult(context.Result.ZipContent, args.SolutionName.ProjectName)); }
private async Task <ModuleInfo> GetModuleInfoAsync(ProjectBuildArgs args) { return(await ModuleInfoProvider.GetAsync(args.TemplateName)); }