From d5d3fd086c2e5be749ed3249dc72bc7d858df800 Mon Sep 17 00:00:00 2001 From: David Fowler Date: Sun, 18 Oct 2015 02:38:46 -0700 Subject: [PATCH] Fixed bootstrapping on osx/linux MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - This won’t fully work since we need to download a precanned build from somewhere. --- scripts/bootstrap | 7 +++++++ scripts/stage0/dotnet-compile-csc | 17 +++++++++++++++++ scripts/stage0/dotnet-compile.cmd | 11 ----------- scripts/stage0/dotnet-publish.cmd | 11 ----------- src/Microsoft.DotNet.Tools.Compiler/Program.cs | 1 - .../Resolution/LibraryManager.cs | 2 -- .../Resolution/PackageDependencyProvider.cs | 4 ---- 7 files changed, 24 insertions(+), 29 deletions(-) create mode 100755 scripts/stage0/dotnet-compile-csc delete mode 100644 scripts/stage0/dotnet-compile.cmd delete mode 100644 scripts/stage0/dotnet-publish.cmd diff --git a/scripts/bootstrap b/scripts/bootstrap index b891b819f..7b0b4fbbd 100755 --- a/scripts/bootstrap +++ b/scripts/bootstrap @@ -48,8 +48,11 @@ dnu restore "$REPOROOT" --runtime osx.10.10-x64 --runtime ubuntu.14.04-x64 --run echo "Building basic dotnet tools using Stage 0 (DNX hosted)" $STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi $STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi $STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi $STAGE0_PUBLISH --framework dnxcore50 --runtime $RID --output "$STAGE1_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish" # Add stage1 to the path and use it to build stage2 @@ -57,6 +60,10 @@ export PATH=$STAGE1_DIR:$PATH echo "Building stage2 dotnet using stage1 ..." dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Cli" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Compiler.Csc" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi dotnet publish --framework dnxcore50 --runtime $RID --output "$STAGE2_DIR" "$REPOROOT/src/Microsoft.DotNet.Tools.Publish" +rc=$?; if [[ $rc != 0 ]]; then exit $rc; fi diff --git a/scripts/stage0/dotnet-compile-csc b/scripts/stage0/dotnet-compile-csc new file mode 100755 index 000000000..3214c0a0a --- /dev/null +++ b/scripts/stage0/dotnet-compile-csc @@ -0,0 +1,17 @@ +#!/usr/bin/env bash + +SOURCE="${BASH_SOURCE[0]}" +while [ -h "$SOURCE" ]; do # resolve $SOURCE until the file is no longer a symlink + DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + SOURCE="$(readlink "$SOURCE")" + [[ $SOURCE != /* ]] && SOURCE="$DIR/$SOURCE" # if $SOURCE was a relative symlink, we need to resolve it relative to the path where the symlink file was located +done +DIR="$( cd -P "$( dirname "$SOURCE" )" && pwd )" + +# work around restore timeouts on Mono +[ -z "$MONO_THREADS_PER_CPU" ] && export MONO_THREADS_PER_CPU=50 + +# Makes development easier +export PATH=$PATH:$DIR + +exec "dnx" -p "$DIR/../../src/Microsoft.DotNet.Tools.Compiler.Csc" run "$@" diff --git a/scripts/stage0/dotnet-compile.cmd b/scripts/stage0/dotnet-compile.cmd deleted file mode 100644 index 05eb4946b..000000000 --- a/scripts/stage0/dotnet-compile.cmd +++ /dev/null @@ -1,11 +0,0 @@ -@Echo OFF -SETLOCAL -SET ERRORLEVEL= - -REM makes testing easier for now -set PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%PATH%;%~dp0 - -dnx %DOTNET_OPTIONS% -p %~dp0..\..\src\Microsoft.DotNet.Tools.Compiler run %* - -exit /b %ERRORLEVEL% -ENDLOCAL diff --git a/scripts/stage0/dotnet-publish.cmd b/scripts/stage0/dotnet-publish.cmd deleted file mode 100644 index 823b89fae..000000000 --- a/scripts/stage0/dotnet-publish.cmd +++ /dev/null @@ -1,11 +0,0 @@ -@Echo OFF -SETLOCAL -SET ERRORLEVEL= - -REM makes testing easier for now -set PATH=%PATH%;%~dp0 - -dnx %DOTNET_OPTIONS% -p %~dp0..\..\src\Microsoft.DotNet.Tools.Publish run %* - -exit /b %ERRORLEVEL% -ENDLOCAL diff --git a/src/Microsoft.DotNet.Tools.Compiler/Program.cs b/src/Microsoft.DotNet.Tools.Compiler/Program.cs index b824bbf52..e3d47650a 100644 --- a/src/Microsoft.DotNet.Tools.Compiler/Program.cs +++ b/src/Microsoft.DotNet.Tools.Compiler/Program.cs @@ -156,7 +156,6 @@ namespace Microsoft.DotNet.Tools.Compiler // Default suppressions "-nowarn:CS1701", "-nowarn:CS1702", - "-nowarn:CS1705", "-nostdlib", "-nologo", $"-out:\"{outputName}\"" diff --git a/src/Microsoft.Extensions.ProjectModel/Resolution/LibraryManager.cs b/src/Microsoft.Extensions.ProjectModel/Resolution/LibraryManager.cs index dac67c3b5..5b8924b4e 100644 --- a/src/Microsoft.Extensions.ProjectModel/Resolution/LibraryManager.cs +++ b/src/Microsoft.Extensions.ProjectModel/Resolution/LibraryManager.cs @@ -13,7 +13,6 @@ namespace Microsoft.Extensions.ProjectModel.Resolution private readonly IList _libraries; private readonly IList _diagnostics; private readonly string _projectPath; - private readonly NuGetFramework _targetFramework; public LibraryManager(string projectPath, NuGetFramework targetFramework, @@ -21,7 +20,6 @@ namespace Microsoft.Extensions.ProjectModel.Resolution IList diagnostics) { _projectPath = projectPath; - _targetFramework = targetFramework; _libraries = libraries; _diagnostics = diagnostics; } diff --git a/src/Microsoft.Extensions.ProjectModel/Resolution/PackageDependencyProvider.cs b/src/Microsoft.Extensions.ProjectModel/Resolution/PackageDependencyProvider.cs index 37766fda9..2d41c6b1d 100644 --- a/src/Microsoft.Extensions.ProjectModel/Resolution/PackageDependencyProvider.cs +++ b/src/Microsoft.Extensions.ProjectModel/Resolution/PackageDependencyProvider.cs @@ -10,13 +10,10 @@ namespace Microsoft.Extensions.ProjectModel.Resolution { public class PackageDependencyProvider { - private readonly string _packagesPath; - private readonly VersionFolderPathResolver _packagePathResolver; public PackageDependencyProvider(string packagesPath) { - _packagesPath = packagesPath; _packagePathResolver = new VersionFolderPathResolver(packagesPath); } @@ -33,7 +30,6 @@ namespace Microsoft.Extensions.ProjectModel.Resolution targetLibrary.RuntimeAssemblies.Any() || !containsAssembly; - var resolved = compatible; var dependencies = new List(targetLibrary.Dependencies.Count + targetLibrary.FrameworkAssemblies.Count); PopulateDependencies(dependencies, targetLibrary);