Setup the CoreCLR repo to use the LocalPackagePublish mechanism.

This will enable the 'local publish' of the CoreCLR package to a location where
it can be picked up by the CoreFx build. What this means is that you will be able
to build the CoreCLR package and use that to run the CoreFx tests on top of it.

Changes required to make this happen:
 - Refactor the managed build to make sure the buildtools gets restored before
   we attempt to use the targets it provides.
 - Take a dependency to the Microsoft.DotNet.BuildTools to bring in the packages.targets
 - Update the $(PackagesDir) to point to the <repo root>\packages to make it consistent with CoreFx
 - Hook-up the LocalPackagePublish targets to the build of the CoreCLR NuGet packages
This commit is contained in:
Alex Ghiondea 2015-02-18 16:26:30 -08:00
Родитель f846ccff6b
Коммит fbc318cfd9
8 изменённых файлов: 119 добавлений и 86 удалений

Просмотреть файл

@ -11,7 +11,7 @@ set "__ProjectDir=%~dp0"
if %__ProjectDir:~-1%==\ set "__ProjectDir=%__ProjectDir:~0,-1%"
set "__ProjectFilesDir=%__ProjectDir%"
set "__SourceDir=%__ProjectDir%\src"
set "__PackagesDir=%__SourceDir%\.nuget"
set "__PackagesDir=%__ProjectDir%\packages"
set "__RootBinDir=%__ProjectDir%\binaries"
set "__LogsDir=%__RootBinDir%\Logs"
set "__CMakeSlnDir=%__RootBinDir%\CMake"

Просмотреть файл

@ -2,86 +2,12 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="dir.props" />
<!-- Inline task to bootstrap the build to enable downloading nuget.exe -->
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var directory = System.IO.Path.GetDirectoryName(FileName);
System.IO.Directory.CreateDirectory(directory);
var client = new System.Net.WebClient();
client.Proxy = System.Net.WebRequest.DefaultWebProxy;
client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
client.DownloadFile(Address, FileName);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="_RestoreBuildTools"
BeforeTargets="Build"
Inputs="$(BuildToolsTargetInputs)"
Outputs="$(BuildToolsTargetOutputs)"
>
<!-- Download latest nuget.exe -->
<DownloadFile
Condition="!Exists($(NuGetToolPath))"
Address="http://nuget.org/nuget.exe"
FileName="$(NuGetToolPath)" />
<!-- Restore build tools -->
<Exec
StandardOutputImportance="Low"
Command="&quot;$(NuGetToolPath)&quot; install &quot; $(SourceDir).nuget\packages.config &quot; -o &quot; $(ToolsDir) &quot; $(NuGetConfigCommandLine)" />
<Touch Files="$(BuildToolsInstallSemaphore)" AlwaysCreate="true" />
</Target>
<!-- Setup Nuget properties -->
<ItemGroup>
<NuSpecSrcs Include="$(PackagesDir)Microsoft.DotNet.CoreCLR.nuspec" />
<NuSpecSrcs Condition="'$(Configuration)'=='Release'" Include="$(PackagesDir)Microsoft.DotNet.CoreCLR.Development.nuspec" />
<NuSpecSrcs Condition="'$(Configuration)'=='Debug'" Include="$(PackagesDir)Microsoft.DotNet.CoreCLR.Debug.Development.nuspec" />
</ItemGroup>
<ItemGroup>
<!-- Backslash appended, see note in dir.props about the PackagesBinDir property -->
<NuSpecs Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.nuspec" />
<NuSpecs Condition="'$(Configuration)'=='Release'" Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.Development.nuspec" />
<NuSpecs Condition="'$(Configuration)'=='Debug'" Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.Debug.Development.nuspec" />
<!-- We use build.proj instead of dirs.proj so we don't conflict with the TFS build-->
<Project Include="src\build.proj" />
</ItemGroup>
<!-- Generate Microsoft.Dotnet.CoreCLR nuget package and associated development package -->
<Target Name="BuildNuGetPackages" AfterTargets="MovePDB" Condition="'$(BuildNugetPackage)' != 'false'">
<MakeDir Directories="$(PackagesBinDir)" Condition="!Exists('$(PackagesBinDir)')" />
<Copy SourceFiles="@(NuSpecSrcs)" DestinationFolder="$(PackagesBinDir)" />
<Exec Command="&quot;$(NuGetToolPath)&quot; pack &quot;%(NuSpecs.Identity)&quot; -NoPackageAnalysis -NoDefaultExcludes -OutputDirectory &quot;$(PackagesBinDir)&quot;" />
</Target>
<ItemGroup>
<PDBSToMove Include="$(BinDir)mscorlib.pdb"/>
</ItemGroup>
<PropertyGroup>
<MscorlibPDBPath>$(BinDir)mscorlib.pdb</MscorlibPDBPath>
</PropertyGroup>
<Target Name="MovePDB" AfterTargets="Build">
<Move Condition="Exists($(MscorlibPDBPath))"
SourceFiles="@(PDBSToMove)"
DestinationFolder="$(BinDir)PDB"
/>
</Target>
<!-- Build mscorlib -->
<ItemGroup>
<Project Include="src\mscorlib\mscorlib.csproj" />
</ItemGroup>
<Import Project="dir.targets" />
<Import Project="dir.traversal.targets" />

