dotnet / arcade

Tools that provide common build infrastructure for multiple .NET Foundation projects.
MIT License
662 stars 336 forks source link

Scripts parsing global.json throws if it don't have required properties #1557

Open natemcmaster opened 5 years ago

natemcmaster commented 5 years ago

eng/common/tools.ps1 throws if required options are not set in global.json. The powershell error thrown does not make it clear what is the expected syntax for global.json.

For instance, if 'tools' isn't present:

2018-12-12T03:00:31.9251470Z The property 'tools' cannot be found on this object. Verify that the property exists.
2018-12-12T03:00:31.9273638Z System.Management.Automation.PropertyNotFoundException: The property 'tools' cannot be found on this object. Verify that the property exists.
2018-12-12T03:00:31.9274457Z    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-12-12T03:00:31.9274686Z    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2018-12-12T03:00:31.9274985Z    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-12-12T03:00:31.9275266Z    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-12-12T03:00:31.9292453Z at InitializeBuildTool, F:\vsagent\-containerSas\76\s\eng\common\tools.ps1: line 310
2018-12-12T03:00:31.9292784Z at InitializeToolset, F:\vsagent\-containerSas\76\s\eng\common\tools.ps1: line 388
2018-12-12T03:00:31.9293008Z at Build, F:\vsagent\-containerSas\76\s\eng\common\Build.ps1: line 78
2018-12-12T03:00:31.9293169Z at <ScriptBlock>, F:\vsagent\-containerSas\76\s\eng\common\Build.ps1: line 125
2018-12-12T03:00:31.9293600Z at <ScriptBlock>, <No file>: line 1

Or if msbuild-sdks is missing the Arcade entry:

2018-12-12T00:53:55.1340100Z The property 'Microsoft.DotNet.Arcade.Sdk' cannot be found on this object. Verify that the property exists.
2018-12-12T00:53:55.1363846Z System.Management.Automation.PropertyNotFoundException: The property 'Microsoft.DotNet.Arcade.Sdk' cannot be found on this object. Verify that the property exists.
2018-12-12T00:53:55.1364401Z    at System.Management.Automation.ExceptionHandlingOps.CheckActionPreference(FunctionContext funcContext, Exception exception)
2018-12-12T00:53:55.1364650Z    at System.Management.Automation.Interpreter.ActionCallInstruction`2.Run(InterpretedFrame frame)
2018-12-12T00:53:55.1365035Z    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-12-12T00:53:55.1365296Z    at System.Management.Automation.Interpreter.EnterTryCatchFinallyInstruction.Run(InterpretedFrame frame)
2018-12-12T00:53:55.1382179Z at InitializeToolset, F:\vsagent\-containerSas\70\s\eng\common\tools.ps1: line 373
2018-12-12T00:53:55.1382681Z at Build, F:\vsagent\-containerSas\70\s\eng\common\Build.ps1: line 78
2018-12-12T00:53:55.1382915Z at <ScriptBlock>, F:\vsagent\-containerSas\70\s\eng\common\Build.ps1: line 125
2018-12-12T00:53:55.1383308Z at <ScriptBlock>, <No file>: line 1

Context: we're trying to implement darc dependency flow by only using part of Arcade. It doesn't appear we actually need some of these entries in global.json

markwilkie commented 5 years ago

@mmitche / @jcagme - It seems we might should clean up the property interdependency with the dependency flow stuff.