Package M.DN.PA and M.E.DM on *nix
authorMatt Ellis <matell@microsoft.com>
Thu, 11 May 2017 21:10:18 +0000 (14:10 -0700)
committerMatt Ellis <matell@microsoft.com>
Thu, 11 May 2017 21:10:18 +0000 (14:10 -0700)
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

src/installer/managed/Microsoft.DotNet.PlatformAbstractions/Microsoft.DotNet.PlatformAbstractions.csproj
src/installer/managed/Microsoft.Extensions.DependencyModel/Microsoft.Extensions.DependencyModel.csproj
src/installer/managed/dir.proj
src/installer/pkg/packaging/dir.proj
src/installer/publish/dir.props
src/installer/publish/dir.targets
tools-local/tasks/GetBuildableFrameworks.cs [deleted file]

index 2842604..f4c66a3 100644 (file)
@@ -4,6 +4,7 @@
   <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>
 
index e77ce0b..c05bac3 100644 (file)
@@ -4,6 +4,7 @@
   <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>
index a2c685c..519e825 100644 (file)
@@ -3,11 +3,8 @@
   <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>
index 78d2e3f..b4a5046 100644 (file)
 
   <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>
index 54f84d7..dbf0742 100644 (file)
@@ -18,8 +18,8 @@
     <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>
index 42883ea..6a6e8f7 100644 (file)
@@ -9,7 +9,7 @@
     <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>
diff --git a/tools-local/tasks/GetBuildableFrameworks.cs b/tools-local/tasks/GetBuildableFrameworks.cs
deleted file mode 100644 (file)
index f95572b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-// 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;
-        }
-    }
-}