build: Update build.sh to run fully manual build#2832
build: Update build.sh to run fully manual build#2832
Conversation
Also, add ubuntu-16.10-x64 to the list of architectures to build for.w
|
Hi @nadiasvertex, I'm your friendly neighborhood Microsoft Pull Request Bot (You can call me MSBOT). Thanks for your contribution! TTYL, MSBOT; |
| cmake -DCMAKE_BUILD_TYPE=Debug . | ||
| make -j | ||
| make test | ||
| popd |
There was a problem hiding this comment.
The biggest step is missing: dotnet build from src/powershell-unix
| powershell -noprofile -c "Import-Module ./build.psm1; Start-PSBuild" | ||
| else | ||
| echo 'No `powershell`, see docs/building/linux.md or macos.md to build PowerShell!' | ||
| echo 'Continuing with full manual build' |
There was a problem hiding this comment.
Maybe a separate script (i.e. build-new-platform.sh or something) would be better. The reason is the build system is already pretty complicated. Putting more logic into the main build path would increase the probability of future errors and time for trouble-shooting.
vors
left a comment
There was a problem hiding this comment.
When onboarding new unix distros, it's desirable to have docker build as well https://github.com/PowerShell/PowerShell/tree/master/docker
For example see https://github.com/PowerShell/PowerShell/pull/2738/files#diff-7f8105a00850a7f7fea1de45bca96f8e
| else | ||
| echo 'No `powershell`, see docs/building/linux.md or macos.md to build PowerShell!' | ||
| echo 'Continuing with full manual build' | ||
| ./build-from-scratch.sh |
There was a problem hiding this comment.
Again, I don't think it should be run automatically.
The error message should suggest to use this script, but not run it.
There was a problem hiding this comment.
Why? This makes no sense. The user has typed "build.sh". They expect the build to run. The script has proved to itself that powershell is not available. So now it should fail and tell the user what to do next? That seems to be the height of silly, especially when it knows what to do next.
There was a problem hiding this comment.
You right, it's silly.
I was thinking we are using this script for the CI build and didn't want to complicate the CI troubleshooting.
But turns out that script is not used and purely for the convenience here.
Please, ignore my comment about the separating logic into a different file: since we call it anyway, there is no need to do it. Sorry for going back and forth on it.
Couple more things:
build.shwill never be as fully-featured asbuild.psm1file. I.e.build.psm1can finddotnet, if it's not in the path, can rundotnet buildordotnet publish, etc. I think it's better to avoid duplicating all such logic and usebuild.shprecisely for the bootstrapping on the new platforms. If we agree about this purpose, then my suggestion would be to replace
pushd src/powershell-unix
dotnet build --configuration Linux
popd
by
dotnet publish --configuration Linux ./src/powershell-unix/ --output bin
And add an echo message about the build location, something like You can run powershell from bin/.
publishwill create a self-contained build of powershell.- Putting it in
bin/will allow to avoid complicated logic about figuring out where the build was made - this version could be used for the build with
.psm1and would not interfere with the standard location (avoid "file in use" problem).
build.shdoesn't perform analog ofRestore-PSModule(adding PS modules from myget and psgallery). It's worth to have a message with this information at the end of the build to avoid confusion.
| @@ -0,0 +1,26 @@ | ||
| #!/usr/bin/env bash |
There was a problem hiding this comment.
I don't think build-from-scratch is a good name. build.sh also build everything from scratch.
Maybe build-without-powershell.sh? I think name should emphasise what's different about this build script.
|
That sounds great. I will make th or changes.
…On Mon, Dec 5, 2016, 2:05 PM Sergei Vorobev ***@***.***> wrote:
***@***.**** commented on this pull request.
------------------------------
In build.sh <#2832>:
>
if hash powershell 2>/dev/null; then
echo 'Continuing with `powershell -noprofile -c Start-PSBuild`'
powershell -noprofile -c "Import-Module ./build.psm1; Start-PSBuild"
else
- echo 'No `powershell`, see docs/building/linux.md or macos.md to build PowerShell!'
+ echo 'Continuing with full manual build'
+ ./build-from-scratch.sh
You right, it's silly.
I was thinking we are using this script for the CI build and didn't want
to complicate the CI troubleshooting.
But turns out that script is not used and purely for the convenience here.
Please, ignore my comment about the separating logic into a different
file: since we call it anyway, there is no need to do it. Sorry for going
back and forth on it.
Couple more things:
- build.sh will never be as fully-featured as build.psm1 file. I.e.
build.psm1 can find dotnet, if it's not in the path, can run dotnet
build or dotnet publish, etc. I think it's better to avoid duplicating
all such logic and use build.sh precisely for the bootstrapping on the
new platforms. If we agree about this purpose, then my suggestion would be
to replace
pushd src/powershell-unix
dotnet build --configuration Linux
popd
by
dotnet publish --configuration Linux ./src/powershell-unix/ --output bin
And add an echo message about the build location, something like You can
run powershell from bin/.
1. publish will create a self-contained build of powershell.
2. Putting it in bin/ will allow to avoid complicated logic about
figuring out where the build was made
3. this version could be used for the build with .psm1 and would not
interfere with the standard location (avoid "file in use" problem).
- build.sh doesn't perform analog of Restore-PSModule (adding PS
modules from myget and psgallery). It's worth to have a message with this
information at the end of the build to avoid confusion.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#2832>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AB8JvCcph1OdwgySUuL4jaQkQbE6FVSyks5rFGB3gaJpZM4LCEBA>
.
|
|
I like this change a lot 😄 |
|
@nadiasvertex your build issue with #2735 complaining about Microsoft.CodeAnalysis.dll is due to |
| powershell -noprofile -c "Import-Module ./build.psm1; Start-PSBuild" | ||
| else | ||
| echo 'No `powershell`, see docs/building/linux.md or macos.md to build PowerShell!' | ||
| echo 'Continuing with full manual build' |
There was a problem hiding this comment.
Seems like we should include install dotnet in build.sh
Also cmake
|
@SteveL-MSFT If |
|
@andschwa well, this is awkward since dotnet restore on my Ubuntu 16.10 system has packages with Pascal casing... removing the ToLower() I can get a build on 16.10 using this change, but getting an exception starting powershell |
|
@SteveL-MSFT file a bug with .NET CLI, see if they purposefully changed it back 😄 |
|
@andschwa I think the difference is a breaking change they made with preview3 vs preview2. On my Windows box and Ubuntu16.10, I have preview2 (as far as I can tell, preview3 isn't available on 16.10). My Ubuntu16.04 box has preview3. This PR may have to wait until we have preview3. |
|
I installed the exact build that docker run -it ubuntu:16.10 bash
apt-get update
apt-get install libunwind8 libicu57 libcurl3 git curl
curl -sO https://raw.githubusercontent.com/dotnet/cli/v1.0.0-preview2-1-3177/scripts/obtain/dotnet-install.sh
bash dotnet-install.sh -c preview -v 1.0.0-preview2-1-00317
git clone https://github.com/PowerShell/PowerShell.git
cd PowerShell/
~/.dotnet/dotnet --version
~/.dotnet/dotnet restore
ls ~/.nuget/packages/And got: So I dug a bit further, and in 32a8601 the
This commit was made December 8, so I'd recommend @nadiasvertex you pull PowerShell and get the latest changes, as the bug you hit appears fixed. |
|
(This corresponds to @SteveL-MSFT finding the change is in preview3, but not preview2; and I didn't realize we'd reverted the tooling back that far.) |
* build: Update build.sh to run fully manual build * add ubuntu-16.10-x64 to the list of architectures to build for.w
Also, add ubuntu-16.10-x64 to the list of architectures to build for.