Skip to content
This repository was archived by the owner on Jan 11, 2024. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
Original file line number Diff line number Diff line change
Expand Up @@ -15,26 +15,30 @@ namespace Microsoft.DotNet.Build.Tasks.Packaging
public class CreateTrimDependencyGroups : PackagingTask
{
[Required]
public string FrameworkListsPath
public ITaskItem[] Dependencies
{
get;
set;
}

[Required]
public ITaskItem[] Dependencies
public ITaskItem[] Files
{
get;
set;
}

/// <summary>
/// Package index files used to define stable package list.
/// </summary>
[Required]
public ITaskItem[] Files
public ITaskItem[] PackageIndexes
{
get;
set;
}


[Output]
public ITaskItem[] TrimmedDependencies
{
Expand All @@ -53,12 +57,14 @@ public override bool Execute()
Log.LogError("Dependencies argument must be specified");
return false;
}
if (null == FrameworkListsPath)
if (PackageIndexes == null && PackageIndexes.Length == 0)
{
Log.LogError("FrameworkListsPath argument must be specified");
Log.LogError("PackageIndexes argument must be specified");
return false;
}

var index = PackageIndex.Load(PackageIndexes.Select(pi => pi.GetMetadata("FullPath")));

// Retrieve the list of generation dependency group TFM's
var dependencyGroups = Dependencies.GroupBy(d => d.GetMetadata("TargetFramework")).Select(dg => new
{
Expand All @@ -82,7 +88,7 @@ public override bool Execute()
{
// Determine inbox frameworks for this generation that don't already have explicit groups
HashSet<NuGetFramework> inboxFrameworksList = new HashSet<NuGetFramework>(
Frameworks.GetAlllInboxFrameworks(FrameworkListsPath)
index.GetAlllInboxFrameworks()
.Where(fx => !fx.IsPCL)
.Where(fx => Generations.DetermineGenerationForFramework(fx, UseNetPlatform) >= portableDependencyGroup.Framework.Version &&
!frameworksToExclude.Any(exFx => exFx.Framework == fx.Framework && exFx.Version <= fx.Version)));
Expand All @@ -103,7 +109,7 @@ public override bool Execute()
{
string version = GetVersion(dependency);

if (!Frameworks.IsInbox(FrameworkListsPath, framework, dependency.ItemSpec, version))
if (!index.IsInbox(dependency.ItemSpec, framework, version))
{
addedDependencyToFramework = true;
AddDependency(addedDependencies, new TaskItem(dependency), framework, portableDependencyGroup.Framework);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public ITaskItem[] Frameworks
public string RuntimeFile { get; set; }

[Required]
public string FrameworkListsPath
public ITaskItem[] PackageIndexes
{
get;
set;
Expand Down Expand Up @@ -234,10 +234,8 @@ private void LoadFrameworks()
}

// inspect any TFMs inbox
var frameworkData = FrameworkSet.Load(FrameworkListsPath);
var inboxFrameworks = frameworkData.Frameworks.SelectMany(f => f.Value)
.Where(fx => fx.Assemblies.ContainsKey(PackageId))
.Select(fx => NuGetFramework.Parse(fx.FrameworkName.FullName));
var index = PackageIndex.Load(PackageIndexes.Select(pi => pi.GetMetadata("FullPath")));
var inboxFrameworks = index.GetInboxFrameworks(PackageId).NullAsEmpty();

foreach (var inboxFramework in inboxFrameworks)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,14 @@
using Microsoft.Build.Utilities;
using System;
using System.IO;
using System.Linq;

namespace Microsoft.DotNet.Build.Tasks.Packaging
{
public class GetInboxFrameworks : PackagingTask
{
[Required]
public string FrameworkListsPath
public ITaskItem[] PackageIndexes
{
get;
set;
Expand Down Expand Up @@ -40,9 +41,9 @@ public string[] InboxFrameworks

public override bool Execute()
{
if (null == FrameworkListsPath)
if (PackageIndexes == null && PackageIndexes.Length == 0)
{
Log.LogError("FrameworkListsPath argument must be specified");
Log.LogError("PackageIndexes argument must be specified");
return false;
}

Expand All @@ -52,16 +53,11 @@ public override bool Execute()
return false;
}

if (!Directory.Exists(FrameworkListsPath))
{
Log.LogError("FrameworkListsPath '{0}' does not exist", FrameworkListsPath);
return false;
}

Log.LogMessage(LogImportance.Low, "Determining inbox frameworks for {0}, {1}", AssemblyName, AssemblyVersion);

var index = PackageIndex.Load(PackageIndexes.Select(pi => pi.GetMetadata("FullPath")));


InboxFrameworks = Frameworks.GetInboxFrameworksList(FrameworkListsPath, AssemblyName, AssemblyVersion, Log);
InboxFrameworks = index.GetInboxFrameworks(AssemblyName, AssemblyVersion).Select(fx => fx.GetShortFolderName()).ToArray();

return !Log.HasLoggedErrors;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ public class GetPackageFromModule : PackagingTask

public override bool Execute()
{
Dictionary<string, string> modulesToPackages;
IDictionary<string, string> modulesToPackages;

if (PackageIndexes != null && PackageIndexes.Length > 0)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@
<Compile Include="CreateTrimDependencyGroups.cs" />
<Compile Include="ApplyBaseLine.cs" />
<Compile Include="Extensions.cs" />
<Compile Include="Framework.cs" />
<Compile Include="FrameworkUtilities.cs" />
<Compile Include="GenerateNuSpec.cs" />
<Compile Include="GenerateRuntimeDependencies.cs" />
Expand All @@ -66,14 +65,16 @@
<Compile Include="VersionUtility.cs" />
</ItemGroup>
<ItemGroup>
<None Include="PackageFiles\Packaging.targets">
<None Include="$(MSBuildThisFileDirectory)PackageFiles\Packaging.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<SubType>Designer</SubType>
</None>
<None Include="PackageFiles\PackageLibs.targets">
<None Include="$(MSBuildThisFileDirectory)PackageFiles\Packaging.common.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="PackageFiles\_._">
<None Include="$(MSBuildThisFileDirectory)PackageFiles\PackageLibs.targets">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="$(MSBuildThisFileDirectory)PackageFiles\_._">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Include="project.json" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<PackagingTaskDir Condition="'$(PackagingTaskDir)' == ''">$(MSBuildThisFileDirectory)</PackagingTaskDir>
<GenerationDefinitionFile Condition="'$(GenerationDefinitionFile)' == ''">$(MSBuildThisFileDirectory)Generations.json</GenerationDefinitionFile>
<RuntimeIdGraphDefinitionFile Condition="'$(RuntimeIdGraphDefinitionFile)' == '' AND Exists('$(ProjectDir)pkg/Microsoft.NETCore.Platforms/runtime.json')">$(ProjectDir)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeIdGraphDefinitionFile>
<RuntimeIdGraphDefinitionFile Condition="'$(RuntimeIdGraphDefinitionFile)' == ''">$(MSBuildThisFileDirectory)runtime.json</RuntimeIdGraphDefinitionFile>
</PropertyGroup>

<UsingTask TaskName="GetApplicableAssetsFromPackages" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetPackageDestination" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<Import Condition="'$(_PackagingCommonTargetsImported)' != 'true'" Project="Packaging.common.targets"/>

<Target Name="UpdatePkgProjProjectReferences" BeforeTargets="AssignProjectConfiguration">
<!-- Update PkgProj references to call the GetPackageAssets target -->
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<_PackagingCommonTargetsImported>true</_PackagingCommonTargetsImported>
</PropertyGroup>

<PropertyGroup>
<PackagingTaskDir Condition="'$(PackagingTaskDir)' == ''">$(MSBuildThisFileDirectory)</PackagingTaskDir>
<RuntimeIdGraphDefinitionFile Condition="'$(RuntimeIdGraphDefinitionFile)' == '' AND Exists('$(ProjectDir)pkg/Microsoft.NETCore.Platforms/runtime.json')">$(ProjectDir)pkg/Microsoft.NETCore.Platforms/runtime.json</RuntimeIdGraphDefinitionFile>
<RuntimeIdGraphDefinitionFile Condition="'$(RuntimeIdGraphDefinitionFile)' == ''">$(MSBuildThisFileDirectory)runtime.json</RuntimeIdGraphDefinitionFile>
</PropertyGroup>

<PropertyGroup Condition="'$(PackageTargetRuntimeSuffix)' != ''">
<PackageTargetRuntime Condition="'$(PackageTargetRuntime)' != ''">$(PackageTargetRuntime)-$(PackageTargetRuntimeSuffix)</PackageTargetRuntime>
<PackageTargetRuntime Condition="'$(PackageTargetRuntime)' == ''">$(PackageTargetRuntimeSuffix)</PackageTargetRuntime>
</PropertyGroup>

<UsingTask TaskName="ApplyBaseLine" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="ApplyPreReleaseSuffix" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="CreateTrimDependencyGroups" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="FilterUnknownPackages" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GenerateNuSpec" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GeneratePackageReport" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GenerateRuntimeDependencies" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetApplicableAssetsFromPackages" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetAssemblyReferences" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetInboxFrameworks" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetLastStablePackage" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetMinimumNETStandard" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetPackageDescription" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetPackageDestination" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetPackageFromModule" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="GetPackageVersion" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="HarvestPackage" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="NuGetPack" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="PromoteDependencies" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="SplitDependenciesBySupport" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="SplitReferences" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="UpdatePackageIndex" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="ValidatePackage" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
<UsingTask TaskName="VerifyClosure" AssemblyFile="$(PackagingTaskDir)Microsoft.DotNet.Build.Tasks.Packaging.dll"/>
</Project>
Loading