Skip to content

Commit ff43d04

Browse files
author
Rahul Kumar
committed
update version of buildtools
1 parent d4eccd4 commit ff43d04

File tree

10 files changed

+114
-172
lines changed

10 files changed

+114
-172
lines changed

CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -794,7 +794,7 @@ if(WIN32)
794794
add_compile_options(/Zl) # omit default library name in .OBJ
795795
endif(WIN32)
796796

797-
# TODO change version
797+
# Microsoft.Dotnet.BuildTools.Coreclr version
798798
set(BuildToolsVersion "1.0.4-prerelease")
799799
set(BuildToolsDir "${CLR_DIR}/packages/Microsoft.DotNet.BuildTools.CoreCLR.${BuildToolsVersion}")
800800

build.cmd

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -254,6 +254,13 @@ if not defined __BuildSequential (
254254
set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount
255255
)
256256

257+
REM =========================================================================================
258+
REM ===
259+
REM === Restore Build Tools
260+
REM ===
261+
REM =========================================================================================
262+
call %~dp0init-tools.cmd
263+
257264
REM =========================================================================================
258265
REM ===
259266
REM === Start the build steps

dir.props

Lines changed: 19 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -10,16 +10,16 @@
1010

1111
<!-- Build Tools Versions -->
1212
<PropertyGroup>
13-
<BuildToolsVersion>1.0.25-prerelease-00121</BuildToolsVersion>
14-
<BuildToolsCoreCLRVersion>1.0.3-prerelease</BuildToolsCoreCLRVersion>
15-
<DnxVersion Condition="'$(OsEnvironment)'!='Unix'">1.0.0-rc2-16128</DnxVersion>
16-
<DnxVersion Condition="'$(OsEnvironment)'=='Unix'">1.0.0-rc2-16128</DnxVersion>
17-
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'!='Unix'">dnx-coreclr-win-x86.$(DnxVersion)</DnxPackageName>
18-
<DnxPackageName Condition="'$(DnxPackageName)' == '' and '$(OsEnvironment)'=='Unix'">dnx-mono.$(DnxVersion)</DnxPackageName>
1913
<RoslynVersion>1.0.0-rc3-20150510-01</RoslynVersion>
2014
<RoslynPackageName>Microsoft.Net.ToolsetCompilers</RoslynPackageName>
21-
<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
22-
<BuildToolsCoreCLRLocation>$(ToolsDir)$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion)</BuildToolsCoreCLRLocation>
15+
</PropertyGroup>
16+
17+
<!--
18+
Switching to the .NET Core version of the BuildTools tasks seems to break numerous scenarios, such as VS intellisense and resource designer
19+
as well as runnning the build on mono. Until we can get these sorted out we will continue using the .NET 4.5 version of the tasks.
20+
-->
21+
<PropertyGroup>
22+
<BuildToolsTargets45>true</BuildToolsTargets45>
2323
</PropertyGroup>
2424

2525
<!-- Common properties -->
@@ -61,14 +61,19 @@
6161
<PackagesBinDir>$(__PackagesBinDir)</PackagesBinDir>
6262
<PackagesBinDir Condition="'$(__PackagesBinDir)'==''">$(BinDir).nuget</PackagesBinDir>
6363

64-
<ToolsDir Condition="'$(ToolsDir)'==''">$(PackagesDir)Microsoft.DotNet.BuildTools.$(BuildToolsVersion)/lib/</ToolsDir>
64+
<ToolsDir Condition="'$(ToolsDir)'==''">$(ProjectDir)Tools/</ToolsDir>
65+
<DotnetCliPath Condition="'$(DotnetCliPath)'==''">$(ToolsDir)dotnetcli/bin/</DotnetCliPath>
6566
<BuildToolsSemaphore Condition="'$(BuildToolsSemaphore)' == ''">$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll</BuildToolsSemaphore>
66-
<!-- Directory for the CoreCLR tools (BCLRewriter, etc.) -->
67-
<CoreCLRToolsDir>$(PackagesDir)Microsoft.DotNet.BuildTools.CoreCLR.$(BuildToolsCoreCLRVersion)/</CoreCLRToolsDir>
6867

