Merge pull request #3737 from livarcocc/compile_msbuild
Compile msbuild
This commit is contained in:
commit
5724544618
14 changed files with 502 additions and 53 deletions
20
build.proj
20
build.proj
|
@ -1,7 +1,7 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" DefaultTargets="BuildTheWholeCli" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="build/Microsoft.DotNet.Cli.Monikers.props" />
|
||||
|
||||
|
||||
<PropertyGroup>
|
||||
<!--
|
||||
$(OS) is set to Unix/Windows_NT. This comes from an environment variable on Windows and MSBuild on Unix.
|
||||
|
@ -21,20 +21,24 @@
|
|||
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<RepoRoot>$(MSBuildThisFileDirectory)</RepoRoot>
|
||||
|
||||
|
||||
<CoreSetupChannel>preview</CoreSetupChannel>
|
||||
<SharedFrameworkName>Microsoft.NETCore.App</SharedFrameworkName>
|
||||
<SharedFrameworkVersion>1.0.0</SharedFrameworkVersion>
|
||||
<SharedHostVersion>1.0.1</SharedHostVersion>
|
||||
<HostFxrVersion>1.0.1</HostFxrVersion>
|
||||
|
||||
<CoreCLRVersion>1.0.2</CoreCLRVersion>
|
||||
<JitVersion>1.0.2</JitVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<DotnetCliBuildFrameworkInputs Include="build_projects/**/*.cs" Exclude="build_projects/**/obj/**/*.cs" />
|
||||
<DotnetCliBuildFrameworkInputs Include="build_projects/**/project.json;build_projects/**/project.lock.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Workaround to "Native image cannot be loaded multiple times" issue
|
||||
A target in the top level file needs to run and invoke a task
|
||||
|
||||
<!-- Workaround to "Native image cannot be loaded multiple times" issue
|
||||
A target in the top level file needs to run and invoke a task
|
||||
https://github.com/Microsoft/msbuild/issues/750 -->
|
||||
<Target Name="MSBuildWorkaroundTarget">
|
||||
<Message Text="Dont remove this target" />
|
||||
|
@ -49,14 +53,9 @@
|
|||
|
||||
<Target DependsOnTargets="$(CLITargets)" Name="BuildTheWholeCli"></Target>
|
||||
|
||||
<UsingTask TaskName="CompileTargets" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="TestTargets" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="PublishTargets" AssemblyFile="$(CLIBuildDll)" />
|
||||
|
||||
<Target DependsOnTargets="BuildDotnetCliBuildFramework" Name="Compile">
|
||||
<CompileTargets />
|
||||
</Target>
|
||||
|
||||
<Target DependsOnTargets="BuildDotnetCliBuildFramework" Name="Test">
|
||||
<TestTargets />
|
||||
</Target>
|
||||
|
@ -66,5 +65,6 @@
|
|||
</Target>
|
||||
|
||||
<Import Project="build/Microsoft.DotNet.Cli.Prepare.targets" />
|
||||
<Import Project="build/Microsoft.DotNet.Cli.Compile.targets" />
|
||||
<Import Project="build/Microsoft.DotNet.Cli.Package.targets" />
|
||||
</Project>
|
||||
|
|
180
build/Microsoft.DotNet.Cli.Compile.targets
Normal file
180
build/Microsoft.DotNet.Cli.Compile.targets
Normal file
|
@ -0,0 +1,180 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="compile/Microsoft.DotNet.Cli.LzmaArchive.targets" />
|
||||
|
||||
<UsingTask TaskName="FixModeFlags" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="ChangeEntryPointLibraryName" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="RemoveAssetFromDepsPackages" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="CleanPublishOutput" AssemblyFile="$(CLIBuildDll)" />
|
||||
<UsingTask TaskName="CrossgenDirectory" AssemblyFile="$(CLIBuildDll)" />
|
||||
|
||||
<Target Name="Compile" DependsOnTargets="Prepare;
|
||||
SetupStage;
|
||||
CompileStage;
|
||||
BuildProjectsForNuGetPackages;
|
||||
GenerateNuGetPackagesArchive" />
|
||||
|
||||
<Target Name="SetupStage">
|
||||
<PropertyGroup>
|
||||
<SrcDirectory>$(RepoRoot)/src</SrcDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<CompileStageInputs Include="$(SrcDirectory)/**/*.cs" Exclude="$(SrcDirectory)/**/obj/**/*.cs" />
|
||||
<CompileStageInputs Include="$(SrcDirectory)/**/project.json;$(SrcDirectory)/**/project.lock.json" />
|
||||
|
||||
<Stage Include="Stage1">
|
||||
<Inputs>@(CompileStageInputs)</Inputs>
|
||||
<StageDirectory>$(Stage1Directory)</StageDirectory>
|
||||
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
|
||||
<DotnetExe>$(Stage0Path)/dotnet.exe</DotnetExe>
|
||||
</Stage>
|
||||
<Stage Include="Stage2">
|
||||
<Inputs>@(CompileStageInputs)</Inputs>
|
||||
<StageDirectory>$(Stage2Directory)</StageDirectory>
|
||||
<StageSymbolsDirectory>$(Stage2SymbolsDirectory)</StageSymbolsDirectory>
|
||||
<DotnetExe>$(DotnetStage1)</DotnetExe>
|
||||
</Stage>
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
|
||||
<Target Name="CompileStage"
|
||||
Inputs="%(Stage.Inputs)"
|
||||
Outputs="%(StageDirectory)/sdk/$(SdkVersion)/dotnet.dll">
|
||||
<PropertyGroup>
|
||||
<ExeSuffix Condition=" '$(OSName)' == 'win' ">.exe</ExeSuffix>
|
||||
<ExeSuffix Condition=" '$(OSName)' != 'win' "></ExeSuffix>
|
||||
|
||||
<DynamicLibPrefix Condition=" '$(OSName)' == 'win' "></DynamicLibPrefix>
|
||||
<DynamicLibPrefix Condition=" '$(OSName)' != 'win' ">lib</DynamicLibPrefix>
|
||||
|
||||
<DynamicLibSuffix Condition=" '$(OSName)' == 'win' ">.dll</DynamicLibSuffix>
|
||||
<DynamicLibSuffix Condition=" '$(OSName)' == 'osx' ">.dylib</DynamicLibSuffix>
|
||||
<DynamicLibSuffix Condition=" '$(DynamicLibSuffix)' == '' ">.so</DynamicLibSuffix>
|
||||
|
||||
<DotnetHostBaseName>dotnet$(ExeSuffix)</DotnetHostBaseName>
|
||||
<DotnetHostFxrBaseName>$(DynamicLibPrefix)hostfxr$(DynamicLibSuffix)</DotnetHostFxrBaseName>
|
||||
<HostPolicyBaseName>$(DynamicLibPrefix)hostpolicy$(DynamicLibSuffix)</HostPolicyBaseName>
|
||||
|
||||
<StageDirectory>%(Stage.StageDirectory)</StageDirectory>
|
||||
<StageSymbolsDirectory>%(Stage.StageSymbolsDirectory)</StageSymbolsDirectory>
|
||||
<SdkOutputDirectory>$(StageDirectory)/sdk/$(SdkVersion)</SdkOutputDirectory>
|
||||
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
|
||||
<BinaryToCorehostifyOutDir>$(SdkOutputDirectory)/$(BinaryToCorehostifyRelDir)</BinaryToCorehostifyOutDir>
|
||||
<MSBuildTargetsDirectory>$(SdkOutputDirectory)/runtimes/any/native</MSBuildTargetsDirectory>
|
||||
|
||||
<SharedFrameworkNameVersionPath>$(StageDirectory)/shared/$(SharedFrameworkName)/$(SharedFrameworkVersion)</SharedFrameworkNameVersionPath>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<BinObj Include="$(SrcDirectory)/**/bin/**/*" />
|
||||
<BinObj Include="$(SrcDirectory)/**/obj/**/*" />
|
||||
<FilesToRemoveFromStageDirectory Include="$(StageDirectory)/**/*" />
|
||||
|
||||
<SharedFramework Include="$(SharedFrameworkPublishDirectory)/**/*" />
|
||||
|
||||
<BinariesToRemove Include="csc" />
|
||||
<BinariesToRemove Include="vbc" />
|
||||
|
||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.targets" />
|
||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.Targets" />
|
||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.props" />
|
||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.overridetasks" />
|
||||
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
|
||||
</ItemGroup>
|
||||
|
||||
<Delete Files="@(BinObj)" />
|
||||
|
||||
<Delete Files="@(FilesToRemoveFromStageDirectory)" />
|
||||
<RemoveDir Directories="$(StageDirectory)" />
|
||||
<MakeDir Directories="$(StageDirectory)"/>
|
||||
|
||||
<!-- CopySharedFramework -->
|
||||
<Copy SourceFiles="@(SharedFramework)"
|
||||
DestinationFiles="@(SharedFramework->'$(StageDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<!-- Publish DotNet -->
|
||||
<Exec Command="%(Stage.DotnetExe) publish
|
||||
--native-subdirectory
|
||||
--output $(SdkOutputDirectory)
|
||||
--configuration $(Configuration)
|
||||
--version-suffix $(CommitCount)
|
||||
$(SrcDirectory)/dotnet" />
|
||||
|
||||
<!-- Corehostify Binaries -->
|
||||
<FixModeFlags Dir="$(SdkOutputDirectory)" />
|
||||
|
||||
<Exec Command="%(Stage.DotnetExe) publish
|
||||
--output $(SdkOutputDirectory)
|
||||
--framework netcoreapp1.0
|
||||
$(SrcDirectory)/compilers" />
|
||||
|
||||
<Copy SourceFiles="$(BinaryToCorehostifyOutDir)/csc.exe"
|
||||
DestinationFiles="$(SdkOutputDirectory)/csc.dll" />
|
||||
|
||||
<Move SourceFiles="$(BinaryToCorehostifyOutDir)/csc.exe"
|
||||
DestinationFiles="$(SdkOutputDirectory)/csc.exe" />
|
||||
|
||||
<Copy SourceFiles="$(SdkOutputDirectory)/compilers.deps.json"
|
||||
DestinationFiles="$(SdkOutputDirectory)/csc.deps.json" />
|
||||
|
||||
<Copy SourceFiles="$(SdkOutputDirectory)/compilers.runtimeconfig.json"
|
||||
DestinationFiles="$(SdkOutputDirectory)/csc.runtimeconfig.json" />
|
||||
|
||||
<ChangeEntryPointLibraryName
|
||||
DepsFile="$(SdkOutputDirectory)/csc.deps.json"
|
||||
NewName="csc.deps.json" />
|
||||
|
||||
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/csc.deps.json"
|
||||
SectionName="runtimeTargets"
|
||||
AssetPath="$(BinaryToCorehostifyRelDir)/%(BinariesToRemove.Identity).exe" />
|
||||
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/dotnet.deps.json"
|
||||
SectionName="runtimeTargets"
|
||||
AssetPath="$(BinaryToCorehostifyRelDir)/%(BinariesToRemove.Identity).exe" />
|
||||
|
||||
<!-- cleanup compilers project output we don't need -->
|
||||
<CleanPublishOutput Path="$(SdkOutputDirectory)"
|
||||
Name="compilers"
|
||||
DeleteRuntimeConfigJson="true"
|
||||
DeleteDepsJson="true" />
|
||||
|
||||
<!-- Copy Host to SDK Directory -->
|
||||
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostBaseName)"
|
||||
DestinationFiles="$(SdkOutputDirectory)/corehost$(ExeSuffix)" />
|
||||
|
||||
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostFxrBaseName)"
|
||||
DestinationFiles="$(SdkOutputDirectory)/$(DotnetHostFxrBaseName)" />
|
||||
|
||||
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(HostPolicyBaseName)"
|
||||
DestinationFiles="$(SdkOutputDirectory)/$(HostPolicyBaseName)" />
|
||||
|
||||
<CrossgenDirectory CoreCLRVersion="$(CoreCLRVersion)"
|
||||
JitVersion="$(JitVersion)"
|
||||
SharedFrameworkNameVersionPath="$(SharedFrameworkNameVersionPath)"
|
||||
SdkOutputDirectory="$(SdkOutputDirectory)" />
|
||||
|
||||
<!-- Generate .version file -->
|
||||
<WriteLinesToFile File="$(SdkOutputDirectory)/.version"
|
||||
Lines="$(CommitHash);$(SdkVersion)"
|
||||
Overwrite="true" />
|
||||
|
||||
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
|
||||
DestinationFiles="@(MSBuildTargetsToCopy->'$(SdkOutputDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<ItemGroup>
|
||||
<FilesToClean Include="$(StageDirectory)/sdk/**/vbc.exe" />
|
||||
</ItemGroup>
|
||||
|
||||
<Delete Files="@(FilesToClean)" />
|
||||
|
||||
<ItemGroup>
|
||||
<FilesToCopy Include="$(StageDirectory)/**/*" />
|
||||
<PdbsToClean Include="$(StageDirectory)/sdk/**/*.pdb" />
|
||||
</ItemGroup>
|
||||
|
||||
<Copy SourceFiles="@(FilesToCopy)"
|
||||
DestinationFiles="@(FilesToCopy->'$(StageSymbolsDirectory)\%(RecursiveDir)%(Filename)%(Extension)')" />
|
||||
|
||||
<Delete Files="@(PdbsToClean)" />
|
||||
</Target>
|
||||
</Project>
|
|
@ -29,11 +29,17 @@
|
|||
<DotNetPath>$(Stage0Path)</DotNetPath>
|
||||
|
||||
<BaseOutputDirectory>$(RepoRoot)/artifacts/$(Rid)</BaseOutputDirectory>
|
||||
<OutputDirectory>$(BaseOutputDirectory)/stage2/</OutputDirectory>
|
||||
<ToolsOutputDirectory>$(BaseOutputDirectory)/tools</ToolsOutputDirectory>
|
||||
<Stage1Directory>$(BaseOutputDirectory)/stage1</Stage1Directory>
|
||||
<Stage1SymbolsDirectory>$(BaseOutputDirectory)/stage1symbols</Stage1SymbolsDirectory>
|
||||
<DotnetStage1>$(Stage1Directory)/dotnet.exe</DotnetStage1>
|
||||
<Stage2Directory>$(BaseOutputDirectory)/stage2</Stage2Directory>
|
||||
<Stage2SymbolsDirectory>$(BaseOutputDirectory)/stage2symbols</Stage2SymbolsDirectory>
|
||||
<DotnetStage2>$(Stage2Directory)/dotnet.exe</DotnetStage2>
|
||||
<OutputDirectory>$(Stage2Directory)/</OutputDirectory>
|
||||
<Stage2CompilationDirectory>$(BaseOutputDirectory)/stage2compilation</Stage2CompilationDirectory>
|
||||
<IntermediateDirectory>$(BaseOutputDirectory)/intermediate</IntermediateDirectory>
|
||||
<PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory>
|
||||
<SymbolsOutputDirectory>$(BaseOutputDirectory)/stage2symbols</SymbolsOutputDirectory>
|
||||
<PackagesDirectory>$(BaseOutputDirectory)/packages</PackagesDirectory>
|
||||
<SharedFrameworkPublishDirectory>$(IntermediateDirectory)/sharedFrameworkPublish</SharedFrameworkPublishDirectory>
|
||||
</PropertyGroup>
|
||||
|
||||
|
@ -197,4 +203,4 @@
|
|||
ForceZipArchive="true" />
|
||||
</Target>
|
||||
|
||||
</Project>
|
||||
</Project>
|
51
build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets
Normal file
51
build/compile/Microsoft.DotNet.Cli.LzmaArchive.targets
Normal file
|
@ -0,0 +1,51 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Target Name="GenerateNuGetPackagesArchive"
|
||||
DependsOnTargets="SetupNuGetPackagesArchiveInputsOutputs"
|
||||
Inputs="@(GenerateNuGetPackagesArchiveInputs)"
|
||||
Outputs="$(FinalArchive)">
|
||||
<ItemGroup>
|
||||
<FilesToClean Include="$(NuGetPackagesArchiveProject)/**/*" />
|
||||
<FilesToClean Include="$(NuGetPackagesArchiveFolder)/**/*" />
|
||||
</ItemGroup>
|
||||
|
||||
<Delete Files="@(FilesToClean)" />
|
||||
<RemoveDir Directories="$(NuGetPackagesArchiveProject);$(NuGetPackagesArchiveFolder)" />
|
||||
<MakeDir Directories="$(NuGetPackagesArchiveProject);$(NuGetPackagesArchiveFolder)"/>
|
||||
|
||||
<Exec Command="$(DotnetStage2) new" WorkingDirectory="$(NuGetPackagesArchiveProject)" />
|
||||
<Exec Command="$(DotnetStage2) restore --packages $(NuGetPackagesArchiveFolder)"
|
||||
WorkingDirectory="$(NuGetPackagesArchiveProject)" />
|
||||
|
||||
<Delete Files="$(IntermediateArchive);$(IntermediateArchive).zip" />
|
||||
|
||||
<Message Text="Publishing Archiver" />
|
||||
<Exec Command="$(DotnetStage2) publish --output $(ToolsOutputDirectory) --configuration $(Configuration)"
|
||||
WorkingDirectory="$(RepoRoot)/tools/Archiver" />
|
||||
|
||||
<Exec Command="$(ArchiverExe) -a $(IntermediateArchive) $(NuGetPackagesArchiveFolder)" />
|
||||
|
||||
<Copy SourceFiles="$(IntermediateArchive)" DestinationFiles="$(FinalArchive)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="SetupNuGetPackagesArchiveInputsOutputs"
|
||||
DependsOnTargets="Prepare;SetupStage">
|
||||
<PropertyGroup>
|
||||
<NuGetPackagesArchiveProject>$(IntermediateDirectory)/NuGetPackagesArchiveProject</NuGetPackagesArchiveProject>
|
||||
<NuGetPackagesArchiveFolder>$(IntermediateDirectory)/NuGetPackagesArchiveFolder</NuGetPackagesArchiveFolder>
|
||||
<ArchiverExe>$(ToolsOutputDirectory)/Archiver</ArchiverExe>
|
||||
<IntermediateArchive>$(IntermediateDirectory)/nuGetPackagesArchive.lzma</IntermediateArchive>
|
||||
<FinalArchive>$(Stage2Directory)/sdk/$(SdkVersion)/nuGetPackagesArchive.lzma</FinalArchive>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<GenerateNuGetPackagesArchiveInputs Include="$(_DotNetNewFolder)/CSharp_Console/**/*" />
|
||||
<GenerateNuGetPackagesArchiveInputs Include="$(SrcDirectory)/dotnet-archive/**/*"
|
||||
Exclude="$(SrcDirectory)/dotnet-archive/**/bin/**/*;
|
||||
$(SrcDirectory)/dotnet-archive/**/obj/**/*" />
|
||||
<GenerateNuGetPackagesArchiveInputs Include="$(SrcDirectory)/Microsoft.DotNet.Archive/**/*"
|
||||
Exclude="$(SrcDirectory)/Microsoft.DotNet.Archive/**/bin/**/*;
|
||||
$(SrcDirectory)/Microsoft.DotNet.Archive/**/obj/**/*" />
|
||||
</ItemGroup>
|
||||
</Target>
|
||||
</Project>
|
|
@ -11,7 +11,7 @@
|
|||
<!-- Set up Items with Layout Input Files -->
|
||||
<ItemGroup>
|
||||
<SdkLayoutInput Include="$(OutputDirectory)/sdk/**/*" />
|
||||
<SdkDebugLayoutInput Include="$(SymbolsOutputDirectory)/sdk/**/*" />
|
||||
<SdkDebugLayoutInput Include="$(Stage2SymbolsDirectory)/sdk/**/*" />
|
||||
<CombinedHostHostFxrFrameworkSdkInput Include="$(OutputDirectory)/**/*" />
|
||||
<CombinedFrameworkSdkInput Include="$(OutputDirectory)/shared/**/*" />
|
||||
<CombinedFrameworkSdkInput Include="$(OutputDirectory)/sdk/**/*" />
|
||||
|
@ -56,7 +56,7 @@
|
|||
|
||||
<LayoutDefinition Include="Debug">
|
||||
<InputFiles>@(SdkDebugLayoutInput)</InputFiles>
|
||||
<OutputFiles>@(SdkDebugRelativeOutputFiles -> '$(SdkDebugLayoutOutputDirectory)/%(Identity)')</OutputFiles>
|
||||
<OutputFiles>@(SdkDebugRelativeOutputFiles -> '$(SdkDebugLayoutOutputDirectory)/%(Identity)')</OutputFiles>
|
||||
<NameWithVersion>$(ArtifactNameWithVersionSdkDebug)</NameWithVersion>
|
||||
<Name>$(ArtifactNameSdkDebug)</Name>
|
||||
</LayoutDefinition>
|
||||
|
|
|
@ -66,4 +66,16 @@
|
|||
--configuration $(Configuration)
|
||||
--version-suffix $(NupkgVersionSuffix)" />
|
||||
</Target>
|
||||
|
||||
<Target Name="BuildProjectsForNuGetPackages"
|
||||
DependsOnTargets="Init;
|
||||
SetupGenerateNugetPackagesInputsOutputs"
|
||||
Condition=" '$(OS)' == 'Windows_NT' ">
|
||||
<MakeDir Directories="$(PackagingBuildBasePath)" />
|
||||
|
||||
<Exec Command="$(DotnetStage2) build
|
||||
--build-base-path $(PackagingBuildBasePath)
|
||||
--configuration $(Configuration)
|
||||
%(ProjectsToPack.Identity)" />
|
||||
</Target>
|
||||
</Project>
|
||||
|
|
|
@ -0,0 +1,31 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class ChangeEntryPointLibraryName : Task
|
||||
{
|
||||
[Required]
|
||||
public string DepsFile { get; set; }
|
||||
|
||||
[Required]
|
||||
public string NewName { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
PublishMutationUtilties.ChangeEntryPointLibraryName(DepsFile, NewName);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
37
build_projects/dotnet-cli-build/CleanPublishOutput.cs
Normal file
37
build_projects/dotnet-cli-build/CleanPublishOutput.cs
Normal file
|
@ -0,0 +1,37 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class CleanPublishOutput : Task
|
||||
{
|
||||
[Required]
|
||||
public string Path { get; set; }
|
||||
|
||||
[Required]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool DeleteRuntimeConfigJson { get; set; }
|
||||
|
||||
[Required]
|
||||
public bool DeleteDepsJson { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
PublishMutationUtilties.CleanPublishOutput(Path, Name, DeleteRuntimeConfigJson, DeleteDepsJson);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -220,9 +220,14 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
foreach (var binaryToRemove in new string[] { "csc", "vbc" })
|
||||
{
|
||||
var assetPath = Path.Combine(binaryToCorehostifyRelDir, $"{binaryToRemove}.exe").Replace(Path.DirectorySeparatorChar, '/');
|
||||
RemoveAssetFromDepsPackages(binaryToCoreHostifyDeps, "runtimeTargets", assetPath);
|
||||
RemoveAssetFromDepsPackages(
|
||||
Path.Combine(sdkOutputDirectory, "dotnet.deps.json"), "runtimeTargets", assetPath);
|
||||
RemoveAssetFromDepsPackages.DoRemoveAssetFromDepsPackages(
|
||||
binaryToCoreHostifyDeps,
|
||||
"runtimeTargets",
|
||||
assetPath);
|
||||
RemoveAssetFromDepsPackages.DoRemoveAssetFromDepsPackages(
|
||||
Path.Combine(sdkOutputDirectory, "dotnet.deps.json"),
|
||||
"runtimeTargets",
|
||||
assetPath);
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -360,40 +365,6 @@ namespace Microsoft.DotNet.Cli.Build
|
|||
File.Copy(intermediateArchive, finalArchive);
|
||||
}
|
||||
|
||||
private static void RemoveAssetFromDepsPackages(string depsFile, string sectionName, string assetPath)
|
||||
{
|
||||
JToken deps;
|
||||
using (var file = File.OpenText(depsFile))
|
||||
using (JsonTextReader reader = new JsonTextReader(file))
|
||||
{
|
||||
deps = JObject.ReadFrom(reader);
|
||||
}
|
||||
|
||||
foreach (JProperty target in deps["targets"])
|
||||
{
|
||||
foreach (JProperty pv in target.Value.Children<JProperty>())
|
||||
{
|
||||
var section = pv.Value[sectionName];
|
||||
if (section != null)
|
||||
{
|
||||
foreach (JProperty relPath in section)
|
||||
{
|
||||
if (assetPath.Equals(relPath.Name))
|
||||
{
|
||||
relPath.Remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var file = File.CreateText(depsFile))
|
||||
using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented })
|
||||
{
|
||||
deps.WriteTo(writer);
|
||||
}
|
||||
}
|
||||
|
||||
private static void CopySharedFramework(string sharedFrameworkPublish, string rootOutputDirectory)
|
||||
{
|
||||
CopyRecursive(sharedFrameworkPublish, rootOutputDirectory);
|
||||
|
|
39
build_projects/dotnet-cli-build/CrossgenDirectory.cs
Normal file
39
build_projects/dotnet-cli-build/CrossgenDirectory.cs
Normal file
|
@ -0,0 +1,39 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class CrossgenDirectory : Task
|
||||
{
|
||||
[Required]
|
||||
public string CoreCLRVersion { get; set; }
|
||||
|
||||
[Required]
|
||||
public string JitVersion { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SharedFrameworkNameVersionPath { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SdkOutputDirectory { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
var crossgenUtil = new Crossgen(CoreCLRVersion, JitVersion);
|
||||
|
||||
crossgenUtil.CrossgenDirectory(SharedFrameworkNameVersionPath, SdkOutputDirectory);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
28
build_projects/dotnet-cli-build/FixModeFlags.cs
Normal file
28
build_projects/dotnet-cli-build/FixModeFlags.cs
Normal file
|
@ -0,0 +1,28 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class FixModeFlags : Task
|
||||
{
|
||||
[Required]
|
||||
public string Dir { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
FS.FixModeFlags(Dir);
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,70 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Net.Http;
|
||||
using Microsoft.Build.Framework;
|
||||
using Microsoft.Build.Utilities;
|
||||
using Microsoft.DotNet.Cli.Build.Framework;
|
||||
using Microsoft.DotNet.InternalAbstractions;
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Linq;
|
||||
|
||||
using static Microsoft.DotNet.Cli.Build.Framework.BuildHelpers;
|
||||
|
||||
namespace Microsoft.DotNet.Cli.Build
|
||||
{
|
||||
public class RemoveAssetFromDepsPackages : Task
|
||||
{
|
||||
[Required]
|
||||
public string DepsFile { get; set; }
|
||||
|
||||
[Required]
|
||||
public string SectionName { get; set; }
|
||||
|
||||
[Required]
|
||||
public string AssetPath { get; set; }
|
||||
|
||||
public override bool Execute()
|
||||
{
|
||||
DoRemoveAssetFromDepsPackages(DepsFile, SectionName, AssetPath);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
public static void DoRemoveAssetFromDepsPackages(string depsFile, string sectionName, string assetPath)
|
||||
{
|
||||
JToken deps;
|
||||
using (var file = File.OpenText(depsFile))
|
||||
using (JsonTextReader reader = new JsonTextReader(file))
|
||||
{
|
||||
deps = JObject.ReadFrom(reader);
|
||||
}
|
||||
|
||||
foreach (JProperty target in deps["targets"])
|
||||
{
|
||||
foreach (JProperty pv in target.Value.Children<JProperty>())
|
||||
{
|
||||
var section = pv.Value[sectionName];
|
||||
if (section != null)
|
||||
{
|
||||
foreach (JProperty relPath in section)
|
||||
{
|
||||
if (assetPath.Equals(relPath.Name))
|
||||
{
|
||||
relPath.Remove();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
using (var file = File.CreateText(depsFile))
|
||||
using (var writer = new JsonTextWriter(file) { Formatting = Formatting.Indented })
|
||||
{
|
||||
deps.WriteTo(writer);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -16,5 +16,17 @@
|
|||
},
|
||||
"frameworks": {
|
||||
"netcoreapp1.0": {}
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x64": {},
|
||||
"win7-x86": {},
|
||||
"osx.10.11-x64": {},
|
||||
"ubuntu.14.04-x64": {},
|
||||
"ubuntu.16.04-x64": {},
|
||||
"centos.7-x64": {},
|
||||
"rhel.7.2-x64": {},
|
||||
"debian.8-x64": {},
|
||||
"fedora.23-x64": {},
|
||||
"opensuse.13.2-x64": {}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -19,5 +19,17 @@
|
|||
"dnxcore50"
|
||||
]
|
||||
}
|
||||
},
|
||||
"runtimes": {
|
||||
"win7-x64": {},
|
||||
"win7-x86": {},
|
||||
"osx.10.11-x64": {},
|
||||
"ubuntu.14.04-x64": {},
|
||||
"ubuntu.16.04-x64": {},
|
||||
"centos.7-x64": {},
|
||||
"rhel.7.2-x64": {},
|
||||
"debian.8-x64": {},
|
||||
"fedora.23-x64": {},
|
||||
"opensuse.13.2-x64": {}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue