Add BuildAll target, CodeQL update, and build cleanup#4290
Add BuildAll target, CodeQL update, and build cleanup#4290paulmedynski wants to merge 6 commits into
Conversation
- Added BuildAll target that builds all projects for all OS+TFM combinations - Updated CodeQL to use BuildAll target for broader code coverage - Added TrimDocs condition to skip doc trimming during cross-builds - Added implicit usings to Test.Common project - Removed obsolete ToolsVersion and DefaultTargets Project attributes - Reduced build console noise from RepositoryInfo.targets - Removed obsolete ToolsVersion from ManualTesting.Tests.ruleset - Added trailing newline to ManualTesting.Tests.ruleset - Quoted project paths in BuildTests/BuildSamples/BuildTools targets
There was a problem hiding this comment.
Pull request overview
Adds a new BuildAll orchestration target in build.proj and updates the CodeQL workflow to build more of the repository during analysis, alongside a handful of MSBuild/props cleanup and minor project tweaks.
Changes:
- Introduces
BuildAll(and supportingBuildTests/BuildSamples/BuildTools) and switches CodeQL to call it. - Adds a
TrimDocsopt-out for ref-doc trimming to better support cross-build scenarios. - Cleans up legacy MSBuild
ToolsVersion/DefaultTargetsusage and reduces build log noise.
Reviewed changes
Copilot reviewed 9 out of 9 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
| tools/targets/RepositoryInfo.targets | Lowers message verbosity for translated repo URL logging. |
| tools/props/AssemblyRef.props | Removes legacy <Project> attributes. |
| tools/props/AssemblyInfo.props | Removes legacy <Project> attributes. |
| src/Microsoft.Data.SqlClient/tests/ManualTests/Microsoft.Data.SqlClient.ManualTesting.Tests.ruleset | Removes obsolete ToolsVersion and normalizes file ending. |
| src/Microsoft.Data.SqlClient/tests/Common/Microsoft.Data.SqlClient.TestCommon.csproj | Enables implicit usings for the shared test helper project. |
| src/Microsoft.Data.SqlClient/ref/Microsoft.Data.SqlClient.csproj | Adds TrimDocs switch to optionally skip IntelliSense XML trimming. |
| src/Directory.Build.props | Removes legacy <Project> attributes; clarifies versioning evaluation order. |
| build.proj | Adds BuildAll + ancillary build targets and shared arg handling. |
| .github/workflows/codeql.yml | Switches manual CodeQL build step to BuildAll. |
…is Linux. - Removed unnecessary usings in TestCommon.
| <AssemblyName>Microsoft.Data.SqlClient.TestCommon</AssemblyName> | ||
| <RootNamespace>Microsoft.Data.SqlClient.TestCommon</RootNamespace> | ||
|
|
||
| <ImplicitUsings>enable</ImplicitUsings> |
There was a problem hiding this comment.
Reduces 'using' noise.
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="Latest"> | |||
There was a problem hiding this comment.
ToolsVersion is an obsolete attribute we don't need any more.
| @@ -1,5 +1,5 @@ | |||
| <?xml version="1.0" encoding="utf-8"?> | |||
| <Project ToolsVersion="Current" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | |||
There was a problem hiding this comment.
Only build.proj has a default target. Build doesn't exist here anyway, so this was just cruft.
| <PropertyGroup> | ||
| <PowerShellCommand Condition="'$(OS)' == 'Windows_NT'">powershell.exe</PowerShellCommand> | ||
| <PowerShellCommand Condition="'$(OS)' != 'Windows_NT'">pwsh</PowerShellCommand> | ||
| <PowerShellCommand Condition="$([MSBuild]::IsOSPlatform('Windows'))">powershell.exe</PowerShellCommand> |
There was a problem hiding this comment.
BuildAll sets $(OS) to whatever it wants, regardless of the actual host OS. This will be clobbered by @mdaigle 's pwsh tool changes anyway, so it's a temp fix.
| <Target Name="Build" DependsOnTargets="BuildLogging;BuildAbstractions;BuildSqlClient;BuildAzure;BuildAkvProvider;BuildSqlServer" /> | ||
|
|
||
| <!-- Build all projects in the repo, for all supported OS and TargetFramework combinations.--> | ||
| <Target Name="BuildAll" DependsOnTargets="Build;BuildTests;BuildSamples;BuildTools" /> |
There was a problem hiding this comment.
Devs can use this with local changes to be pretty confident they didn't break compilation, regardless of their host OS.
| <!-- Build SqlClient UnitTests (project references only, no ReferenceType). --> | ||
| <Message Text=">>> Building SqlClient UnitTests for %(_OsValues.Identity)"/> | ||
| <Exec ConsoleToMsBuild="true" | ||
| Command=""$(DotnetPath)dotnet" build "$(UnitTestsProjectPath)" -p:Configuration=$(Configuration) -p:OS=%(_OsValues.Identity)" /> |
There was a problem hiding this comment.
MSBuild performs one exec for each element in _OsValues, so this builds our Windows and Unix code.
| </PropertyGroup> | ||
|
|
||
| <Message Text=">>> Building GenAPI project via command: '$(DotnetCommand)'"/> | ||
| <Message Importance="High" Text=">>> Building GenAPI project"/> |
There was a problem hiding this comment.
Now we can see what is happening without much verbosity, but we still get the details when asked for.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4290 +/- ##
==========================================
+ Coverage 66.04% 69.14% +3.10%
==========================================
Files 275 271 -4
Lines 42976 67215 +24239
==========================================
+ Hits 28383 46478 +18095
- Misses 14593 20737 +6144
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Cleaned up a bunch of cruft from our git configuration files.
| **/notsupported/*.cs | ||
|
|
||
| # C# language server cache | ||
| *.lscache |
There was a problem hiding this comment.
This is new - the latest C# Dev Kit for VS Code produced a bunch of these cache files.
Description
Add BuildAll target that builds all projects for all OS+TFM combinations. This makes it easy for devs to compile local changes and avoid surprises for the code that otherwise wouldn't be compiled due to their host OS.
Changes
BuildAlltarget inbuild.projthat builds all projects (tests, samples, tools) across OS+TFM combos.BuildAllfor broader code coverage.TestCommonproject and removed unnecessaryusings.ToolsVersionandDefaultTargets<Project>attributes.RepositoryInfo.targets.build.projmessaging.Split from #4259.