(params packagePackParams, debug bool, logger log.Logger)
| 80 | } |
| 81 | |
| 82 | func (c PackagePackCommand) execute(params packagePackParams, debug bool, logger log.Logger) (*packagePackResult, error) { |
| 83 | projectReader := studio.NewStudioProjectReader(params.Source) |
| 84 | project, err := projectReader.ReadMetadata() |
| 85 | if err != nil { |
| 86 | return nil, err |
| 87 | } |
| 88 | supported, err := project.TargetFramework.IsSupported() |
| 89 | if !supported { |
| 90 | return nil, err |
| 91 | } |
| 92 | _ = projectReader.AddToIgnoredFiles(project.NupkgIgnoreFilePattern()) |
| 93 | |
| 94 | uipcli := studio.NewUipcli(c.Exec, logger) |
| 95 | err = uipcli.Initialize(project.TargetFramework) |
| 96 | if err != nil { |
| 97 | return nil, err |
| 98 | } |
| 99 | |
| 100 | if !debug { |
| 101 | bar := c.newPackagingProgressBar(logger) |
| 102 | defer close(bar) |
| 103 | } |
| 104 | args := c.preparePackArguments(params) |
| 105 | exitCode, stdErr, err := uipcli.ExecuteAndWait(args...) |
| 106 | if err != nil { |
| 107 | return nil, err |
| 108 | } |
| 109 | |
| 110 | var result *packagePackResult |
| 111 | if exitCode == 0 { |
| 112 | nupkgPath := studio.FindLatestNupkg(params.Destination) |
| 113 | nupkgReader := studio.NewNupkgReader(nupkgPath) |
| 114 | nuspec, err := nupkgReader.ReadNuspec() |
| 115 | if err != nil { |
| 116 | return nil, err |
| 117 | } |
| 118 | result = newSucceededPackagePackResult( |
| 119 | nupkgPath, |
| 120 | project.Name, |
| 121 | project.Description, |
| 122 | project.ProjectId, |
| 123 | nuspec.Version) |
| 124 | } else { |
| 125 | result = newFailedPackagePackResult( |
| 126 | stdErr, |
| 127 | &project.Name, |
| 128 | &project.Description, |
| 129 | &project.ProjectId) |
| 130 | } |
| 131 | return result, nil |
| 132 | } |
| 133 | |
| 134 | func (c PackagePackCommand) preparePackArguments(params packagePackParams) []string { |
| 135 | args := []string{"package", "pack", params.Source, "--output", params.Destination} |
no test coverage detected