GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — Make it easier to install the dotnet CLI tools by JamesWTruher · Pull Request #1139 · PowerShell/PSScriptAnalyzer

Conversation

@JamesWTruher

@JamesWTruher James Truher (JamesWTruher) commented Feb 12, 2019

Copy link
Copy Markdown
Contributor

PR Summary

Sometimes the build of script analyzer fails because version specified in global.json is not installed. This PR makes it easier to install the proper version of the CLI tools with the -bootstrap parameter to build.ps1

PS> ./build.ps1 -bootstrap

will determine which version of the CLI is needed, validate whether the proper version is already present, and if not, will install it.

This does not validate whether the net452 targeting framework is installed, that must be done manually.

PR Checklist

  • PR has a meaningful title
    • Use the present tense and imperative mood when describing your changes
  • Summarized changes
  • Change is not breaking
  • Make sure all .cs, .ps1 and .psm1 files have the correct copyright header
  • Make sure you've added a new test if existing tests do not effectively test the code changed and/or updated documentation
  • This PR is ready to merge and is not Work in Progress.
    • If the PR is work in progress, please add the prefix WIP: to the beginning of the title and remove the prefix when the PR is ready.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
James Truher (JamesWTruher) added 8 commits February 5, 2019 01:00
@JamesWTruher
Add bootstrapping code to install dotnet
73069c3
@JamesWTruher
fix logic for downloading proper dotnet installer.
b10fa9c
@JamesWTruher
add a version checker for installed dotnet
a3379fc
Also harden logic for running the installation script
@JamesWTruher
Add bootstrapping code to install dotnet
d2b4eca
@JamesWTruher
Fix merge conflicts
1e484c6
@JamesWTruher
Fix merge conflicts
ef6f4f5
@JamesWTruher
Merge branch 'bootstrap' of https://github.com/JamesWTruher/PSScriptA…
31c39b4
…nalyzer into bootstrap
@JamesWTruher
Handle missing dotnet, and install it.
7f3ddb3
@JamesWTruher
James Truher (JamesWTruher) requested review from Travis Plunk (TravisEz13), Christoph Bergmeister (bergmeister) and Rob Holt (rjmholt) February 12, 2019 08:27
@JamesWTruher James Truher (JamesWTruher) added the Area - Build label Feb 12, 2019
@bergmeister

Christoph Bergmeister (bergmeister) commented Feb 12, 2019

Copy link
Copy Markdown
Collaborator

Awesome, I wanted to do that for a while but was never too bothered to actually take the initiative.
Looks ok but the code that you copied from the appveyor.psm1 for this change should be removed then and the new -Bootstrap switch should be used in CI to avoid code duplication.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JamesWTruher James Truher (JamesWTruher) mentioned this pull request Feb 12, 2019
Add new function which checks for the proper version of dotnet #1131
Closed
5 of 6 tasks
@JamesWTruher
Add logic for checking the appropriate version of the Cli tools befor…
ecc4b3f
…e starting to build
@JamesWTruher
James Truher (JamesWTruher) removed request for Travis Plunk (TravisEz13) and Rob Holt (rjmholt) February 12, 2019 22:42
James Truher (JamesWTruher) added 6 commits February 12, 2019 15:49
@JamesWTruher
Update appveyor.psm1 to use build script bootstrapping for installing…
2df5451
… dotnet CLI

