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

Dotnet publish with filter profile #685

Merged
merged 2 commits into from
Jan 27, 2017
Merged

Conversation

ramarag
Copy link
Member

@ramarag ramarag commented Jan 19, 2017

@@ -76,6 +83,38 @@ public static LockFileTargetLibrary GetLibrary(this LockFileTarget lockFileTarge

return projectDeps;
}

public static HashSet<string> GetIntersetction(
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: Intersetction

Copy link
Member Author

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>
Copy link
Contributor

Choose a reason for hiding this comment

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

Typo: FilterProFile (j missing?)

Copy link
Member Author

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,
Copy link
Member

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

Copy link
Member Author

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(
Copy link
Member

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.

Copy link
Member Author

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);
Copy link
Member

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.

Copy link
Member Author

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;
Copy link
Member

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);
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Member Author

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>
Copy link
Member

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?

Copy link
Member Author

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

@ramarag
Copy link
Member Author

ramarag commented Jan 24, 2017

@eerhardt i have addressed your comments


<!--
============================================================
RunResolvePublishAssemblies
Copy link
Member

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.

Copy link
Member Author

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; }
Copy link
Member

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.

  1. Its casing is different than the existing properties.
  2. It is an abbreviation, where the rest aren't.

Copy link
Member Author

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; }
Copy link
Member

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".

Copy link
Member Author

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

Copy link
Member

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; }
Copy link
Member

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.

Copy link
Member Author

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

Copy link
Member Author

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

@ramarag ramarag merged commit 2d2957d into dotnet:future Jan 27, 2017
mmitche pushed a commit to mmitche/sdk that referenced this pull request Jun 5, 2020
…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
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.

5 participants