Skip to content

Commit 6ecb85e

Browse files
authored
Merge pull request #273 from candrews/serialNumber
Set serialNumber when merging
2 parents eabd721 + 3ce25d2 commit 6ecb85e

File tree

2 files changed

+4
-0
lines changed

2 files changed

+4
-0
lines changed

src/cyclonedx/Commands/MergeCommand.cs

+1
Original file line numberDiff line numberDiff line change
@@ -102,6 +102,7 @@ public static async Task<int> Merge(MergeCommandOptions options)
102102
}
103103

104104
outputBom.Version = 1;
105+
outputBom.SerialNumber = "urn:uuid:" + System.Guid.NewGuid().ToString();
105106

106107
if (!outputToConsole)
107108
{

tests/cyclonedx.tests/MergeTests.cs

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
using System;
1818
using System.Collections.Generic;
1919
using System.IO;
20+
using System.Text.RegularExpressions;
2021
using System.Threading.Tasks;
2122
using Xunit;
2223
using Snapshooter;
@@ -70,6 +71,8 @@ public async Task Merge(
7071

7172
Assert.Equal(0, exitCode);
7273
var bom = File.ReadAllText(fullOutputPath);
74+
bom = Regex.Replace(bom, @"\s*""serialNumber"": "".*?"",\r?\n", ""); // json
75+
bom = Regex.Replace(bom, @"\s+serialNumber="".*?""", ""); // xml
7376
Snapshot.Match(bom, SnapshotNameExtension.Create(hierarchical ? "Hierarchical" : "Flat", snapshotInputFilenames, inputFormat, outputFilename, outputFormat));
7477
}
7578
}

0 commit comments

Comments
 (0)