New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bootstrapper magic mode & run #1961

Merged
merged 19 commits into from Oct 22, 2016

Conversation

Projects
None yet
4 participants
@vbfox
Contributor

vbfox commented Oct 12, 2016

Bootstraper Magic mode (And also --run but that's boring)

It add 2 features to the bootstraper:

  • --run when passed all arguments after it are ignored and when paket.exe is downloaded it's started with the remaining arguments
  • Magic mode similar to some unix binaries that change behavior when renamed, the bootstraper when renamed to paket.exe behave just like it !
    • Download the real file to the temp directory and assume --run
    • Except if --run is really passed, pass all it's arguments to paket.exe as-is
    • Keep using the same file without checking for updates for 12 hours (Assume --max-file-age=720)

The end result is that the bootstraper paket.exe can be placed at the root of a repository avoiding the need of shell scripts, cmd scripts or even a .paket folder.

The "first time user" experience is also much better : place paket.exe in solution root then paket init. You can commit it, it's small and keep itself up-to-date.

PS: The bootstraper gain 4KB moving from 39KB to 43KB

vbfox added some commits Oct 12, 2016

Implement a --run parameter in bootstraper
When this parameter is present the boostraper run paket.exe after
downloading it. It also ignore all parameters after --run and pass them
back to paket.exe
Add a "magic" mode to the bootstraper
If the bootstraper is renamed to paket.exe it download the real paket.exe
to the temporary folder instead.

In addition if --run isn't specified on the command line it act as if it
was passed and run paket.exe with all the arguments it received.

The result is that it produce a paket.exe of 47Ko that act like the normal
one (As long as an internet connection is available)
Better working '--run' and magic mode in bootstraper
* As Process.Start isn't powerful enough to support our scenario PInvoke
  is used on both windows and unix to get the functionality of running a
  subprocess while keeping the console.
* The bootstraper now get an icon, only a low resolution one but it look a
  little nicer.
Remove the icon from the bootstraper
Sad but 6KB on a 48KB executable is too much for an icon

@vbfox vbfox changed the title from [WIP] Bootstraper run to Bootstraper run Oct 14, 2016

@vbfox vbfox changed the title from Bootstraper run to Bootstraper magic mode & run Oct 14, 2016

@vbfox vbfox changed the title from Bootstraper magic mode & run to [WIP] Bootstraper magic mode & run Oct 14, 2016

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 14, 2016

Contributor

Still WIP as the console ends up slightly corrupted on MacOSX, don't know if it's fixable.

Contributor

vbfox commented Oct 14, 2016

Still WIP as the console ends up slightly corrupted on MacOSX, don't know if it's fixable.

vbfox added some commits Oct 14, 2016

Better Mono/unix code
The code is tested on "Ubuntu on Windows" and i'll validate it also on MacOSX Sierra.

@vbfox vbfox changed the title from [WIP] Bootstraper magic mode & run to Bootstraper magic mode & run Oct 15, 2016

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 15, 2016

Contributor

I think this PR is ready for being tested/checked @forki . It should be labeled as "alpha" or something like that until it's tested on more platforms / by more people.

I had some problems on mono/unix but I think they are now solved with the latest commit working without problems on the systems I have access to. If anyone is interested in the murky little details UnixMonoConsoleRunner.cs contains a bunch of comments.

Tested on:

  • Windows 10
  • Bash on Ubuntu On Windows
  • MacOSX sierra
Contributor

vbfox commented Oct 15, 2016

I think this PR is ready for being tested/checked @forki . It should be labeled as "alpha" or something like that until it's tested on more platforms / by more people.

I had some problems on mono/unix but I think they are now solved with the latest commit working without problems on the systems I have access to. If anyone is interested in the murky little details UnixMonoConsoleRunner.cs contains a bunch of comments.

Tested on:

  • Windows 10
  • Bash on Ubuntu On Windows
  • MacOSX sierra
@baronfel

This comment has been minimized.

Show comment
Hide comment
@baronfel

baronfel Oct 15, 2016

Contributor

Oh nice, lemme give this a spin on my own and windows boxen

Contributor

baronfel commented Oct 15, 2016

Oh nice, lemme give this a spin on my own and windows boxen

@baronfel

This comment has been minimized.

Show comment
Hide comment
@baronfel

baronfel Oct 15, 2016

Contributor

With the PR should we also update the paket.targets to use the new paket.exe convention? The paket.targets that get pulled in on init now also pull in another copy of the bootstrapper, which is redundant if the user has paket.bootstrapper.exe renamed in their solution/project root.

Contributor

baronfel commented Oct 15, 2016

With the PR should we also update the paket.targets to use the new paket.exe convention? The paket.targets that get pulled in on init now also pull in another copy of the bootstrapper, which is redundant if the user has paket.bootstrapper.exe renamed in their solution/project root.

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 15, 2016

Contributor

@baronfel Ah yes I forgot about that feature :)

