diff --git a/README.md b/README.md index b97014643..54a1b44af 100644 --- a/README.md +++ b/README.md @@ -8,25 +8,22 @@ Build Status |**Debug**|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_debug_ubuntu)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_debug_ubuntu/)|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_debug_windows_nt)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_debug_windows_nt/)|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_debug_osx)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_debug_osx/) | |**Release**|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_release_ubuntu)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_release_ubuntu/)|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_release_windows_nt)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_release_windows_nt/)|[![Build Status](http://dotnet-ci.cloudapp.net/buildStatus/icon?job=Private/dotnet_cli_release_osx)](http://dotnet-ci.cloudapp.net/job/Private/job/dotnet_cli_release_osx/) | +## Prerequisites +In order to build dotnet-cli, you need the following installed on you machine + +### For Windows + +1. Visual Studio 2015 with Web Development Tools + * Beta8 is available here and should work: http://www.microsoft.com/en-us/download/details.aspx?id=49442 + * Install `WebToolsExtensionsVS14.msi` and `DotNetVersionManager-x64.msi` +2. CMake (available from https://cmake.org/) is required to build the native host `corehost` ## Building/Running 1. Run `build.cmd` or `build.sh` from the root 2. Use `artifacts/{os}-{arch}/stage2/dotnet` to try out the `dotnet` command. You can also add `artifacts/{os}-{arch}/stage2` to the PATH if you want to run `dotnet` from anywhere. -## Notes - -Right now the CLI uses [DNX](https://github.com/aspnet/dnx) for NuGet restore. - -## Visual Studio - -* Requires VS 2015 with Web Development Tools installed to open in VS - * Beta8 is available here and should work: http://www.microsoft.com/en-us/download/details.aspx?id=49442 - * Install `WebToolsExtensionsVS14.msi` and `DotNetVersionManager-x64.msi` -* Requires that you have a DNX installed (the build script _should_ set it up for you though) -* Compilation is not required before building, but you must run `dnu restore` (which comes from the DNX commands) after changing dependencies. If you add/remove dependencies in VS, it will run it for you - ## Visual Studio Code * You can also use Visual Studo code https://code.visualstudio.com/ diff --git a/scripts/bootstrap.cmd b/scripts/bootstrap.cmd index e1bb5bea2..94642f621 100644 --- a/scripts/bootstrap.cmd +++ b/scripts/bootstrap.cmd @@ -75,7 +75,10 @@ if errorlevel 1 goto fail REM deploy corehost.exe to the output copy "%HOST_DIR%\corehost.exe" "%STAGE1_DIR%" +if errorlevel 1 goto fail + if exist "%HOST_DIR%\corehost.pdb" copy "%HOST_DIR%\corehost.pdb" "%STAGE1_DIR%" +if errorlevel 1 goto fail echo Re-building dotnet tools with the bootstrapped version REM This should move into a proper build script of some kind once we are bootstrapped @@ -104,11 +107,14 @@ dotnet publish --framework "%TFM%" --runtime "%RID%" --output "%STAGE2_DIR%" --c if errorlevel 1 goto fail REM deploy corehost.exe to the output -copy "%HOST_DIR%/corehost.exe" "%STAGE2_DIR%" -if exist "%HOST_DIR%/corehost.pdb" copy "%HOST_DIR/corehost.pdb" "%STAGE2_DIR%" +copy "%HOST_DIR%\corehost.exe" "%STAGE2_DIR%" +if errorlevel 1 goto fail + +if exist "%HOST_DIR%\corehost.pdb" copy "%HOST_DIR%\corehost.pdb" "%STAGE2_DIR%" +if errorlevel 1 goto fail echo Crossgening Roslyn compiler ... -call "%~dp0crossgen/crossgen_roslyn.cmd" "%STAGE2_DIR%" +call "%~dp0crossgen\crossgen_roslyn.cmd" "%STAGE2_DIR%" if errorlevel 1 goto fail REM Copy DNX in to stage2 @@ -124,11 +130,11 @@ del "%REPOROOT%\test\TestApp\project.lock.json" dotnet restore "%REPOROOT%\test\TestApp" --runtime "%RID%" --quiet dotnet publish "%REPOROOT%\test\TestApp" --framework "%TFM%" --runtime "%RID%" --output "%REPOROOT%\artifacts\%RID%\smoketest" -"%REPOROOT%/artifacts/%RID%/smoketest/TestApp" +"%REPOROOT%/artifacts/%RID%/smoketest/TestApp" 2>nul >nul if errorlevel 1 goto fail REM Check that a compiler error is reported -dotnet compile "%REPOROOT%\test\compile\failing\SimpleCompilerError" --framework "%TFM%" >nul +dotnet compile "%REPOROOT%\test\compile\failing\SimpleCompilerError" --framework "%TFM%" >nul 2>nul if %errorlevel% == 0 goto fail echo Bootstrapped dotnet to %STAGE2_DIR% diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index a1882a70e..00e853f4b 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -273,12 +273,6 @@ namespace Microsoft.DotNet.Tools.Compiler } return outputPath; - - string intermediateOutputPath = Path.Combine( - context.ProjectFile.ProjectDirectory, - Constants.ObjDirectoryName, - configuration, - context.TargetFramework.GetTwoDigitShortFolderName()); } private static string GetIntermediateOutputPath(ProjectContext context, string configuration, string outputOptionValue) diff --git a/src/corehost/src/pal.windows.cpp b/src/corehost/src/pal.windows.cpp index 5a5cade95..c5b3e7cff 100644 --- a/src/corehost/src/pal.windows.cpp +++ b/src/corehost/src/pal.windows.cpp @@ -2,6 +2,11 @@ #include "trace.h" #include "utils.h" +#include +#include + +static std::wstring_convert, wchar_t> g_converter; + bool pal::load_library(const char_t* path, dll_t& dll) { dll = ::LoadLibraryW(path); @@ -100,36 +105,12 @@ bool pal::get_own_executable_path(string_t& recv) std::string pal::to_stdstring(const string_t& str) { - // Calculate the size needed - auto length = ::WideCharToMultiByte(CP_ACP, 0, str.c_str(), -1, nullptr, 0, nullptr, nullptr); - - // Allocate a string - auto buf = new char[length]; - auto res = ::WideCharToMultiByte(CP_ACP, 0, str.c_str(), (int)str.length(), buf, length, nullptr, nullptr); - if (res == -1) - { - return std::string(); - } - auto copied = std::string(buf); - delete[] buf; - return copied; + return g_converter.to_bytes(str); } pal::string_t pal::to_palstring(const std::string& str) { - // Calculate the size needed - auto length = ::MultiByteToWideChar(CP_ACP, 0, str.c_str(), -1, nullptr, 0); - - // Allocate a string - auto buf = new char_t[length]; - auto res = ::MultiByteToWideChar(CP_ACP, 0, str.c_str(), (int)str.length(), buf, length); - if (res == -1) - { - return string_t(); - } - auto copied = string_t(buf); - delete[] buf; - return copied; + return g_converter.from_bytes(str); } bool pal::realpath(string_t& path) @@ -166,9 +147,7 @@ std::vector pal::readdir(const string_t& path) auto handle = ::FindFirstFileW(search_string.c_str(), &data); do { - string_t filepath(path); - filepath.push_back(DIR_SEPARATOR); - filepath.append(data.cFileName); + string_t filepath(data.cFileName); files.push_back(filepath); } while (::FindNextFileW(handle, &data)); ::FindClose(handle);