dotnet-installer/build/Microsoft.DotNet.Cli.Compile.targets

299 lines
14 KiB
Text
Raw Normal View History

2016-07-01 18:02:26 +00:00
<?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" />
<Import Project="crossgen/Microsoft.DotNet.Cli.Crossgen.targets" />
2016-08-09 20:22:22 +00:00
<PropertyGroup>
<BinaryToCorehostifyRelDir>runtimes/any/native</BinaryToCorehostifyRelDir>
2016-08-09 22:19:34 +00:00
<MSBuildImportsDir>$(RepoRoot)/resources/MSBuildImports</MSBuildImportsDir>
2016-08-09 20:22:22 +00:00
</PropertyGroup>
<ItemGroup>
<PublishOutputExtensions Include="$(ExeExtension);.dll;.pdb;.deps.json;.runtimeconfig.json" />
<BundledTools Include="MSBuild;NuGet.CommandLine.XPlat;dotnet" />
<MSBuildImportsContent Include="$(MSBuildImportsDir)/**/*" />
</ItemGroup>
<Target Name="Compile" DependsOnTargets="Prepare;
SetupStage;
CompileStage;
PublishSdks;
First step to ingest template engine (#5065) * First step to ingest template engine Please do not merge yet @piotrp @seancpeters @livarocc * Localization * Attempt to get a build going Rename program.cs to New3Command.cs Move TableFormatter into its own file Consume template engine packages version 1.0.0-beta1-20161218-24 Temporarily add MyGet templating feed so that package restore will work * Update ExtendedCommandParser Make short form args prefer longer runs of characters in the source parameter before falling back to p:shortname syntax Change scoping for a few methods to get rid of inconsistent visiblity errors * Fix package installation wildcards * Cleanup New3Command, fix review issue, bump version, sorting for template list * Installation, loc fix, help formatting * Use latest TemplateEngine packages * New3 unit tests * Fixed formatting on csproj files * Add the build steps to add templates to the layout * Change tests slightly to make comparisons easier Also fixes the wrong flag getting passed to set language * Fixes for 127, 128, 130, 131 - help display * Sync to latest TemplateEngine version Absorbs new search logic * All tests passing Cleaner New3Command Support for project/item template contexts * Try to make tests more durable * Disable test parallelization for dotnet-new tests * Update web SDK and template engine versions * Remove AI package feed * Simplify CLI interface to Template Engine * Fix host identifier and update to latest packages * Update template engine & Web SDK versions * Fix template engine version * Remove UsingTask and redeclaration of property
2017-01-06 22:48:27 +00:00
PublishTemplates;
BuildProjectsForNuGetPackages;
GetNuGetPackagesArchive;" />
<Target Name="SetupStage"
DependsOnTargets="Prepare">
<PropertyGroup>
<SrcDirectory>$(RepoRoot)/src</SrcDirectory>
</PropertyGroup>
<ItemGroup>
<CompileStageInputs Include="$(SrcDirectory)/**/*.cs" Exclude="$(SrcDirectory)/**/obj/**/*.cs" />
<CompileStageInputs Include="$(SrcDirectory)/**/*.csproj;$(SrcDirectory)/**/project.assets.json" />
<Stage Include="Stage1">
<Inputs>@(CompileStageInputs)</Inputs>
<StageDirectory>$(Stage1Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage1SymbolsDirectory)</StageSymbolsDirectory>
<DotnetDir>$(Stage0Directory)</DotnetDir>
</Stage>
<Stage Include="Stage2">
<Inputs>@(CompileStageInputs)</Inputs>
<StageDirectory>$(Stage2Directory)</StageDirectory>
<StageSymbolsDirectory>$(Stage2SymbolsDirectory)</StageSymbolsDirectory>
<DotnetDir>$(Stage0Directory)</DotnetDir>
</Stage>
</ItemGroup>
</Target>
<Target Name="CompileStage"
DependsOnTargets="SetupStage;
InitCrossgenProps;"
Inputs="%(Stage.Inputs)"
Outputs="%(StageDirectory)/sdk/$(SdkVersion)/dotnet.dll">
<PropertyGroup>
<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$(ExeExtension)</DotnetHostBaseName>
<DotnetHostFxrBaseName>$(DynamicLibPrefix)hostfxr$(DynamicLibSuffix)</DotnetHostFxrBaseName>
<HostPolicyBaseName>$(DynamicLibPrefix)hostpolicy$(DynamicLibSuffix)</HostPolicyBaseName>
<StageDirectory>%(Stage.StageDirectory)</StageDirectory>
<StageSymbolsDirectory>%(Stage.StageSymbolsDirectory)</StageSymbolsDirectory>
<SdkOutputDirectory>$(StageDirectory)/sdk/$(SdkVersion)</SdkOutputDirectory>
<BinaryToCorehostifyOutDir>$(SdkOutputDirectory)/$(BinaryToCorehostifyRelDir)</BinaryToCorehostifyOutDir>
<MSBuildTargetsDirectory>$(SdkOutputDirectory)/runtimes/any/native</MSBuildTargetsDirectory>
<SharedFrameworkNameVersionPath>$(StageDirectory)/shared/$(SharedFrameworkName)/$(SharedFrameworkVersion)</SharedFrameworkNameVersionPath>
</PropertyGroup>
<ItemGroup>
<BinObj Remove="*" />
<BinObj Include="$(SrcDirectory)/**/bin/**/*" />
<BinObj Include="$(SrcDirectory)/**/obj/**/*" Exclude="$(SrcDirectory)/**/obj/project.assets.json;$(SrcDirectory)/**/obj/*.csproj.nuget.g.props;$(SrcDirectory)/**/obj/*.csproj.nuget.g.targets" />
<SharedFramework Remove="*" />
2016-07-01 18:02:26 +00:00
<SharedFramework Include="$(SharedFrameworkPublishDirectory)/**/*" />
2017-01-04 21:27:41 +00:00
<RuntimeTargetsAssetsToRemoveFromDeps Remove="*" />
<RuntimeTargetsAssetsToRemoveFromDeps Include="csc" />
<RuntimeTargetsAssetsToRemoveFromDeps Include="vbc" />
<RuntimeTargetsAssetsToRemoveFromDeps Include="MSBuild" />
<RuntimeAssetsToRemoveFromDeps Remove="*" />
<RuntimeAssetsToRemoveFromDeps Include="redist" />
<RuntimeAssetsToRemoveFromDeps Include="tool_msbuild" />
<RuntimeAssetsToRemoveFromDeps Include="tool_nuget" />
</ItemGroup>
<Delete Files="@(BinObj)" />
<RemoveDir Directories="$(StageDirectory)" />
<MakeDir Directories="$(StageDirectory)"/>
<!-- CopySharedFramework -->
<Copy SourceFiles="@(SharedFramework)"
2016-08-09 20:22:22 +00:00
DestinationFiles="@(SharedFramework->'$(StageDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Workaround for https://github.com/dotnet/sdk/issues/115 -->
<ItemGroup>
2017-01-21 02:30:10 +00:00
<HackFilesToCopy Include="$(NuGetPackagesDir)\microsoft.build.runtime\$(CLI_MSBuild_Version)\contentFiles\any\netcoreapp1.0\**;
$(NuGetPackagesDir)\microsoft.build.runtime\$(CLI_MSBuild_Version)\contentFiles\any\netcoreapp1.1\**;
$(NuGetPackagesDir)\microsoft.codeanalysis.build.tasks\$(CLI_Roslyn_Version)\contentFiles\any\any\**;
$(NuGetPackagesDir)\microsoft.testplatform.cli\$(CLI_TestPlatform_Version)\contentFiles\any\any\**" />
</ItemGroup>
<Copy SourceFiles="@(HackFilesToCopy)"
DestinationFiles="@(HackFilesToCopy->'$(SdkOutputDirectory)/%(RecursiveDir)%(Filename)%(Extension)')" />
<!-- Publish DotNet -->
<DotNetPublish ToolPath="%(Stage.DotnetDir)"
Output="$(SdkOutputDirectory)"
Configuration="$(Configuration)"
VersionSuffix="$(VersionSuffix)"
ProjectPath="$(SrcDirectory)/redist/redist.csproj"
MSBuildArgs="/p:GenerateRuntimeConfigurationFiles=true" />
<!-- Publish DotNet -->
<DotNetPublish ToolPath="%(Stage.DotnetDir)"
Output="$(SdkOutputDirectory)/Roslyn"
Configuration="$(Configuration)"
VersionSuffix="$(VersionSuffix)"
ProjectPath="$(SrcDirectory)/tool_roslyn/tool_roslyn.csproj" />
<!-- Corehostify Binaries -->
<ItemGroup Condition=" '$(OSName)' != 'win' ">
<SdkOutputChmodTargets Remove="*" />
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.exe;
$(SdkOutputDirectory)/**/*.dll" >
<!-- Managed assemblies do not need execute -->
<Mode>u=rw,g=r,o=r</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*.dylib;
$(SdkOutputDirectory)/**/*.so" >
<!-- Generally, dylibs and sos have 'x' -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
<SdkOutputChmodTargets Include="$(SdkOutputDirectory)/**/*"
Exclude="$(SdkOutputDirectory)/**/*.*" >
<!-- Executables need x -->
<Mode>u=rwx,g=rx,o=rx</Mode>
</SdkOutputChmodTargets>
</ItemGroup>
<Chmod Condition=" '$(OSName)' != 'win' "
File="%(SdkOutputChModTargets.FullPath)"
Mode="%(SdkOutputChModTargets.Mode)" />
2016-08-09 20:22:22 +00:00
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/redist.deps.json"
SectionName="runtimeTargets"
2017-01-04 21:27:41 +00:00
AssetPath="$(BinaryToCorehostifyRelDir)/%(RuntimeTargetsAssetsToRemoveFromDeps.Identity).exe" />
<RemoveAssetFromDepsPackages DepsFile="$(SdkOutputDirectory)/redist.deps.json"
SectionName="runtime"
AssetPath="%(RuntimeAssetsToRemoveFromDeps.Identity).dll" />
2016-08-09 20:22:22 +00:00
<Copy SourceFiles="$(SdkOutputDirectory)/redist.deps.json"
DestinationFiles="$(SdkOutputDirectory)/%(BundledTools.Identity).deps.json" />
2016-08-09 20:22:22 +00:00
<Copy SourceFiles="$(SdkOutputDirectory)/redist.runtimeconfig.json"
DestinationFiles="$(SdkOutputDirectory)/%(BundledTools.Identity).runtimeconfig.json" />
<ChangeEntryPointLibraryName
2016-08-09 20:22:22 +00:00
DepsFile="$(SdkOutputDirectory)/%(BundledTools.Identity).deps.json"
NewName="%(BundledTools.Identity).deps.json" />
2016-08-09 20:22:22 +00:00
<!-- cleanup project output we don't need -->
<Delete Files="$(SdkOutputDirectory)/redist%(PublishOutputExtensions.Identity)" />
<Delete Files="$(SdkOutputDirectory)/tool_msbuild%(PublishOutputExtensions.Identity)" />
2017-01-04 21:27:41 +00:00
<Delete Files="$(SdkOutputDirectory)/tool_nuget%(PublishOutputExtensions.Identity)" />
<!-- Copy Host to SDK Directory -->
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostBaseName)"
DestinationFiles="$(SdkOutputDirectory)/corehost$(ExeExtension)" />
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(DotnetHostFxrBaseName)"
DestinationFiles="$(SdkOutputDirectory)/$(DotnetHostFxrBaseName)" />
<Copy SourceFiles="$(SharedFrameworkNameVersionPath)/$(HostPolicyBaseName)"
DestinationFiles="$(SdkOutputDirectory)/$(HostPolicyBaseName)" />
2016-08-09 20:22:22 +00:00
<!-- copy core sdk -->
2016-08-09 22:19:34 +00:00
<Copy SourceFiles="@(MSBuildImportsContent)"
2016-08-09 20:22:22 +00:00
DestinationFolder="$(SdkOutputDirectory)/%(RecursiveDir)" />
<!-- Crossgen the Shared Framework -->
<ItemGroup>
<SdkFiles Remove="*" />
<!-- Removing Full CLR built TestHost assemblies from getting Crossgen as it is throwing error -->
<SdkFilesExclude Include="$(SdkOutputDirectory)/TestHost*/**/*" />
<SdkFiles Include="$(SdkOutputDirectory)/**/*" Exclude="@(SdkFilesExclude)" />
<SdkFilesWithPEMarker Remove="*" />
</ItemGroup>
<AddMetadataIsPE Items="@(SdkFiles)">
<Output TaskParameter="ResultItems" ItemName="SdkFilesWithPEMarker" />
</AddMetadataIsPE>
<ItemGroup>
<CrossgenTargets Remove="*" />
<CrossgenTargets Include="%(SdkFilesWithPEMarker.FullPath)" Condition=" '%(SdkFilesWithPEMarker.IsPE)' == 'True' " />
<CompileStageSdkDirectories Remove="*" />
</ItemGroup>
<RemoveDuplicates Inputs="@(SdkFiles->'%(RootDir)%(Directory)')">
<Output TaskParameter="Filtered" ItemName="CompileStageSdkDirectories" />
</RemoveDuplicates>
<Crossgen Condition=" '$(DISABLE_CROSSGEN)' != '1' "
SourceAssembly="%(CrossgenTargets.FullPath)"
DestinationPath="%(CrossgenTargets.FullPath)"
JITPath="$(LibCLRJitPath)"
CrossgenPath="$(CrossgenPath)"
ReadyToRun="True"
PlatformAssemblyPaths="@(PlatformAssemblies);
@(CompileStageSdkDirectories);
$(SharedFrameworkNameVersionPath)" />
<!-- Generate .version file -->
<WriteLinesToFile File="$(SdkOutputDirectory)/.version"
Lines="$(CommitHash);$(SdkVersion);$(Rid)"
Overwrite="true" />
<ItemGroup>
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.targets" />
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.Targets" />
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.props" />
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.overridetasks" />
<MSBuildTargetsToCopy Include="$(MSBuildTargetsDirectory)/**/*.tasks" />
</ItemGroup>
<Copy SourceFiles="@(MSBuildTargetsToCopy)"
2016-08-09 20:22:22 +00:00
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>
<Target Name="PublishSdks"
DependsOnTargets="Prepare">
<ItemGroup>
<SdksToBundle Include="build/Microsoft.DotNet.Cli.BundledSdks.proj">
<Properties>
CLIBuildDll=$(CLIBuildDll);
NuGetPackagesDir=$(NuGetPackagesDir);
SdkLayoutDirectory=$(SdkOutputDirectory)/Sdks/%(BundledSdk.Identity);
SdkPackageName=%(BundledSdk.Identity);
SdkPackageVersion=%(BundledSdk.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</SdksToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(SdksToBundle)">
</MSBuild>
</Target>
First step to ingest template engine (#5065) * First step to ingest template engine Please do not merge yet @piotrp @seancpeters @livarocc * Localization * Attempt to get a build going Rename program.cs to New3Command.cs Move TableFormatter into its own file Consume template engine packages version 1.0.0-beta1-20161218-24 Temporarily add MyGet templating feed so that package restore will work * Update ExtendedCommandParser Make short form args prefer longer runs of characters in the source parameter before falling back to p:shortname syntax Change scoping for a few methods to get rid of inconsistent visiblity errors * Fix package installation wildcards * Cleanup New3Command, fix review issue, bump version, sorting for template list * Installation, loc fix, help formatting * Use latest TemplateEngine packages * New3 unit tests * Fixed formatting on csproj files * Add the build steps to add templates to the layout * Change tests slightly to make comparisons easier Also fixes the wrong flag getting passed to set language * Fixes for 127, 128, 130, 131 - help display * Sync to latest TemplateEngine version Absorbs new search logic * All tests passing Cleaner New3Command Support for project/item template contexts * Try to make tests more durable * Disable test parallelization for dotnet-new tests * Update web SDK and template engine versions * Remove AI package feed * Simplify CLI interface to Template Engine * Fix host identifier and update to latest packages * Update template engine & Web SDK versions * Fix template engine version * Remove UsingTask and redeclaration of property
2017-01-06 22:48:27 +00:00
<Target Name="PublishTemplates"
DependsOnTargets="Prepare">
<ItemGroup>
<TemplatesToBundle Include="build/Microsoft.DotNet.Cli.BundledTemplates.proj">
<Properties>
TemplateLayoutDirectory=$(SdkOutputDirectory)/Templates;
TemplatePackageName=%(BundledTemplate.Identity);
TemplatePackageVersion=%(BundledTemplate.Version);
Stage0Directory=$(Stage0Directory)
</Properties>
</TemplatesToBundle>
</ItemGroup>
<MSBuild
BuildInParallel="False"
Projects="@(TemplatesToBundle)">
</MSBuild>
</Target>
</Project>