Build these packages on *nix, but don't publish them (they will not
have all of the content, since we don't yet build desktop versions of
the libraries when building on *nix).
As part of this work, I removed the GetBuildArgsByFrameworks task,
since we can just use conditional properties to remove the desktop
TFMs when we are building on *nix.
Fixes dotnet/core-setup#2319
Commit migrated from https://github.com/dotnet/core-setup/commit/
f1033a8638aa62a252d8ea6efb24dcf287f3ce2a
<PropertyGroup>
<Description>Abstractions for making code that uses file system and environment testable.</Description>
<TargetFrameworks>net45;netstandard1.3</TargetFrameworks>
+ <TargetFrameworks Condition="'$(OS)' != 'Windows_NT'" >netstandard1.3</TargetFrameworks>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup>
<Description>Abstractions for reading `.deps` files.</Description>
<TargetFrameworks>net451;netstandard1.3;netstandard1.6</TargetFrameworks>
+ <TargetFrameworks Condition="'$(OS)' != 'Windows_NT'">netstandard1.3;netstandard1.6</TargetFrameworks>
</PropertyGroup>
<ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
- <UsingTask TaskName="GetBuildArgsByFrameworks" AssemblyFile="$(LocalBuildToolsTaskDir)core-setup.tasks.dll"/>
-
<Target Name="Build">
-
- <MakeDir Condition="!Exists('$(pOutDir)')" Directories="$(pOutDir)" />
+ <MakeDir Condition="!Exists('$(pOutDir)')" Directories="$(pOutDir)" />
<PropertyGroup>
<Args>/p:Configuration=$(ConfigurationGroup)</Args>
<PackageProjects Include="$(MSBuildThisFileDirectory)Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj" />
</ItemGroup>
- <GetBuildArgsByFrameworks
- OSGroup="$(OSGroup)"
- ProjectPaths="@(PackageProjects)">
- <Output ItemName="buildCmdArgs" TaskParameter="BuildArgs" />
- </GetBuildArgsByFrameworks>
-
- <Exec Command="$(DotnetSdkToolCommand) build $(Args) %(buildCmdArgs.Identity)"
+ <Exec Command="$(DotnetSdkToolCommand) build $(Args) %(PackageProjects.Identity)"
EnvironmentVariables="NUGET_PACKAGES=$(PackagesDir)" />
</Target>
-</Project>
\ No newline at end of file
+</Project>
<Target Name="GenerateNugetPackages" DependsOnTargets="InitPackage">
<ItemGroup>
- <PackageProjects Condition="'$(OS)' == 'Windows_NT'" Include="$(ProjectDir)src\managed\Microsoft.DotNet.PlatformAbstractions\Microsoft.DotNet.PlatformAbstractions.csproj" />
- <PackageProjects Condition="'$(OS)' == 'Windows_NT'" Include="$(ProjectDir)src\managed\Microsoft.Extensions.DependencyModel\Microsoft.Extensions.DependencyModel.csproj" />
+ <PackageProjects Include="$(ProjectDir)src\managed\Microsoft.DotNet.PlatformAbstractions\Microsoft.DotNet.PlatformAbstractions.csproj" />
+ <PackageProjects Include="$(ProjectDir)src\managed\Microsoft.Extensions.DependencyModel\Microsoft.Extensions.DependencyModel.csproj" />
</ItemGroup>
<PropertyGroup>
<CompressedFile Include="$(PackagesOutDir)*$(SharedFrameworkNuGetVersion)$(CompressedFileExtension)" />
<RuntimePackageFile Include="$(PackagesOutDir)runtime.*$(SharedFrameworkNuGetVersion).nupkg" />
<RuntimePackageFile Include="$(PackagesOutDir)runtime.*$(SharedFrameworkNuGetVersion).symbols.nupkg" />
- <IdentityPackageFile Include="$(PackagesOutDir)*$(SharedFrameworkNuGetVersion).nupkg" Exclude="@(RuntimePackageFile)" />
- <IdentityPackageFile Include="$(PackagesOutDir)*$(SharedFrameworkNuGetVersion).symbols.nupkg" Exclude="@(RuntimePackageFile)" />
+ <RidAgnosticPackageFile Include="$(PackagesOutDir)*$(SharedFrameworkNuGetVersion).nupkg" Exclude="@(RuntimePackageFile)" />
+ <RidAgnosticPackageFile Include="$(PackagesOutDir)*$(SharedFrameworkNuGetVersion).symbols.nupkg" Exclude="@(RuntimePackageFile)" />
</ItemGroup>
<ItemGroup>
<ItemGroup>
<PublishFile Include="@(CompressedFile)" />
<PublishFile Include="@(RuntimePackageFile)" />
- <PublishFile Condition="'$(PublishRidAgnosticPackages)' == 'true'" Include="@(IdentityPackageFile)" />
+ <PublishFile Condition="'$(PublishRidAgnosticPackages)' == 'true'" Include="@(RidAgnosticPackageFile)" />
<Project Include="publish.proj">
<PublishTarget>UploadToAzure</PublishTarget>
<AdditionalProperties>%(Project.AdditionalProperties);ItemsToPublish=@(PublishFile);$(OutputVersionBadge);RelativeBlobPath=$(RelativeBlobPath)</AdditionalProperties>
+++ /dev/null
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-// See the LICENSE file in the project root for more information.
-
-using System;
-using Microsoft.Build.Framework;
-using System.IO;
-using Newtonsoft.Json;
-using Newtonsoft.Json.Linq;
-using System.Collections.Generic;
-using System.Text.RegularExpressions;
-using Microsoft.Build.Utilities;
-
-namespace Microsoft.DotNet.Build.Tasks
-{
- /// <summary>
- /// This target opens the json files and extracts the frameworks that are buildable
- /// according to the current OSGroup.
- /// In short it removes net45 and similar from *nix systems.
- /// The output is an ItemGroup that can be batch called when executing 'dotnet build'
- /// </summary>
- public class GetBuildArgsByFrameworks : BuildTask
- {
- [Required]
- public ITaskItem[] ProjectPaths { get; set; }
- [Required]
- public string OSGroup { get; set; }
- [Output]
- public ITaskItem[] BuildArgs { get; set; }
- public override bool Execute()
- {
- List<string> args = new List<string>();
- foreach (var projectPath in ProjectPaths)
- {
- string text = File.ReadAllText(projectPath.ItemSpec);
- Match match = Regex.Match(text, "<TargetFrameworks>(.*)</TargetFrameworks>");
- if (match.Groups.Count == 2)
- {
- string[] tfms = match.Groups[1].Value.Split(';');
- foreach (string framework in tfms)
- {
- if (OSGroup == "Windows_NT"
- || framework.StartsWith("netstandard")
- || framework.StartsWith("netcoreapp"))
- {
- args.Add($"--framework {framework} {projectPath}");
- }
- }
- }
- }
-
- BuildArgs = new ITaskItem[args.Count];
- for (int i = 0; i < BuildArgs.Length; i++)
- {
- BuildArgs[i] = new TaskItem(args[i]);
- }
-
- return true;
- }
- }
-}