@@ -102,6 +102,9 @@ public class PushToBuildStorage : MSBuildTaskBase
102
102
/// </summary>
103
103
public bool PreserveRepoOrigin { get ; set ; }
104
104
105
+ /// <summary>
106
+ /// The visibility of the artifacts to put in the manifest.
107
+ /// </summary>
105
108
public ITaskItem [ ] ArtifactVisibilitiesToPublish { get ; set ; }
106
109
107
110
/// <summary>
@@ -116,6 +119,8 @@ public class PushToBuildStorage : MSBuildTaskBase
116
119
/// </summary>
117
120
public bool UseHardlinksIfPossible { get ; set ; } = true ;
118
121
122
+ public bool PublishManifestOnly { get ; set ; } = false ;
123
+
119
124
public override void ConfigureServices ( IServiceCollection collection )
120
125
{
121
126
collection . TryAddSingleton < IBlobArtifactModelFactory , BlobArtifactModelFactory > ( ) ;
@@ -138,12 +143,19 @@ public bool ExecuteTask(IFileSystem fileSystem,
138
143
{
139
144
if ( PushToLocalStorage )
140
145
{
141
- if ( string . IsNullOrEmpty ( AssetsLocalStorageDir ) ||
142
- string . IsNullOrEmpty ( ShippingPackagesLocalStorageDir ) ||
143
- string . IsNullOrEmpty ( NonShippingPackagesLocalStorageDir ) ||
144
- string . IsNullOrEmpty ( AssetManifestsLocalStorageDir ) )
146
+ if ( ! PublishManifestOnly )
147
+ {
148
+ if ( string . IsNullOrEmpty ( AssetsLocalStorageDir ) ||
149
+ string . IsNullOrEmpty ( ShippingPackagesLocalStorageDir ) ||
150
+ string . IsNullOrEmpty ( NonShippingPackagesLocalStorageDir ) ||
151
+ string . IsNullOrEmpty ( PdbArtifactsLocalStorageDir ) )
152
+ {
153
+ throw new Exception ( $ "AssetsLocalStorageDir, ShippingPackagesLocalStorageDir, NonShippingPackagesLocalStorageDir and PdbArtifactsLocalStorageDir need to be specified if PublishToLocalStorage is set to true") ;
154
+ }
155
+ }
156
+ if ( string . IsNullOrEmpty ( AssetManifestsLocalStorageDir ) )
145
157
{
146
- throw new Exception ( $ "AssetsLocalStorageDir, ShippingPackagesLocalStorageDir, NonShippingPackagesLocalStorageDir and AssetManifestsLocalStorageDir need to be specified if PublishToLocalStorage is set to true") ;
158
+ throw new Exception ( $ "AssetManifestsLocalStorageDir needs to be specified if PublishToLocalStorage is set to true") ;
147
159
}
148
160
149
161
Log . LogMessage ( MessageImportance . High , "Performing push to local artifacts storage." ) ;
@@ -195,43 +207,46 @@ public bool ExecuteTask(IFileSystem fileSystem,
195
207
throw new Exception ( $ "PdbArtifactsLocalStorageDir must be specified.") ;
196
208
}
197
209
198
- foreach ( var package in buildModel . Artifacts . Packages )
210
+ if ( ! PublishManifestOnly )
199
211
{
200
- if ( ! fileSystem . FileExists ( package . OriginalFile ) )
212
+ foreach ( var package in buildModel . Artifacts . Packages )
201
213
{
202
- Log . LogError ( $ "Could not find file { package . OriginalFile } .") ;
203
- continue ;
204
- }
214
+ if ( ! fileSystem . FileExists ( package . OriginalFile ) )
215
+ {
216
+ Log . LogError ( $ "Could not find file { package . OriginalFile } .") ;
217
+ continue ;
218
+ }
205
219
206
- PushToLocalStorageOrAzDO ( package ) ;
207
- }
220
+ PushToLocalStorageOrAzDO ( package ) ;
221
+ }
208
222
209
- foreach ( var blobArtifact in buildModel . Artifacts . Blobs )
210
- {
211
- if ( ! fileSystem . FileExists ( blobArtifact . OriginalFile ) )
223
+ foreach ( var blobArtifact in buildModel . Artifacts . Blobs )
212
224
{
213
- Log . LogError ( $ "Could not find file { blobArtifact . OriginalFile } .") ;
214
- continue ;
215
- }
225
+ if ( ! fileSystem . FileExists ( blobArtifact . OriginalFile ) )
226
+ {
227
+ Log . LogError ( $ "Could not find file { blobArtifact . OriginalFile } .") ;
228
+ continue ;
229
+ }
216
230
217
- PushToLocalStorageOrAzDO ( blobArtifact ) ;
218
- }
231
+ PushToLocalStorageOrAzDO ( blobArtifact ) ;
232
+ }
219
233
220
- foreach ( var pdbArtifact in buildModel . Artifacts . Pdbs )
221
- {
222
- if ( ! fileSystem . FileExists ( pdbArtifact . OriginalFile ) )
234
+ foreach ( var pdbArtifact in buildModel . Artifacts . Pdbs )
223
235
{
224
- Log . LogError ( $ "Could not find file { pdbArtifact . OriginalFile } .") ;
225
- continue ;
236
+ if ( ! fileSystem . FileExists ( pdbArtifact . OriginalFile ) )
237
+ {
238
+ Log . LogError ( $ "Could not find file { pdbArtifact . OriginalFile } .") ;
239
+ continue ;
240
+ }
241
+ PushToLocalStorageOrAzDO ( pdbArtifact ) ;
226
242
}
227
- PushToLocalStorageOrAzDO ( pdbArtifact ) ;
228
- }
229
243
230
- if ( ! PushToLocalStorage && buildModel . Artifacts . Pdbs . Any ( ) )
231
- {
232
- // Upload the full set of PDBs
233
- Log . LogMessage ( MessageImportance . High ,
234
- $ "##vso[artifact.upload containerfolder=PdbArtifacts;artifactname=PdbArtifacts]{ PdbArtifactsLocalStorageDir } ") ;
244
+ if ( ! PushToLocalStorage && buildModel . Artifacts . Pdbs . Any ( ) )
245
+ {
246
+ // Upload the full set of PDBs
247
+ Log . LogMessage ( MessageImportance . High ,
248
+ $ "##vso[artifact.upload containerfolder=PdbArtifacts;artifactname=PdbArtifacts]{ PdbArtifactsLocalStorageDir } ") ;
249
+ }
235
250
}
236
251
237
252
// Write the manifest, then create an artifact for it.
0 commit comments