Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
05e97c3
Refactor TargetManifest parsing into separate target and raise runtim…
eerhardt May 20, 2017
ff2ccb3
Don't copy runtime store assemblies to 'refs'
eerhardt May 23, 2017
68746af
Add test for PreserveCompilationContext + runtime store.
eerhardt May 23, 2017
0038c5a
Automatically set Link metadata on items outside the project folder
dsplaisted May 24, 2017
5a88319
Fix test for whether items are inside the project directory on non-Wi…
dsplaisted May 24, 2017
9cd7443
Merge pull request #1247 from livarcocc/merge_master
May 24, 2017
afeec7b
Respond to PR feedback.
eerhardt May 24, 2017
44ebdae
Merge branch 'release/2.0.0' into Fix1216
eerhardt May 24, 2017
1e87e64
Simplify conditions for automatically setting link metadata
dsplaisted May 24, 2017
d5b0fe6
Add logic to roll forward to patch versions of .NET Core for self-con…
dsplaisted May 17, 2017
0e6652d
Merge pull request #1245 from eerhardt/Fix1216
eerhardt May 24, 2017
325c345
Apply code review feedback
dsplaisted May 24, 2017
935c5a1
Merge pull request #1222 from dsplaisted/983-implicit-patch
dsplaisted May 24, 2017
4f396b2
Generate an error if targeting a version of .NET Core or .NET Standar…
dsplaisted May 25, 2017
7a82cab
Update CLI version to 2.0.0-preview2-006189
eerhardt May 25, 2017
058e79b
Merge pull request #1254 from dotnet/eerhardt-patch-1
eerhardt May 25, 2017
9c1e948
Fix whitespace
dsplaisted May 25, 2017
f36dfbc
Merge pull request #1253 from dsplaisted/1194-cap-target-versions
dsplaisted May 25, 2017
6117f89
Make AssemblyInfo generation respect property changes on incremental …
dasMulli May 25, 2017
f9ddc86
Changed target dependency definitions and created public GetAssemblyA…
dasMulli May 25, 2017
b20dc82
Don't pass duplicate items to conflict resolution if CopyLocalLockFil…
dsplaisted May 25, 2017
e321f3c
Merge pull request #1246 from dsplaisted/1115-LinkBase
dsplaisted May 25, 2017
ea14363
Merge branch 'release/2.0.0' into feature/incremental-assembly-attrib…
dasMulli May 26, 2017
320e6b9
Merge pull request #1255 from dasMulli/feature/incremental-assembly-a…
nguerrera May 26, 2017
8952139
Don't generate deps or runtimeconfig files when build has failed but …
dsplaisted May 26, 2017
90612fd
Switch to better check that there's only one error when reference ass…
dsplaisted May 26, 2017
184ad01
Include log files in Jenkins archive
dsplaisted May 26, 2017
f5ab65b
Merge pull request #1260 from dsplaisted/archive-log
dsplaisted May 26, 2017
e853bf9
Merge pull request #1256 from dsplaisted/1135-extra-conflicts
dsplaisted May 26, 2017
f8f29fa
Merge pull request #1257 from dsplaisted/1234-runtime-config-on-failure
dsplaisted May 26, 2017
9081105
Merge branch 'release/2.0.0' into merge-release
nguerrera May 30, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion DotnetCLIVersion.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2.0.0-preview2-006082
2.0.0-preview2-006189
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="9.0.1" />
<PackageReference Include="System.Data.SqlClient" Version="4.3.0" />
</ItemGroup>
</Project>
8 changes: 8 additions & 0 deletions TestAssets/TestProjects/LinkTest/LinkTest/Class1.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace LinkTest
{
public class Class1
{
}
}
63 changes: 63 additions & 0 deletions TestAssets/TestProjects/LinkTest/LinkTest/LinkTest.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<ItemGroup Condition="'$(IncludeWithGlob)' == 'true' And '$(UseLinkBase)' == 'true'">
<Compile Include="..\Linked\**\*.cs" LinkBase="Linked\Files" />
<AdditionalFiles Include="..\Linked\**\*.Additional.txt" LinkBase="Linked\Files" />
<None Include="..\Linked\**\*.None.txt" LinkBase="Linked\Files" />
<Content Include="..\Linked\**\*.Content.txt" LinkBase="Linked\Files" />
<EmbeddedResource Include="..\Linked\**\*.Embedded.txt" LinkBase="Linked\Files" />
<CustomItem Include="..\Linked\**\*.Custom.txt" LinkBase="Linked\Files" />
</ItemGroup>

