Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Implement the Visual Studio build log converter #1533

Merged
33 commits merged into from
Jun 17, 2019

Conversation

ghost
Copy link

@ghost ghost commented Jun 13, 2019

Compare the test file SomeErrors.txt (the input) to SomeErrors.sarif (the output) to see the implementation choices I made. In particular, I did not segregate those lines that mentioned a build tool (such as "LINK") into separate run objects. IMO the entire log represents a single "run" -- the build.

It is not at all clear what to put in run.tool.name. It's not even necessarily true that the log was produced by Visual Studio or even MSBuild. Any script that ran the underlying tools (csc, link, rc, ...) would produce error messages in the same format. Suggestions welcome.

Larry Golding added 28 commits June 7, 2019 13:55
Also:
- Fix #1524: ResultLogJsonWriter emits language "en-US"
- Fix #1525: FileDiffingUnitTests doesn't notice spurious default-valued properties
@ghost ghost requested review from michaelcfanning and harleenkohli June 13, 2019 16:21
@@ -294,7 +294,7 @@ public void CompleteRun()

SerializeIfNotNull(_run.Tags, "tags");
SerializeIfNotNull(_run.Conversion, "conversion");
SerializeIfNotNull(_run.Language, "language");
SerializeIfNotDefault(_run.Language, "language", "en-US");
Copy link
Author

@ghost ghost Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SerializeIfNotDefault [](start = 12, length = 21)

This is the fix for #1524, "ResultLogJsonWriter emits language 'en-US'". Note that I hard-coded the default -- this string appears in several places and I chose not to make today the day I DRY it out. #Resolved

@@ -188,24 +188,26 @@ protected static string GenerateDiffCommand(string suiteName, string expected, s

public static bool AreEquivalent<T>(string actualSarif, string expectedSarif, IContractResolver contractResolver = null)
{
if (actualSarif.Equals(expectedSarif)) { return true; }
expectedSarif = expectedSarif ?? "{}";
Copy link
Author

@ghost ghost Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

expectedSarif [](start = 12, length = 13)

The changes in this method are the fix for #1525, "FileDiffingUnitTests don't notice spurious default-valued properties".

@@ -16,12 +16,12 @@ namespace Microsoft.CodeAnalysis.Sarif
/// See https://xunit.github.io/docs/shared-context for more information about xUnit class fixtures.
///
/// This particular fixture deletes any existing test output files that may have been produced
/// by a previous run. It is designed for use on test classes that derive from FileDiffingTests.
Copy link
Author

@ghost ghost Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FileDiffingTests [](start = 83, length = 16)

Wrong class name. #Resolved

* BUGFIX: Add `Result.Level` (and remove `Result.Rank`) for Fortify Converter based on MicroFocus feedback.
* API NON-BREAKING: Provider a SARIF converter for Visual Studio log files.
Copy link
Member

@michaelcfanning michaelcfanning Jun 13, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Provider [](start = 20, length = 8)

s/be 'Provide' #Resolved

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed.


In reply to: 293605399 [](ancestors = 293605399)

@michaelcfanning
Copy link
Member

michaelcfanning commented Jun 13, 2019

have you tested your converter in all three viewers? vs. vs code, and ado results explorer?
have you tried open vey large build logs from actual product builds? #Pending

@ghost
Copy link
Author

ghost commented Jun 13, 2019

Will send you results in email.


In reply to: 501906158 [](ancestors = 501906158)

@ghost
Copy link
Author

ghost commented Jun 17, 2019

@harleenkohli is added to the review. #Closed

@harleenkohli
Copy link
Contributor

harleenkohli commented Jun 17, 2019

The files in the Inputs directory have the extension .txt rather than the more natural .log because the repo's .gitignore file excludes .log files.

very NIT: could a better place for this readme be inside the "Inputs" folder? #ByDesign


Refers to: src/Test.UnitTests.Sarif.Converters/TestData/VisualStudioBuildLogConverter/README.md:1 in 2caebcf. [](commit_id = 2caebcf, deletion_comment = False)

@harleenkohli
Copy link
Contributor

The files in the Inputs directory have the extension .txt rather than the more natural .log because the repo's .gitignore file excludes .log files.

(cool trick for getting the gitignore issue out of the way)


In reply to: 502849560 [](ancestors = 502849560)


Refers to: src/Test.UnitTests.Sarif.Converters/TestData/VisualStudioBuildLogConverter/README.md:1 in 2caebcf. [](commit_id = 2caebcf, deletion_comment = False)

@@ -382,7 +382,7 @@
* BUGFIX: Multitool crashes on launch: Can't find CommandLine.dll. https://github.com/microsoft/sarif-sdk/issues/1487

## **v2.1.2** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.1.2) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.1.2) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.1.2) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.1.2)
* API BREAKING: Change location.logicalLocation to logicalLocations array. https://github.com/oasis-tcs/sarif-spec/issues/414
* API BREAKING: Change result.logicalLocation to logicalLocations array. https://github.com/oasis-tcs/sarif-spec/issues/414

## **v2.1.3** [Sdk](https://www.nuget.org/packages/Sarif.Sdk/2.1.3) | [Driver](https://www.nuget.org/packages/Sarif.Driver/2.1.3) | [Converters](https://www.nuget.org/packages/Sarif.Converters/2.1.3) | [Multitool](https://www.nuget.org/packages/Sarif.Multitool/2.1.3)
Copy link
Contributor

@harleenkohli harleenkohli Jun 17, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/Sarif.Sdk/2.1.3) [](start = 50, length = 17)

Should we call out that its MSBuild log file ? (VS logs could mean something more generic?) #Pending

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

sigh I did struggle with the naming. I supposed MSBuild is better. Even that's not perfect because any tool or script that produces error lines in this standard format will work. I'll merge this but will ask for a call from Michael.


In reply to: 294517116 [](ancestors = 294517116)

Copy link
Contributor

@harleenkohli harleenkohli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

:shipit:

@ghost
Copy link
Author

ghost commented Jun 17, 2019

The files in the Inputs directory have the extension .txt rather than the more natural .log because the repo's .gitignore file excludes .log files.

I put the file here because this is the folder that contains the affected files. My usual "scope reduction" approach :)


In reply to: 502849825 [](ancestors = 502849825,502849560)


Refers to: src/Test.UnitTests.Sarif.Converters/TestData/VisualStudioBuildLogConverter/README.md:1 in 2caebcf. [](commit_id = 2caebcf, deletion_comment = False)

@ghost ghost merged commit 44f0e46 into master Jun 17, 2019
@ghost ghost deleted the users/lgolding/build-log-converter branch June 17, 2019 21:23
This pull request was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants