Skip to content

Commit

Permalink
Move CoreCLR to the modern build tools and dnx
Browse files Browse the repository at this point in the history
This changes moves coreclr onto DNX (same version as corefx).  Theoretically, this should allow these tests to target the desktop CLR.  All of the old package.config files are gone and replaced with corresponding project.json files.  The up front restore behavior is retained.  Tests are now buildable individually, though not runnable in a similar fashion.
  • Loading branch information
mmitche committed Jul 9, 2015
1 parent eed62e3 commit 1972ec2
Show file tree
Hide file tree
Showing 3,126 changed files with 23,369 additions and 8,375 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
5 changes: 2 additions & 3 deletions build.cmd
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@ echo.
set "__BinDir=%__RootBinDir%\Product\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__IntermediatesDir=%__RootBinDir%\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__PackagesBinDir=%__BinDir%\.nuget"
set "__ToolsDir=%__RootBinDir%\tools"
set "__TestBinDir=%__RootBinDir%\tests\%__BuildOS%.%__BuildArch%.%__BuildType%"
set "__TestIntermediatesDir=%__RootBinDir%\tests\obj\%__BuildOS%.%__BuildArch%.%__BuildType%"

Expand Down Expand Up @@ -183,7 +182,7 @@ call "!VS%__VSProductVersion%COMNTOOLS!\VsDevCmd.bat"
echo Commencing build of mscorlib for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
set "__MScorlibBuildLog=%__LogsDir%\MScorlib_%__BuildOS%__%__BuildArch%__%__BuildType%.log"
%_msbuildexe% "%__ProjectFilesDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__MScorlibBuildLog%" /p:OS=%__BuildOS% %__AdditionalMSBuildArgs%
%_msbuildexe% "%__ProjectFilesDir%\build.proj" %__MSBCleanBuildArgs% /nologo /maxcpucount /verbosity:minimal /nodeReuse:false /fileloggerparameters:Verbosity=normal;LogFile="%__MScorlibBuildLog%" /p:OSGroup=%__BuildOS% %__AdditionalMSBuildArgs%
IF NOT ERRORLEVEL 1 (
if defined __MscorlibOnly exit /b 0
goto CrossGenMscorlib
Expand All @@ -208,7 +207,7 @@ exit /b 1
echo.
echo Commencing build of tests for %__BuildOS%.%__BuildArch%.%__BuildType%
echo.
call tests\buildtest.cmd
call %__ProjectDir%\tests\buildtest.cmd
IF NOT ERRORLEVEL 1 goto SuccessfulBuild
echo Test binaries build failed. Refer !__MScorlibBuildLog! for details.
exit /b 1
Expand Down
105 changes: 68 additions & 37 deletions dir.props
Original file line number Diff line number Diff line change
@@ -1,4 +1,26 @@
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<!--
$(OS) is set to Unix/Windows_NT. This comes from an environment variable on Windows and MSBuild on Unix.
-->
<PropertyGroup>
<OsEnvironment Condition="'$(OsEnvironment)'==''">$(OS)</OsEnvironment>
</PropertyGroup>

<!-- Build Tools Versions -->
<PropertyGroup>
<BuildToolsVersion>1.0.25-prerelease-00056</BuildToolsVersion>
<BuildToolsCoreCLRVersion>1.0.2-prerelease</BuildToolsCoreCLRVersion>
<DnxVersion Condition="'$(OsEnvironment)'!='Unix'">1.0.0-beta5-12101</DnxVersion>
<DnxVersion Condition="'$(OsEnvironment)'=='Unix'">1.0.0-beta5-12101</DnxVersion>
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'!='Unix'">dnx-coreclr-win-x86.$(DnxVersion)</DnxPackageName>
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'=='Unix'">dnx-mono.$(DnxVersion)</DnxPackageName>
<RoslynVersion>1.0.0-rc3-20150510-01</RoslynVersion>
<RoslynPackageName>Microsoft.Net.ToolsetCompilers</RoslynPackageName>
<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
<BuildToolsCoreCLRLocation>$(ToolsDir)$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion)</BuildToolsCoreCLRLocation>
</PropertyGroup>

<!-- Common properties -->
<PropertyGroup>
<!-- Set basic properties and normalize -->
Expand All @@ -15,33 +37,67 @@
<BuildOS Condition="'$(__BuildOS)' == ''">Windows_NT</BuildOS>

<ProjectDir>$(__ProjectDir)\</ProjectDir>
<ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)\</ProjectDir>
<ProjectDir Condition="'$(__ProjectDir)'==''">$(MSBuildThisFileDirectory)</ProjectDir>

<SourceDir>$(__SourceDir)\</SourceDir>
<SourceDir Condition="'$(__SourceDir)'==''">$(ProjectDir)\src\</SourceDir>
<SourceDir Condition="'$(__SourceDir)'==''">$(ProjectDir)src\</SourceDir>

<PackagesGlobalConfig>$(SourceDir).nuget\packages.config</PackagesGlobalConfig>
<PackagesDir>$(__PackagesDir)\</PackagesDir>
<PackagesDir Condition="'$(__PackagesDir)'==''">$(ProjectDir)\packages\</PackagesDir>
<PackagesDir Condition="'$(__PackagesDir)'==''">$(ProjectDir)packages\</PackagesDir>

<RootBinDir>$(__RootBinDir)\</RootBinDir>
<RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)\bin\</RootBinDir>
<RootBinDir Condition="'$(__RootBinDir)'==''">$(ProjectDir)bin\</RootBinDir>

<BinDir>$(__BinDir)\</BinDir>
<BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)\Product\$(BuildOS).$(BuildArch).$(BuildType)\</BinDir>
<BinDir Condition="'$(__BinDir)'==''">$(RootBinDir)Product\$(BuildOS).$(BuildArch).$(BuildType)\</BinDir>

<!-- We don't append back slash because this path is used by nuget.exe as output directory and it
fails to write packages to it if the path contains the forward slash.
-->
<PackagesBinDir>$(__PackagesBinDir)</PackagesBinDir>
<PackagesBinDir Condition="'$(__PackagesBinDir)'==''">$(BinDir)\.nuget</PackagesBinDir>

<ToolsDir>$(__ToolsDir)\</ToolsDir>
<ToolsDir Condition="'$(__ToolsDir)'==''">$(RootBinDir)\tools\</ToolsDir>

<PackagesBinDir Condition="'$(__PackagesBinDir)'==''">$(BinDir).nuget</PackagesBinDir>

<ToolsDir Condition="'$(ToolsDir)'==''">$(PackagesDir)Microsoft.DotNet.BuildTools.$(BuildToolsVersion)/lib/</ToolsDir>
<!-- Directory for the CoreCLR tools (BCLRewriter, etc.) -->
<CoreCLRToolsDir>$(PackagesDir)Microsoft.DotNet.BuildTools.CoreCLR.$(BuildToolsCoreCLRVersion)/</CoreCLRToolsDir>

<TestWorkingDir>$(__TestWorkingDir)\</TestWorkingDir>
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)\tests\$(BuildOS).$(BuildArch).$(BuildType)\</TestWorkingDir>
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)tests\$(BuildOS).$(BuildArch).$(BuildType)\</TestWorkingDir>
</PropertyGroup>

<!-- Common nuget properties -->
<PropertyGroup>
<NuGetToolPath Condition="'$(NuGetToolPath)'==''">$(PackagesDir)NuGet.exe</NuGetToolPath>
<NuGetConfigFile Condition="'$(NuGetConfigFile)'==''">$(SourceDir)NuGet.Config</NuGetConfigFile>
<NuGetConfigCommandLine>-ConfigFile "$(NuGetConfigFile)"</NuGetConfigCommandLine>

<NugetRestoreCommand>"$(NuGetToolPath)"</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) install</NugetRestoreCommand>
<!-- Trim off the last slash so that nuget doesn't get confused and say there are illegal characters on
the path. -->
<NugetRestoreCommand>$(NugetRestoreCommand) -OutputDirectory "$(PackagesDir.TrimEnd('\\'))"</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) $(NuGetConfigCommandLine)</NugetRestoreCommand>
<NugetRestoreCommand>$(NugetRestoreCommand) -Verbosity detailed</NugetRestoreCommand>
<NugetRestoreCommand Condition="'$(OsEnvironment)'=='Unix'">mono $(NuGetRestoreCommand)</NugetRestoreCommand>
</PropertyGroup>

<PropertyGroup>
<DnxPackageDir Condition="'$(DnxPackageDir)'==''">$(PackagesDir)/$(DnxPackageName)/</DnxPackageDir>
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'!='Unix'">$(DnxPackageDir)\bin\dnu.cmd</DnuToolPath>
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'=='Unix'">$(DnxPackageDir)/bin/dnu</DnuToolPath>

<DnuRestoreCommand>"$(DnuToolPath)"</DnuRestoreCommand>
<DnuRestoreCommand>$(DnuRestoreCommand) restore</DnuRestoreCommand>
<DnuRestoreCommand>$(DnuRestoreCommand) --packages "$(PackagesDir.TrimEnd('\\'))"</DnuRestoreCommand>
<DnuRestoreCommand Condition="'$(LockDependencies)' == 'true'">$(DnuRestoreCommand) --lock</DnuRestoreCommand>
</PropertyGroup>

