You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-14 22:30:10 +00:00
com.unity.ide.visualstudio@2.0.5
## [2.0.5] - 2020-10-30 Integration: Disable legacy pdb symbol checking for Unity packages
This commit is contained in:
@@ -1,3 +1,8 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Unity Technologies.
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -7,181 +12,175 @@ using UnityEditor.PackageManager;
|
||||
|
||||
namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
public interface IAssemblyNameProvider
|
||||
{
|
||||
string[] ProjectSupportedExtensions { get; }
|
||||
string ProjectGenerationRootNamespace { get; }
|
||||
ProjectGenerationFlag ProjectGenerationFlag { get; }
|
||||
public interface IAssemblyNameProvider
|
||||
{
|
||||
string[] ProjectSupportedExtensions { get; }
|
||||
string ProjectGenerationRootNamespace { get; }
|
||||
ProjectGenerationFlag ProjectGenerationFlag { get; }
|
||||
|
||||
string GetAssemblyNameFromScriptPath(string path);
|
||||
string GetAssemblyNameFromScriptPath(string path);
|
||||
string GetAssemblyName(string assemblyOutputPath, string assemblyName);
|
||||
bool IsInternalizedPackagePath(string path);
|
||||
IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution);
|
||||
IEnumerable<string> GetAllAssetPaths();
|
||||
UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath);
|
||||
ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories);
|
||||
void ToggleProjectGeneration(ProjectGenerationFlag preference);
|
||||
}
|
||||
IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution);
|
||||
IEnumerable<string> GetAllAssetPaths();
|
||||
UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath);
|
||||
ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories);
|
||||
void ToggleProjectGeneration(ProjectGenerationFlag preference);
|
||||
}
|
||||
|
||||
public class AssemblyNameProvider : IAssemblyNameProvider
|
||||
{
|
||||
ProjectGenerationFlag m_ProjectGenerationFlag = (ProjectGenerationFlag)EditorPrefs.GetInt(
|
||||
"unity_project_generation_flag",
|
||||
(int)(ProjectGenerationFlag.Local | ProjectGenerationFlag.Embedded));
|
||||
public class AssemblyNameProvider : IAssemblyNameProvider
|
||||
{
|
||||
ProjectGenerationFlag m_ProjectGenerationFlag = (ProjectGenerationFlag)EditorPrefs.GetInt(
|
||||
"unity_project_generation_flag",
|
||||
(int)(ProjectGenerationFlag.Local | ProjectGenerationFlag.Embedded));
|
||||
|
||||
public string[] ProjectSupportedExtensions => EditorSettings.projectGenerationUserExtensions;
|
||||
public string[] ProjectSupportedExtensions => EditorSettings.projectGenerationUserExtensions;
|
||||
|
||||
public string ProjectGenerationRootNamespace => EditorSettings.projectGenerationRootNamespace;
|
||||
public string ProjectGenerationRootNamespace => EditorSettings.projectGenerationRootNamespace;
|
||||
|
||||
public ProjectGenerationFlag ProjectGenerationFlag
|
||||
{
|
||||
get => m_ProjectGenerationFlag;
|
||||
private set
|
||||
{
|
||||
EditorPrefs.SetInt("unity_project_generation_flag", (int)value);
|
||||
m_ProjectGenerationFlag = value;
|
||||
}
|
||||
}
|
||||
public ProjectGenerationFlag ProjectGenerationFlag
|
||||
{
|
||||
get => m_ProjectGenerationFlag;
|
||||
private set
|
||||
{
|
||||
EditorPrefs.SetInt("unity_project_generation_flag", (int)value);
|
||||
m_ProjectGenerationFlag = value;
|
||||
}
|
||||
}
|
||||
|
||||
public string GetAssemblyNameFromScriptPath(string path)
|
||||
{
|
||||
return CompilationPipeline.GetAssemblyNameFromScriptPath(path);
|
||||
}
|
||||
public string GetAssemblyNameFromScriptPath(string path)
|
||||
{
|
||||
return CompilationPipeline.GetAssemblyNameFromScriptPath(path);
|
||||
}
|
||||
|
||||
public IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution)
|
||||
{
|
||||
foreach (var assembly in CompilationPipeline.GetAssemblies())
|
||||
{
|
||||
if (assembly.sourceFiles.Any(shouldFileBePartOfSolution))
|
||||
{
|
||||
var options = new ScriptCompilerOptions()
|
||||
{
|
||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||
};
|
||||
public IEnumerable<Assembly> GetAssemblies(Func<string, bool> shouldFileBePartOfSolution)
|
||||
{
|
||||
foreach (var assembly in CompilationPipeline.GetAssemblies())
|
||||
{
|
||||
if (assembly.sourceFiles.Any(shouldFileBePartOfSolution))
|
||||
{
|
||||
var options = new ScriptCompilerOptions
|
||||
{
|
||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||
};
|
||||
|
||||
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\",
|
||||
assembly.sourceFiles, new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).Concat(EditorUserBuildSettings.activeScriptCompilationDefines).ToArray(),
|
||||
assembly.assemblyReferences,
|
||||
assembly.compiledAssemblyReferences,
|
||||
assembly.flags,
|
||||
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\",
|
||||
assembly.sourceFiles, new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).Concat(EditorUserBuildSettings.activeScriptCompilationDefines).ToArray(),
|
||||
assembly.assemblyReferences,
|
||||
assembly.compiledAssemblyReferences,
|
||||
assembly.flags,
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
options,
|
||||
assembly.rootNamespace);
|
||||
#else
|
||||
options);
|
||||
options);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.PlayerAssemblies))
|
||||
{
|
||||
foreach (var assembly in CompilationPipeline.GetAssemblies(AssembliesType.Player).Where(assembly => assembly.sourceFiles.Any(shouldFileBePartOfSolution)))
|
||||
{
|
||||
var options = new ScriptCompilerOptions()
|
||||
{
|
||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||
};
|
||||
if (ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.PlayerAssemblies))
|
||||
{
|
||||
foreach (var assembly in CompilationPipeline.GetAssemblies(AssembliesType.Player).Where(assembly => assembly.sourceFiles.Any(shouldFileBePartOfSolution)))
|
||||
{
|
||||
var options = new ScriptCompilerOptions
|
||||
{
|
||||
ResponseFiles = assembly.compilerOptions.ResponseFiles,
|
||||
AllowUnsafeCode = assembly.compilerOptions.AllowUnsafeCode,
|
||||
ApiCompatibilityLevel = assembly.compilerOptions.ApiCompatibilityLevel
|
||||
};
|
||||
|
||||
yield return new Assembly(assembly.name, @"Temp\Bin\Debug\Player\",
|
||||
assembly.sourceFiles,
|
||||
new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).ToArray(),
|
||||
assembly.assemblyReferences,
|
||||
assembly.compiledAssemblyReferences,
|
||||
assembly.flags,
|
||||
yield return
|
||||
new Assembly(assembly.name, @"Temp\Bin\Debug\Player\",
|
||||
assembly.sourceFiles,
|
||||
new[] { "DEBUG", "TRACE" }.Concat(assembly.defines).ToArray(),
|
||||
assembly.assemblyReferences,
|
||||
assembly.compiledAssemblyReferences,
|
||||
assembly.flags,
|
||||
#if UNITY_2020_2_OR_NEWER
|
||||
options,
|
||||
assembly.rootNamespace);
|
||||
options,
|
||||
assembly.rootNamespace);
|
||||
#else
|
||||
options);
|
||||
options);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string GetCompileOutputPath(string assemblyName)
|
||||
{
|
||||
if (assemblyName.EndsWith(".Player", StringComparison.Ordinal))
|
||||
{
|
||||
return @"Temp\Bin\Debug\Player\";
|
||||
}
|
||||
else
|
||||
{
|
||||
return @"Temp\Bin\Debug\";
|
||||
}
|
||||
}
|
||||
public string GetCompileOutputPath(string assemblyName)
|
||||
{
|
||||
return assemblyName.EndsWith(".Player", StringComparison.Ordinal) ? @"Temp\Bin\Debug\Player\" : @"Temp\Bin\Debug\";
|
||||
}
|
||||
|
||||
public IEnumerable<string> GetAllAssetPaths()
|
||||
{
|
||||
return AssetDatabase.GetAllAssetPaths();
|
||||
}
|
||||
public IEnumerable<string> GetAllAssetPaths()
|
||||
{
|
||||
return AssetDatabase.GetAllAssetPaths();
|
||||
}
|
||||
|
||||
public UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath)
|
||||
{
|
||||
return UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath);
|
||||
}
|
||||
public UnityEditor.PackageManager.PackageInfo FindForAssetPath(string assetPath)
|
||||
{
|
||||
return UnityEditor.PackageManager.PackageInfo.FindForAssetPath(assetPath);
|
||||
}
|
||||
|
||||
public bool IsInternalizedPackagePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path.Trim()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var packageInfo = FindForAssetPath(path);
|
||||
if (packageInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var packageSource = packageInfo.source;
|
||||
switch (packageSource)
|
||||
{
|
||||
case PackageSource.Embedded:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Embedded);
|
||||
case PackageSource.Registry:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Registry);
|
||||
case PackageSource.BuiltIn:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.BuiltIn);
|
||||
case PackageSource.Unknown:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Unknown);
|
||||
case PackageSource.Local:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Local);
|
||||
case PackageSource.Git:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Git);
|
||||
case PackageSource.LocalTarball:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.LocalTarBall);
|
||||
}
|
||||
public bool IsInternalizedPackagePath(string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path.Trim()))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var packageInfo = FindForAssetPath(path);
|
||||
if (packageInfo == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
var packageSource = packageInfo.source;
|
||||
switch (packageSource)
|
||||
{
|
||||
case PackageSource.Embedded:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Embedded);
|
||||
case PackageSource.Registry:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Registry);
|
||||
case PackageSource.BuiltIn:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.BuiltIn);
|
||||
case PackageSource.Unknown:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Unknown);
|
||||
case PackageSource.Local:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Local);
|
||||
case PackageSource.Git:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.Git);
|
||||
case PackageSource.LocalTarball:
|
||||
return !ProjectGenerationFlag.HasFlag(ProjectGenerationFlag.LocalTarBall);
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories)
|
||||
{
|
||||
return CompilationPipeline.ParseResponseFile(
|
||||
responseFilePath,
|
||||
projectDirectory,
|
||||
systemReferenceDirectories
|
||||
);
|
||||
}
|
||||
public ResponseFileData ParseResponseFile(string responseFilePath, string projectDirectory, string[] systemReferenceDirectories)
|
||||
{
|
||||
return CompilationPipeline.ParseResponseFile(
|
||||
responseFilePath,
|
||||
projectDirectory,
|
||||
systemReferenceDirectories
|
||||
);
|
||||
}
|
||||
|
||||
public void ToggleProjectGeneration(ProjectGenerationFlag preference)
|
||||
{
|
||||
if (ProjectGenerationFlag.HasFlag(preference))
|
||||
{
|
||||
ProjectGenerationFlag ^= preference;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectGenerationFlag |= preference;
|
||||
}
|
||||
}
|
||||
public void ToggleProjectGeneration(ProjectGenerationFlag preference)
|
||||
{
|
||||
if (ProjectGenerationFlag.HasFlag(preference))
|
||||
{
|
||||
ProjectGenerationFlag ^= preference;
|
||||
}
|
||||
else
|
||||
{
|
||||
ProjectGenerationFlag |= preference;
|
||||
}
|
||||
}
|
||||
|
||||
public void ResetProjectGenerationFlag()
|
||||
{
|
||||
ProjectGenerationFlag = ProjectGenerationFlag.None;
|
||||
}
|
||||
public void ResetProjectGenerationFlag()
|
||||
{
|
||||
ProjectGenerationFlag = ProjectGenerationFlag.None;
|
||||
}
|
||||
|
||||
public string GetAssemblyName(string assemblyOutputPath, string assemblyName)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user