A lot of things can be solved with the main executable knowing (via an argument) that it was started from a bootstraper already. I'll add that to the PR.

Contributor

vbfox commented Oct 15, 2016

@baronfel Ah yes I forgot about that feature :)

A lot of things can be solved with the main executable knowing (via an argument) that it was started from a bootstraper already. I'll add that to the PR.

vbfox added a commit to vbfox/ColoredPrintf that referenced this pull request Oct 19, 2016

vbfox added a commit to vbfox/MasterOfFoo that referenced this pull request Oct 19, 2016

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Oct 20, 2016

Member

Do you think it's ready for alpha release? Can you please add a bit of docs?

Member

forki commented Oct 20, 2016

Do you think it's ready for alpha release? Can you please add a bit of docs?

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 20, 2016

Contributor

Yes I think it's ready. When merged the version in PaketRunner might need adjustment but that's all.

Regarding docs I documented it in the doc about bootstraper.
To avoid confusing users while it's still in test I didn't change the installation / getting started pages. Should I change them ? Maybe only installation with a warning that it's experimental ?

Contributor

vbfox commented Oct 20, 2016

Yes I think it's ready. When merged the version in PaketRunner might need adjustment but that's all.

Regarding docs I documented it in the doc about bootstraper.
To avoid confusing users while it's still in test I didn't change the installation / getting started pages. Should I change them ? Maybe only installation with a warning that it's experimental ?

@forki forki merged commit c2e92ca into fsprojects:master Oct 22, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Oct 22, 2016

Member

thx I released it in alpha!

Member

forki commented Oct 22, 2016

thx I released it in alpha!

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Oct 22, 2016

Member

can we get alpha versions of paket in magic mode?

Member

forki commented Oct 22, 2016

can we get alpha versions of paket in magic mode?

@forki forki added the enhancement label Oct 22, 2016

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 22, 2016

Contributor

can we get alpha versions of paket in magic mode?

Yes you can but can't ask for "prerelease" in general you must specify a version for now. Even in magic mode the .config file is still supported for that, creating a paket.exe.config with :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="PaketVersion" value="3.24.0-alpha002"/>
  </appSettings>
</configuration>

Will use the current alpha.

If the magic mode is really useful and used a lot I was thinking to move paket version specification in paket.dependencies using a very simple syntax known to the boostraper and that the main executable ignores like :

# bootstraper: 3.24 --prefer-nuget

source https://api.nuget.org/v3/index.json
nuget FAKE
nuget FSharp.Core ~> 4
Contributor

vbfox commented Oct 22, 2016

can we get alpha versions of paket in magic mode?

Yes you can but can't ask for "prerelease" in general you must specify a version for now. Even in magic mode the .config file is still supported for that, creating a paket.exe.config with :

<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <appSettings>
    <add key="PaketVersion" value="3.24.0-alpha002"/>
  </appSettings>
</configuration>

Will use the current alpha.