<ItemGroup Condition="'$(IncludeWithGlob)' == 'true' And '$(UseLinkBase)' != 'true'">
<Compile Include="..\Linked\**\*.cs" />
<AdditionalFiles Include="..\Linked\**\*.Additional.txt" />
<None Include="..\Linked\**\*.None.txt" />
<Content Include="..\Linked\**\*.Content.txt" />
<EmbeddedResource Include="..\Linked\**\*.Embedded.txt" />
<CustomItem Include="..\Linked\**\*.Custom.txt" />
</ItemGroup>

<ItemGroup Condition="'$(IncludeWithGlob)' != 'true' And '$(UseLinkBase)' == 'true'">
<Compile Include="..\Linked\Linked.Class.cs" LinkBase="Linked\Files"/>
<AdditionalFiles Include="..\Linked\Linked.Additional.txt" LinkBase="Linked\Files"/>
<None Include="..\Linked\Linked.None.txt" LinkBase="Linked\Files"/>
<Content Include="..\Linked\Linked.Content.txt" LinkBase="Linked\Files"/>
<EmbeddedResource Include="..\Linked\Linked.Embedded.txt" LinkBase="Linked\Files"/>
<CustomItem Include="..\Linked\*Linked.Custom.txt" LinkBase="Linked\Files"/>
</ItemGroup>

<ItemGroup Condition="'$(IncludeWithGlob)' != 'true' And '$(UseLinkBase)' != 'true'">
<Compile Include="..\Linked\Linked.Class.cs"/>
<AdditionalFiles Include="..\Linked\Linked.Additional.txt" />
<None Include="..\Linked\Linked.None.txt" />
<Content Include="..\Linked\Linked.Content.txt" />
<EmbeddedResource Include="..\Linked\Linked.Embedded.txt" />
<CustomItem Include="..\Linked\*Linked.Custom.txt" />
</ItemGroup>


<Target Name="WriteItems" DependsOnTargets="Compile">
<ItemGroup>
<LinesToWrite Include="Compile%09%(Compile.FullPath)%09%(Compile.Link)" />
<LinesToWrite Include="AdditionalFiles%09%(AdditionalFiles.FullPath)%09%(AdditionalFiles.Link)" />
<LinesToWrite Include="None%09%(None.FullPath)%09%(None.Link)" />
<LinesToWrite Include="Content%09%(Content.FullPath)%09%(Content.Link)" />
<LinesToWrite Include="EmbeddedResource%09%(EmbeddedResource.FullPath)%09%(EmbeddedResource.Link)" />
<LinesToWrite Include="CustomItem%09%(CustomItem.FullPath)%09%(CustomItem.Link)" />
</ItemGroup>

<WriteLinesToFile
File="$(IntermediateOutputPath)\Items.txt"
Lines="@(LinesToWrite)"
Overwrite="true"
Encoding="Unicode"
/>
</Target>


</Project>
Empty file.
8 changes: 8 additions & 0 deletions TestAssets/TestProjects/LinkTest/Linked/A/B C/Linked.Class.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace LinkTest
{
public class LinkedSubClass
{
}
}
Empty file.
Empty file.
Empty file.
Empty file.
Empty file.
8 changes: 8 additions & 0 deletions TestAssets/TestProjects/LinkTest/Linked/Linked.Class.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
using System;

