DYN-8977 Create global.json dynamically#16266
Conversation
There was a problem hiding this comment.
See the ticket for this pull request: https://jira.autodesk.com/browse/DYN-8977
There was a problem hiding this comment.
Pull Request Overview
This PR removes the static global.json files and creates them dynamically during GitHub Actions builds to enable updated .NET SDK configuration.
- Removed global.json files from the src and test directories.
- Added steps in multiple GitHub Actions workflows (dynamo_bin_diff.yml, build_dynamo_core.yml, build_dynamo_all.yml) to dynamically generate global.json with SDK version 8.0.100 and rollForward set to "latestFeature".
Reviewed Changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| test/global.json | Removed static global.json file from the test directory. |
| src/global.json | Removed static global.json file from the src directory. |
| .github/workflows/dynamo_bin_diff.yml | Added dynamic global.json creation steps in two build jobs. |
| .github/workflows/build_dynamo_core.yml | Added dynamic global.json creation to the build core workflow. |
| .github/workflows/build_dynamo_all.yml | Added dynamic global.json creation to the build all workflow. |
| } | ||
| } | ||
| "@ | ||
| $globalJson | Out-File -FilePath ${{ github.workspace }}\Dynamo\global.json -Encoding utf8 |
There was a problem hiding this comment.
did the dotnet command not work for some reason?
There was a problem hiding this comment.
It did, but I couldn't figure out how to add projects with dotnet add globalJson.
We could run dotnet add command twice (for src and test folders) or this.
| run: | | ||
| $globalJson = @" | ||
| { | ||
| "projects": ["src", "test"], |
There was a problem hiding this comment.
I do not see it mentioned in the docs https://learn.microsoft.com/en-us/dotnet/core/tools/global-json
There was a problem hiding this comment.
with projects array, global.json applies to all projects in the folders which avoids the need of adding it in different places.
|
I'm curious: Why do these actions suddenly need a |
We suddenly need it because the git actions build machines were updated with more dotnet sdk versions. Our builds are getting some of the dependencies confused (net8 tooling vs net9 tooling). This is why the global.json config was made https://learn.microsoft.com/en-us/dotnet/core/tools/global-json |
| run: | | ||
| dotnet restore ${{ github.workspace }}\master\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 -p:DotNet=net8.0 | ||
| run: dotnet restore ${{ github.workspace }}\master\src\Dynamo.All.sln /p:Configuration=Release --runtime=win-x64 -p:DotNet=net8.0 | ||
| - name: Build Dynamo with MSBuild |
There was a problem hiding this comment.
Why is the -p:DotNet=net8.0 not used in the previous dotnet restore in line 41?
There was a problem hiding this comment.
@pinzart90 Correct me if I am wrong, I think we can remove it here as well, net8.0 is the default
https://github.com/DynamoDS/Dynamo/blob/master/src/Config/CS_SDK.props#L9
There was a problem hiding this comment.
@avidit can you make that change, and then we can merge
Purpose
Remove .net global.json and create it dynamically for github build actions
Declarations
Check these if you believe they are true
*.resxfilesRelease Notes
N/A
Reviewers
@DynamoDS/dynamo
FYIs
(FILL ME IN, Optional) Names of anyone else you wish to be notified of