update build script to handle WMF4 better (theoretically)
@JamesWTruher
make the hunt for the dotnet executable more generic and try harder t…
4d2bf72
…o find the exe
@JamesWTruher
Fix typo when checking for usable versions of dotnet
d9833c4
@JamesWTruher
use -version rather than ambiguous -v when installing dotnet
4909995
@JamesWTruher
Improve error message when hunting for cli version
b3d23cf
Use output of dotnet --version if there are problems with --list-sdks
@JamesWTruher
ignore errors when first attempting to find dotnet executable
020c086
set failure of finding dotnet as a warning, we will attempt to install it during bootstrap
this handles the case of a blank slate where dotnet has never been installed
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch 3 times, most recently from badeae0 to fcf73b6 Compare February 14, 2019 19:19
@JamesWTruher
Improve logic for handling a system where dotnet has never been insta…
34835b8
…lled
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch 2 times, most recently from 6d7ec14 to f0dab58 Compare February 14, 2019 20:59
@JamesWTruher
fine tune messages emitted during the hunt for dotnet
e3752cc
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch from f0dab58 to e3752cc Compare February 14, 2019 21:15
James Truher (JamesWTruher) added 5 commits February 14, 2019 13:48
@JamesWTruher
additional logic for finding dotnet executable
8a7ea47
@JamesWTruher
harden search for dotnet
c19ae0a
Sometimes you can't even invoke dotnet if the version is too low
@JamesWTruher
Attempt to quieten build output.
a3e81e1
Throw away stderr of dotnet execution under some case and emit it in others.
Change ToString of PortableVersion to enable better sorts
@JamesWTruher
Fix tostring method for portable version
16ae243
@JamesWTruher
add -Raw flag to Get-GlobalJsonSdkVersion
1747530
Sometimes we need the raw version so the installation script works, but sometimes we need to be able to compare it with other versions.
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch 2 times, most recently from 4686c98 to 866f35b Compare February 15, 2019 19:15
@JamesWTruher
Attempt to harden the upload code
264652d
Also add additional verbose output to improve debuggability
print response from upload
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch from 866f35b to 264652d Compare February 15, 2019 19:39
@JamesWTruher
upgrade pester version to 4.4.4
cd1cbb9
@JamesWTruher
James Truher (JamesWTruher) force-pushed the bootstrap branch from cf72691 to cd1cbb9 Compare February 15, 2019 23:38
James Truher (JamesWTruher) added 4 commits February 15, 2019 16:17
@JamesWTruher
Force the testsuite TestFixture to be named 'Pester' to get through a…
fb8013a
…ppveyors test result recognition
@JamesWTruher
Emit env:LANG to output before executing tests
44a370b
We've had trouble with LANG being set to something that causes problems, so make sure we report what it is.
Removed a bit of the verbosity which was added for debugging
@JamesWTruher
Create tests for build module
58e9216
Fix some errors in the module discovered by the tests
@JamesWTruher
Add additional tests
8dcfa81
Change logic when downloading the dotnet install script
Also enforce en_US.UTF-8 language to ensure that appveyor can see our test results
@JamesWTruher

James Truher (JamesWTruher) commented Feb 19, 2019

Copy link
Copy Markdown
Contributor Author

Christoph Bergmeister (@bergmeister) - I think this is ready now, let me know if you have additional comments

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

bergmeister
Christoph Bergmeister (bergmeister) approved these changes Feb 19, 2019
View reviewed changes

@bergmeister Christoph Bergmeister (bergmeister) left a comment •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Collaborator

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A lot of positive changes, even tests for it, I am overall happy with it. Points to consider or think about before merging (but not required to be addressed):

  • If we call bootstrap automatically anyway as part of the build module, why do we need to expose the Bootstrap switch then?
  • Why can we not rely on the dotnet binary doing the logic for testing if the version is suitable? As far as I am aware they do logic and write to stderr in certain cases. It looks a bit like re-inventing the wheel to me but as long as it works, I am fine with it though.
  • Most of the logic seems to be quite generic, I am wondering if it would be worthwhile to later separate the dotnet logic of this out into a separate repo/module on the PSGallery?

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@bergmeister Christoph Bergmeister (bergmeister) changed the title WIP: Make it easier to install the dotnet CLI tools Make it easier to install the dotnet CLI tools Feb 19, 2019
@JamesWTruher

James Truher (JamesWTruher) commented Feb 19, 2019

Copy link
Copy Markdown
Contributor Author

Christoph Bergmeister (@bergmeister) thanks for the feedback and here are answers to questions:

  • I thought it would be useful to run the bootstrapping outside of the build process under some circumstances. I personally want to install sometimes, but not build.
  • I found in my testing that some earlier versions of dotnet don't even let you run if there's a mismatch. I was trying to support any old version where that might happen. I also need to support when dotnet isn't even there.
  • quite possibly - I did try to keep it generic for possible reuse.
bergmeister reacted with thumbs up emoji
All reactions
  • 👍 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@JamesWTruher
