Skip to content

Commit e847964

Browse files
Bump: skip local source-dep candidates for cross-family deps
When a consumer references the same logical product under multiple family versions (e.g. Metalama.Vsx 2026.1 references Metalama 2026.1 and Metalama 2026.0 with alias "Metalama20260"), both iterations resolved to the same local source-dep path because the candidate paths use only dependency.Name without a version qualifier. Whichever branch ..\Metalama happened to be on was used by both iterations, so the cross-family value was wrong. Fix: when dependency.ProductFamily.Version differs from the consumer's family version, skip the local candidates entirely and download from the dep's release branch via VcsRepository.TryDownloadTextFile. Same-family deps still prefer local checkouts. Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
1 parent e6424f7 commit e847964

1 file changed

Lines changed: 20 additions & 11 deletions

File tree

src/PostSharp.Engineering.BuildTools/Build/Files/AutoUpdatedVersionsFile.cs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -119,21 +119,30 @@ public static bool TryWrite(
119119
var errors = 0;
120120
string? inheritedMainVersion = null;
121121

122+
var consumerFamilyVersion = context.Product.DependencyDefinition.ProductFamily.Version;
123+
122124
foreach ( var dependencyConfiguration in autoUpdatedDependencies )
123125
{
124126
var dependency = dependencyConfiguration.Definition;
125127

126-
string[] filePathCandidates =
127-
[
128-
Path.GetFullPath(
129-
Path.Combine(
130-
context.RepoDirectory,
131-
context.Product.SourceDependenciesDirectory,
132-
dependency.Name,
133-
dependency.EngineeringDirectory,
134-
FileName ) ),
135-
Path.GetFullPath( Path.Combine( context.RepoDirectory, "..", dependency.Name, dependency.EngineeringDirectory, FileName ) )
136-
];
128+
// Local source-dep paths use only dependency.Name (no version qualifier), so two references to the same
129+
// logical product under different family versions — e.g. Metalama 2026.1 and Metalama 2026.0 (aliased) on
130+
// Vsx 2026.1 — would resolve to the same local checkout, and both iterations would read whichever branch
131+
// it happens to be on. For cross-family deps, skip local candidates and always download from the dep's
132+
// own release branch on GitHub.
133+
string[] filePathCandidates = dependency.ProductFamily.Version == consumerFamilyVersion
134+
?
135+
[
136+
Path.GetFullPath(
137+
Path.Combine(
138+
context.RepoDirectory,
139+
context.Product.SourceDependenciesDirectory,
140+
dependency.Name,
141+
dependency.EngineeringDirectory,
142+
FileName ) ),
143+
Path.GetFullPath( Path.Combine( context.RepoDirectory, "..", dependency.Name, dependency.EngineeringDirectory, FileName ) )
144+
]
145+
: [];
137146

138147
var theirAutoUpdatedVersionsFilePath = filePathCandidates.FirstOrDefault( File.Exists );
139148

0 commit comments

Comments
 (0)