Skip to content

Commit aa0365e

Browse files
committed
ADD: ReleaseAssetList module
1 parent 4f229b8 commit aa0365e

File tree

4 files changed

+84
-1
lines changed

4 files changed

+84
-1
lines changed

CHANGELOG.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,16 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### New features
1111

1212
- A new property `CompletePublishFolderMetadataDependsOn` has been added. The `CompletePublishFolderMetadata` target will depend on targets listed in this property. This is useful to separate concerns among alternate pack methods.
13+
- The new `ReleaseAssetList` module allows for creation of lists of assets to associate with a release, useful when releases are created externally (GitHub, etc.) and associated assets are the only way to retrieve published artifacts.
14+
- release asset list generation is enabled by the `GenerateReleaseAssetList` boolean property, defaulting to `true` except in libraries and test projects;
15+
- to include a file in the release asset list for a project, just add one or more `ReleaseAsset` items;
16+
- the `Description` metadata of `ReleaseAsset` items can be used to add a textual description of each asset, for CI systems that can use it;
17+
- release assets without a `Description` metadata are given a default description according to the `DefaultReleaseAssetDescription` property, whose default value is "(no description given)";
18+
- release asset lists are UTF-8 text files;
19+
- each row of a release asset list contains the full path of an asset, a tab character (Unicode U+0009), and the asset's description;
20+
- rows are separated by the build system's line separator (CR+LF on Windows, LF otherwise);
21+
- each project in a solution generates its own release asset list, whose name can be set via the `ReleaseAssetListFileName` property, defaulting to `$(MSBuildProjectName).assets.txt`;
22+
- all release asset lists for a solution are placed in the artifacts directory, `$(ArtifactsDirectory)$(Configuration)`.
1323
- New metadata in `PublishFolder` items allow for zipping a published folder:
1424
- `CreateZipFile` (boolean) enables the creation of a ZIP file with the contents of the published folder;
1525
- `ZipFileName` (string) is the name (complete with extension) of the created ZIP file;
@@ -21,7 +31,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2131
- `$(MSBuildProjectName)-%(PublishFolder.Identity)_$(BuildVersion).zip` if the `BuildVersion` property is set (such as when using Nerdbank.GitVersioning);
2232
- `$(MSBuildProjectName)-%(PublishFolder.Identity).zip` otherwise.
2333

24-
2534
### Changes to existing features
2635

2736
- The minimum supported version of Roslyn is now 4.7

docs/Diagnostics.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
- [XmlDocumentation module (1800-1899)](#xmldocumentation-module-1800-1899)
1313
- [AlternatePack module (1900-1999)](#alternatepack-module-1900-1999)
1414
- [NerdbankGitVersioning module (2000-2099)](#nerdbankgitversioning-module-2000-2099)
15+
- [ReleaseAssetList module (2100-2199)](#releaseassetlist-module-2100-2199)
1516

1617
## Overview
1718

@@ -100,3 +101,9 @@ Each module is assigned a contiguous range of 100 diagnostics, as listed below.
100101
| Code | Severity | Message | Description |
101102
| -----| :------: | ------- | ----------- |
102103
| BVSDK2000 | Error | Version specification JSON file not found. | A `version.json` or `.version.json` file for the project was not found within the repository root. |
104+
105+
## ReleaseAssetList module (2100-2199)
106+
107+
| Code | Severity | Message | Description |
108+
| -----| :------: | ------- | ----------- |
109+
| This module has no associated diagnostics. | | | |
Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Project>
2+
3+
<Target Name="PrepareReleaseAssetList"
4+
AfterTargets="Pack"
5+
DependsOnTargets="$(WriteReleaseAssetListDependsOn)"
6+
Condition="$(GenerateReleaseAssetList)">
7+
8+
<PropertyGroup Condition="'$(ReleaseAssetDefaultDescription)' == ''">
9+
<ReleaseAssetDefaultDescription>(no description given)</ReleaseAssetDefaultDescription>
10+
</PropertyGroup>
11+
12+
<ItemGroup>
13+
<ReleaseAsset Update="%(ReleaseAsset.Identity)"
14+
Description="$([System.String]::Copy('%(ReleaseAsset.Description)').Trim())" />
15+
<ReleaseAsset Update="%(ReleaseAsset.Identity)"
16+
Condition="'%(ReleaseAsset.Description)' == ''"
17+
Description="$(ReleaseAssetDefaultDescription)" />
18+
</ItemGroup>
19+
20+
</Target>
21+
22+
<Target Name="WriteReleaseAssetList"
23+
AfterTargets="Pack"
24+
DependsOnTargets="$(WriteReleaseAssetListDependsOn);PrepareReleaseAssetList"
25+
Condition="$(GenerateReleaseAssetList)">
26+
27+
<ItemGroup>
28+
<BV_ReleaseAssetText Include="%(ReleaseAsset.FullPath)&#09;%(Description)" />
29+
</ItemGroup>
30+
31+
<PropertyGroup>
32+
<ReleaseAssetListFileName Condition="'$(ReleaseAssetListFileName)' == ''">$(MSBuildProjectName).assets.txt</ReleaseAssetListFileName>
33+
<ReleaseAssetListPath Condition="'$(ReleaseAssetListPath)' == ''">$(ArtifactsDirectory)$(Configuration)\$(ReleaseAssetListFileName)</ReleaseAssetListPath>
34+
</PropertyGroup>
35+
36+
<WriteLinesToFile Condition="@(ReleaseAsset->Count()) > 0"
37+
File="$(ReleaseAssetListPath)"
38+
Lines="@(BV_ReleaseAssetText)"
39+
Overwrite="true" />
40+
41+
<Delete Condition="@(ReleaseAsset->Count()) == 0"
42+
Files="$(ReleaseAssetListPath)" />
43+
44+
<ItemGroup>
45+
<BV_ReleaseAssetText Remove="@(BV_ReleaseAssetText)" />
46+
</ItemGroup>
47+
48+
</Target>
49+
50+
</Project>
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
<Project>
2+
3+
<!-- The default for GenerateReleaseAssetList is true, except for libraries and test projects -->
4+
<PropertyGroup Condition="'$(GenerateReleaseAssetList)' == ''">
5+
<GenerateReleaseAssetList>true</GenerateReleaseAssetList>
6+
<GenerateReleaseAssetList Condition="$(BV_IsLibraryProject) Or $(BV_IsTestProject)">false</GenerateReleaseAssetList>
7+
</PropertyGroup>
8+
9+
<!-- Coalesce GenerateReleaseAssetList to a boolean value, defaulting to false -->
10+
<PropertyGroup Condition="'$(GenerateReleaseAssetList)' != 'true'">
11+
<GenerateReleaseAssetList>false</GenerateReleaseAssetList>
12+
</PropertyGroup>
13+
14+
<Import Project="Module.Core.targets"
15+
Condition="$(GenerateReleaseAssetList)" />
16+
17+
</Project>

0 commit comments

Comments
 (0)