namespace LinkTest
{
public class LinkedClass
{
}
}
Empty file.
Empty file.
Empty file.
Empty file.
1 change: 1 addition & 0 deletions netci.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ ${buildCommand}""")

def archiveSettings = new ArchivalSettings()
archiveSettings.addFiles("bin/**/*")
archiveSettings.addFiles("bin/log/**/*")
archiveSettings.excludeFiles("bin/obj/*")
archiveSettings.setFailIfNothingArchived()
archiveSettings.setArchiveOnFailure()
Expand Down
10 changes: 3 additions & 7 deletions src/Tasks/Microsoft.NET.Build.Tasks/DependencyContextBuilder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ internal class DependencyContextBuilder
private IEnumerable<string> _excludeFromPublishPackageIds;
private CompilationOptions _compilationOptions;
private string _referenceAssembliesPath;
private Dictionary<PackageIdentity, StringBuilder> _filteredPackages;
private Dictionary<PackageIdentity, string> _filteredPackages;
private bool _includeMainProjectInDepsFile = true;

public DependencyContextBuilder(SingleProjectInfo mainProjectInfo, ProjectContext projectContext)
Expand Down Expand Up @@ -82,7 +82,7 @@ public DependencyContextBuilder WithReferenceAssembliesPath(string referenceAsse
return this;
}

public DependencyContextBuilder WithPackagesThatWhereFiltered(Dictionary<PackageIdentity, StringBuilder> packagesThatWhereFiltered)
public DependencyContextBuilder WithPackagesThatWhereFiltered(Dictionary<PackageIdentity, string> packagesThatWhereFiltered)
{
_filteredPackages = packagesThatWhereFiltered;
return this;
Expand Down Expand Up @@ -223,11 +223,7 @@ private RuntimeLibrary CreateRuntimeLibrary(
{
string runtimeStoreManifestName = null;
var pkg = new PackageIdentity(name, NuGetVersion.Parse(version));
StringBuilder listofManifests = null;
if (_filteredPackages?.TryGetValue(pkg, out listofManifests) == true)
{
runtimeStoreManifestName = listofManifests.ToString();
}
_filteredPackages?.TryGetValue(pkg, out runtimeStoreManifestName);

return new RuntimeLibrary(
type,
Expand Down
48 changes: 48 additions & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/FindItemsFromPackages.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Build.Framework;
using NuGet.Packaging.Core;
using System.Collections.Generic;
using System.Linq;

namespace Microsoft.NET.Build.Tasks
{
/// <summary>
/// Returns the ITaskItem values in Items that were resolved from the specified
/// set of Packages.
/// </summary>
/// <remarks>
/// Both Items and Packages are expected to have 'PackageName' and 'PackageVersion'
/// metadata properties to use for the matching.
/// </remarks>
public sealed class FindItemsFromPackages : TaskBase
{
[Required]
public ITaskItem[] Items { get; set; }

[Required]
public ITaskItem[] Packages { get; set; }

[Output]
public ITaskItem[] ItemsFromPackages { get; private set; }

protected override void ExecuteCore()
{
var packageIdentities = new HashSet<PackageIdentity>(
Packages.Select(p => ItemUtilities.GetPackageIdentity(p)));

var itemsFromPackages = new List<ITaskItem>();
foreach (ITaskItem item in Items)
{
PackageIdentity identity = ItemUtilities.GetPackageIdentity(item);
if (identity != null && packageIdentities.Contains(identity))
{
itemsFromPackages.Add(item);
}
}

ItemsFromPackages = itemsFromPackages.ToArray();
}
}
}
37 changes: 11 additions & 26 deletions src/Tasks/Microsoft.NET.Build.Tasks/GenerateDepsFile.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,11 @@
using Newtonsoft.Json;
using NuGet.Packaging.Core;
using NuGet.ProjectModel;
using NuGet.Versioning;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Linq;
using System.Text;

namespace Microsoft.NET.Build.Tasks
{
Expand Down Expand Up @@ -65,7 +64,7 @@ public class GenerateDepsFile : TaskBase

public ITaskItem[] ExcludeFromPublishPackageReferences { get; set; }

public string[] TargetManifestFileList { get; set; }
public ITaskItem[] RuntimeStorePackages { get; set; }

public bool IsSelfContained { get; set; }

Expand All @@ -80,35 +79,21 @@ public ITaskItem[] FilesWritten
private Dictionary<string, HashSet<string>> compileFilesToSkip = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);
private Dictionary<string, HashSet<string>> runtimeFilesToSkip = new Dictionary<string, HashSet<string>>(StringComparer.OrdinalIgnoreCase);

private Dictionary<PackageIdentity, StringBuilder> GetFilteredPackages()
private Dictionary<PackageIdentity, string> GetFilteredPackages()
{
Dictionary<PackageIdentity, StringBuilder> filteredPackages = null;
Dictionary<PackageIdentity, string> filteredPackages = null;

if (TargetManifestFileList != null && TargetManifestFileList.Length > 0)
if (RuntimeStorePackages != null && RuntimeStorePackages.Length > 0)
{
filteredPackages = new Dictionary<PackageIdentity, StringBuilder>();

foreach (var targetManifestFile in TargetManifestFileList)
filteredPackages = new Dictionary<PackageIdentity, string>();
foreach (var package in RuntimeStorePackages)
{
Log.LogMessage(MessageImportance.Low, string.Format(CultureInfo.CurrentCulture, Strings.ParsingFiles, targetManifestFile));
var packagesSpecified = StoreArtifactParser.Parse(targetManifestFile);
var targetManifestFileName = Path.GetFileName(targetManifestFile);

foreach (var pkg in packagesSpecified)
{
Log.LogMessage(MessageImportance.Low, string.Format(CultureInfo.CurrentCulture, Strings.PackageInfoLog, pkg.Id, pkg.Version));
StringBuilder fileList;
if (filteredPackages.TryGetValue(pkg, out fileList))
{
fileList.Append($";{targetManifestFileName}");
}
else
{
filteredPackages.Add(pkg, new StringBuilder(targetManifestFileName));
}
}
filteredPackages.Add(
ItemUtilities.GetPackageIdentity(package),
package.GetMetadata(MetadataKeys.RuntimeStoreManifestNames));
}
}

return filteredPackages;
}

Expand Down
19 changes: 18 additions & 1 deletion src/Tasks/Microsoft.NET.Build.Tasks/ItemUtilities.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using System;
using Microsoft.Build.Framework;
using Microsoft.NET.Build.Tasks.ConflictResolution;
using NuGet.Packaging.Core;
using NuGet.Versioning;
using System;
using System.IO;

namespace Microsoft.NET.Build.Tasks
Expand Down Expand Up @@ -132,5 +134,20 @@ public static string GetTargetPath(ITaskItem item)

return Path.GetFileName(sourcePath);
}

public static PackageIdentity GetPackageIdentity(ITaskItem item)
{
string packageName = item.GetMetadata(MetadataKeys.PackageName);
string packageVersion = item.GetMetadata(MetadataKeys.PackageVersion);

if (string.IsNullOrEmpty(packageName) || string.IsNullOrEmpty(packageVersion))
{
return null;
}

return new PackageIdentity(
packageName,
NuGetVersion.Parse(packageVersion));
}
}
}
3 changes: 3 additions & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/MetadataKeys.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,5 +47,8 @@ internal static class MetadataKeys
public const string StartColumn = "StartColumn";
public const string EndLine = "EndLine";
public const string EndColumn = "EndColumn";

// Publish Target Manifest
public const string RuntimeStoreManifestNames = "RuntimeStoreManifestNames";
}
}
71 changes: 71 additions & 0 deletions src/Tasks/Microsoft.NET.Build.Tasks/ParseTargetManifests.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
// Copyright (c) .NET Foundation and contributors. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using NuGet.Packaging.Core;
using System;
using System.Collections.Generic;
using System.Globalization;
using System.IO;
using System.Text;

namespace Microsoft.NET.Build.Tasks
{
/// <summary>
/// Parses the target manifest files into MSBuild Items.
/// </summary>
public sealed class ParseTargetManifests : TaskBase
{
public string TargetManifestFiles { get; set; }

[Output]
public ITaskItem[] RuntimeStorePackages { get; private set; }

protected override void ExecuteCore()
{
string[] targetManifestFileList = TargetManifestFiles?.Split(new[] { ';' }, StringSplitOptions.RemoveEmptyEntries);

if (targetManifestFileList != null && targetManifestFileList.Length > 0)
{
var runtimeStorePackages = new Dictionary<PackageIdentity, StringBuilder>();
foreach (var manifestFile in targetManifestFileList)
{
Log.LogMessage(MessageImportance.Low, string.Format(CultureInfo.CurrentCulture, Strings.ParsingFiles, manifestFile));
var packagesSpecified = StoreArtifactParser.Parse(manifestFile);
var targetManifestFileName = Path.GetFileName(manifestFile);

foreach (var pkg in packagesSpecified)
{
Log.LogMessage(MessageImportance.Low, string.Format(CultureInfo.CurrentCulture, Strings.PackageInfoLog, pkg.Id, pkg.Version));
StringBuilder fileList;
if (runtimeStorePackages.TryGetValue(pkg, out fileList))
{
fileList.Append($";{targetManifestFileName}");
}
else
{
runtimeStorePackages.Add(pkg, new StringBuilder(targetManifestFileName));
}
}
}

var resultPackages = new List<ITaskItem>();
foreach (var storeEntry in runtimeStorePackages)
{
string packageName = storeEntry.Key.Id;
string packageVersion = storeEntry.Key.Version.ToNormalizedString();

TaskItem item = new TaskItem($"{packageName}/{packageVersion}");
item.SetMetadata(MetadataKeys.PackageName, packageName);
item.SetMetadata(MetadataKeys.PackageVersion, packageVersion);
item.SetMetadata(MetadataKeys.RuntimeStoreManifestNames, storeEntry.Value.ToString());

resultPackages.Add(item);
}

RuntimeStorePackages = resultPackages.ToArray();
}
}
}
}
Loading