6968
<TestWorkingDir>$(__TestWorkingDir)\</TestWorkingDir>
7069
<TestWorkingDir Condition="'$(__TestWorkingDir)'==''">$(RootBinDir)tests\$(BuildOS).$(BuildArch).$(BuildType)\</TestWorkingDir>
70+
<BuildToolsTaskDir Condition="'$(BuildToolsTargets45)' == 'true'">$(ToolsDir)net45/</BuildToolsTaskDir>
71+
7172
</PropertyGroup>
73+
74+
<!-- Import Build tools common props file where repo-independent properties are found -->
75+
<Import Project="$(ToolsDir)Build.Common.props" />
76+
7277

7378
<!-- Common nuget properties -->
7479
<PropertyGroup>
@@ -87,23 +92,15 @@
8792
</PropertyGroup>
8893

8994
<PropertyGroup>
90-
<DnxPackageDir Condition="'$(DnxPackageDir)'==''">$(PackagesDir)/$(DnxPackageName)/</DnxPackageDir>
91-
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'!='Unix'">$(DnxPackageDir)\bin\dnu.cmd</DnuToolPath>
92-
<DnuToolPath Condition="'$(DnuToolPath)'=='' and '$(OsEnvironment)'=='Unix'">$(DnxPackageDir)/bin/dnu</DnuToolPath>
95+
<DotnetToolCommand Condition="'$(DotnetToolCommand)'=='' and '$(OsEnvironment)'!='Unix'">$(DotnetCliPath)dotnet.exe</DotnetToolCommand>
96+
<DotnetToolCommand Condition="'$(DotnetToolCommand)'=='' and '$(OsEnvironment)'=='Unix'">$(DotnetCliPath)dotnet</DotnetToolCommand>
9397

94-
<DnuRestoreCommand>"$(DnuToolPath)"</DnuRestoreCommand>
98+
<DnuRestoreCommand>"$(DotnetToolCommand)"</DnuRestoreCommand>
9599
<DnuRestoreCommand>$(DnuRestoreCommand) restore</DnuRestoreCommand>
96100
<DnuRestoreCommand>$(DnuRestoreCommand) --packages "$(PackagesDir.TrimEnd('\\'))"</DnuRestoreCommand>
97101
<DnuRestoreCommand Condition="'$(LockDependencies)' == 'true'">$(DnuRestoreCommand) --lock</DnuRestoreCommand>
98102
</PropertyGroup>
99103

100-
<!-- Common build tool properties -->
101-
<!-- <PropertyGroup>
102-
<BuildToolsCoreCLRPackageName>Microsoft.DotNet.BuildTools.CoreCLR</BuildToolsCoreCLRPackageName>
103-
<BuildToolsCoreCLRVersion>1.0.2-prerelease</BuildToolsCoreCLRVersion>
104-
<BuildToolsCoreCLRLocation>$(ToolsDir)$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion)</BuildToolsCoreCLRLocation>
105-
</PropertyGroup> -->
106-
107104
<!-- Setup Nuget properties -->
108105
<ItemGroup>
109106
<NuSpecSrcs Include="$(SourceDir)\.nuget\Microsoft.DotNet.CoreCLR.nuspec" />

dir.targets

