| OLD | NEW |
| 1 // Copyright 2017 The LUCI Authors. All rights reserved. | 1 // Copyright 2017 The LUCI Authors. All rights reserved. |
| 2 // Use of this source code is governed under the Apache License, Version 2.0 | 2 // Use of this source code is governed under the Apache License, Version 2.0 |
| 3 // that can be found in the LICENSE file. | 3 // that can be found in the LICENSE file. |
| 4 | 4 |
| 5 package application | 5 package application |
| 6 | 6 |
| 7 import ( | 7 import ( |
| 8 "strings" | 8 "strings" |
| 9 | 9 |
| 10 "github.com/maruel/subcommands" | 10 "github.com/maruel/subcommands" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 // normalize a clone. | 55 // normalize a clone. |
| 56 if err := spec.NormalizeSpec(s.Clone(), nil); err != nil { | 56 if err := spec.NormalizeSpec(s.Clone(), nil); err != nil { |
| 57 return errors.Annotate(err).Reason("failed to normalize
specification").Err() | 57 return errors.Annotate(err).Reason("failed to normalize
specification").Err() |
| 58 } | 58 } |
| 59 | 59 |
| 60 renderedSpec := spec.Render(s) | 60 renderedSpec := spec.Render(s) |
| 61 logging.Infof(c, "Successfully verified specification:\n%s", ren
deredSpec) | 61 logging.Infof(c, "Successfully verified specification:\n%s", ren
deredSpec) |
| 62 | 62 |
| 63 // Run our Verification generator and verify each generated envi
ronment. | 63 // Run our Verification generator and verify each generated envi
ronment. |
| 64 if a.WithVerificationConfig != nil { | 64 if a.WithVerificationConfig != nil { |
| 65 » » » err := a.WithVerificationConfig(c, func(cfg Config, veri
ficationScenarios []*vpython.Pep425Tag) error { | 65 » » » err := a.WithVerificationConfig(c, func(cfg Config, veri
ficationScenarios []*vpython.PEP425Tag) error { |
| 66 if len(s.VerifyPep425Tag) > 0 { | 66 if len(s.VerifyPep425Tag) > 0 { |
| 67 verificationScenarios = s.VerifyPep425Ta
g | 67 verificationScenarios = s.VerifyPep425Ta
g |
| 68 } | 68 } |
| 69 if len(verificationScenarios) == 0 { | 69 if len(verificationScenarios) == 0 { |
| 70 return nil | 70 return nil |
| 71 } | 71 } |
| 72 | 72 |
| 73 var failures []string | 73 var failures []string |
| 74 for _, vs := range verificationScenarios { | 74 for _, vs := range verificationScenarios { |
| 75 // Create a verification environment to
pass to our package loader. | 75 // Create a verification environment to
pass to our package loader. |
| 76 e := vpython.Environment{ | 76 e := vpython.Environment{ |
| 77 Spec: s.Clone(), | 77 Spec: s.Clone(), |
| 78 » » » » » » Pep425Tag: []*vpython.Pep425Tag{
vs}, | 78 » » » » » » Pep425Tag: []*vpython.PEP425Tag{
vs}, |
| 79 } | 79 } |
| 80 if err := spec.NormalizeEnvironment(&e);
err != nil { | 80 if err := spec.NormalizeEnvironment(&e);
err != nil { |
| 81 logging.Errorf(c, "Failed to nor
malize environment against %q: %s", vs.TagString(), err) | 81 logging.Errorf(c, "Failed to nor
malize environment against %q: %s", vs.TagString(), err) |
| 82 failures = append(failures, vs.T
agString()) | 82 failures = append(failures, vs.T
agString()) |
| 83 continue | 83 continue |
| 84 } | 84 } |
| 85 | 85 |
| 86 if err := cfg.PackageLoader.Resolve(c, &
e); err != nil { | 86 if err := cfg.PackageLoader.Resolve(c, &
e); err != nil { |
| 87 logging.Errorf(c, "Failed to res
olve against %q: %s", vs.TagString(), err) | 87 logging.Errorf(c, "Failed to res
olve against %q: %s", vs.TagString(), err) |
| 88 failures = append(failures, vs.T
agString()) | 88 failures = append(failures, vs.T
agString()) |
| (...skipping 10 matching lines...) Expand all Loading... |
| 99 return nil | 99 return nil |
| 100 }) | 100 }) |
| 101 if err != nil { | 101 if err != nil { |
| 102 return err | 102 return err |
| 103 } | 103 } |
| 104 } | 104 } |
| 105 | 105 |
| 106 return nil | 106 return nil |
| 107 }) | 107 }) |
| 108 } | 108 } |
| OLD | NEW |