<!-- Common build tool properties -->
<!-- <PropertyGroup>
<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
<BuildToolsCoreCLRVersion>1.0.2-prerelease</BuildToolsCoreCLRVersion>
<BuildToolsCoreCLRLocation>$(ToolsDir)$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion)</BuildToolsCoreCLRLocation>
</PropertyGroup> -->

<!-- Setup Nuget properties -->
<ItemGroup>
Expand All @@ -65,29 +121,4 @@

<TargetsUnix Condition="'$(TargetsFreeBSD)' == 'true' or '$(TargetsLinux)' == 'true' or '$(TargetsOSX)' == 'true'">true</TargetsUnix>
</PropertyGroup>

<!-- Common NuGet properties -->
<PropertyGroup>
<NuGetToolPath>$(ToolsDir)NuGet.exe</NuGetToolPath>
<NuGetConfigFile>$(SourceDir)NuGet.Config</NuGetConfigFile>
<NuGetConfigCommandLine
Condition="Exists('$(NuGetConfigFile)')">-ConfigFile &quot;$(NuGetConfigFile)&quot;</NuGetConfigCommandLine>
</PropertyGroup>

<!-- Common build tool properties -->
<PropertyGroup>

<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
<BuildToolsCoreCLRVersion>1.0.2-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>
124 changes: 102 additions & 22 deletions dir.targets
Original file line number Diff line number Diff line change
@@ -1,43 +1,123 @@
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" InitialTargets="_RestoreBuildToolsWrapper" 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"/>
<Address ParameterType="System.String" Required="true" />
<FileName ParameterType="System.String" Required="true" />
</ParameterGroup>
<Task>
<Reference Include="System" />
<Reference Include="System.IO" />
<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);
var directory = System.IO.Path.GetDirectoryName(FileName);
Directory.CreateDirectory(directory);
var tempFile = Path.Combine(directory, Path.GetRandomFileName());
var client = new System.Net.WebClient();
client.Proxy = System.Net.WebRequest.DefaultWebProxy;
if (client.Proxy != null) client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
var tryCount = 1;
var maxTries = 3;
while (tryCount <= maxTries)
{
try
{
Log.LogMessage("Attempting to download {0}...", Address);
client.DownloadFile(Address, tempFile);
break;
}
catch (System.Net.WebException e)
{
tryCount++;
if (tryCount > maxTries)
{
throw;
}
else
{
Log.LogMessage(MessageImportance.High, "Download failed, retrying: {0}", e.Message);
}
}
}
try
{
if (!File.Exists(FileName))
File.Move(tempFile, FileName);
}
finally
{
if (File.Exists(tempFile))
File.Delete(tempFile);
}
]]>
</Code>
</Task>
</UsingTask>

<!--
Needed to avoid the IntialTargets from having an Output which ends up getting
added to the output references when you have a project to project reference.
-->
<Target Name="_RestoreBuildToolsWrapper" DependsOnTargets="_RestoreBuildTools" />

<Target Name="_RestoreBuildTools"
BeforeTargets="Build"
Inputs="$(BuildToolsCoreCLRTargetInputs)"
Outputs="$(BuildToolsCoreCLRTargetOutputs)"
>
Inputs="$(MSBuildThisFileDirectory)dir.props;$(SourceDir).nuget/packages.$(OsEnvironment).config"
Outputs="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll;$(NugetToolPath);$(DnuToolPath)">
<Message Importance="High" Text="Restoring build tools..." />

<Copy Condition="Exists('$(NuGetCachedPath)')" SourceFiles="$(NuGetCachedPath)" DestinationFiles="$(NuGetToolPath)" SkipUnchangedFiles="true" />

<!-- Download latest nuget.exe -->
<DownloadFile
Condition="!Exists($(NuGetToolPath))"
Address="https://nuget.org/nuget.exe"
FileName="$(NuGetToolPath)" />
<DownloadFile FileName="$(NuGetToolPath)"
Address="https://www.nuget.org/nuget.exe"
Condition="!Exists('$(NuGetToolPath)') and '$(OsEnvironment)'=='Windows_NT'" />

<Exec Command="curl -sSL --create-dirs -o $(NuGetToolPath) https://api.nuget.org/downloads/nuget.exe"
Condition="!Exists('$(NuGetToolPath)') and '$(OsEnvironment)'=='Unix'" />

