-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Dotnet cache #591
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 cache #591
Conversation
if (pkginfo != null) | ||
{ | ||
packageDir = pkginfo.PathResolver.GetInstallPath(packageId, version); | ||
packageRoot = pkginfo.PathResolver.GetVersionListPath(""); //TODO Check with nuget if this is the correct way to get the package root |
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 a hack for now, i filed an issue with nuget client and got them to get a change- NuGet/NuGet.Client#1096, that we will use as
FallbackPackagePathInfo.PathResolver.RootPath to get the packageRoot.
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.
If this isn't fixed by the time you check this in, it would be a good idea to put this info into a comment until we can take that new nuget change.
In reply to: 94865939 [](ancestors = 94865939)
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.
Please file an issue on yourself to clean this up and reference the issue in the code. NIT: spacing issues
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 #635
Cleans up the temp directory used by optimize phase | ||
============================================================ | ||
--> | ||
<Target Name="_CleanupTempFiles" |
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.
will also do this at the start of cache phase
<PublishDir Condition="'$(ComposeDir)' == '' and '$(RuntimeIdentifier)' != ''">$(OutputPath)$(RuntimeIdentifier)\</PublishDir> | ||
|
||
<FX_Version Condition="'$(FX_Version)' == ''">$(_ShortFrameworkVersion)</FX_Version> | ||
<_CrossProjFileDir>$([System.IO.Path]::Combine($([System.IO.Path]::GetTempPath()),"Optimize_Crossgen_$(RuntimeIdentifier)_$(TargetFramework)_$(FX_Version)"))</_CrossProjFileDir> |
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.
should change this to be unique to every invocation
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.
Did you mean to include .Microsoft.NET.ComposeCache.targets.swp
? It's showing up as a binary file and I don't know what it's for.
public string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot) | ||
{ | ||
packageRoot = _root; | ||
return Path.Combine(_root, packageId, version.ToNormalizedString(), "path"); |
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.
Call the previous overload of this function here instead of duplicating the logic.
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
@@ -24,27 +25,38 @@ public PublishAssembliesResolver WithPrivateAssets(IEnumerable<string> privateAs | |||
_privateAssetPackageIds = privateAssetPackageIds; | |||
return this; | |||
} | |||
public PublishAssembliesResolver PreserveCacheLayout(string cond) |
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 is this method taking a string
and trying to convert to a bool
instead of just taking a bool
directly? Also, the parameter should be named preserveCacheLayout
or similar instead of cond
.
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: With
PreserveCacheLayout()
.
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
@@ -29,7 +29,8 @@ public class ResolvePublishAssemblies : TaskBase | |||
public string PlatformLibraryName { get; set; } | |||
|
|||
public ITaskItem[] PrivateAssetsPackageReferences { get; set; } | |||
|
|||
|
|||
public string PreserveCacheLayout { 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.
Change this to be of type bool
and MSBuild will handle the conversion.
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
<PublishDir Condition="'$(ComposeDir)' == '' and '$(RuntimeIdentifier)' != ''">$(OutputPath)$(RuntimeIdentifier)\</PublishDir> | ||
|
||
<FX_Version Condition="'$(FX_Version)' == ''">$(_ShortFrameworkVersion)</FX_Version> | ||
<_CrossProjFileDir>$([System.IO.Path]::Combine($([System.IO.Path]::GetTempPath()),"Optimize_Crossgen_$(RuntimeIdentifier)_$(TargetFramework)_$(FX_Version)"))</_CrossProjFileDir> |
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 think using a path inside the temp path for this risks build failures if two different builds on the same machine try to write to the same folder.
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.
Is there any reason not to use a folder under the intermediate output path for this?
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 have already called this out in #591 (comment)
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
============================================================ | ||
--> | ||
<Target Name="_CopyResolvedManagedFiles" | ||
DependsOnTargets="_ComputeResolvedFilesToCachTypes; |
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 looks like there's an 'e' missing in "Cache" for _ComputeResolvedFilesToCachTypes
<_AssembliestoCrossGen Include="$(_RuntimeDir)\**\*.*" /> | ||
</ItemGroup> | ||
|
||
<Error Text="Error more than one coreclr found !" Condition="'@(_CoreclrResolvedPath->Count())' > 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.
Strings like these are supposed to be added to Strings.resx and then generated during the build with the NETSdkError
task, so they can be localized.
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
<_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrPath)))</_CoreclrDir> | ||
<_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrDir)))</_CoreclrDir> | ||
<_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrDir)))</_CoreclrDir> | ||
<_CoreclrDir>$([System.IO.Path]::GetDirectoryName($(_CoreclrDir)))</_CoreclrDir> |
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 looks like you're trying to get the relative path ..\..\..\tools
from where the CoreCLR was resolved. I think you can probably do this much more cleanly with Path.GetFullPath() or a similar 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.
done
<_CrossgenDir>$([System.IO.Path]::Combine($(_CoreclrDir),"tools"))</_CrossgenDir> | ||
<!-- TODO override with rid specific tools path for x-arch --> | ||
<_Crossgen>$([System.IO.Path]::Combine($(_CrossgenDir),"crossgen"))</_Crossgen> | ||
<_Crossgen Condition="$(RuntimeIdentifier.StartsWith('win'))">$([System.IO.Path]::Combine($(_CrossgenDir),"crossgen.exe"))</_Crossgen> |
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 seems like this should be based on the current OS you're running on, rather than the target you're crossgen'ing for.
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
<RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier> | ||
</PropertyGroup> | ||
<ItemGroup> | ||
<PackageReference Include="Microsoft.NETCore.App" Version="$(FX_Version)" /> |
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 don't think you need this any more as of #450
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.
Actually the Version of NetcoreApp is specified by the user
@@ -53,13 +54,14 @@ protected override void ExecuteCore() | |||
IEnumerable<ResolvedFile> resolvedAssemblies = | |||
new PublishAssembliesResolver(packageResolver) | |||
.WithPrivateAssets(privateAssetsPackageIds) | |||
.PreserveCacheLayout(PreserveCacheLayout) |
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 should follow the same naming as the existing method. WithPreserveCacheLayout
.
@@ -13,6 +13,7 @@ public class PublishAssembliesResolver | |||
{ | |||
private readonly IPackageResolver _packageResolver; | |||
private IEnumerable<string> _privateAssetPackageIds; | |||
private bool _preserveCacheLayout; |
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 you add a unit test or two for the new behavior?
Along with that idea - it would be good to add an integration test or two in https://github.com/dotnet/sdk/blob/master/test/Microsoft.NET.Publish.Tests/.
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 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.
Added tests
|
||
foreach (LockFileRuntimeTarget runtimeTarget in targetLibrary.RuntimeTargets.FilterPlaceHolderFiles()) | ||
{ | ||
if (string.Equals(runtimeTarget.AssetType, "native", StringComparison.OrdinalIgnoreCase) || | ||
string.Equals(runtimeTarget.AssetType, "runtime", StringComparison.OrdinalIgnoreCase)) | ||
{ | ||
string srcpath = Path.Combine(libraryPath, runtimeTarget.Path); |
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) the casing/naming of this variable doesn't really match existing code. It could be srcPath
or sourcePath
.
{ | ||
if (_preserveCacheLayout) | ||
{ | ||
destpath = Path.GetDirectoryName(libraryPath.Replace(pkgRoot, "")); |
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.
Do you want to replace all the occurences? Or just the beginning? Maybe checking if the libraryPath starts with pkgRoot, then substring the pkgRoot length off of libraryPath.
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.
:+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.
done
{ | ||
SourcePath = Path.GetFullPath(sourcePath); | ||
DestinationSubDirectory = destinationSubDirectory; | ||
AssetType = String.IsNullOrEmpty(assetType) ? String.Empty : assetType.ToLower(); |
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) the typical coding in the dotnet repos is to use string
not String
.
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 does assetType
get a default null?
============================================================ | ||
_RunOptimizer | ||
|
||
Start the optimization face |
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.
face
? Did you mean phase
?
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, thanks
============================================================ | ||
ComposeCache | ||
|
||
The main publish entry point. |
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 must be a copy-paste error.
<!-- | ||
============================================================ | ||
_RestoreCrossgen | ||
Restores netcoreapp and pulbishes it to a temp directory |
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.
typeo pulbishes
============================================================ | ||
--> | ||
<Target Name="_RestoreCrossgen"> | ||
<!-- Restore Crossgen--> |
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) this comment doesn't really add value since it is just repeating the name of the target.
============================================================ | ||
--> | ||
<Target Name="_RunOptimizer" | ||
DependsOnTargets="_ComputeResolvedFilesToCachTypes; |
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) Cach
<!-- TODO override with rid specific tools path for x-arch --> | ||
<_Crossgen>$([System.IO.Path]::Combine($(_CrossgenDir),"crossgen"))</_Crossgen> | ||
<_Crossgen Condition="$(RuntimeIdentifier.StartsWith('win'))">$([System.IO.Path]::Combine($(_CrossgenDir),"crossgen.exe"))</_Crossgen> | ||
<_JitPath>$([System.IO.Path]::Combine($(_NetCoreRefDir),"libclrjit.so"))</_JitPath> |
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.
Does this support OSX? Isn't it dylib
on OSX?
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 should be fixed now
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='coreclr'" /> | ||
<_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)" | ||
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libcoreclr'" /> | ||
<_AssembliestoCrossGen Include="$(_RuntimeDir)\**\*.*" /> |
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.
Don't we want to crossgen ALL of the app's references and the app itself?
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.
Only the managed assemblies, which are copied in step https://github.com/dotnet/sdk/pull/591/files/f8e0bd7d906be1ae3d1f8b105bf539455c3da6ce#diff-8a3d011306d4fb49ae22e3b9f51e2811R309
@@ -8,5 +8,6 @@ namespace Microsoft.NET.Build.Tasks | |||
public interface IPackageResolver | |||
{ | |||
string GetPackageDirectory(string packageId, NuGetVersion version); | |||
string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot); |
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.
We shouldn't need this per the earlier comment.
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 earlier comment #591 (comment) is referring to duplication of logic within the function and not its usage
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.
@srivatsn, what's going to be our policy on breaking changes to API surface area in Microsoft.NET.Build.Tasks. We have stuff that's public for unit testability but not intended to be called by customers. Should we lock it down with IVTA before RTM?
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 one is only breaking if someone implements the interface, which I doubt anyone would do, but my experience with these sorts of things on corefx was traumatic.
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.
@nguerrera correct me if i am wrong- IPackageResolver is more like the interface sdk consumes, kind of like PAL that abstracts Nuget package management. So if the interface changes it is unlikely to ever break our consumers.
As of now this interface is only implemented by sdk
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.
Nothing in Microsoft.NET.Build.Tasks.dll
is meant to be consumed by callers outside of the .targets files in the dotnet/sdk repo. Yes, it says public
and people could try to use the types in this assembly, but we don't package them in any consumable way - i.e. no NuGet package that you can reference and now refer to types in the assembly. If someone tries, and they get broken in the future, they need to fix themselves.
The reason we can't make these types 'internal' and use IVTA right now is because #55 isn't fixed. So the signing of the assemblies gets messed up cross-platform, which leads to complications with IVTA.
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.
If someone tries, and they get broken in the future, they need to fix themselves.
My experience with these statements is that we make them while building v1 and then get blocked from actually breaking anything in v2 no matter how bizarre the use case. I'd rather make things explicitly internal to just avoid having to even discuss such a policy.
The reason we can't make these types 'internal' and use IVTA right now is because #55 isn't fixed.
The current skip-signing condition is too aggressive. Public signing works fine on non-Windows and would allow us to use IVTA with the same key across all platforms.
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 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 @gkhanna79 You can disregard this for this PR.
packageDir = pkginfo.PathResolver.GetInstallPath(packageId, version); | ||
packageRoot = pkginfo.PathResolver.GetVersionListPath(""); //TODO Check with nuget if this is the correct way to get the package root | ||
} | ||
return packageDir; |
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.
Shouldnt the invariant of this function be that it will always return non-null value?
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
|
||
results.AddRange(GetResolvedFiles(targetLibrary.RuntimeAssemblies, libraryPath)); | ||
results.AddRange(GetResolvedFiles(targetLibrary.NativeLibraries, libraryPath)); | ||
results.AddRange(GetResolvedFiles(targetLibrary.RuntimeAssemblies, libraryPath, pkgRoot, "runtime")); |
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.
Will being more specific (about "runtime" and "native") affect other scenarios that use this Resolve 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.
I believe targetLibrary.RuntimeAssemblies by definition are "runtime" assemblies
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 am trying to understand what difference your change brings in from what the code currently is. Can you please elaborate?
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.
When results are getting populated previously we used to lose the information on the type of assemblies, [ their type was explicit due to their nuget layout and way nuget provides them as different lists like-
RuntimeAssemblies - managed code
NativeLibraries - unmanaged code
I am just adding back this information, to be used in filtering the list by the msbuild targets
sourcePath: Path.Combine(libraryPath, runtimeTarget.Path), | ||
destinationSubDirectory: GetRuntimeTargetDestinationSubDirectory(runtimeTarget))); | ||
sourcePath: srcpath, | ||
destinationSubDirectory: GetDestinationSubDirectory(srcpath, |
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.
Wouldnt this result in nullRef exception when GetDestinationSubDirectory returns 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.
GetDestinationSubDirectory is not going to return null, unless the path needed for preservecachelayout=false is null ( i.e GetRuntimeTargetDestinationSubDirectory(runtimeTarget)
namespace Microsoft.NET.Build.Tasks | ||
{ | ||
public class ResolvedFile | ||
{ | ||
public string SourcePath { get; } | ||
|
||
public string DestinationSubDirectory { get; } | ||
|
||
public string AssetType { get; } |
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 not an enum instead of string?
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.
adding
0d906ac
to
6afda82
Compare
1cd7b0b
to
2a93e9f
Compare
@dsplaisted @eerhardt @schellap can i get a sign off ? @srivatsn I do not have any write privileges on the sdk repo, can you do the needful ? |
Can this method not be in a second interface so as to not introduce a breaking change?
Thanks,
Gaurav
-------- Original message --------
From: Nick Guerrera <notifications@github.com>
Date: 1/13/17 9:03 PM (GMT-08:00)
To: dotnet/sdk <sdk@noreply.github.com>
Cc: "Gaurav Khanna (CLR)" <Gaurav.Khanna@microsoft.com>, Mention <mention@noreply.github.com>
Subject: Re: [dotnet/sdk] Dotnet cache (#591)
@nguerrera commented on this pull request.
________________________________
In src/Tasks/Microsoft.NET.Build.Tasks/IPackageResolver.cs<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fsdk%2Fpull%2F591&data=02%7C01%7CGaurav.Khanna%40microsoft.com%7Cd4195c84319f40af912f08d43c3ab096%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636199670149292929&sdata=W7K%2F%2FRTLsLyE6NIWap%2FeGxmJyKd8ezE1J6Dk722xK9I%3D&reserved=0>:
@@ -8,5 +8,6 @@ namespace Microsoft.NET.Build.Tasks
public interface IPackageResolver
{
string GetPackageDirectory(string packageId, NuGetVersion version);
+ string GetPackageDirectory(string packageId, NuGetVersion version, out string packageRoot);
This one is only breaking if someone implements the interface, which I doubt anyone would do, but my experience with these sorts of things on corefx was traumatic.
-
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fdotnet%2Fsdk%2Fpull%2F591&data=02%7C01%7CGaurav.Khanna%40microsoft.com%7Cd4195c84319f40af912f08d43c3ab096%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636199670149292929&sdata=W7K%2F%2FRTLsLyE6NIWap%2FeGxmJyKd8ezE1J6Dk722xK9I%3D&reserved=0>, or mute the thread<https://na01.safelinks.protection.outlook.com/?url=https%3A%2F%2Fgithub.com%2Fnotifications%2Funsubscribe-auth%2FAJA3wWNP1Vuu5scu2ZZvZiBt5DHNqerZks5rSFcjgaJpZM4LcMkm&data=02%7C01%7CGaurav.Khanna%40microsoft.com%7Cd4195c84319f40af912f08d43c3ab096%7C72f988bf86f141af91ab2d7cd011db47%7C1%7C0%7C636199670149292929&sdata=tCiNVh8WVGlnqCsGeSpQNMkx5%2FMFjQ9p9EYBFjQEcPA%3D&reserved=0>.
|
I have made all changes that are required for dotnet cache in sdk repo signoffs ? |
59ed07c
to
9dc35d6
Compare
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0"> | ||
<ItemGroup> | ||
<PackageReference Include="System.Private.Uri" Version="4.4.0-beta-24821-02" /> | ||
<PackageReference Include="Microsoft.NETCore.CoreDisTools" Version="1.0.1-prerelease-00001" /> |
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.
Does this package need to be referenced in order to run the ComposeCache
target? Should there be a test of a "normal" test app, like https://github.com/dotnet/sdk/blob/master/TestAssets/TestProjects/SimpleDependencies/SimpleDependencies.csproj?
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 cache step is used to prime the assemblies. the run step will only occur after publish with filter profile. The CoreDistTools are unmanaged native component. I do not see the need for a SimpleManaged test. Will add one when i do publish PR
namespace Microsoft.NET.Build.Tasks | ||
{ | ||
public enum AssetType | ||
{ | ||
none, |
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.
Enum values are normally PascalCased.
DayOfWeek.Sunday
, StringComparison.Ordinal
, etc.
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
other.SourcePath == SourcePath && | ||
other.DestinationSubDirectory == DestinationSubDirectory; | ||
; |
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.
unnecessary
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.
removed
@@ -29,7 +29,8 @@ public class ResolvePublishAssemblies : TaskBase | |||
public string PlatformLibraryName { get; set; } | |||
|
|||
public ITaskItem[] PrivateAssetsPackageReferences { get; set; } | |||
|
|||
|
|||
public bool preserveCacheLayout { 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.
Public properties should be PascalCased.
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
namespace Microsoft.NET.Build.Tasks | ||
{ | ||
public enum AssetType |
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.
NuGet doesn't seem to have an enum for AssetType, do we need one? We are just turning strings into this enum, and then back into strings to put on Item metadata. Is the enum necessary?
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 Enum is convenient for reasoning on the types of assets we are dealing with
one of these files and not have an incremental build replace it. | ||
--> | ||
<Copy SourceFiles = "@(_ManagedResolvedFileToPublish)" | ||
DestinationFiles="$(PublishDir)%(RecursiveDir)%(Filename)%(Extension)" |
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.
We fixed a bug the way Publish copies files and the bug seems to be duplicated here. See #581
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 am going to copy the files every time, will remove the comments
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="$(MSBuildToolsVersion)"> | ||
<PropertyGroup> | ||
<TargetFramework>$(_TFM)</TargetFramework> | ||
<RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier> |
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 seems redundant. It is setting a property to itself.
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 used to generate the Project to restore crossgen, the Alternative is to pass it as parameter to the Restore Target. I will leave it here for increased diagnosability
51af688
to
55b7cda
Compare
|
||
<!-- CrossGen the assemblies --> | ||
<Message Text="$(_Crossgen) -readytorun -in %(_AssembliestoCrossGen.Fullpath) -out $([System.IO.Path]::Combine($(_RuntimeOptimizedDir),%(RecursiveDir)%(Filename)%(Extension))) -jitpath $(_JitPath) -platform_assemblies_paths $(_RuntimeRefDir)$(PathSeparator)$(_NetCoreRefDir)"/> | ||
<Exec |
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.
Currently the Exec tasks are running sequentially
@eerhardt @dsplaisted any ideas on making them run in parallel ?
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.
http://stackoverflow.com/questions/997047/how-to-run-tasks-in-parallel-in-msbuild
AFAIK, the only way you can parallelize work in MSBuild is to split the work into separate MSBuild
invocations. That was the answer 7 years ago, and I'm assuming it is still the same answer.
@rainersigwald @jeffkl @cdmihai - in case they know of a 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.
Running things in parallel while waiting until they are all complete is a hard enough problem as it is :) The <Exec />
task certainly can't do this and parallel-ism in MSBuild (AFAIK) is for building at the same time not executing targets or tasks.
What would work best is use a Task
from a task library that can do this in parallel which would give you a lot of options including better logging, caching, etc. Maybe someone should work on a CrossGen MSBuild task?
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.
That's correct, no way to do this within a project. You can create a new project that just does this work and invoke it multiple times in parallel, or you could invoke a target on this project multiple times in parallel.
d6dafc9
to
5e0d6e8
Compare
@schellap @nguerrera @eerhardt @gkhanna79 @srivatsn PTAL
This is the implementation towards #554