Lines changed: 11 additions & 117 deletions
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,17 @@
11
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" InitialTargets="_RestoreBuildToolsWrapper" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
4-
<!-- Inline task to bootstrap the build to enable downloading nuget.exe -->
5-
<UsingTask TaskName="DownloadFile" TaskFactory="CodeTaskFactory" AssemblyFile="$(MSBuildToolsPath)\Microsoft.Build.Tasks.v12.0.dll">
6-
<ParameterGroup>
7-
<Address ParameterType="System.String" Required="true" />
8-
<FileName ParameterType="System.String" Required="true" />
9-
</ParameterGroup>
10-
<Task>
11-
<Reference Include="System" />
12-
<Reference Include="System.IO" />
13-
<Code Type="Fragment" Language="cs">
14-
<![CDATA[
15-
var directory = System.IO.Path.GetDirectoryName(FileName);
16-
Directory.CreateDirectory(directory);
17-
18-
var tempFile = Path.Combine(directory, Path.GetRandomFileName());
19-
var client = new System.Net.WebClient();
20-
client.Proxy = System.Net.WebRequest.DefaultWebProxy;
21-
if (client.Proxy != null) client.Proxy.Credentials = System.Net.CredentialCache.DefaultCredentials;
22-
var tryCount = 1;
23-
var maxTries = 3;
24-
25-
while (tryCount <= maxTries)
26-
{
27-
try
28-
{
29-
Log.LogMessage("Attempting to download {0}...", Address);
30-
client.DownloadFile(Address, tempFile);
31-
break;
32-
}
33-
catch (System.Net.WebException e)
34-
{
35-
tryCount++;
36-
if (tryCount > maxTries)
37-
{
38-
throw;
39-
}
40-
else
41-
{
42-
Log.LogMessage(MessageImportance.High, "Download failed, retrying: {0}", e.Message);
43-
}
44-
}
45-
}
46-
47-
try
48-
{
49-
if (!File.Exists(FileName))
50-
File.Move(tempFile, FileName);
51-
}
52-
finally
53-
{
54-
if (File.Exists(tempFile))
55-
File.Delete(tempFile);
56-
}
57-
]]>
58-
</Code>
59-
</Task>
60-
</UsingTask>
61-
62-
<!--
63-
Needed to avoid the IntialTargets from having an Output which ends up getting
64-
added to the output references when you have a project to project reference.
65-
-->
66-
<Target Name="_RestoreBuildToolsWrapper" DependsOnTargets="_RestoreBuildTools" />
67-
68-
<Target Name="_RestoreBuildTools"
69-
Inputs="$(MSBuildThisFileDirectory)dir.props;$(SourceDir).nuget/packages.$(OsEnvironment).config"
70-
Outputs="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll;$(NugetToolPath);$(DnuToolPath)">
71-
<Message Importance="High" Text="Restoring build tools..." />
72-
73-
<Copy Condition="Exists('$(NuGetCachedPath)')" SourceFiles="$(NuGetCachedPath)" DestinationFiles="$(NuGetToolPath)" SkipUnchangedFiles="true" />
74-
75-
<!-- Download latest nuget.exe -->
76-
<DownloadFile FileName="$(NuGetToolPath)"
77-
Address="https://www.nuget.org/nuget.exe"
78-
Condition="!Exists('$(NuGetToolPath)') and '$(OsEnvironment)'=='Windows_NT'" />
79-
80-
<Exec Command="curl -sSL --create-dirs -o $(NuGetToolPath) https://api.nuget.org/downloads/nuget.exe"
81-
Condition="!Exists('$(NuGetToolPath)') and '$(OsEnvironment)'=='Unix'" />
82-
83-
<PropertyGroup>
84-
<_RestoreBuildToolsCommand>$(NugetRestoreCommand) "$(SourceDir).nuget/packages.$(OsEnvironment).config"</_RestoreBuildToolsCommand>
85-
</PropertyGroup>
86-
87-
<!-- Restore build tools -->
88-
<Exec Command="$(_RestoreBuildToolsCommand)" StandardOutputImportance="Low" />
89-
90-
<!-- currently DNU doesn't support -ConfigFile: https://github.com/aspnet/dnx/issues/1693
91-
Our DnuRestoreCommand doesn't force a config file and we rely on the
92-
directory probing for it to find nuget.config. This works for restore from source,
93-
but not restore from PackagesDir as happens for test project restore since PackagesDir
94-
will not be under src. To workaround, copy our nuget.config to packages. -->
95-
<Copy Condition="Exists('$(NuGetConfigFile)')" SourceFiles="$(NuGetConfigFile)" DestinationFolder="$(PackagesDir)" SkipUnchangedFiles="true" />
96-
<!-- Add this back if above comment becomes a problem -->
97-
<!-- <Copy Condition="Exists('$(NuGetConfigFile)')" SourceFiles="$(NuGetConfigFile)" DestinationFolder="$(IntermediateOutputRootPath)" SkipUnchangedFiles="true" /> -->
98-
99-
<!-- Add DNU and Roslyn tool execute rights -->
100-
<Exec Condition="'$(OsEnvironment)'=='Unix'"
101-
Command="chmod a+x &quot;$(DnxPackageDir)/bin/dnu&quot;" />
102-
<Exec Condition="'$(OsEnvironment)'=='Unix'"
103-
Command="chmod a+x &quot;$(DnxPackageDir)/bin/dnx&quot;" />
104-
<Exec Condition="'$(OsEnvironment)'=='Unix'"
105-
Command="find '$(RoslynPackageDir)tools' -name &quot;*.exe&quot; -exec chmod &quot;+x&quot; '{}' ';'" />
106-
107-
<Error Condition="'$(ErrorIfBuildToolsRestoredFromIndividualProject)'=='true'"
108-
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." />
109-
110-
<!--
111-
There are cases where the inputs could be newer than the outputs but the
112-
download or restore may not need to update. In such cases we need to touch
113-
these files otherwise we continually run this target over and over for
114-
every project until these files are cleaned (if the are ever cleaned).
115-
-->
116-
<Touch Files="$(ToolsDir)Microsoft.DotNet.Build.Tasks.dll;$(NugetToolPath);$(DnuToolPath)" />
2+
<Project ToolsVersion="12.0" InitialTargets="CheckForBuildTools" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3+
4+
<Target Name="CheckForBuildTools">
5+
<Error Condition="!Exists('$(ToolsDir)')"
6+
Text="The tools directory [$(ToolsDir)] does not exist. Please run init-tools.cmd in your enlistment to ensure the tools are installed before attempting to build an individual project." />
1177
</Target>
1188

