Skip to content

Commit

Permalink
Don't binplace for upload any "Vertical" visibility assets. They shou…
Browse files Browse the repository at this point in the history
…ldn't be uploaded from jobs and they won't be in the asset manifest anyway.
  • Loading branch information
jkoritzinsky committed Dec 18, 2024
1 parent 4b84ab1 commit f68a748
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ public sealed class GetKnownArtifactsFromAssetManifests : Build.Utilities.Task
private const string RepoOriginAttributeName = "RepoOrigin";
private const string NonShippingAttributeName = "NonShipping";
private const string DotNetReleaseShippingAttributeName = "DotNetReleaseShipping";
private const string VisibilityAttributeName = "Visibility";
private const string DefaultVisibility = "External";

// Package metadata
private const string PackageElementName = "Package";
Expand Down Expand Up @@ -69,7 +71,8 @@ public override bool Execute()
{ PackageVersionAttributeName, package.Attribute(PackageVersionAttributeName)!.Value },
{ RepoOriginAttributeName, package.Attribute(RepoOriginAttributeName)?.Value ?? string.Empty },
{ NonShippingAttributeName, package.Attribute(NonShippingAttributeName)?.Value ?? string.Empty },
{ DotNetReleaseShippingAttributeName, package.Attribute(DotNetReleaseShippingAttributeName)?.Value ?? string.Empty }
{ DotNetReleaseShippingAttributeName, package.Attribute(DotNetReleaseShippingAttributeName)?.Value ?? string.Empty },
{ VisibilityAttributeName, package.Attribute(VisibilityAttributeName)?.Value ?? DefaultVisibility },
}))
.Distinct(TaskItemManifestEqualityComparer.Instance)
.ToArray();
Expand All @@ -81,7 +84,8 @@ public override bool Execute()
{
{ RepoOriginAttributeName, blob.Attribute(RepoOriginAttributeName)?.Value ?? string.Empty },
{ NonShippingAttributeName, blob.Attribute(NonShippingAttributeName)?.Value ?? string.Empty },
{ DotNetReleaseShippingAttributeName, blob.Attribute(DotNetReleaseShippingAttributeName)?.Value ?? string.Empty }
{ DotNetReleaseShippingAttributeName, blob.Attribute(DotNetReleaseShippingAttributeName)?.Value ?? string.Empty },
{ VisibilityAttributeName, blob.Attribute(VisibilityAttributeName)?.Value ?? DefaultVisibility },
}))
.Distinct(TaskItemManifestEqualityComparer.Instance)
.ToArray();
Expand Down Expand Up @@ -110,4 +114,4 @@ public bool Equals(TaskItem? x, TaskItem? y)

public int GetHashCode([DisallowNull] TaskItem obj) => HashCode.Combine(obj.ItemSpec, obj.GetMetadata(PackageVersionAttributeName));
}
}
}
10 changes: 7 additions & 3 deletions src/SourceBuild/content/repo-projects/Directory.Build.targets
Original file line number Diff line number Diff line change
Expand Up @@ -554,9 +554,13 @@
<ShippingFolder Condition="%(ProducedPackage.NonShipping) != 'true'">Shipping</ShippingFolder>
</ProducedPackage>

<!-- When building from source, the Private.SourceBuilt.Artifacts archive already contains the nuget packages. -->
<BinPlaceFile Include="@(ProducedPackage->'$(ArtifactsPackagesDir)%(ShippingFolder)/$(RepositoryName)/%(Identity).%(Version).nupkg')" Condition="'$(DotNetBuildSourceOnly)' != 'true'" />
<BinPlaceFile Include="@(ProducedAsset->'$(ArtifactsAssetsDir)%(Identity)')" />
<!--
When building from source, the Private.SourceBuilt.Artifacts archive already contains the nuget packages.
Don't binplace any packages or blobs with vertical visibility. These are only used for building other repos within this vertical
and shouldn't be staged for upload.
-->
<BinPlaceFile Include="@(ProducedPackage->'$(ArtifactsPackagesDir)%(ShippingFolder)/$(RepositoryName)/%(Identity).%(Version).nupkg')" Condition="'$(DotNetBuildSourceOnly)' != 'true' and '%(Visibility)' != 'Vertical'" />
<BinPlaceFile Include="@(ProducedAsset->'$(ArtifactsAssetsDir)%(Identity)')" Condition="'%(Visibility)' != 'Vertical'"/>
</ItemGroup>

<!-- Add manifests from dependent verticals. -->
Expand Down

0 comments on commit f68a748

Please sign in to comment.