Просмотреть файл

@ -114,7 +114,7 @@ __CMakeArgs=DEBUG
# Set the various build properties here so that CMake and MSBuild can pick them up
__ProjectDir="$__ProjectRoot"
__SourceDir="$__ProjectDir/src"
__PackagesDir="$__SourceDir/.nuget"
__PackagesDir="$__ProjectDir/packages"
__RootBinDir="$__ProjectDir/binaries"
__LogsDir="$__RootBinDir/Logs"
__CMakeSlnDir="$__RootBinDir/CMake"

Просмотреть файл

@ -16,7 +16,7 @@
<SourceDir Condition="'$(__SourceDir)'==''">$(ProjectDir)\src\</SourceDir>
<PackagesDir>$(__PackagesDir)\</PackagesDir>
<PackagesDir Condition="'$(__PackagesDir)'==''">$(SourceDir)\.nuget\</PackagesDir>
<PackagesDir Condition="'$(__PackagesDir)'==''">$(ProjectDir)\packages\</PackagesDir>
<RootBinDir>$(__RootBinDir)\</RootBinDir>
<RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)\binaries\</RootBinDir>
@ -37,6 +37,20 @@
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)\tests\$(BuildArch)\$(BuildType)\</TestWorkingDir>
</PropertyGroup>
<!-- Setup Nuget properties -->
<ItemGroup>
<NuSpecSrcs Include="$(SourceDir)\.nuget\Microsoft.DotNet.CoreCLR.nuspec" />
<NuSpecSrcs Condition="'$(Configuration)'=='Release'" Include="$(SourceDir)\.nuget\Microsoft.DotNet.CoreCLR.Development.nuspec" />
<NuSpecSrcs Condition="'$(Configuration)'=='Debug'" Include="$(SourceDir)\.nuget\Microsoft.DotNet.CoreCLR.Debug.Development.nuspec" />
</ItemGroup>
<ItemGroup>
<!-- Backslash appended, see note in dir.props about the PackagesBinDir property -->
<NuSpecs Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.nuspec" />
<NuSpecs Condition="'$(Configuration)'=='Release'" Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.Development.nuspec" />
<NuSpecs Condition="'$(Configuration)'=='Debug'" Include="$(PackagesBinDir)\Microsoft.DotNet.CoreCLR.Debug.Development.nuspec" />
</ItemGroup>
<!-- Common NuGet properties -->
<PropertyGroup>
<NuGetToolPath>$(ToolsDir)NuGet.exe</NuGetToolPath>
@ -47,10 +61,18 @@
<!-- Common build tool properties -->
<PropertyGroup>
<BuildToolsPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsPackageName>
<BuildToolsVersion>1.0.1-prerelease</BuildToolsVersion>
<BuildToolsInstallSempahore>$(ToolsDir)BuildTools.$(BuildToolsVersion).installed.semaphore</BuildToolsInstallSempahore>
<BuildToolsTargetInputs>$(MSBuildThisFileFullPath);$(MSBuildThisFileDirectory)build.proj</BuildToolsTargetInputs>
<BuildToolsTargetOutputs>$(BuildToolsInstallSempahore)</BuildToolsTargetOutputs>
<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
<BuildToolsCoreCLRVersion>1.0.1-prerelease</BuildToolsCoreCLRVersion>
<BuildToolsCoreCLRInstallSempahore>$(ToolsDir)BuildTools.$(BuildToolsCoreCLRVersion).installed.semaphore</BuildToolsCoreCLRInstallSempahore>
<BuildToolsPackageName>Microsoft.DotNet.BuildTools</BuildToolsPackageName>
<BuildToolsVersion>1.0.25-prerelease-00009</BuildToolsVersion>
<BuildToolsCoreCLRTargetInputs>$(MSBuildThisFileFullPath);$(MSBuildThisFileDirectory)build.proj</BuildToolsCoreCLRTargetInputs>
<BuildToolsCoreCLRTargetOutputs>$(BuildToolsCoreCLRInstallSempahore)</BuildToolsCoreCLRTargetOutputs>
<BuildToolsCoreCLRLocation>$(ToolsDir)\$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion)</BuildToolsCoreCLRLocation>
<BuildToolsLocation>$(ToolsDir)\$(BuildToolsPackageName).$(BuildToolsVersion)</BuildToolsLocation>
</PropertyGroup>
</Project>