<PropertyGroup>
<_RestoreBuildToolsCommand>$(NugetRestoreCommand) "$(SourceDir).nuget/packages.$(OsEnvironment).config"</_RestoreBuildToolsCommand>
</PropertyGroup>

<!-- Restore build tools -->
<Exec
StandardOutputImportance="Low"
Command="&quot;$(NuGetToolPath)&quot; install &quot;$(PackagesGlobalConfig)&quot; -o &quot;$(ToolsDir.Trim('\'))&quot; $(NuGetConfigCommandLine)" />
<Exec Command="$(_RestoreBuildToolsCommand)" StandardOutputImportance="Low" />

<!-- currently DNU doesn't support -ConfigFile: https://github.com/aspnet/dnx/issues/1693
Our DnuRestoreCommand doesn't force a config file and we rely on the
directory probing for it to find nuget.config. This works for restore from source,
but not restore from PackagesDir as happens for test project restore since PackagesDir
will not be under src. To workaround, copy our nuget.config to packages. -->
<Copy Condition="Exists('$(NuGetConfigFile)')" SourceFiles="$(NuGetConfigFile)" DestinationFolder="$(PackagesDir)" SkipUnchangedFiles="true" />
<!-- Add this back if above comment becomes a problem -->
<!-- <Copy Condition="Exists('$(NuGetConfigFile)')" SourceFiles="$(NuGetConfigFile)" DestinationFolder="$(IntermediateOutputRootPath)" SkipUnchangedFiles="true" /> -->

<!-- Add DNU and Roslyn tool execute rights -->
<Exec Condition="'$(OsEnvironment)'=='Unix'"
Command="chmod a+x &quot;$(DnxPackageDir)/bin/dnu&quot;" />
<Exec Condition="'$(OsEnvironment)'=='Unix'"
Command="chmod a+x &quot;$(DnxPackageDir)/bin/dnx&quot;" />
<Exec Condition="'$(OsEnvironment)'=='Unix'"
Command="find '$(RoslynPackageDir)tools' -name &quot;*.exe&quot; -exec chmod &quot;+x&quot; '{}' ';'" />

<Touch Files="$(BuildToolsInstallSemaphore)" AlwaysCreate="true" />
<Error Condition="'$(ErrorIfBuildToolsRestoredFromIndividualProject)'=='true'"
Text="The build tools package was just restored and so we cannot continue the build of an individual project because targets from the build tools package were not able to be imported. Please retry the build the individual project again." />

<!--
There are cases where the inputs could be newer than the outputs but the
download or restore may not need to update. In such cases we need to touch
these files otherwise we continually run this target over and over for
every project until these files are cleaned (if the are ever cleaned).
-->
<Touch Files="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll;$(NugetToolPath);$(DnuToolPath)" />
</Target>
</Project>

<!-- Provide default empty targets for BuildAndTest and Test which can be hooked onto or overridden as necessary -->
<Target Name="BuildAndTest" DependsOnTargets="Build;Test" />

<Target Name="Test" />
</Project>
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.DotNet.BuildTools.CoreCLR" version="1.0.2-prerelease" />
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00009" />
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00056" />
<package id="dnx-coreclr-win-x86" version="1.0.0-beta5-12101" />
</packages>
6 changes: 6 additions & 0 deletions src/.nuget/packages.Windows_NT.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<packages>
<package id="Microsoft.DotNet.BuildTools" version="1.0.25-prerelease-00056" />
<package id="dnx-coreclr-win-x86" version="1.0.0-beta5-12101" />
<package id="Microsoft.DotNet.BuildTools.CoreCLR" version="1.0.2-prerelease" />
</packages>
File renamed without changes.
2 changes: 1 addition & 1 deletion src/mscorlib/Tools/BclRewriter/BclRewriter.targets
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<!-- ********************************************************************************************* -->

<PropertyGroup>
<BclRewriterCommand Condition="'$(BclRewriterCommand)'==''">$(BuildToolsCoreCLRLocation)\BclRewriter.exe</BclRewriterCommand>
<BclRewriterCommand Condition="'$(BclRewriterCommand)'==''">$(CoreCLRToolsDir)\BclRewriter.exe</BclRewriterCommand>
<BclRewriterModelFile>$(MscorlibDir)model.xml</BclRewriterModelFile>
<BclRewriterWorkDir>$(IntermediateOutputPath)\BclRewriter</BclRewriterWorkDir>
<BclRewriterSymbolOutput>$(IntermediateOutputPath)\BclRewriter\$(TargetName).pdb</BclRewriterSymbolOutput>
Expand Down
Loading

0 comments on commit 1972ec2

Please sign in to comment.