Remove MigrationDefaultsConstructor
This commit is contained in:
parent
2d08b5523a
commit
b28ec60ed0
5 changed files with 0 additions and 268 deletions
|
@ -151,8 +151,6 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "tool_nuget", "src\tool_nuge
|
|||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Archiver", "tools\Archiver\Archiver.csproj", "{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "MigrationDefaultsConstructor", "tools\MigrationDefaultsConstructor\MigrationDefaultsConstructor.csproj", "{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArgumentForwardingTests", "test\ArgumentForwardingTests\ArgumentForwardingTests.csproj", "{3E28672F-F4E4-44D5-AEFB-1F425DECC57E}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ArgumentsReflector", "test\ArgumentsReflector\ArgumentsReflector.csproj", "{A5CA696F-585E-40AB-912C-6316BC330C5E}"
|
||||
|
@ -803,30 +801,6 @@ Global
|
|||
{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
|
||||
{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|Any CPU.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|x64.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|x64.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|x86.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Debug|x86.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|Any CPU.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|x64.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|x64.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|x86.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.MinSizeRel|x86.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|x64.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|x86.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.Release|x86.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|Any CPU.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|x64.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|x64.Build.0 = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|x86.ActiveCfg = Release|Any CPU
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42}.RelWithDebInfo|x86.Build.0 = Release|Any CPU
|
||||
{3E28672F-F4E4-44D5-AEFB-1F425DECC57E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{3E28672F-F4E4-44D5-AEFB-1F425DECC57E}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{3E28672F-F4E4-44D5-AEFB-1F425DECC57E}.Debug|x64.ActiveCfg = Release|Any CPU
|
||||
|
@ -1555,7 +1529,6 @@ Global
|
|||
{D82A3246-9831-4024-A9B2-1932EEF3D56F} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{BE4C655A-DC54-4408-B739-743456D34111} = {ED2FE3E2-F7E7-4389-8231-B65123F2076F}
|
||||
{2DFCC95F-75F7-46E1-8F56-256DB4CA98B2} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
||||
{30C5EFC3-E6FD-4071-89FA-EBB9B5084C42} = {0722D325-24C8-4E83-B5AF-0A083E7F0749}
|
||||
{3E28672F-F4E4-44D5-AEFB-1F425DECC57E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{A5CA696F-585E-40AB-912C-6316BC330C5E} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
{4EF497BF-D717-4E03-90B1-932C7F51B918} = {17735A9D-BFD9-4585-A7CB-3208CA6EA8A7}
|
||||
|
|
|
@ -1,19 +0,0 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk" ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.0</TargetFramework>
|
||||
<DebugType>portable</DebugType>
|
||||
<OutputType>Exe</OutputType>
|
||||
<PackageTargetFallback>$(PackageTargetFallback);dnxcore50;portable-net45+win8</PackageTargetFallback>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\..\src\dotnet\dotnet.csproj" />
|
||||
<PackageReference Include="Microsoft.NETCore.App">
|
||||
<Version>$(CLI_SharedFrameworkVersion)</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.Build.Runtime">
|
||||
<Version>$(CLI_MSBuild_Version)</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -1,193 +0,0 @@
|
|||
using System;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Collections.Generic;
|
||||
using Microsoft.DotNet.Cli;
|
||||
using Microsoft.DotNet.Cli.Utils;
|
||||
using Microsoft.Build.Evaluation;
|
||||
using Microsoft.Build.Execution;
|
||||
using Newtonsoft.Json;
|
||||
using System.Threading;
|
||||
using Microsoft.Build.Construction;
|
||||
using Microsoft.DotNet.ProjectJsonMigration.Models;
|
||||
|
||||
namespace MigrationDefaultsConstructor
|
||||
{
|
||||
public class Program
|
||||
{
|
||||
private const string c_temporaryDotnetNewMSBuildProjectName = "p";
|
||||
|
||||
static void Main(string[] args)
|
||||
{
|
||||
var sdkRootPath=args[0];
|
||||
|
||||
var beforeCommonSdkTargetsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.BeforeCommon.targets");
|
||||
var commonSdkTargetsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.Common.targets");
|
||||
var sdkTargetsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.targets");
|
||||
var sdkPropsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.props");
|
||||
var csharpTargetsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.CSharp.targets");
|
||||
var csharpPropsFilePath = Path.Combine(sdkRootPath, "src", "Tasks", "Microsoft.NET.Build.Tasks", "build", "Microsoft.NET.Sdk.CSharp.props");
|
||||
|
||||
var beforeCommonSdkTargetsFile = ProjectRootElement.Open(beforeCommonSdkTargetsFilePath);
|
||||
var commonSdkTargetsFile = ProjectRootElement.Open(commonSdkTargetsFilePath);
|
||||
var sdkTargetsFile = ProjectRootElement.Open(sdkTargetsFilePath);
|
||||
var sdkPropsFile = ProjectRootElement.Open(sdkPropsFilePath);
|
||||
var csharpPropsFile = ProjectRootElement.Open(csharpPropsFilePath);
|
||||
var csharpTargetsFile = ProjectRootElement.Open(csharpTargetsFilePath);
|
||||
|
||||
var allProperties = new List<DefaultProjectPropertyInfo>();
|
||||
var allItems = new List<DefaultProjectItemInfo>();
|
||||
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "OutputType");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "Configuration", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "Platform");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "FileAlignment");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "PlatformTarget");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "ErrorReport");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "AssemblyName");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "RootNamespace");
|
||||
AddPropertyDefault(allProperties, sdkPropsFile, "Deterministic");
|
||||
|
||||
AddPropertyDefault(allProperties, csharpPropsFile, "WarningLevel");
|
||||
AddPropertyDefault(allProperties, csharpPropsFile, "NoWarn");
|
||||
|
||||
AddHardcodedPropertyDefault(allProperties, "PackageRequireLicenseAcceptance", "false");
|
||||
|
||||
AddConfigurationPropertyDefaults(allProperties, sdkPropsFile, "Debug");
|
||||
AddConfigurationPropertyDefaults(allProperties, sdkPropsFile, "Release");
|
||||
|
||||
AddConfigurationPropertyDefaults(allProperties, csharpPropsFile, "Debug");
|
||||
AddConfigurationPropertyDefaults(allProperties, csharpPropsFile, "Release");
|
||||
|
||||
AddPropertyDefault(allProperties, commonSdkTargetsFile, "VersionPrefix", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, commonSdkTargetsFile, "AssemblyTitle", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, commonSdkTargetsFile, "Product", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, commonSdkTargetsFile, "NeutralLanguage", ignoreConditions: true);
|
||||
|
||||
AddPropertyDefault(allProperties, beforeCommonSdkTargetsFile, "AutoUnifyAssemblyReferences", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, beforeCommonSdkTargetsFile, "DesignTimeAutoUnify", ignoreConditions: true);
|
||||
AddPropertyDefault(allProperties, beforeCommonSdkTargetsFile, "TargetExt", ignoreConditions: true);
|
||||
|
||||
AddCompileAndEmbeddedResourceDefaults(allItems, sdkTargetsFile);
|
||||
|
||||
var wrapper = new SerializableMigrationDefaultsInfo()
|
||||
{
|
||||
Items = allItems,
|
||||
Properties = allProperties
|
||||
};
|
||||
|
||||
var output = Path.Combine(Directory.GetCurrentDirectory(), "sdkdefaults.json");
|
||||
string json = JsonConvert.SerializeObject(wrapper, Formatting.Indented);
|
||||
File.WriteAllText(output, json);
|
||||
}
|
||||
|
||||
private static void AddHardcodedPropertyDefault(List<DefaultProjectPropertyInfo> allProperties,
|
||||
string name,
|
||||
string value,
|
||||
string condition="",
|
||||
string parentCondition="")
|
||||
{
|
||||
var propertyInfo = new DefaultProjectPropertyInfo
|
||||
{
|
||||
Name = name,
|
||||
Value = value,
|
||||
Condition = condition,
|
||||
ParentCondition = parentCondition
|
||||
};
|
||||
|
||||
allProperties.Add(propertyInfo);
|
||||
}
|
||||
|
||||
private static void AddCompileAndEmbeddedResourceDefaults(List<DefaultProjectItemInfo> allItems, ProjectRootElement msbuild)
|
||||
{
|
||||
var exclude = msbuild.Properties.Where(p=>p.Name == "DefaultExcludes").First().Value;
|
||||
|
||||
var compileInclude = msbuild.Items.Where(i => i.ItemType == "Compile").First().Include;
|
||||
if (string.IsNullOrEmpty(compileInclude))
|
||||
{
|
||||
compileInclude = "**\\*.cs";
|
||||
}
|
||||
|
||||
var embedInclude = msbuild.Items.Where(i => i.ItemType == "EmbeddedResource").First().Include;
|
||||
if (string.IsNullOrEmpty(embedInclude))
|
||||
{
|
||||
embedInclude = "**\\*.resx";
|
||||
}
|
||||
|
||||
allItems.Add(new DefaultProjectItemInfo
|
||||
{
|
||||
ItemType = "Compile",
|
||||
Include=compileInclude,
|
||||
Exclude=exclude
|
||||
});
|
||||
|
||||
allItems.Add(new DefaultProjectItemInfo
|
||||
{
|
||||
ItemType = "EmbeddedResource",
|
||||
Include=embedInclude,
|
||||
Exclude=exclude
|
||||
});
|
||||
}
|
||||
|
||||
private static void AddConfigurationPropertyDefaults(List<DefaultProjectPropertyInfo> allProperties, ProjectRootElement msbuild, string config)
|
||||
{
|
||||
var configPropertyGroup = msbuild.PropertyGroups.Where(p => p.Condition.Contains("$(Configuration)") && p.Condition.Contains(config)).First();
|
||||
|
||||
configPropertyGroup.Condition = $" '$(Configuration)' == '{config}' ";
|
||||
|
||||
foreach (var property in configPropertyGroup.Properties)
|
||||
{
|
||||
var propertyInfo = new DefaultProjectPropertyInfo
|
||||
{
|
||||
Name = property.Name,
|
||||
Value = property.Value,
|
||||
Condition = property.Condition,
|
||||
ParentCondition = property.Parent.Condition
|
||||
};
|
||||
|
||||
allProperties.Add(propertyInfo);
|
||||
}
|
||||
}
|
||||
|
||||
private static void AddPropertyDefault(List<DefaultProjectPropertyInfo> allProperties, ProjectRootElement msbuild, string propertyName, int? index=null, bool ignoreConditions=false)
|
||||
{
|
||||
var properties = msbuild.Properties.Where(p => p.Name == propertyName).ToList();
|
||||
if (!properties.Any())
|
||||
{
|
||||
throw new Exception("property not found:" + propertyName);
|
||||
}
|
||||
|
||||
if (properties.Count() > 1 && index == null)
|
||||
{
|
||||
throw new Exception("More than one property found but index is null:" + propertyName);
|
||||
}
|
||||
|
||||
var property = properties[index ?? 0];
|
||||
|
||||
if (ignoreConditions)
|
||||
{
|
||||
var propertyInfo = new DefaultProjectPropertyInfo
|
||||
{
|
||||
Name = property.Name,
|
||||
Value = property.Value,
|
||||
Condition = null,
|
||||
ParentCondition = null
|
||||
};
|
||||
|
||||
allProperties.Add(propertyInfo);
|
||||
}
|
||||
else
|
||||
{
|
||||
var propertyInfo = new DefaultProjectPropertyInfo
|
||||
{
|
||||
Name = property.Name,
|
||||
Value = property.Value,
|
||||
Condition = property.Condition,
|
||||
ParentCondition = property.Parent.Condition
|
||||
};
|
||||
|
||||
allProperties.Add(propertyInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,7 +0,0 @@
|
|||
# Migration Defaults Constructor
|
||||
|
||||
This pulls the migration property and item defaults from a clone of the dotnet/sdk repo.
|
||||
|
||||
Run `./run.sh` to generate an sdkdefaults.json
|
||||
|
||||
Move it to the Microsoft.DotNet.ProjectJsonMigration project under `src` to override the defaults in dotnet (it's embedded as a resource).
|
|
@ -1,22 +0,0 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
SOURCE="${BASH_SOURCE[0]}"
|
||||
while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
SOURCE="$(readlink "$SOURCE")"
|
||||
[[ "$SOURCE" != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located
|
||||
done
|
||||
DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )"
|
||||
|
||||
rm -rf bin obj
|
||||
dotnet publish -o bin -f netcoreapp1.0
|
||||
cp -a "$DIR/bin/runtimes/any/native/." "$DIR/bin"
|
||||
|
||||
sdkRevision="cc1fc023e3375b3944dbedfdd4ba2b5d2cbd01f0"
|
||||
sdkRoot="$DIR/bin/sdk"
|
||||
(cd bin && \
|
||||
git clone https://github.com/dotnet/sdk.git && \
|
||||
cd sdk && \
|
||||
git reset --hard $sdkRevision)
|
||||
|
||||
dotnet "$DIR/bin/MigrationDefaultsConstructor.dll" "$sdkRoot"
|
Loading…
Add table
Reference in a new issue