Skip to content
This repository was archived by the owner on Sep 9, 2020. It is now read-only.

Commit a8a1a5f

Browse files
committed
solver: ValidateParams skip alt src PR validation
This change modifies the ValidateParams() function ignore deducing project root of projects that have an alternate source. This is needed when the project repository is not reachable and an alternate repo is used.
1 parent a876439 commit a8a1a5f

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

gps/solver.go

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,17 @@ func (e DeductionErrs) Error() string {
399399

400400
// ValidateParams validates the solver parameters to ensure solving can be completed.
401401
func ValidateParams(params SolveParameters, sm SourceManager) error {
402+
// Create a list of projects to skip project root deduction. This is
403+
// required for projects with an alternate source.
404+
altSrc := make(map[string]bool)
405+
if params.Manifest != nil {
406+
for proj, prop := range params.Manifest.DependencyConstraints() {
407+
if prop.Source != "" {
408+
altSrc[string(proj)] = true
409+
}
410+
}
411+
}
412+
402413
// Ensure that all packages are deducible without issues.
403414
var deducePkgsGroup sync.WaitGroup
404415
deductionErrs := make(DeductionErrs)
@@ -420,6 +431,10 @@ func ValidateParams(params SolveParameters, sm SourceManager) error {
420431
}
421432

422433
for _, ip := range rd.externalImportList(paths.IsStandardImportPath) {
434+
if altSrc[ip] {
435+
// Skip project root deduction for project with alternate source.
436+
continue
437+
}
423438
deducePkgsGroup.Add(1)
424439
go deducePkg(ip, sm)
425440
}

0 commit comments

Comments
 (0)