James Truher (JamesWTruher) merged commit cfeb7d5 into PowerShell:development Feb 19, 2019
Christoph Bergmeister (bergmeister) pushed a commit to bergmeister/PSScriptAnalyzer that referenced this pull request Mar 5, 2019
@JamesWTruher @bergmeister
Make it easier to install the dotnet CLI tools (PowerShell#1139)
26ada32
* Add bootstrapping code to install dotnet

* fix logic for downloading proper dotnet installer.

* add a version checker for installed dotnet

Also harden logic for running the installation script

* Add bootstrapping code to install dotnet

* Handle missing dotnet, and install it.

* Add logic for checking the appropriate version of the Cli tools before starting to build

* Update appveyor.psm1 to use build script bootstrapping for installing dotnet CLI

update build script to handle WMF4 better (theoretically)

* make the hunt for the dotnet executable more generic and try harder to find the exe

* Fix typo when checking for usable versions of dotnet

* use -version rather than ambiguous -v when installing dotnet

* Improve error message when hunting for cli version

Use output of dotnet --version if there are problems with --list-sdks

* ignore errors when first attempting to find dotnet executable

set failure of finding dotnet as a warning, we will attempt to install it during bootstrap
this handles the case of a blank slate where dotnet has never been installed

* Improve logic for handling a system where dotnet has never been installed

* fine tune messages emitted during the hunt for dotnet

* additional logic for finding dotnet executable

* harden search for dotnet

Sometimes you can't even invoke dotnet if the version is too low

* Attempt to quieten build output.

Throw away stderr of dotnet execution under some case and emit it in others.
Change ToString of PortableVersion to enable better sorts

* Fix tostring method for portable version

* add -Raw flag to Get-GlobalJsonSdkVersion

Sometimes we need the raw version so the installation script works, but sometimes we need to be able to compare it with other versions.

* Attempt to harden the upload code

Also add additional verbose output to improve debuggability
print response from upload

* upgrade pester version to 4.4.4

* Force the testsuite TestFixture to be named 'Pester' to get through appveyors test result recognition

* Emit env:LANG to output before executing tests

We've had trouble with LANG being set to something that causes problems, so make sure we report what it is.
Removed a bit of the verbosity which was added for debugging

* Create tests for build module

Fix some errors in the module discovered by the tests

* Add additional tests

Change logic when downloading the dotnet install script
Also enforce en_US.UTF-8 language to ensure that appveyor can see our test results
Christoph Bergmeister (bergmeister) pushed a commit to bergmeister/PSScriptAnalyzer that referenced this pull request Mar 22, 2019
@JamesWTruher @bergmeister
Make it easier to install the dotnet CLI tools (PowerShell#1139)
3b439ea
* Add bootstrapping code to install dotnet

* fix logic for downloading proper dotnet installer.

* add a version checker for installed dotnet

Also harden logic for running the installation script

* Add bootstrapping code to install dotnet

* Handle missing dotnet, and install it.

* Add logic for checking the appropriate version of the Cli tools before starting to build

* Update appveyor.psm1 to use build script bootstrapping for installing dotnet CLI

update build script to handle WMF4 better (theoretically)

* make the hunt for the dotnet executable more generic and try harder to find the exe

* Fix typo when checking for usable versions of dotnet

* use -version rather than ambiguous -v when installing dotnet

* Improve error message when hunting for cli version

Use output of dotnet --version if there are problems with --list-sdks

* ignore errors when first attempting to find dotnet executable

set failure of finding dotnet as a warning, we will attempt to install it during bootstrap
this handles the case of a blank slate where dotnet has never been installed

* Improve logic for handling a system where dotnet has never been installed

* fine tune messages emitted during the hunt for dotnet

* additional logic for finding dotnet executable

* harden search for dotnet

Sometimes you can't even invoke dotnet if the version is too low

* Attempt to quieten build output.

Throw away stderr of dotnet execution under some case and emit it in others.
Change ToString of PortableVersion to enable better sorts

* Fix tostring method for portable version

* add -Raw flag to Get-GlobalJsonSdkVersion

Sometimes we need the raw version so the installation script works, but sometimes we need to be able to compare it with other versions.

* Attempt to harden the upload code

Also add additional verbose output to improve debuggability
print response from upload

* upgrade pester version to 4.4.4

* Force the testsuite TestFixture to be named 'Pester' to get through appveyors test result recognition

* Emit env:LANG to output before executing tests

We've had trouble with LANG being set to something that causes problems, so make sure we report what it is.
Removed a bit of the verbosity which was added for debugging

* Create tests for build module

Fix some errors in the module discovered by the tests

* Add additional tests

Change logic when downloading the dotnet install script
Also enforce en_US.UTF-8 language to ensure that appveyor can see our test results
@bergmeister Christoph Bergmeister (bergmeister) mentioned this pull request Oct 26, 2019
Fix configuration for PS v5 and v6 builds to be Debug/Release and not PSV6Debug, etc. as it used to be able to produce actual debug builds #1356
Merged
5 of 6 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@bergmeister Christoph Bergmeister (bergmeister) bergmeister approved these changes

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

Area - Build

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@JamesWTruher @bergmeister
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
You are visitor 01402503 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.