-
Notifications
You must be signed in to change notification settings - Fork 1.4k
feat: Unity 2020.3 LTS support (C#8 + netstandard2.0 + 2021.2 API guards) #1323
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
Open
RoyougiShiki
wants to merge
10
commits into
CoplayDev:beta
Choose a base branch
from
RoyougiShiki:pr/compat-2020
base: beta
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
3848e79
compat: Unity 2020.3 LTS support (v10.1.2 baseline)
RoyougiShiki 3b8574c
test: add Unity 2020.3 compatibility test project
RoyougiShiki 3c690f0
fix(p0): replace deadlocking Client.List polling with packages-lock.j…
RoyougiShiki 3d0c375
Merge remote-tracking branch 'upstream/beta' into pr/compat-2020
RoyougiShiki b2279ba
chore: merge upstream beta (10.1.3-beta.4) into compat branch
RoyougiShiki 000fde5
chore: ignore compile_check.log
RoyougiShiki e940e90
fix: address CodeRabbit review findings
RoyougiShiki df74f8f
fix: second-round CodeRabbit findings
RoyougiShiki 775f15b
fix: quote if-exist operand in Unity path detection
RoyougiShiki 639279b
fix: verify_compile.cmd - exit-code doc, editor version warning, matr…
RoyougiShiki File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,70 @@ | ||
| using System.Diagnostics; | ||
|
|
||
| namespace MCPForUnity.Editor.Helpers | ||
| { | ||
| /// <summary> | ||
| /// Unity 2020.3 compatibility shim: ProcessStartInfo.ArgumentList was introduced in | ||
| /// .NET Core 2.1 / netstandard2.1. On Unity 2020.3 (netstandard2.0) we emulate it | ||
| /// with ProcessStartInfo.Arguments, quoting each argument. | ||
| /// </summary> | ||
| public static class ProcessArgumentListCompat | ||
| { | ||
| /// <summary>Append one argument (quoted if it contains whitespace) — replaces ArgumentList.Add.</summary> | ||
| public static ProcessStartInfo AddArg(this ProcessStartInfo psi, string arg) | ||
| { | ||
| if (string.IsNullOrEmpty(psi.Arguments)) | ||
| { | ||
| psi.Arguments = Quote(arg); | ||
| } | ||
| else | ||
| { | ||
| psi.Arguments += " " + Quote(arg); | ||
| } | ||
| return psi; | ||
| } | ||
|
|
||
| private static string Quote(string arg) | ||
| { | ||
| if (string.IsNullOrEmpty(arg)) | ||
| { | ||
| return "\"\""; | ||
| } | ||
|
|
||
| // Only quote when necessary; otherwise pass through verbatim so | ||
| // backslashes in paths (e.g. C:\Program Files\...) are preserved. | ||
| if (arg.IndexOfAny(new[] { ' ', '\t', '"' }) < 0) | ||
| { | ||
| return arg; | ||
| } | ||
|
|
||
| // Standard Windows command-line quoting (the algorithm used by | ||
| // .NET's ArgumentList / CommandLineToArgvW): wrap in quotes; for every | ||
| // run of backslashes, double them only when immediately followed by a | ||
| // quote or at the very end of the argument (before the closing quote). | ||
| var sb = new System.Text.StringBuilder(); | ||
| sb.Append('"'); | ||
| int backslashes = 0; | ||
| foreach (char ch in arg) | ||
| { | ||
| if (ch == '\\') | ||
| { | ||
| backslashes++; | ||
| continue; | ||
| } | ||
| if (ch == '"') | ||
| { | ||
| sb.Append('\\', backslashes * 2 + 1); | ||
| sb.Append('"'); | ||
| backslashes = 0; | ||
| continue; | ||
| } | ||
| sb.Append('\\', backslashes); | ||
| backslashes = 0; | ||
| sb.Append(ch); | ||
| } | ||
| sb.Append('\\', backslashes * 2); | ||
| sb.Append('"'); | ||
| return sb.ToString(); | ||
| } | ||
| } | ||
| } | ||
11 changes: 11 additions & 0 deletions
11
MCPForUnity/Editor/Helpers/ProcessArgumentListCompat.cs.meta
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.