Reopening PR with Baseline for capturing Objs [For include cleanup validation not for merging]#128262
Closed
moyo1997 wants to merge 2 commits into
Closed
Reopening PR with Baseline for capturing Objs [For include cleanup validation not for merging]#128262moyo1997 wants to merge 2 commits into
moyo1997 wants to merge 2 commits into
Conversation
…ine artifacts Add a post-build step to global-build-job.yml that collects compiled object files (.obj/.o) for the 102 source files modified in PR dotnet#127295 (Remove Unused Includes) and publishes them as pipeline artifacts. - New script: eng/pipelines/collect-obj-files.ps1 Searches artifacts/obj/ for object files matching the 102 source basenames and copies them to a staging directory. - Modified: eng/pipelines/common/global-build-job.yml Added pwsh step + PublishBuildArtifacts task after the build step. Runs on every build leg, publishes per-leg artifacts named ObjFiles_<os>_<arch>_<config>. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Contributor
|
Tagging subscribers to this area: @dotnet/runtime-infrastructure |
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Adds a build pipeline step and PowerShell helper to collect and publish compiled object files (.obj/.o) for 102 source files modified in PR #127295, to enable analysis of size/content changes per platform.
Changes:
- New PowerShell script that recursively scans
artifacts/objand copies matching object files (preserving relative paths) to a staging dir. - Two new pipeline steps in
global-build-job.ymlto invoke the script and publish the collected files as a build artifact.
Show a summary per file
| File | Description |
|---|---|
| eng/pipelines/collect-obj-files.ps1 | New script with hardcoded list of 102 basenames; matches <base>.{c,cpp}.{o,obj} and copies to output dir. |
| eng/pipelines/common/global-build-job.yml | Adds collection + PublishBuildArtifacts@1 steps gated on succeededOrFailed(). |
Copilot's findings
- Files reviewed: 2/2 changed files
- Comments generated: 5
Comment on lines
+3
to
+120
| # the 102 source files modified in PR #127295 ("Remove Unused Includes"). | ||
| # Usage: pwsh collect-obj-files.ps1 -ArtifactsObjDir <path> -OutputDir <path> | ||
|
|
||
| param( | ||
| [Parameter(Mandatory)] | ||
| [string]$ArtifactsObjDir, | ||
|
|
||
| [Parameter(Mandatory)] | ||
| [string]$OutputDir | ||
| ) | ||
|
|
||
| Set-StrictMode -Version Latest | ||
| $ErrorActionPreference = 'Stop' | ||
|
|
||
| # The 102 source file basenames from PR #127295 (dotnet/runtime). | ||
| # We search for object files whose name matches "<basename>.obj" or "<basename>.o". | ||
| $sourceBasenames = @( | ||
| "assembly" | ||
| "dacfn" | ||
| "processdescriptor" | ||
| "walker" | ||
| "dactable" | ||
| "debuggermodule" | ||
| "funceval" | ||
| "ceefilegenwriter" | ||
| "arraylist" | ||
| "dres" | ||
| "windasm" | ||
| "interoplib" | ||
| "block" | ||
| "dllmain" | ||
| "ee_il_dll" | ||
| "importer" | ||
| "loopcloning" | ||
| "promotion" | ||
| "promotiondecomposition" | ||
| "simdcodegenxarch" | ||
| "custattr_import" | ||
| "regmeta" | ||
| "regmeta_compilersupport" | ||
| "regmeta_emit" | ||
| "regmeta_import" | ||
| "regmeta_vm" | ||
| "stgtiggerstream" | ||
| "mdinternaldisp" | ||
| "memory" | ||
| "AsmOffsetsVerify" | ||
| "Crst" | ||
| "DebugHeader" | ||
| "EHHelpers" | ||
| "FinalizerHelpers" | ||
| "GCHelpers" | ||
| "GcStressControl" | ||
| "HandleTableHelpers" | ||
| "MathHelpers" | ||
| "MiscHelpers" | ||
| "RestrictedCallouts" | ||
| "RuntimeInstance" | ||
| "SyncClean" | ||
| "ThunksMapping" | ||
| "TypeManager" | ||
| "UniversalTransitionHelpers" | ||
| "event" | ||
| "ep-rt-aot" | ||
| "eventpipeinternal" | ||
| "eventtrace" | ||
| "eventtrace_gcheap" | ||
| "interoplibinterface_java" | ||
| "portable" | ||
| "rhassert" | ||
| "startup" | ||
| "stressLog" | ||
| "threadstore" | ||
| "PalCommon" | ||
| "PalMinWin" | ||
| "yieldprocessornormalized" | ||
| "mcs" | ||
| "removedup" | ||
| "icorjitinfo_generated" | ||
| "jithost" | ||
| "superpmi-shim-counter" | ||
| "superpmi-shim-simple" | ||
| "streamingsuperpmi" | ||
| "hostimpl" | ||
| "rangelist" | ||
| "cgenamd64" | ||
| "appdomain" | ||
| "callcounting" | ||
| "ceeload" | ||
| "class" | ||
| "classcompat" | ||
| "clsload" | ||
| "comcallablewrapper" | ||
| "cominterfacemarshaler" | ||
| "commodule" | ||
| "comutilnative" | ||
| "corelib" | ||
| "dllimport" | ||
| "exceptionhandling" | ||
| "fieldmarshaler" | ||
| "interoplibinterface_comwrappers" | ||
| "interoputil" | ||
| "jitinterfacegen" | ||
| "method" | ||
| "methodtable" | ||
| "onstackreplacement" | ||
| "peassembly" | ||
| "prestub" | ||
| "qcallentrypoints" | ||
| "stdinterfaces" | ||
| "stdinterfaces_wrapper" | ||
| "stubhelpers" | ||
| "stublink" | ||
| "threadsuspend" | ||
| "tieredcompilation" | ||
| "longfile.windows" | ||
| ) | ||
|
|
Comment on lines
+142
to
+180
| # Search for .obj and .o files recursively | ||
| $extensions = @('*.obj', '*.o') | ||
| foreach ($ext in $extensions) { | ||
| $files = Get-ChildItem -Path $ArtifactsObjDir -Filter $ext -Recurse -File -ErrorAction SilentlyContinue | ||
| foreach ($file in $files) { | ||
| # Extract the source basename: e.g., "assembly.cpp.obj" -> "assembly" | ||
| # CMake names obj files as <sourcename>.cpp.obj (or .c.obj) on Windows, | ||
| # and <sourcename>.cpp.o (or .c.o) on Linux/macOS. | ||
| $objName = $file.Name | ||
| # Remove the object extension first | ||
| $withoutObjExt = $objName | ||
| if ($objName.EndsWith('.obj')) { | ||
| $withoutObjExt = $objName.Substring(0, $objName.Length - 4) | ||
| } | ||
| elseif ($objName.EndsWith('.o')) { | ||
| $withoutObjExt = $objName.Substring(0, $objName.Length - 2) | ||
| } | ||
|
|
||
| # Remove the source extension (.cpp, .c) | ||
| $baseName = $withoutObjExt | ||
| if ($withoutObjExt.EndsWith('.cpp')) { | ||
| $baseName = $withoutObjExt.Substring(0, $withoutObjExt.Length - 4) | ||
| } | ||
| elseif ($withoutObjExt.EndsWith('.c')) { | ||
| $baseName = $withoutObjExt.Substring(0, $withoutObjExt.Length - 2) | ||
| } | ||
|
|
||
| if ($basenameSet.Contains($baseName)) { | ||
| # Preserve relative path from artifacts/obj | ||
| $relativePath = $file.FullName.Substring($ArtifactsObjDir.TrimEnd([IO.Path]::DirectorySeparatorChar, '/').Length + 1) | ||
| $destPath = Join-Path $OutputDir $relativePath | ||
| $destDir = Split-Path $destPath -Parent | ||
| if (-not (Test-Path $destDir)) { | ||
| New-Item -ItemType Directory -Path $destDir -Force | Out-Null | ||
| } | ||
| Copy-Item -Path $file.FullName -Destination $destPath -Force | ||
| Write-Host "Copied: $relativePath ($($file.Length) bytes)" | ||
| $totalCopied++ | ||
| } |
Comment on lines
+246
to
+250
| - task: PublishBuildArtifacts@1 | ||
| displayName: Publish object files | ||
| inputs: | ||
| PathtoPublish: '$(Build.StagingDirectory)/obj-artifacts' | ||
| ArtifactName: 'ObjFiles_${{ parameters.osGroup }}${{ parameters.osSubgroup }}_${{ parameters.archType }}_${{ parameters.buildConfig }}' |
Comment on lines
+237
to
+241
| # Collect and publish .obj/.o files for the 102 source files from PR #127295 | ||
| - pwsh: | | ||
| $(Build.SourcesDirectory)/eng/pipelines/collect-obj-files.ps1 ` | ||
| -ArtifactsObjDir "$(Build.SourcesDirectory)/artifacts/obj" ` | ||
| -OutputDir "$(Build.StagingDirectory)/obj-artifacts" |
|
|
||
| if ($basenameSet.Contains($baseName)) { | ||
| # Preserve relative path from artifacts/obj | ||
| $relativePath = $file.FullName.Substring($ArtifactsObjDir.TrimEnd([IO.Path]::DirectorySeparatorChar, '/').Length + 1) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
No description provided.