From a5dfe80d9aafdd68737bb7c4e224f75f2ee38f47 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:03:41 -0700 Subject: [PATCH 01/13] Download and install packages for Ubuntu and OS X This both downloads the v0.3.0 release for the current platform and now also installs it (requiring `sudo`). Should probably rename. --- download.sh | 32 +++++++++++++++++++++++++++++--- 1 file changed, 29 insertions(+), 3 deletions(-) diff --git a/download.sh b/download.sh index 7b2637d03..806f2cbe1 100755 --- a/download.sh +++ b/download.sh @@ -2,13 +2,39 @@ [[ -n $GITHUB_TOKEN ]] || { echo >&2 "GITHUB_TOKEN variable is undefined, please provide token"; exit 1; } +# Set OS specific asset ID and package name +case "$OSTYPE" in + linux*) + asset='1536045' + package='powershell_0.3.0-1_amd64.deb' + ;; + darwin*) + asset='1536063' + package='powershell-0.3.0.pkg' + ;; + *) + exit 2 >&2 "$OSTYPE not supported!" + ;; +esac + # Authorizes with read-only access to GitHub API # Retrieves URL of v0.3.0 release asset -# Downloads asset to powershell.deb curl -s -i \ -H "Authorization: token $GITHUB_TOKEN " \ -H 'Accept: application/octet-stream' \ - 'https://api.github.com/repos/PowerShell/PowerShell/releases/assets/1536045' | + "https://api.github.com/repos/PowerShell/PowerShell/releases/assets/$asset" | grep location | sed 's/location: //g' | - wget -i - -O powershell.deb + wget -i - -O $package + +# Installs PowerShell package +case "$OSTYPE" in + linux*) + sudo dpkg -i ./$package + ;; + darwin*) + sudo installer -pkg ./$package -target / + ;; +esac + +echo "Congratulations! PowerShell is now installed." From d94a040229bc84feaff5ed07ee8d0b51620f5ff7 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:11:38 -0700 Subject: [PATCH 02/13] Add Start-PSBootstrap function Installs Open PowerShell build dependenices on all platform; deprecates `bootstrap.sh`. --- PowerShellGitHubDev.psm1 | 50 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 50 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 3cc1a739d..d0c2f8a89 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -261,6 +261,56 @@ function Start-PSxUnit { } } + +function Start-PSBootstrap { + [CmdletBinding()]param() + + Write-Host "Installing Open PowerShell build dependencies" + + if ($IsLinux) { + precheck 'curl' "Bootstrap dependency 'curl' not found in PATH, please install!" > $null + precheck 'apt-get' "Bootstrap dependency 'apt-get' not found in PATH, this only supports Ubuntu 14.04!" > $null + + # Setup LLVM feed + curl -s http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - + echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list + sudo apt-get update -qq + + # Install ours and .NET's dependencies + sudo apt-get install -y wget make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 + + # Install .NET CLI packages + Remove-Item dotnet*.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-host-ubuntu-x64.latest.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-sharedframework-ubuntu-x64.latest.deb + + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb + sudo dpkg -i dotnet-sdk-ubuntu-x64.latest.deb + + } elseif ($IsOSX) { + precheck 'brew' "Bootstrap dependency 'brew' not found, must install Homebrew! See http://brew.sh/" + + # Install ours and .NET's dependencies + brew install cmake wget openssl + + # Install .NET CLI packages + Remove-Item dotnet*.pkg + wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg + sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target / + } elseif ($IsWindows -And -Not $IsCore) { + Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 + ./install.ps1 + $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } else { + Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)" + } +} + + function Start-PSPackage { [CmdletBinding()]param( # PowerShell packages use Semantic Versioning http://semver.org/ From a031dd909560f4cc7526855745c64861b14986bc Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:12:30 -0700 Subject: [PATCH 03/13] Remove deprecated bootstrap.sh --- bootstrap.sh | 20 -------------------- 1 file changed, 20 deletions(-) delete mode 100755 bootstrap.sh diff --git a/bootstrap.sh b/bootstrap.sh deleted file mode 100755 index 599321730..000000000 --- a/bootstrap.sh +++ /dev/null @@ -1,20 +0,0 @@ -#!/usr/bin/env bash - -echo "Installing build dependencies" - -curl http://llvm.org/apt/llvm-snapshot.gpg.key | sudo apt-key add - -echo "deb http://llvm.org/apt/trusty/ llvm-toolchain-trusty-3.6 main" | sudo tee /etc/apt/sources.list.d/llvm.list -sudo apt-get update -qq - -sudo apt-get install -y wget make g++ cmake \ - libc6 libgcc1 libstdc++6 \ - libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-host-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-host-ubuntu-x64.latest.deb - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sharedframework-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-sharedframework-ubuntu-x64.latest.deb - -wget -P /tmp https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-sdk-ubuntu-x64.latest.deb -sudo dpkg -i /tmp/dotnet-sdk-ubuntu-x64.latest.deb From 995eaf4c0fe7d5eefdfe4d977a80f684b50e3bf1 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:13:03 -0700 Subject: [PATCH 04/13] Update Travis to use Start-PSBootstrap --- .travis.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5cc937b31..57d9e5e3d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -6,11 +6,9 @@ git: before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest - - ./bootstrap.sh - ./download.sh - - sudo dpkg -i ./powershell.deb script: - - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBuild; Start-PSPester" + - powershell -c "Import-Module ./PowerShellGitHubDev.psm1; Start-PSBootstrap; Start-PSBuild; Start-PSPester" notifications: slack: secure: sKYd4n61+ZFzGZuWGUl8V1kN0NM16wRVOFVlNhlFCwnkrEsKROb++EvXf5uwnKuzxkhEjvPWO+UFgeshQDoR93y4s5YLfhC5JupK4nUzjPzWs208KTrh8u/x9MY8X6Ojxi85EEAiku5GzMoMlkucSStZUYwbIfnelzqdw8uoRwmm2MW4XCPwsuEuDUVghyiva0Mdx1G6MopCrK8T96WywJXT3chhfZQgVt+sQCBt9g+2kjDaObKrzG0P07IVK43ZpDgnu6AoxlyBzIx9mJH2Oa/tki3/kTO72Wcp3ps3qvmiStADamzVKR9p1VlWCLWAd6VOehxuByCGEyujpzk135Wud2DZYO+8LD6inZVhFe3Wt5pCU9BDXZppiATfMCqgXEH7nK54pEn79yHcjthRJ2+Z9ot7As2fu3RSBmTAi8nRP0fxRyX/jctR3S6P0qt0y1ynx9nzBfhmhPQW0PMVazWS/nruQIvK/3iiYXjZxM5bBwIvabmwV00EYeTdbL6ufXWNgQcG1ZWkDsi2I3vst/ytUbHwaFYg83bXWpxg9DCzJeWLVUvE5/3NfBxRAuCTot/fgTEA9IYScvrlL7Q/bT0cOt0vEM98MPf1UO+WP85uxhsRgHtwDEo+jMaL6ZFkPhlV6mmmED4NdY2//a571cLNXdnuMAze5O3TWGBG53g= From 70f921e824c3287f76753c054f404df06c5ad68f Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:21:02 -0700 Subject: [PATCH 05/13] Update AppVeyor to use Start-PSBootstrap --- appveyor.yml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/appveyor.yml b/appveyor.yml index 9b494ce18..1d4b21f7d 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -18,13 +18,10 @@ install: - ps: Set-Content c:\users\appveyor\.ssh\id_rsa $fileContent - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester - - ps: Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 - - ps: ./install.ps1 -version 1.0.0-beta-002198 + - ps: Import-Module .\PowerShellGitHubDev.psm1; Start-PSBootstrap build_script: - ps: | - $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" - dotnet --version Import-Module .\PowerShellGitHubDev.psm1 Start-PSBuild -Publish Start-PSBuild -FullCLR From 7538951dfa72da5020119d8754103fe1bc44e63e Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:36:15 -0700 Subject: [PATCH 06/13] Install package dependencies in download.sh --- PowerShellGitHubDev.psm1 | 2 +- download.sh | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index d0c2f8a89..483da716a 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -277,7 +277,7 @@ function Start-PSBootstrap { sudo apt-get update -qq # Install ours and .NET's dependencies - sudo apt-get install -y wget make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 + sudo apt-get install -y make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5 # Install .NET CLI packages Remove-Item dotnet*.deb diff --git a/download.sh b/download.sh index 806f2cbe1..9c19dc600 100755 --- a/download.sh +++ b/download.sh @@ -7,6 +7,8 @@ case "$OSTYPE" in linux*) asset='1536045' package='powershell_0.3.0-1_amd64.deb' + # Install curl and wget to download package + sudo apt-get install -y curl wget ;; darwin*) asset='1536063' @@ -30,6 +32,8 @@ curl -s -i \ # Installs PowerShell package case "$OSTYPE" in linux*) + # Install dependencies + sudo apt-get install -y libunwind8 libicu52 sudo dpkg -i ./$package ;; darwin*) From aa1af214bc29521cfd20c205f089dc9b4dc817b1 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:54:52 -0700 Subject: [PATCH 07/13] Add OS X to Travis CI matrix --- .travis.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.travis.yml b/.travis.yml index 57d9e5e3d..06e25765a 100644 --- a/.travis.yml +++ b/.travis.yml @@ -3,6 +3,9 @@ sudo: required dist: trusty git: submodules: false +os: + - linux + - osx before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest From 38041211b53634a03ddbe41570438b407b046ff5 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 15:56:03 -0700 Subject: [PATCH 08/13] Remove deprecated omibuild and psrp scripts --- omibuild.sh | 13 ------------- psrp.sh | 2 -- 2 files changed, 15 deletions(-) delete mode 100755 omibuild.sh delete mode 100755 psrp.sh diff --git a/omibuild.sh b/omibuild.sh deleted file mode 100755 index 756b995dc..000000000 --- a/omibuild.sh +++ /dev/null @@ -1,13 +0,0 @@ -#!/usr/bin/env bash - -# Build OMI -pushd src/omi/Unix -./configure --dev -make -j -popd - -# Build the OMI Provider -pushd src/omi-provider -cmake -DCMAKE_BUILD_TYPE=Debug . -make -j -popd diff --git a/psrp.sh b/psrp.sh deleted file mode 100755 index eb42adc06..000000000 --- a/psrp.sh +++ /dev/null @@ -1,2 +0,0 @@ -export CORE_ROOT=$(pwd)/bin -sudo -E ./src/omi/Unix/output/bin/omiserver -l --loglevel 2 From 14837da6640d7170e8f2f1cf1346325af0ceca64 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:21:23 -0700 Subject: [PATCH 09/13] Update documentation for Start-PSBootstrap Also moved Git setup section first. --- docs/building/linux.md | 77 +++++++++++++++++++++-------------- docs/building/osx.md | 20 +++------ docs/building/windows-core.md | 30 +++++++++----- 3 files changed, 72 insertions(+), 55 deletions(-) diff --git a/docs/building/linux.md b/docs/building/linux.md index 5e4076f7e..68fbf0bbe 100644 --- a/docs/building/linux.md +++ b/docs/building/linux.md @@ -10,6 +10,16 @@ Environment These instructions are written assuming the Ubuntu 14.04 LTS, since that's the distro the team uses. +Git Setup +--------- + +Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and +[Contributing Guidelines](../../CONTRIBUTING.md). + +This guide assumes that you have recursively cloned the PowerShell +repository and `cd`ed into it. + Toolchain Setup --------------- @@ -26,16 +36,46 @@ Unfortunately, the `apt-get` feed for `dotnet` has been deprecated, and the latest version is only distributed in the form of three separate packages, which require manual dependency resolution. -**To ease this process, just run `./bootstrap.sh` and enter password -for `sudo` when prompted.** +Installing the toolchain is as easy as running `Start-PSBootstrap` in +PowerShell. Of course, this requires a self-hosted copy of PowerShell +on Linux. -The [bootstrap script](../../bootstrap.sh) does the following: +Fortunately, this is as easy as downloading and installing the +package. Unfortunately, while the repository is still private, the +package cannot be downloaded as simply as with `wget`. We have a +script that wraps the GitHub API and uses a personal access token to +authorize in order to obtain the package. + +The `./download.sh` script will also install the PowerShell package. + +> You can alternativelly download via a browser, upload it to your +> box via some other method, and manually install it. + +In Bash: + +```sh +GITHUB_TOKEN= ./download.sh +powershell +``` + +You should now be in a `powershell` console host that is installed +separately from any development copy you're about to build. Just +import our module, bootsrap the dependencies, and build! + +In PowerShell: + +```powershell +Import-Module ./PowerShellGitHubDev.psm1 +Start-PSBootstrap +``` + +The `Start-PSBootstrap` function does the following: - Adds the LLVM package feed - Installs our dependencies combined with the dependencies of the .NET CLI toolchain via `apt-get` - Installs the .NET CLI host, shared framework, and SDK by downloading - the three `.deb` packages to `/tmp` and using `dpkg -i` + the three `.deb` packages and using `dpkg -i` [dotnet-cli]: https://github.com/dotnet/cli#new-to-net-cli [CMake]: https://cmake.org/cmake/help/v2.8.12/cmake.html @@ -55,36 +95,13 @@ uninstall prior any prior versions. [cli-docs]: https://dotnet.github.io/getting-started/ -Git Setup ---------- - -Using Git requires it to be setup correctly; refer to the -[README](../../README.md) and -[Contributing Guidelines](../../CONTRIBUTING.md). - Build using our module ====================== We maintain a [PowerShell module](../../PowerShellGitHubDev.psm1) with the function `Start-PSBuild` to build PowerShell. Since this is -PowerShell code, it requires self-hosting. Fortunately, this is as -easy as downloading and installing the package. Unfortunately, while -the repository is still private, the package cannot be downloaded as -simply as with `wget`. We have a script that wraps the GitHub API and -uses a personal access token to authorize and obtain the package. - -> You can alternativelly download via a browser and upload it to your -> box via some other method. - -```sh -GITHUB_TOKEN= ./download.sh -sudo dpkg -i ./powershell.deb -powershell -``` - -You should now be in a `powershell` console host that is installed -separately from any development copy you're about to build. Just -import our module and build! +PowerShell code, it requires self-hosting. If you have followed the +toolchain setup section above, you should have `powershell` installed. > If you cannot or do not want to self-host, `Start-PSBuild` is just a > convenience; you can execute each step of the build process yourself @@ -99,8 +116,6 @@ Congratulations! If everything went right, PowerShell is now built. The `Start-PSBuild` script will output the location of the executable: `./src/Microsoft.PowerShell.CoreConsoleHost/bin/Linux/netstandardapp1.5/ubuntu.14.04-x64/powershell`. -> Note that the `./build.sh` script is deprecated and will be removed - You can run our cross-platform Pester tests with `Start-PSPester`, and our xUnit tests with `Start-PSxUnit`. diff --git a/docs/building/osx.md b/docs/building/osx.md index de8b97737..56c4c04a7 100644 --- a/docs/building/osx.md +++ b/docs/building/osx.md @@ -11,22 +11,14 @@ Environment =========== You will want [Homebrew](http://brew.sh/), the missing package manager -for OS X. Once installed, use `brew` to install the following -dependencies. +for OS X. Once installed, follow the same instructions to download and +install a self-hosted copy of PowerShell on your OS X machine, and use +`Start-PSBootstrap` to install the dependencies. -```sh -brew install openssl cmake wget -``` +The `Start-PSBootstrap` function does the following: -Instead of using Linux `./bootstrap.sh` to install .NET CLI's Ubuntu -packages, you will want to use the official PKG installer for OS X. - -```sh -wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg -open ./dotnet-dev-osx-x64.latest.pkg -``` - -Then follow the wizard's instructions to complete installation. +- Uses `brew` to install CMake, OpenSSL, and GNU WGet +- Downloads and installs the latest .NET CLI package Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 31def61ac..288ef7a61 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -11,16 +11,33 @@ Environment These instructions are tested on Windows 10 and Windows Server 2012 R2, though they should work anywhere the dependencies work. +Git Setup +--------- + +Using Git requires it to be setup correctly; refer to the +[README](../../README.md) and +[Contributing Guidelines](../../CONTRIBUTING.md). + +This guide assumes that you have recursively cloned the PowerShell +repository and `cd`ed into it. + .NET CLI -------- We use the [.NET Command Line Interface][dotnet-cli] (`dotnet`) to -build PowerShell. The following script will install `dotnet` and add -it to your PowerShell session's path: +build PowerShell. The `Start-PSBootstrap` function will automatically +install it and add it to your path: + +```powershell +Import-Module ./PowerShellGitHubDev.psm1 +Start-PSBootstrap +``` + +The `Start-PSBootstrap` function itself does exactly this: ```powershell Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 -./install.ps1 -version 1.0.0-beta-002198 +./install.ps1 $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" ``` @@ -43,13 +60,6 @@ CLI can cause odd failures when running. Please check your version. [redist-2012]: https://www.microsoft.com/en-us/download/confirmation.aspx?id=30679 [redist-2015]: https://www.microsoft.com/en-us/download/details.aspx?id=48145 -Git Setup ---------- - -Using Git requires it to be setup correctly; refer to the -[README](../../README.md) and -[Contributing Guidelines](../../CONTRIBUTING.md). - Build using our module ====================== From beccce54a831ad5a4f270bc189ea55db54d261d2 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:30:00 -0700 Subject: [PATCH 10/13] Use matrix.include and fix OS X PATH --- .travis.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 06e25765a..5977179f2 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,11 +1,14 @@ language: cpp -sudo: required -dist: trusty +matrix: + include: + - os: linux + dist: trusty + sudo: required + - os: osx + language: generic + env: PATH+=/usr/local/share/dotnet git: submodules: false -os: - - linux - - osx before_install: - git config --global url.git@github.com:.insteadOf https://github.com/ - git submodule update --init -- src/windows-build src/Modules/Pester src/libpsl-native/test/googletest From 3d21d5da934fe9768a45a9487401d209602c6630 Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 16:41:50 -0700 Subject: [PATCH 11/13] Deal with paths magically in Start-PSBuild --- PowerShellGitHubDev.psm1 | 16 ++++++++++++++-- docs/building/osx.md | 5 +++++ docs/building/windows-core.md | 1 - 3 files changed, 19 insertions(+), 3 deletions(-) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 483da716a..e8b6d8244 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -23,6 +23,7 @@ try { function Start-PSBuild { [CmdletBinding(DefaultParameterSetName='CoreCLR')] param( + [switch]$NoPath, [switch]$Restore, [Parameter(ParameterSetName='CoreCLR')] @@ -57,6 +58,15 @@ function Start-PSBuild { $FullCLR = $true } + if (-not $NoPath) { + Write-Verbose "Appending probable .NET CLI tool path" + if ($IsWindows) { + $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } elseif ($IsOSX) { + $env:PATH += ":/usr/local/share/dotnet" + } + } + # verify we have all tools in place to do the build $precheck = precheck 'dotnet' "Build dependency 'dotnet' not found in PATH! See: https://dotnet.github.io/getting-started/" if ($FullCLR) { @@ -65,7 +75,8 @@ function Start-PSBuild { # msbuild is needed to build powershell.exe # msbuild is part of .NET Framework, we can try to get it from well-known location. - if (-not (Get-Command -Name msbuild -ErrorAction Ignore)) { + if (-nopt $NoPath -and -not (Get-Command -Name msbuild -ErrorAction Ignore)) { + Write-Verbose "Appending probable Visual C++ tools path" $env:path += ";${env:SystemRoot}\Microsoft.Net\Framework\v4.0.30319" } @@ -301,10 +312,11 @@ function Start-PSBootstrap { Remove-Item dotnet*.pkg wget https://dotnetcli.blob.core.windows.net/dotnet/beta/Installers/Latest/dotnet-dev-osx-x64.latest.pkg sudo installer -pkg dotnet-dev-osx-x64.latest.pkg -target / + } elseif ($IsWindows -And -Not $IsCore) { Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 - $env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" + } else { Write-Warning "Start-PSBootstrap cannot be run in Core PowerShell on Windows (need Invoke-WebRequest!)" } diff --git a/docs/building/osx.md b/docs/building/osx.md index 56c4c04a7..e08ba59b8 100644 --- a/docs/building/osx.md +++ b/docs/building/osx.md @@ -19,6 +19,11 @@ The `Start-PSBootstrap` function does the following: - Uses `brew` to install CMake, OpenSSL, and GNU WGet - Downloads and installs the latest .NET CLI package +- Adds `/usr/local/share/dotnet` to the process path + +Please heed that last step. You may want to add the .NET CLI tool +location to your path more permanently by adding it to your shell's +profile. Build using our module ====================== diff --git a/docs/building/windows-core.md b/docs/building/windows-core.md index 288ef7a61..33c73211d 100644 --- a/docs/building/windows-core.md +++ b/docs/building/windows-core.md @@ -38,7 +38,6 @@ The `Start-PSBootstrap` function itself does exactly this: ```powershell Invoke-WebRequest -Uri https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/install.ps1 -OutFile install.ps1 ./install.ps1 -$env:Path += ";$env:LocalAppData\Microsoft\dotnet\cli" ``` If you have any problems installing `dotnet`, please see their From ed62e5c6e62ec65acfbb0f241ab240e28e674a2a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 19:00:18 -0700 Subject: [PATCH 12/13] Add OS X 10.9 runtime --- PowerShellGitHubDev.psm1 | 1 + src/Microsoft.PowerShell.CoreConsoleHost/project.json | 1 + 2 files changed, 2 insertions(+) diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index e8b6d8244..1b81a2ff9 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -36,6 +36,7 @@ function Start-PSBuild { "win7-x64", "win81-x64", "win10-x64", + "osx.10.9-x64", "osx.10.10-x64", "osx.10.11-x64")] [Parameter(ParameterSetName='CoreCLR')] diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/project.json b/src/Microsoft.PowerShell.CoreConsoleHost/project.json index 22edf8af0..af65a00ad 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/project.json +++ b/src/Microsoft.PowerShell.CoreConsoleHost/project.json @@ -37,6 +37,7 @@ "win7-x64": { }, "win81-x64": { }, "win10-x64": { }, + "osx.10.9-x64": { }, "osx.10.10-x64": { }, "osx.10.11-x64": { } } From b2bc4183fe3cd0341e1054e203d9f486a616d14a Mon Sep 17 00:00:00 2001 From: Andrew Schwartzmeyer Date: Wed, 13 Apr 2016 19:09:39 -0700 Subject: [PATCH 13/13] Disable Travis CI OS X support Unfortunately, Travis CI's OS X machines are 10.9.5, per https://docs.travis-ci.com/user/osx-ci-environment/#CI-environment-OS. While NuGet supports the RID, .NET Core does not yet publish 10.9 packages, resulting in a build failure we can't do anything about. I've asked for best-effort support by providing runtime packages for 10.9 in dotnet/corefx#7731. Revert "Add OS X 10.9 runtime" This reverts commit 19ab0de84cec37bb90443df14d4e69f10c41e1b1. --- .travis.yml | 6 +++--- PowerShellGitHubDev.psm1 | 1 - src/Microsoft.PowerShell.CoreConsoleHost/project.json | 1 - 3 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index 5977179f2..90817fd1c 100644 --- a/.travis.yml +++ b/.travis.yml @@ -4,9 +4,9 @@ matrix: - os: linux dist: trusty sudo: required - - os: osx - language: generic - env: PATH+=/usr/local/share/dotnet + # - os: osx + # language: generic + # env: PATH+=/usr/local/share/dotnet git: submodules: false before_install: diff --git a/PowerShellGitHubDev.psm1 b/PowerShellGitHubDev.psm1 index 1b81a2ff9..e8b6d8244 100644 --- a/PowerShellGitHubDev.psm1 +++ b/PowerShellGitHubDev.psm1 @@ -36,7 +36,6 @@ function Start-PSBuild { "win7-x64", "win81-x64", "win10-x64", - "osx.10.9-x64", "osx.10.10-x64", "osx.10.11-x64")] [Parameter(ParameterSetName='CoreCLR')] diff --git a/src/Microsoft.PowerShell.CoreConsoleHost/project.json b/src/Microsoft.PowerShell.CoreConsoleHost/project.json index af65a00ad..22edf8af0 100644 --- a/src/Microsoft.PowerShell.CoreConsoleHost/project.json +++ b/src/Microsoft.PowerShell.CoreConsoleHost/project.json @@ -37,7 +37,6 @@ "win7-x64": { }, "win81-x64": { }, "win10-x64": { }, - "osx.10.9-x64": { }, "osx.10.10-x64": { }, "osx.10.11-x64": { } }