-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Add output DebugSymbolsFiles to ResolvePackageAssets #27580
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
Merged
Merged
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -12,7 +12,6 @@ | |||||
| using Microsoft.Build.Framework; | ||||||
| using Microsoft.Build.Utilities; | ||||||
| using NuGet.Common; | ||||||
| using NuGet.Frameworks; | ||||||
| using NuGet.ProjectModel; | ||||||
| using NuGet.Versioning; | ||||||
|
|
||||||
|
|
@@ -156,6 +155,9 @@ public sealed class ResolvePackageAssets : TaskBase | |||||
| [Required] | ||||||
| public string DotNetAppHostExecutableNameWithoutExtension { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// True indicates we are doing a design-time build. Otherwise we are in a build. | ||||||
| /// </summary> | ||||||
| public bool DesignTimeBuild { get; set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
|
|
@@ -231,6 +233,24 @@ public sealed class ResolvePackageAssets : TaskBase | |||||
| [Output] | ||||||
| public ITaskItem[] PackageDependencies { get; private set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// List of symbol files (.pdb) related to NuGet packages. | ||||||
| /// </summary> | ||||||
| /// <remarks> | ||||||
| /// Pdb files to be copied to the output directory | ||||||
| /// </remarks> | ||||||
| [Output] | ||||||
| public ITaskItem[] DebugSymbolsFiles { get; private set;} | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// List of xml files related to NuGet packages. | ||||||
| /// </summary> | ||||||
| /// <remarks> | ||||||
| /// The XML files should only be included in the publish output if PublishReferencesDocumentationFiles is true | ||||||
| /// </remarks> | ||||||
| [Output] | ||||||
| public ITaskItem[] ReferenceDocumentationFiles { get; private set; } | ||||||
|
|
||||||
| /// <summary> | ||||||
| /// Messages from the assets file. | ||||||
| /// These are logged directly and therefore not returned to the targets (note private here). | ||||||
|
|
@@ -311,11 +331,13 @@ private void ReadItemGroups() | |||||
| ApphostsForShimRuntimeIdentifiers = reader.ReadItemGroup(); | ||||||
| CompileTimeAssemblies = reader.ReadItemGroup(); | ||||||
| ContentFilesToPreprocess = reader.ReadItemGroup(); | ||||||
| DebugSymbolsFiles = reader.ReadItemGroup(); | ||||||
| FrameworkAssemblies = reader.ReadItemGroup(); | ||||||
| FrameworkReferences = reader.ReadItemGroup(); | ||||||
| NativeLibraries = reader.ReadItemGroup(); | ||||||
| PackageDependencies = reader.ReadItemGroup(); | ||||||
| PackageFolders = reader.ReadItemGroup(); | ||||||
| ReferenceDocumentationFiles = reader.ReadItemGroup(); | ||||||
| ResourceAssemblies = reader.ReadItemGroup(); | ||||||
| RuntimeAssemblies = reader.ReadItemGroup(); | ||||||
| RuntimeTargets = reader.ReadItemGroup(); | ||||||
|
|
@@ -510,7 +532,7 @@ private static BinaryReader CreateReaderFromDisk(ResolvePackageAssets task, byte | |||||
| BinaryReader reader = null; | ||||||
| try | ||||||
| { | ||||||
| if (File.GetLastWriteTimeUtc(task.ProjectAssetsCacheFile) > File.GetLastWriteTimeUtc(task.ProjectAssetsFile)) | ||||||
| if (IsCacheFileUpToDate()) | ||||||
| { | ||||||
| reader = OpenCacheFile(task.ProjectAssetsCacheFile, settingsHash); | ||||||
| } | ||||||
|
|
@@ -537,6 +559,8 @@ private static BinaryReader CreateReaderFromDisk(ResolvePackageAssets task, byte | |||||
| } | ||||||
|
|
||||||
| return reader; | ||||||
|
|
||||||
| bool IsCacheFileUpToDate() => File.GetLastWriteTimeUtc(task.ProjectAssetsCacheFile) > File.GetLastWriteTimeUtc(task.ProjectAssetsFile); | ||||||
| } | ||||||
|
|
||||||
| private static BinaryReader OpenCacheStream(Stream stream, byte[] settingsHash) | ||||||
|
|
@@ -651,6 +675,8 @@ internal sealed class CacheWriter : IDisposable | |||||
|
|
||||||
| private const string NetCorePlatformLibrary = "Microsoft.NETCore.App"; | ||||||
|
|
||||||
| private const char RelatedPropertySeparator = ';'; | ||||||
|
|
||||||
| public CacheWriter(ResolvePackageAssets task) | ||||||
| { | ||||||
| _targetFramework = task.TargetFramework; | ||||||
|
|
@@ -776,11 +802,13 @@ private void WriteItemGroups() | |||||
| WriteItemGroup(WriteApphostsForShimRuntimeIdentifiers); | ||||||
| WriteItemGroup(WriteCompileTimeAssemblies); | ||||||
| WriteItemGroup(WriteContentFilesToPreprocess); | ||||||
| WriteItemGroup(WriteDebugSymbolsFiles); | ||||||
| WriteItemGroup(WriteFrameworkAssemblies); | ||||||
| WriteItemGroup(WriteFrameworkReferences); | ||||||
| WriteItemGroup(WriteNativeLibraries); | ||||||
| WriteItemGroup(WritePackageDependencies); | ||||||
| WriteItemGroup(WritePackageFolders); | ||||||
| WriteItemGroup(WritePackageFolders); | ||||||
| WriteItemGroup(WriteReferenceDocumentationFiles); | ||||||
| WriteItemGroup(WriteResourceAssemblies); | ||||||
| WriteItemGroup(WriteRuntimeAssemblies); | ||||||
| WriteItemGroup(WriteRuntimeTargets); | ||||||
|
|
@@ -1091,6 +1119,61 @@ private void WriteContentFilesToPreprocess() | |||||
| }); | ||||||
| } | ||||||
|
|
||||||
| private void WriteDebugSymbolsFiles() | ||||||
| { | ||||||
| WriteDebugItems( | ||||||
| p => p.RuntimeAssemblies, | ||||||
| MetadataKeys.PdbExtension); | ||||||
| } | ||||||
|
|
||||||
| private void WriteReferenceDocumentationFiles() | ||||||
| { | ||||||
| WriteDebugItems( | ||||||
| p => p.CompileTimeAssemblies, | ||||||
| MetadataKeys.XmlExtension); | ||||||
| } | ||||||
|
|
||||||
| private void WriteDebugItems( | ||||||
| Func<LockFileTargetLibrary, IEnumerable<LockFileItem>> getAssets, | ||||||
| string extension) | ||||||
| { | ||||||
| foreach (var library in _runtimeTarget.Libraries) | ||||||
| { | ||||||
| if (!library.IsPackage()) | ||||||
| { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| foreach (LockFileItem asset in getAssets(library)) | ||||||
| { | ||||||
| if (asset.IsPlaceholderFile() || !asset.Properties.ContainsKey(MetadataKeys.RelatedProperty)) | ||||||
| { | ||||||
| continue; | ||||||
| } | ||||||
|
|
||||||
| string itemSpec = _packageResolver.ResolvePackageAssetPath(library, asset.Path); | ||||||
|
|
||||||
| string relatedExtensions = asset.Properties[MetadataKeys.RelatedProperty]; | ||||||
|
|
||||||
| foreach (string fileExtension in relatedExtensions.Split(RelatedPropertySeparator)) | ||||||
| { | ||||||
| if (fileExtension.ToLower() == extension) | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should probably use invariant comparison
Suggested change
|
||||||
| { | ||||||
| string xmlFilePath = Path.ChangeExtension(itemSpec, fileExtension); | ||||||
| if (File.Exists(xmlFilePath)) | ||||||
| { | ||||||
| WriteItem(xmlFilePath, library); | ||||||
| } | ||||||
| else | ||||||
| { | ||||||
| _task.Log.LogWarning(Strings.AssetsFileNotFound, xmlFilePath); | ||||||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This isn't really the right error message here. Do we need to log a warning at all here? |
||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
| } | ||||||
|
|
||||||
| private void WriteFrameworkAssemblies() | ||||||
| { | ||||||
| if (_task.DisableFrameworkAssemblies) | ||||||
|
|
||||||
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
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.