If the magic mode is really useful and used a lot I was thinking to move paket version specification in paket.dependencies using a very simple syntax known to the boostraper and that the main executable ignores like :

# bootstraper: 3.24 --prefer-nuget

source https://api.nuget.org/v3/index.json
nuget FAKE
nuget FSharp.Core ~> 4
@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Oct 24, 2016

Member

yes that would be awesome

Member

forki commented Oct 24, 2016

yes that would be awesome

@forki

This comment has been minimized.

Show comment
Hide comment
@forki

forki Oct 24, 2016

Member

what I would need right now is a setting in appsettings that will take latest alpha

Member

forki commented Oct 24, 2016

what I would need right now is a setting in appsettings that will take latest alpha

@vbfox vbfox changed the title from Bootstraper magic mode & run to Bootstrapper magic mode & run Oct 24, 2016

@vbfox vbfox referenced this pull request Oct 24, 2016

Merged

More boostrapper config #1979

forki added a commit that referenced this pull request Oct 25, 2016

@pmiossec

This comment has been minimized.

Show comment
Hide comment
@pmiossec

pmiossec Oct 25, 2016

The end result is that the bootstraper paket.exe can be placed at the root of a repository avoiding the need of shell scripts, cmd scripts or even a .paket folder.

The "first time user" experience is also much better : place paket.exe in solution root then paket init. You can commit it, it's small and keep itself up-to-date.

Is it the recommended way to use it? Or is it advised to keep the bootstrapper, once renamed, in the .paket folder?
Because in this case the paket.targets does not work anymore :(

Or perhaps update the lines at the beginning of paket.targets file :

<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)..\paket.exe</PaketExePath>
<PaketExePath Condition="!Exists('$(PaketExePath)')">$(PaketToolsPath)paket.exe</PaketExePath>

to verify if we use it as "magic mode" otherwise, continue as usual... (solution tested and that seems to work)

pmiossec commented Oct 25, 2016

The end result is that the bootstraper paket.exe can be placed at the root of a repository avoiding the need of shell scripts, cmd scripts or even a .paket folder.

The "first time user" experience is also much better : place paket.exe in solution root then paket init. You can commit it, it's small and keep itself up-to-date.

Is it the recommended way to use it? Or is it advised to keep the bootstrapper, once renamed, in the .paket folder?
Because in this case the paket.targets does not work anymore :(

Or perhaps update the lines at the beginning of paket.targets file :

<PaketExePath Condition=" '$(PaketExePath)' == '' ">$(PaketToolsPath)..\paket.exe</PaketExePath>
<PaketExePath Condition="!Exists('$(PaketExePath)')">$(PaketToolsPath)paket.exe</PaketExePath>

to verify if we use it as "magic mode" otherwise, continue as usual... (solution tested and that seems to work)

@vbfox

This comment has been minimized.

Show comment
Hide comment
@vbfox

vbfox Oct 25, 2016

Contributor

@pmiossec for now i'd recommend to keep it in .paket for compatibility.

Thanks for the .targets fix :)

As I like having paket.exe in the root i'll continue to fix small details in this mode but I don't know if it'll ever be the recommended / default way 😸 (Magic mode itself might become the recommended / default in v4)

Contributor

vbfox commented Oct 25, 2016

@pmiossec for now i'd recommend to keep it in .paket for compatibility.

Thanks for the .targets fix :)

As I like having paket.exe in the root i'll continue to fix small details in this mode but I don't know if it'll ever be the recommended / default way 😸 (Magic mode itself might become the recommended / default in v4)

vbfox added a commit to vbfox/Paket that referenced this pull request Oct 26, 2016

MSBuild targets now work with paket.exe in root directory
It's now possible to do that with the magic mode and as disussed in #1961 the targets file should support it

vbfox added a commit to vbfox/Paket that referenced this pull request Oct 27, 2016

MSBuild targets now work with paket.exe in root directory
It's now possible to do that with the magic mode and as disussed in #1961 the targets file should support it
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment