Skip to content

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

Merged
merged 2 commits into from
Jan 21, 2017
Merged

Dotnet cache #591

merged 2 commits into from
Jan 21, 2017

Conversation

ramarag
Copy link
Member

@ramarag ramarag commented Jan 5, 2017

@schellap @nguerrera @eerhardt @gkhanna79 @srivatsn PTAL

This is the implementation towards #554

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

Copy link
Member

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)

Copy link

@schellap schellap Jan 9, 2017

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

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 #635

Cleans up the temp directory used by optimize phase
============================================================
-->
<Target Name="_CleanupTempFiles"
Copy link
Member Author

@ramarag ramarag Jan 6, 2017

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

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

Copy link
Member

@dsplaisted dsplaisted left a 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");
Copy link
Member

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.

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

@@ -24,27 +25,38 @@ public PublishAssembliesResolver WithPrivateAssets(IEnumerable<string> privateAs
_privateAssetPackageIds = privateAssetPackageIds;
return this;
}
public PublishAssembliesResolver PreserveCacheLayout(string cond)
Copy link
Member

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.

Copy link

Choose a reason for hiding this comment

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

NIT: With PreserveCacheLayout().

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

@@ -29,7 +29,8 @@ public class ResolvePublishAssemblies : TaskBase
public string PlatformLibraryName { get; set; }

public ITaskItem[] PrivateAssetsPackageReferences { get; set; }


public string PreserveCacheLayout { 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.

Change this to be of type bool and MSBuild will handle the conversion.

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

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

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.

Copy link
Member

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?

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 have already called this out in #591 (comment)

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

============================================================
-->
<Target Name="_CopyResolvedManagedFiles"
DependsOnTargets="_ComputeResolvedFilesToCachTypes;
Copy link
Member

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())' &gt; 1" />
Copy link
Member

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.

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

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

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.

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

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

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.

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

<RuntimeIdentifier>$(RuntimeIdentifier)</RuntimeIdentifier>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NETCore.App" Version="$(FX_Version)" />
Copy link
Member

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

Copy link
Member Author

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

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

Copy link

Choose a reason for hiding this comment

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

👍 for @eerhardt's comment. @ramarag it is important that an end to end test exercises this functionality as dotnet cache is the only one that'd exercise the preserveCacheLayout. Please file an issue and try to close it when you are ready to commit this PR.

Copy link
Member Author

@ramarag ramarag Jan 13, 2017

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

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

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.

Copy link

Choose a reason for hiding this comment

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

:+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.

done

{
SourcePath = Path.GetFullPath(sourcePath);
DestinationSubDirectory = destinationSubDirectory;
AssetType = String.IsNullOrEmpty(assetType) ? String.Empty : assetType.ToLower();
Copy link
Member

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.

Copy link

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

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?

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, thanks

============================================================
ComposeCache

The main publish entry point.
Copy link
Member

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

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

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

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

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?

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 should be fixed now

Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='coreclr'" />
<_CoreclrResolvedPath Include="@(CrossgenResolvedAssembliesToPublish)"
Condition="'%(CrossgenResolvedAssembliesToPublish.Filename)'=='libcoreclr'" />
<_AssembliestoCrossGen Include="$(_RuntimeDir)\**\*.*" />
Copy link
Member

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

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

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.

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 earlier comment #591 (comment) is referring to duplication of logic within the function and not its usage

Copy link
Contributor

@nguerrera nguerrera Jan 14, 2017

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?

Copy link
Contributor

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.

Copy link
Member Author

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

Copy link
Member

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.

Copy link
Contributor

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.

Copy link
Contributor

Choose a reason for hiding this comment

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

Copy link
Contributor

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

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?

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


results.AddRange(GetResolvedFiles(targetLibrary.RuntimeAssemblies, libraryPath));
results.AddRange(GetResolvedFiles(targetLibrary.NativeLibraries, libraryPath));
results.AddRange(GetResolvedFiles(targetLibrary.RuntimeAssemblies, libraryPath, pkgRoot, "runtime"));
Copy link
Member

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?

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 believe targetLibrary.RuntimeAssemblies by definition are "runtime" assemblies

Copy link
Member

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?

Copy link
Member Author

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

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?

Copy link
Member Author

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

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?

Copy link
Member Author

Choose a reason for hiding this comment

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

adding

@ramarag ramarag force-pushed the dotnet-cache branch 4 times, most recently from 0d906ac to 6afda82 Compare January 14, 2017 04:32
@ramarag ramarag changed the title [WIP] Dotnet cache Dotnet cache Jan 14, 2017
@ramarag ramarag force-pushed the dotnet-cache branch 2 times, most recently from 1cd7b0b to 2a93e9f Compare January 14, 2017 04:48
@ramarag
Copy link
Member Author

ramarag commented Jan 14, 2017

@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 ?

@gkhanna79
Copy link
Member

gkhanna79 commented Jan 14, 2017 via email

@ramarag
Copy link
Member Author

ramarag commented Jan 17, 2017

I have made all changes that are required for dotnet cache in sdk repo
@dsplaisted @eerhardt @schellap @nguerrera is there anything else that needs to be changed ?

signoffs ?

@ramarag ramarag force-pushed the dotnet-cache branch 2 times, most recently from 59ed07c to 9dc35d6 Compare January 18, 2017 03:46
<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" />
Copy link
Member

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?

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

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.

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

other.SourcePath == SourcePath &&
other.DestinationSubDirectory == DestinationSubDirectory;
;
Copy link
Member

Choose a reason for hiding this comment

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

unnecessary

Copy link
Member Author

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

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.

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

namespace Microsoft.NET.Build.Tasks
{
public enum AssetType
Copy link
Member

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?

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

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

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

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.

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

@ramarag ramarag force-pushed the dotnet-cache branch 2 times, most recently from 51af688 to 55b7cda Compare January 18, 2017 23:00
@ramarag ramarag self-assigned this Jan 19, 2017

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

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 ?

Copy link
Member

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

Copy link
Contributor

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?

Copy link
Member

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.

@ramarag ramarag force-pushed the dotnet-cache branch 3 times, most recently from d6dafc9 to 5e0d6e8 Compare January 21, 2017 05:52
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.

9 participants