diff --git a/CMakeLists.txt b/CMakeLists.txt index 98d3b760d58c..dfbd1e504147 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -794,7 +794,7 @@ if(WIN32) add_compile_options(/Zl) # omit default library name in .OBJ endif(WIN32) -# TODO change version +# Microsoft.Dotnet.BuildTools.Coreclr version set(BuildToolsVersion "1.0.4-prerelease") set(BuildToolsDir "${CLR_DIR}/packages/Microsoft.DotNet.BuildTools.CoreCLR.${BuildToolsVersion}") diff --git a/build.cmd b/build.cmd index 3751c18b8fd3..f0e884b9430e 100644 --- a/build.cmd +++ b/build.cmd @@ -254,6 +254,13 @@ if not defined __BuildSequential ( set __msbuildCommonArgs=%__msbuildCommonArgs% /maxcpucount ) +REM ========================================================================================= +REM === +REM === Restore Build Tools +REM === +REM ========================================================================================= +call %~dp0init-tools.cmd + REM ========================================================================================= REM === REM === Start the build steps diff --git a/dir.props b/dir.props index fbbb49ae2212..765d13c9f7de 100644 --- a/dir.props +++ b/dir.props @@ -10,16 +10,16 @@ - 1.0.25-prerelease-00121 - 1.0.3-prerelease - 1.0.0-rc2-16128 - 1.0.0-rc2-16128 - dnx-coreclr-win-x86.$(DnxVersion) - dnx-mono.$(DnxVersion) 1.0.0-rc3-20150510-01 Microsoft.Net.ToolsetCompilers - Microsoft.DotNet.BuildTools.CoreCLR - $(ToolsDir)$(BuildToolsCoreCLRPackageName).$(BuildToolsCoreCLRVersion) + + + + + true @@ -61,14 +61,19 @@ $(__PackagesBinDir) $(BinDir).nuget - $(PackagesDir)Microsoft.DotNet.BuildTools.$(BuildToolsVersion)/lib/ + $(ProjectDir)Tools/ + $(ToolsDir)dotnetcli/bin/ $(ToolsDir)Microsoft.DotNet.Build.Tasks.dll - - $(PackagesDir)Microsoft.DotNet.BuildTools.CoreCLR.$(BuildToolsCoreCLRVersion)/ $(__TestWorkingDir)\ $(RootBinDir)tests\$(BuildOS).$(BuildArch).$(BuildType)\ + $(ToolsDir)net45/ + + + + + @@ -87,23 +92,15 @@ - $(PackagesDir)/$(DnxPackageName)/ - $(DnxPackageDir)\bin\dnu.cmd - $(DnxPackageDir)/bin/dnu + $(DotnetCliPath)dotnet.exe + $(DotnetCliPath)dotnet - "$(DnuToolPath)" + "$(DotnetToolCommand)" $(DnuRestoreCommand) restore $(DnuRestoreCommand) --packages "$(PackagesDir.TrimEnd('\\'))" $(DnuRestoreCommand) --lock - - - diff --git a/dir.targets b/dir.targets index fd2dcd335db4..ea799fbbe6eb 100644 --- a/dir.targets +++ b/dir.targets @@ -1,123 +1,17 @@ - - - - - -
- - - - - - - 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); - } - ]]> - - - - - - - - - - - - - - - - - - - <_RestoreBuildToolsCommand>$(NugetRestoreCommand) "$(SourceDir).nuget/packages.$(OsEnvironment).config" - - - - - - - - - - - - - - - - - - - + + + + - + - + + + + + diff --git a/init-tools.cmd b/init-tools.cmd new file mode 100644 index 000000000000..ce1a34ef6151 --- /dev/null +++ b/init-tools.cmd @@ -0,0 +1,76 @@ +@echo off +setlocal + +REM Workaround https://github.com/dotnet/coreclr/issues/2153 +set ComPlus_ReadyToRun=0 + +set INIT_TOOLS_LOG=%~dp0init-tools.log +set PACKAGES_DIR=%~dp0packages\ +set TOOLRUNTIME_DIR=%~dp0Tools +set DOTNET_PATH=%TOOLRUNTIME_DIR%\dotnetcli\ +set DOTNET_CMD=%DOTNET_PATH%bin\dotnet.exe +if [%BUILDTOOLS_SOURCE%]==[] set BUILDTOOLS_SOURCE=https://www.myget.org/F/dotnet-buildtools/ +set /P BUILDTOOLS_VERSION=< %~dp0BuildToolsVersion.txt +set BUILD_TOOLS_PATH=%PACKAGES_DIR%Microsoft.DotNet.BuildTools\%BUILDTOOLS_VERSION%\lib\ +set PROJECT_JSON_PATH=%TOOLRUNTIME_DIR%\%BUILDTOOLS_VERSION% +set PROJECT_JSON_FILE=%PROJECT_JSON_PATH%\project.json +set PROJECT_JSON_CONTENTS={ "dependencies": { "Microsoft.DotNet.BuildTools": "%BUILDTOOLS_VERSION%" , "Microsoft.DotNet.BuildTools.Coreclr": "1.0.4-prerelease"}, "frameworks": { "dnxcore50": { } } } +set BUILD_TOOLS_SEMAPHORE=%PROJECT_JSON_PATH%\init-tools.completed + +:: if force option is specified then clean the tool runtime and build tools package directory to force it to get recreated +if [%1]==[force] ( + if exist "%TOOLRUNTIME_DIR%" rmdir /S /Q "%TOOLRUNTIME_DIR%" + if exist "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" rmdir /S /Q "%PACKAGES_DIR%Microsoft.DotNet.BuildTools" +) + +:: If sempahore exists do nothing +if exist "%BUILD_TOOLS_SEMAPHORE%" ( + echo Tools are already initialized. + goto :EOF +) + +:: Download Nuget.exe +if NOT exist "%PACKAGES_DIR%NuGet.exe" ( + if NOT exist "%PACKAGES_DIR%" mkdir "%PACKAGES_DIR%" + powershell -NoProfile -ExecutionPolicy unrestricted -Command "(New-Object Net.WebClient).DownloadFile('https://www.nuget.org/nuget.exe', '%PACKAGES_DIR%NuGet.exe') +) + +if NOT exist "%PROJECT_JSON_PATH%" mkdir "%PROJECT_JSON_PATH%" +echo %PROJECT_JSON_CONTENTS% > %PROJECT_JSON_FILE% +echo Running %0 > %INIT_TOOLS_LOG% + +if exist "%DOTNET_CMD%" goto :afterdotnetrestore + +echo Installing dotnet cli... +if NOT exist "%DOTNET_PATH%" mkdir "%DOTNET_PATH%" +set /p DOTNET_VERSION=< %~dp0DotnetCLIVersion.txt +set DOTNET_ZIP_NAME=dotnet-win-x64.%DOTNET_VERSION%.zip +set DOTNET_REMOTE_PATH=https://dotnetcli.blob.core.windows.net/dotnet/dev/Binaries/%DOTNET_VERSION%/%DOTNET_ZIP_NAME% +set DOTNET_LOCAL_PATH=%DOTNET_PATH%%DOTNET_ZIP_NAME% +echo Installing '%DOTNET_REMOTE_PATH%' to '%DOTNET_LOCAL_PATH%' >> %INIT_TOOLS_LOG% +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% +if NOT exist "%DOTNET_LOCAL_PATH%" ( + echo ERROR: Could not install dotnet cli correctly. See '%INIT_TOOLS_LOG%' for more details. + goto :EOF +) + +:afterdotnetrestore + +if exist "%BUILD_TOOLS_PATH%" goto :afterbuildtoolsrestore +echo Restoring BuildTools version %BUILDTOOLS_VERSION%... +echo Running: "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG% +call "%DOTNET_CMD%" restore "%PROJECT_JSON_FILE%" --packages %PACKAGES_DIR% --source "%BUILDTOOLS_SOURCE%" >> %INIT_TOOLS_LOG% +if NOT exist "%BUILD_TOOLS_PATH%init-tools.cmd" ( + echo ERROR: Could not restore build tools correctly. See '%INIT_TOOLS_LOG%' for more details. + goto :EOF +) + +:afterbuildtoolsrestore + +echo Initializing BuildTools ... +echo Running: "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG% +call "%BUILD_TOOLS_PATH%init-tools.cmd" "%~dp0" "%DOTNET_CMD%" "%TOOLRUNTIME_DIR%" >> %INIT_TOOLS_LOG% + +:: Create sempahore file +echo Done initializing tools. +echo Init-Tools.cmd completed for BuildTools Version: %BUILDTOOLS_VERSION% > "%BUILD_TOOLS_SEMAPHORE%" \ No newline at end of file diff --git a/src/.nuget/packages.Unix.config b/src/.nuget/packages.Unix.config deleted file mode 100644 index 34039f82834c..000000000000 --- a/src/.nuget/packages.Unix.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/.nuget/packages.Windows_NT.config b/src/.nuget/packages.Windows_NT.config deleted file mode 100644 index d2c4cf51ee7a..000000000000 --- a/src/.nuget/packages.Windows_NT.config +++ /dev/null @@ -1,6 +0,0 @@ - - - - - - diff --git a/src/dlls/mscoree/coreclr/CMakeLists.txt b/src/dlls/mscoree/coreclr/CMakeLists.txt index 36bc12911e3b..1d428193f59f 100644 --- a/src/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/dlls/mscoree/coreclr/CMakeLists.txt @@ -144,7 +144,6 @@ if(WIN32) add_custom_command(TARGET coreclr POST_BUILD - COMMAND ${CLR_DIR}/src/scripts/buildtools/restorebuildtools.bat 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 COMMAND ${BuildToolsDir}/dactablegen.exe /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:${CMAKE_CURRENT_BINARY_DIR}/$/coreclr.pdb /dll:$ /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin COMMAND ${BuildToolsDir}/InjectResource.exe /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$ diff --git a/src/scripts/buildtools/restorebuildtools.bat b/src/scripts/buildtools/restorebuildtools.bat deleted file mode 100644 index a07e81759f1e..000000000000 --- a/src/scripts/buildtools/restorebuildtools.bat +++ /dev/null @@ -1,11 +0,0 @@ -REM ========================================================================================= -REM === -REM === Restore build tools required for native build -REM === -REM ========================================================================================= -echo Restore coreclr build tools nuget package -setlocal -:: Set the environment for the managed build -call "%__VSToolsRoot%\VsDevCmd.bat" -%_msbuildexe% "%~dp0restorebuildtools.proj" /p:OutputPath="%__IntermediatesDir%" /nodeReuse:false -endlocal \ No newline at end of file diff --git a/src/scripts/buildtools/restorebuildtools.proj b/src/scripts/buildtools/restorebuildtools.proj deleted file mode 100644 index cc6c6d2ba95e..000000000000 --- a/src/scripts/buildtools/restorebuildtools.proj +++ /dev/null @@ -1,8 +0,0 @@ - - - - - - - - \ No newline at end of file