119-
<!-- Provide default empty targets for BuildAndTest and Test which can be hooked onto or overridden as necessary -->
9+
<!-- Provide default targets which can be hooked onto or overridden as necessary -->
12010
<Target Name="BuildAndTest" DependsOnTargets="Build;Test" />
121-
11+
<Target Name="RebuildAndTest" DependsOnTargets="Rebuild;Test" />
12212
<Target Name="Test" />
13+
14+
<Import Project="$(ToolsDir)/Build.Common.targets" Condition="'$(UseLiveBuildTools)' != 'true'" />
15+
12316
</Project>
17+

init-tools.cmd

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
@echo off
2+
setlocal
3+
4+
REM Workaround https://github.com/dotnet/coreclr/issues/2153
5+
set ComPlus_ReadyToRun=0
6+
7+
set INIT_TOOLS_LOG=%~dp0init-tools.log
8+
set PACKAGES_DIR=%~dp0packages\
9+
set TOOLRUNTIME_DIR=%~dp0Tools
10+
set DOTNET_PATH=%TOOLRUNTIME_DIR%\dotnetcli\
11+
set DOTNET_CMD=%DOTNET_PATH%bin\dotnet.exe
12+
if [%BUILDTOOLS_SOURCE%]==[] set BUILDTOOLS_SOURCE=https://www.myget.org/F/dotnet-buildtools/
13+
set /P BUILDTOOLS_VERSION=< %~dp0BuildToolsVersion.txt
14+
set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib\
15+
set PROJECT_JSON_PATH=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION%
16+
set PROJECT_JSON_FILE=%PROJECT_JSON_PATH%\project.json
17+
set PROJECT_JSON_CONTENTS={ "dependencies": { "Microsoft.DotNet.BuildTools": "%BUILDTOOLS_VERSION%" , "Microsoft.DotNet.BuildTools.Coreclr": "1.0.4-prerelease"}, "frameworks": { "dnxcore50": { } } }
18+
set BUILD_TOOLS_SEMAPHORE=%PROJECT_JSON_PATH%\init-tools.completed
19+
20+
:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated
21+
if [%1]==[force] (
22+
if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%"
23+
if exist "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%Microsoft.DotNet.BuildTools"
24+
)
25+
26+
:: If sempahore exists do nothing
27+
if exist "%BUILD_TOOLS_SEMAPHORE%" (
28+
echo Tools are already initialized.
29+
goto :EOF
30+
)
31+
32+
:: Download Nuget.exe
33+
if NOT exist "%PACKAGES_DIR%NuGet.exe" (
34+
if NOT exist "%PACKAGES_DIR%" mkdir "%PACKAGES_DIR%"
35+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('https://www.nuget.org/nuget.exe', '%PACKAGES_DIR%NuGet.exe')
36+
)
37+
38+
if NOT exist "%PROJECT_JSON_PATH%" mkdir "%PROJECT_JSON_PATH%"
39+
echo %PROJECT_JSON_CONTENTS% > %PROJECT_JSON_FILE%
40+
echo Running %0 > %INIT_TOOLS_LOG%
41+
42+
if exist "%DOTNET_CMD%" goto :afterdotnetrestore
43+
44+
echo Installing dotnet cli...
45+
if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%"
46+
set /p DOTNET_VERSION=< %~dp0DotnetCLIVersion.txt
47+
set DOTNET_ZIP_NAME=dotnet-win-x64.%DOTNET_VERSION%.zip
48+
set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/%DOTNET_VERSION%/%DOTNET_ZIP_NAME%
49+
set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME%
50+
echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> %INIT_TOOLS_LOG%
51+
powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('%DOTNET_REMOTE_PATH%', '%DOTNET_LOCAL_PATH%'); Add-Type -Assembly 'System.IO.Compression.FileSystem' -ErrorVariable AddTypeErrors; if ($AddTypeErrors.Count -eq 0) { [System.IO.Compression.ZipFile]::ExtractToDirectory('%DOTNET_LOCAL_PATH%', '%DOTNET_PATH%') } else { (New-Object -com shell.application).namespace('%DOTNET_PATH%').CopyHere((new-object -com shell.application).namespace('%DOTNET_LOCAL_PATH%').Items(),16) }" >> %INIT_TOOLS_LOG%
52+
if NOT exist "%DOTNET_LOCAL_PATH%" (
53+
echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details.
54+
goto :EOF
55+
)
56+
57+
:afterdotnetrestore
58+
59+
if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore
60+
echo Restoring BuildTools version %BUILDTOOLS_VERSION%...
61+
echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG%
62+
call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG%
63+
if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" (
64+
echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details.
65+
goto :EOF
66+
)
67+
68+
:afterbuildtoolsrestore
69+
70+
echo Initializing BuildTools ...
71+
echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG%
72+
call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG%
73+
74+
:: Create sempahore file
75+
echo Done initializing tools.
76+
echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%"

src/.nuget/packages.Unix.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/.nuget/packages.Windows_NT.config

Lines changed: 0 additions & 6 deletions
This file was deleted.

src/dlls/mscoree/coreclr/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ if(WIN32)
144144

145145
add_custom_command(TARGET coreclr
146146
POST_BUILD
147-
COMMAND ${CLR_DIR}/src/scripts/buildtools/restorebuildtools.bat
148147
COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/src/debug/daccess/daccess.cpp
149148
COMMAND ${BuildToolsDir}/dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/coreclr.pdb /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin
150149
COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr>

src/scripts/buildtools/restorebuildtools.bat

Lines changed: 0 additions & 11 deletions
This file was deleted.

src/scripts/buildtools/restorebuildtools.proj

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)