Skip to content
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

WIP: global dotnet cli-tool #1932

Merged
merged 2 commits into from
May 19, 2018
Merged

Conversation

kblohm
Copy link
Contributor

@kblohm kblohm commented May 16, 2018

Hi,
since dotnet core 2.1 is in RC now, i created a global FAKE cli tool, based on the 'old' cli-tool.
I build fake itself with the tool, so it should be working fine (at least on my windows machine).
There are still some things we need to decide/do:

  • As far as i know a global tool can not be installed as a DotNetCliToolReference. So should there be 2 tools now? I guess the DotNetCliToolReference makes it easier for CI-Server so thats probably good. So i vote for 2 tools :)
  • The name of the project. I named it Fake-Cli for now. Could also be dotnet-fake-global or fake.cli or whatever. The name of the project does not have to influence the name of the command, which is just fake.
  • I did not update the docs yet.
  • Your bootstrapping-repo should probably be updated afterwards.

build.fsx Outdated
@@ -224,7 +224,16 @@ Trace.setBuildNumber nugetVersion
//if current |> Seq.contains CoreTracing.defaultConsoleTraceListener |> not then
// CoreTracing.setTraceListeners (CoreTracing.defaultConsoleTraceListener :: current)

let dotnetSdk = lazy DotNet.install DotNet.Release_2_1_4

let dotnetSdk = lazy DotNet.install (fun p ->
Copy link
Member

Choose a reason for hiding this comment

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

Should we add that version to Fake.DotNet.Cli as well?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I would have, but i was not sure about the build version. We could just add '2.1.300-rc1' without the build version and just update that 'silently' if it changes. But i would not pollute the module with several 2.1.300-rc1-versions.

@matthid
Copy link
Member

matthid commented May 16, 2018

yes yes yes. Thanks for looking into this :)
Yes finding a reasonable name is the hardest thing here:

  • fake-bin
  • fake-cli
  • fake-global-tool
  • dotnet-fake-global
  • ... or with . instead of -?

Honestly I don't really know (which is probably the reason why I have not looked into this yet)

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

just 'fake' would be nice ;).
Could also be fake-runner.
Shouldn't travis use the version that was just downloaded?

@matthid
Copy link
Member

matthid commented May 16, 2018

Seems like slack likes fake-cli, which is actually quite nice

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

fake-cli <- all lowercase?

@matthid
Copy link
Member

matthid commented May 16, 2018

I would write it all lower case, but I don't think casing actually matters when used on the command line later on.

@matthid
Copy link
Member

matthid commented May 16, 2018

Shouldn't travis use the version that was just downloaded?

Yes it does, but it seems like environment variables are set such that the new version uses the old sdk-files....

@matthid
Copy link
Member

matthid commented May 16, 2018

@matthid matthid changed the base branch from master to release/rc_13 May 16, 2018 21:16
@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

Probably not, but its also consistent with dotnet-fake. I will change it to lower.

Exactly the same lines are in the DotNet module. Thats probably a bug.

@matthid
Copy link
Member

matthid commented May 16, 2018

Yes either a bug in dotnet cli or just another environment variable we need to look at. Also we might need to ensure that "our" newly installed dotnet-sdk is the first in PATH...

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

Are you already merging or can i still force-push?

@matthid
Copy link
Member

matthid commented May 16, 2018

You can still force-push, I just changed to base because this was on the wish list of rc13 :)

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

At least for me, PATH just points to the root dotnet folder and not a specific version. So i guess its the travis.yml that sets the dotnet environment variable to 2.1.4.

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

Do u prefer updating the travis.yml or removing 'dotnet' from the environment in addition to MSBuild stuff (I have MSBUILD and MSBUILD_PATH on my machine and none of the ones listed. So they are missing aswell maybe?)

@matthid
Copy link
Member

matthid commented May 16, 2018

Does that mean you have found the root cause? I'm not sure I understand. I feel like we should find the root cause but chaning travis.yml is a workaround if we can't find it.

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

So build.fsx changes the workingDirectory to the directory of the just downloaded sdk. It does not change the dotnet executable though. That one is still the one that DotNet.exec finds. As in home/.dotnet i suppose. Do u know if the installer script both installs to home/.dotnet/sdk/2.1.300-rc1-008673 AND updates the executable that is in home/.dotnet/ ? Because it does not look like it does that on linux.

@kblohm
Copy link
Contributor Author

kblohm commented May 16, 2018

Ok, i have changed the casing and i added the RC to the DotNet module.
I also changed the travis version. But just to see if that even matters. I will look into a proper fix later.

@kblohm kblohm force-pushed the globalDotnetTool branch 4 times, most recently from 8198eca to f66af87 Compare May 17, 2018 19:23
@@ -10,30 +10,30 @@ module DotNet =

// NOTE: The #if can be removed once we have a working release with the "new" API
// Currently we #load this file in build.fsx
#if NO_DOTNETCORE_BOOTSTRAP
// #if NO_DOTNETCORE_BOOTSTRAP
Copy link
Member

Choose a reason for hiding this comment

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

Maybe just remove. I think you are correct and we don't need this anymore.

@matthid
Copy link
Member

matthid commented May 17, 2018

Do we need fsprojects/Paket#3208 or how did you make it work?

@@ -95,7 +95,7 @@ group Build
nuget SourceLink.Fake
nuget ILRepack
nuget RoslynTools.ReferenceAssemblies

nuget Newtonsoft.Json
Copy link
Member

Choose a reason for hiding this comment

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

Where does this come from?

Copy link
Contributor Author

@kblohm kblohm May 18, 2018

Choose a reason for hiding this comment

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

I #load the DotNet module directly so i can use DotNet.Release_2_1_300_RC1. If i dont add the Newtonsoft.Json the Bootstrap test fails. I can remove it and just add the new version directly and update that later.

