-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Dotnet publish with filter profile #685
Conversation
aa7d295
to
7d6e836
Compare
@@ -76,6 +83,38 @@ public static LockFileTargetLibrary GetLibrary(this LockFileTarget lockFileTarge | |||
|
|||
return projectDeps; | |||
} | |||
|
|||
public static HashSet<string> GetIntersetction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: Intersetction
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
<Target Name="ComputeAssembliesToBeFiltered" | ||
Condition="'$(FilterProjFile)'!=''" > | ||
<PropertyGroup> | ||
<FilterProFileDir>$(MSBuildProjectExtensionsPath)\filterprofile</FilterProFileDir> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Typo: FilterProFile
(j
missing?)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yup, corrected
@@ -76,6 +83,38 @@ public static LockFileTargetLibrary GetLibrary(this LockFileTarget lockFileTarge | |||
|
|||
return projectDeps; | |||
} | |||
|
|||
public static HashSet<string> GetIntersetction( | |||
IDictionary<string, LockFileTargetLibrary> coll1, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It is standard coding in C# to not use abbreviations or contractions in variable names.
coll1
iter
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
corrected
@@ -76,6 +83,38 @@ public static LockFileTargetLibrary GetLibrary(this LockFileTarget lockFileTarge | |||
|
|||
return projectDeps; | |||
} | |||
|
|||
public static HashSet<string> GetIntersetction( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This method doesn't really seem to belong in LockFileExtensions, since it is not an extension method.
My thought would be to make it a private method next to where it is called, and if it needs to be shared somewhere, it can be moved to an appropriate place later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done
{ | ||
IEnumerable<LockFileTargetLibrary> filterLibraries = _filterlockFileTarget.Libraries; | ||
Dictionary<string, LockFileTargetLibrary> filterLookup = | ||
filterLibraries.ToDictionary(e => e.Name, StringComparer.OrdinalIgnoreCase); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) whitespace here. This line should be indented since it is a continuation of the line above it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed
@@ -45,12 +47,20 @@ protected override void ExecuteCore() | |||
IEnumerable<string> privateAssetsPackageIds = PackageReferenceConverter.GetPackageIds(PrivateAssetsPackageReferences); | |||
IPackageResolver packageResolver = NuGetPackageResolver.CreateResolver(lockFile, ProjectPath); | |||
|
|||
LockFile FilterLockFile = null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(nit) local variables should be camelCased.
LockFile FilterLockFile = null; | ||
if (!string.IsNullOrEmpty(FilterProjectAssetsFile)) | ||
{ | ||
FilterLockFile = new LockFileCache(BuildEngine4).GetLockFile(FilterProjectAssetsFile); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can reuse the LockFileCache created above, so we don't need to create 2 instances of this object in the same method.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct me if i am missing something, i thought LockFileCache maps to a single asset file. We are dealing with two asset files here
AssetsFilePath - the App project
FilterLockFile - the Filter profile supplied
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are right that we are using 2 assets files. But what I'm saying is there is no point in creating two instances of the LockFileCache
object. The same cache object can load multiple asset files.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah got it , you did not want to new up another object
Condition="'$(FilterProjFile)'!=''" > | ||
<PropertyGroup> | ||
<FilterProFileDir>$(MSBuildProjectExtensionsPath)\filterprofile</FilterProFileDir> | ||
<FilterProjectAssetsFile>$(FilterProFileDir)\project.assets.json</FilterProjectAssetsFile> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Where does this file get created?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is created in https://github.com/dotnet/sdk/pull/685/files#diff-ffd1a974928a37a20fbc471c040962acR265 as product of restore on the filterprojfile
7d6e836
to
243e12f
Compare
@eerhardt i have addressed your comments |
243e12f
to
db24f59
Compare
|
||
<!-- | ||
============================================================ | ||
RunResolvePublishAssemblies |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This comment and summary are outdated.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops will correct it
@@ -9,6 +9,8 @@ namespace Microsoft.NET.Build.Tasks | |||
{ | |||
internal class RuntimeOptions | |||
{ | |||
public string tfm { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The property doesn't really align with the rest of the properties in the .json file.
- Its casing is different than the existing properties.
- It is an abbreviation, where the rest aren't.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Runtime options are only read by the dotnet host, so we have some leeway here
@@ -9,6 +9,8 @@ namespace Microsoft.NET.Build.Tasks | |||
{ | |||
internal class RuntimeOptions | |||
{ | |||
public string tfm { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why can't this value be inferred from the existing "Framework" property? Also, TFMs don't have patch numbers in them. So if we had a bug fix in crossgen between 1.1.0 and 1.1.1, how would the cache get updated? The assembly was crossgened using 1.1.0 and cached in "netcoreapp1.1", but when I installed 1.1.1, there is no way to get the cache updated, because the assembly was already cached for "netcoreapp1.1".
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The caching step is typically done by admin or installer scripts. We do not expect the end user to do this themselves.
When this feature was spec'd, we decided to not do side by side install for the same TFM, to fix the crossgen bug- we would replace the assemblies already cached with the updated assembles, using the above mechanism
The readytorun images are supposed to be resilient to runtime changes within the same TFM, worst case we are to fallback to jitting
@gkhanna79 : Do correct me if i am wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@ramarag is correct.
@@ -28,6 +28,9 @@ public class GenerateRuntimeConfigurationFiles : TaskBase | |||
public string TargetFramework { get; set; } | |||
|
|||
[Required] | |||
public string TargetFrameworkMoniker { get; set; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Taking both TargetFramework
and TargetFrameworkMoniker
seems redundant.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
i had a chat with @nguerrera there seems to be no other clean way
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There seems to be no good way to get reliably the same TargetFramework which was used to create the TargetFrameworkMoniker. Since we use the user supplied TargetFramework at build time, we want it to be the same here
db24f59
to
c11f9f7
Compare
…0190604.11 (dotnet#685) - Microsoft.AspNetCore.Mvc.Api.Analyzers - 3.0.0-preview6.19304.11 - Microsoft.AspNetCore.Mvc.Analyzers - 3.0.0-preview6.19304.11
@schellap @eerhardt @dsplaisted @nguerrera @gkhanna79 @srivatsn PTAL
Implements #555