43
dir.targets Normal file
Просмотреть файл

@ -0,0 +1,43 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<!-- Inline task to bootstrap the build to enable downloading nuget.exe -->
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
<ParameterGroup>
<Address ParameterType="System.String" Required="true"/>
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Code Type="Fragment" Language="cs">
<![CDATA[
var directory = System.IO.Path.GetDirectoryName(FileName);
System.IO.Directory.CreateDirectory(directory);
var client = new System.Net.WebClient();
client.Proxy = System.Net.WebRequest.DefaultWebProxy;
client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
client.DownloadFile(Address, FileName);
]]>
</Code>
</Task>
</UsingTask>
<Target Name="_RestoreBuildTools"
BeforeTargets="Build"
Inputs="$(BuildToolsCoreCLRTargetInputs)"
Outputs="$(BuildToolsCoreCLRTargetOutputs)"
>
<!-- Download latest nuget.exe -->
<DownloadFile
Condition="!Exists($(NuGetToolPath))"
Address="http://nuget.org/nuget.exe"
FileName="$(NuGetToolPath)" />
<!-- Restore build tools -->
<Exec
StandardOutputImportance="Low"
Command="&quot;$(NuGetToolPath)&quot; install &quot; $(SourceDir).nuget\packages.config &quot; -o &quot; $(ToolsDir) &quot; $(NuGetConfigCommandLine)" />
<Touch Files="$(BuildToolsInstallSemaphore)" AlwaysCreate="true" />
</Target>
</Project>

Просмотреть файл

@ -1,4 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.DotNet.BuildTools.CoreCLR" version="1.0.1-prerelease" />
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00009" />
</packages>

41
src/build.proj Normal file
Просмотреть файл

@ -0,0 +1,41 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="..\dir.props"/>
<!-- List the projects that need to be built -->
<ItemGroup>
<Project Include="mscorlib\mscorlib.csproj" />
</ItemGroup>
<Import Project="..\dir.targets" />
<Import Project="..\dir.traversal.targets" />
<!-- Hook into the local publishing by providing the task that needs to run before we can do the local publishing -->
<Import Project="$(BuildToolsLocation)\lib\packages.targets" Condition="Exists('$(BuildToolsLocation)\lib\packages.targets')" />
<PropertyGroup>
<NugetPackageBuildTargets>BuildNuGetPackages</NugetPackageBuildTargets>
</PropertyGroup>
<!-- Generate Microsoft.Dotnet.CoreCLR nuget package and associated development package -->
<Target Name="BuildNuGetPackages" AfterTargets="MovePDB" Condition="'$(BuildNugetPackage)' != 'false'">
<MakeDir Directories="$(PackagesBinDir)" Condition="!Exists('$(PackagesBinDir)')" />
<Copy SourceFiles="@(NuSpecSrcs)" DestinationFolder="$(PackagesBinDir)" />
<Exec Command="&quot;$(NuGetToolPath)&quot; pack &quot;%(NuSpecs.Identity)&quot; -NoPackageAnalysis -NoDefaultExcludes -OutputDirectory &quot;$(PackagesBinDir)&quot;" />
</Target>
<ItemGroup>
<PDBSToMove Include="$(BinDir)mscorlib.pdb"/>
</ItemGroup>
<PropertyGroup>
<MscorlibPDBPath>$(BinDir)mscorlib.pdb</MscorlibPDBPath>
</PropertyGroup>
<Target Name="MovePDB" AfterTargets="Build">
<Move Condition="Exists($(MscorlibPDBPath))"
SourceFiles="@(PDBSToMove)"
DestinationFolder="$(BinDir)PDB"
/>
</Target>
</Project>

Просмотреть файл

@ -5,7 +5,7 @@
<!-- ********************************************************************************************* -->
<PropertyGroup>
<BclRewriterCommand Condition="'$(BclRewriterCommand)'==''">$(ToolsDir)\$(BuildToolsPackageName).$(BuildToolsVersion)\BclRewriter.exe</BclRewriterCommand>
<BclRewriterCommand Condition="'$(BclRewriterCommand)'==''">$(BuildToolsCoreCLRLocation)\BclRewriter.exe</BclRewriterCommand>
<BclRewriterModelFile>$(MscorlibDir)model.xml</BclRewriterModelFile>
<BclRewriterWorkDir>$(IntermediateOutputPath)\BclRewriter</BclRewriterWorkDir>
<BclRewriterSymbolOutput>$(IntermediateOutputPath)\BclRewriter\$(TargetName).pdb</BclRewriterSymbolOutput>