-
Notifications
You must be signed in to change notification settings - Fork 64
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
Port to .NET Core 3.0 and revamp engineering/build/test #201
Conversation
Currently builds fail intermittently on Windows with NuGet/Home#8692 |
Looks like a NuGet bug that was fixed in 5.1. Need to update the version of NuGet we're using in Pipelines. |
I checked out your code on my Windows machine. Building with I've re-cloned the Office repo using this branch and am currently hydrating files using the gvfs-helper. I'll double-check the maintenance steps will start running from the service. |
@mjcheetham: I had @wilbaker complete his PR, but didn't realize the conflicts it would cause for you. The plan is to hold off on further major changes until this is ready, unless we think it's going to take a long time. For instance, William isn't going to delete the Scalar.Mount project until this is done, but he will be working on some logic in the service. cc: @jrbriggs |
Yep apologies for the conflicts! Fortunately they are easy to resolve.
If you're interested I pushed a branch here that has a merge of master into cc: @jrbriggs, @derrickstolee |
/azp run microsoft.scalar |
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.
Left a few questions after trying out the new code for a bit on the Mac.
|
||
echo 'Running Scalar unit tests...' | ||
$Scalar_PUBLISHDIR/Scalar.UnitTests || exit 1 | ||
dotnet publish $SCALAR_SRCDIR/Scalar.sln --runtime osx-x64 --configuration $CONFIGURATION || exit 1 |
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.
With the move to .NET Core 3.0, should we still be able to build using VS for Mac? Or will we have to use the script?
I'm seeing this error when I try in the IDE:
Related, what is the best way to debug Scalar on Mac now? I used to be able to do the following:
- Build Scalar in VS for Mac
- Right-click on the project I want to run, and select Run With -> Custom Configuration ...
- Point VS at the Published binary I want to test
- Start debugging
But now that VS for Mac is unable to build, it does not appear to let me start debugging this way.
What do you use to debug .NET Core 3 applications on Mac?
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.
What do you use to debug .NET Core 3 applications on Mac?
Related, how can we run the unit tests from an IDE on Mac?
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.
Related, how can we run the unit tests from an IDE on Mac?
To clarify, all I'm looking for is the best way to debug the unit tests on Mac. With the switch to using dotnet test
I'm not sure what the best process is for doing so.
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.
I'm seeing this error when I try in the IDE:
Ah.. this is great (and fixable).. So VS for Mac still uses Mono MSBuild to do it's 'in IDE' builds, not the dotnet
CLI. The custom build tasks I have currently target the .NET Core RoslynCodeTaskFactory
. I have an update that I'll push to fix this, and to select the correct factory depending on the MSBuild runtime.
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.
Related, what is the best way to debug Scalar on Mac now? I used to be able to do the following:
- Build Scalar in VS for Mac
- Right-click on the project I want to run, and select Run With -> Custom Configuration ...
- Point VS at the Published binary I want to test
- Start debugging
You do largely the same thing. If you just want to debug the project, right-click it in the Solution Pad and click ''Start Debugging Project":
To specify command-line arguments, use 'Run With' > 'Custom Configuration' again and pick 'Start Project' and 'Run Action: Debug' (and add your arguments or environment variables):
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.
Related, how can we run the unit tests from an IDE on Mac?
To clarify, all I'm looking for is the best way to debug the unit tests on Mac. With the switch to using dotnet test I'm not sure what the best process is for doing so.
Open the Unit Tests Pad under View > Pads > Unit Tests, select a test to run or debug!
You can also hit 'run all' and see all the lovely green ticks ✅ (hopefully)!
You will also see that the ignored tests are the Windows ones on Mac.
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.
@mjcheetham I tried grabbing the latest code from your branch (e3b2d34), and I'm now seeing a different build error in VS for Mac which prevents me from running the unit tests:
Build FAILED.
/Users/wilbaker/Repos/Scalar/src/Scalar.Common/Scalar.Common.csproj(24,29): error MSB4064: The "PackagePath" parameter is not supported by the "GetGitInstallerVersion" task. Verify the parameter exists on the task, and it is a settable public instance property.
/Users/wilbaker/Repos/Scalar/src/Scalar.Common/Scalar.Common.csproj(24,5): error MSB4063: The "GetGitInstallerVersion" task could not be initialized with its input parameters.
0 Warning(s)
2 Error(s)
Any ideas? I have tried nuking and building again but that did not seem to help.
I confirmed the following worked as expected on Mac:
- Build Scalar from Terminal using
BuildScalarForMac.sh
- Run unit tests with
RunUnitTests.sh
(no warnings! 🎉 ) - Run the install script that is placed in
Scalar.Distribution.Mac
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.
In case it matters, this is what dotnet --version
reports:
~/Repos/Scalar/src/Scripts/Mac>dotnet --version
3.0.100
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.
@mjcheetham as discussed offline, no need to block on VS for Mac support.
I was able to debug the unit tests using VSCode and the following approach:
- Open Terminal Window in VSCode
export VSTEST_HOST_DEBUG=1
dotnet test
- Attach to the PID reported in terminal:
Host debugging is enabled. Please attach debugger to testhost process to continue.
Process Id: 23870, Name: dotnet
If you know a better approach, please let me know 😄
|
||
set -e | ||
. "$(dirname ${BASH_SOURCE[0]})/../InitializeEnvironment.sh" |
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.
I think this may need to be updated to:
"$(dirname ${BASH_SOURCE[0]})/InitializeEnvironment.sh"
When I ran this as it is now there was an error that InitializeEnvironment.sh
could not be found:
~/Repos/Scalar/src/Scripts/Mac>./CreateScalarDistribution.sh
./CreateScalarDistribution.sh: line 3: ./../InitializeEnvironment.sh: No such file or directory
No need to run this script anymore!
Run 'BuildScalarForMac.sh' and look in: /Scalar.Distribution.Mac/dist
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.
I could also just remove this since it's just here to give a nice "error" to people with muscle memory. 😉
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.
ECHO. | ||
ECHO ============================== | ||
ECHO Installing Git for Mac for Scalar | ||
%SCALAR_DISTRIBUTION_ROOT%\Git\%GIT_INSTALLER_EXE% /DIR="C:\Program Files\Git" /NOICONS /COMPONENTS="ext,ext\shellhere,ext\guihere,assoc,assoc_sh" /GROUP="Git" /VERYSILENT /SUPPRESSMSGBOXES /NORESTART || EXIT /B 1 |
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.
This step is failing in the Windows functional tests. Should we change the "very silent" option until we know more about what's going on?
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.
Just making it clear that you can merge as soon as you have passing builds. Let's get this in and then see what small problems we have afterwards.
We get rate limited querying the GitHub API for the release assets to download GCM Core for Mac. Replace this with a simple hardcoding of the GCM Core macOS installer package URL.
Workaround a bug in the NuGet restore logic shipped with the dotnet CLI. NuGet/Home#8692
Thanks for your hard work here, @mjcheetham! I just merged to unblock the other PRs. |
Non-goals
New commands
dotnet build
: Build all managed codedotnet test
: Run all managed unit testsdotnet publish -r [osx-x64|win-x64]
: Build all code including Scalar installer packages and scriptsScripts
BuildScalarForMac.sh
/BuildScalarForWindows.bat
: Build all code and generate installers and install scriptsRunUnitTests.(sh|bat)
: Run the managed unit testsRunFunctionalTests.(sh|bat)
: Run the functional testsRestorePackages.bat
: No-opDirectories
Changes
Platforms/
directory. There is now one platform loader that instantiates the correct type based on the current OS at runtime.sed
to replace placeholder tokens)dotnet
CLI (seedotnet build
/publish
).DirectoryEx
in the Common project.NamedPipeServerStream
methods from the CoreFX to create pipes with the appropriate ACLs on Windows.