@kblohm
Copy link
Contributor Author

kblohm commented May 18, 2018

Did u read the reason why travis build is probably using the wrong version? Do u have any opinions on how to fix that? I could

  • set the right path in the build script
  • add a new method to the DotNet module that can be used to try and find a specific version of Dotnet
  • add a new property to the Dotnet options that specifies the prefered version. Since the current toolpath is set in the Options.Create() i would have to search for the tool twice if the property is set, so that might be kinda strange.

@matthid
Copy link
Member

matthid commented May 18, 2018

Sadly I cannot see the build anymore due to rebasing, the current build seems to have triggered a dotnet-cli bug :/

But IIRC the previous build did use the correct version (ie it started he correct version installed within the build) - instead the problem was the dotnet-cli used the msbuild sdk files from the global existing installation.

I would consider this a bug in the Fake.Dotnet.Cli module, which probably can be debugged by just printing all environment variables before starting dotnet-cli

@kblohm
Copy link
Contributor Author

kblohm commented May 18, 2018

It did use the right version, but probably only because i changed the travis.yml. I wanted to see if that helped.
The build script still just sets the working directory and not the actual dotnet executable to the downloaded version.
So i dont think that is a bug. I am pretty sure Fake.Dotnet.Cli just uses the version it finds, and that is probably the one travis puts there. But i do not really know what happens exactly in travis when u set a dotnet version in travis.yml.

@matthid
Copy link
Member

matthid commented May 18, 2018

So i dont think that is a bug. I am pretty sure Fake.Dotnet.Cli just uses the version it finds

Maybe we talk through each other but if you use DotNet.install according to the docs:

https://fake.build/dotnet-cli.html

Ie combine the DotNet.install and DotNet.<exec> calls then it uses exactly the installed binary (this is ensured by the function returned by DotNet.install and afaik that works).

You can see it in the logs /usr/bin/dotnet is the one installed by travis. In the previous log it started /home/<something>/dotnet

@matthid
Copy link
Member

matthid commented May 19, 2018

Ok circle-ci added an option recently to build pull requests, so next push should have an circleci build (to ease it a bit)

@matthid
Copy link
Member

matthid commented May 19, 2018

On the arguments part: there are like 5 different approaches to do process arguments in FAKE. Maybe we should look into unifying them somehow? I am using the Process.xxxParam functions now. The string-module is very inconsistent.

Yes I agree, basically all but one are broken for some kind of input. We probably should all mark as obsolete.

@matthid
Copy link
Member

matthid commented May 19, 2018

Added an issue #1940, will look at it eventually

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

I am not using Args.toWindowsCommandLine right now. At least for travis the Process.quote is working fine (in this case at so far at least).

@matthid
Copy link
Member

matthid commented May 19, 2018

Ok I think we probably should filter

  'MSBuildLoadMicrosoftTargetsReadOnly' -> 'true'
  'MSBuildSDKsPath' -> '/usr/share/dotnet/sdk/2.1.4/Sdks'

in addition to MSBuildExtensionsPath and MSBUILD_EXE_PATH. I'm pretty sure it will work then :)
Can you add that to the msbuild and dotnet-cli modules?

@matthid
Copy link
Member

matthid commented May 19, 2018

And there is 'DOTNET_HOST_PATH' -> '/usr/share/dotnet/dotnet' which at least looks suspicious

@matthid
Copy link
Member

matthid commented May 19, 2018

Google says it might be a good idea to unset that as well (at least when running the dotnet-cli)

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

Google never lies! I added them.

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

Should we remove all of the environment vars by default or just in the installer case? Somebody might set those intentionally.

@matthid
Copy link
Member

matthid commented May 19, 2018

Actually it should be fine, I designed the setup in a way that if you set those manually it will "just work"

@matthid
Copy link
Member

matthid commented May 19, 2018

Not sure why circleci was failing, retried the build.

@matthid matthid changed the base branch from release/rc_13 to release/rc May 19, 2018 13:20
@matthid
Copy link
Member

matthid commented May 19, 2018

Should I merge this on staging so we can play around and look at the result? Please just merge/rebase on top of release/rc thanks

@matthid
Copy link
Member

matthid commented May 19, 2018

I think the current circleci error goes away after merge/rebase.

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

Ahh you are too fast ;). Should i let these run or rebase again?

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

The "UnskipAndRevertAssemblyInfo" target. Could that be a final target instead? This will not solve all the problems, as i sometimes just skip a build if a realise i forgot something, but at least for the cases where it just fails it should be in a valid state afterwards.

@matthid
Copy link
Member

matthid commented May 19, 2018

Yes good idea. maybe we could detect ctrl+c and run final targets anyway no idea...

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

It would probably be a good idea if you could test the global tool on your machine. I am still kinda sceptical because of

Do we need fsprojects/Paket#3208 or how did you make it work?

As i said, its working for me, but there must be a reason why he needed to make the changes to paket.

@matthid
Copy link
Member

matthid commented May 19, 2018

OK lets try this out on our new shiny staging instance :)

@matthid matthid merged commit 7303149 into fsprojects:release/rc May 19, 2018
@matthid
Copy link
Member

matthid commented May 19, 2018

Our new tool

@kblohm
Copy link
Contributor Author

kblohm commented May 19, 2018

Nice :). Ping me if something is not working.

@kblohm kblohm deleted the globalDotnetTool branch May 19, 2018 16:30
@matthid
Copy link
Member

matthid commented May 20, 2018

Just for reference: The failure we saw on travis was a bug in travis, because it didn't actually install all dotnet sdk requirements. I reported it here: travis-ci/travis-ci#9644

@matthid
Copy link
Member

matthid commented May 21, 2018

It's released :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants