You've already forked com.unity.ide.cursor
mirror of
https://github.com/boxqkrtm/com.unity.ide.cursor.git
synced 2026-05-16 15:30:08 +00:00
com.unity.ide.visualstudio@2.0.14
## [2.0.14] - 2022-01-14 Integration: - Remove package version checking. ## [2.0.13] - 2022-01-12 Integration: - Fixed wrong path to analyzers in generated projects when using external packages. - Fixed selective project generation not creating Analyzer/LangVersion nodes. - Fixed asmdef references with Player projects. Documentation: - Added new documentation including ToC, overview, how to use and images.
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
cmake_minimum_required(VERSION 3.13)
|
||||
cmake_minimum_required(VERSION 3.15)
|
||||
|
||||
project(com)
|
||||
set(SOURCES
|
||||
@@ -10,4 +10,5 @@ set(SOURCES
|
||||
set(CMAKE_CXX_STANDARD 17)
|
||||
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -O3 -Wall")
|
||||
add_executable(COMIntegration ${SOURCES})
|
||||
set_property(TARGET COMIntegration PROPERTY MSVC_RUNTIME_LIBRARY "MultiThreaded")
|
||||
target_link_libraries(COMIntegration Shlwapi.lib)
|
||||
|
||||
Binary file not shown.
@@ -56,10 +56,10 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return relative == Path.GetFileName(relative);
|
||||
}
|
||||
|
||||
public static string MakeAbsolutePath(this string path, string projectDirectory)
|
||||
public static string MakeAbsolutePath(this string path)
|
||||
{
|
||||
if (string.IsNullOrEmpty(path)) { return string.Empty; }
|
||||
return Path.IsPathRooted(path) ? path : Path.Combine(projectDirectory, path);
|
||||
return Path.IsPathRooted(path) ? path : Path.GetFullPath(path);
|
||||
}
|
||||
|
||||
// returns null if outside of the project scope
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>BuildMachineOSBuild</key>
|
||||
<string>19H1217</string>
|
||||
<string>19G2021</string>
|
||||
<key>CFBundleDevelopmentRegion</key>
|
||||
<string>en</string>
|
||||
<key>CFBundleExecutable</key>
|
||||
@@ -27,19 +27,19 @@
|
||||
<key>DTCompiler</key>
|
||||
<string>com.apple.compilers.llvm.clang.1_0</string>
|
||||
<key>DTPlatformBuild</key>
|
||||
<string>12D4e</string>
|
||||
<string>12B45b</string>
|
||||
<key>DTPlatformName</key>
|
||||
<string>macosx</string>
|
||||
<key>DTPlatformVersion</key>
|
||||
<string>11.1</string>
|
||||
<string>11.0</string>
|
||||
<key>DTSDKBuild</key>
|
||||
<string>20C63</string>
|
||||
<string>20A2408</string>
|
||||
<key>DTSDKName</key>
|
||||
<string>macosx11.1</string>
|
||||
<string>macosx11.0</string>
|
||||
<key>DTXcode</key>
|
||||
<string>1240</string>
|
||||
<string>1220</string>
|
||||
<key>DTXcodeBuild</key>
|
||||
<string>12D4e</string>
|
||||
<string>12B45b</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
<string>10.13</string>
|
||||
<key>NSHumanReadableCopyright</key>
|
||||
|
||||
Binary file not shown.
@@ -100,6 +100,9 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
using (solutionSyncMarker.Auto())
|
||||
{
|
||||
// We need the exact VS version/capabilities to tweak project generation (analyzers/langversion)
|
||||
RefreshCurrentInstallation();
|
||||
|
||||
SetupProjectSupportedExtensions();
|
||||
|
||||
// See https://devblogs.microsoft.com/setup/configure-visual-studio-across-your-organization-with-vsconfig/
|
||||
@@ -527,9 +530,12 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
projectBuilder.Append(" <ItemGroup>").Append(k_WindowsNewline);
|
||||
foreach (var reference in assembly.assemblyReferences.Where(i => i.sourceFiles.Any(ShouldFileBePartOfSolution)))
|
||||
{
|
||||
projectBuilder.Append(" <ProjectReference Include=\"").Append(reference.name).Append(GetProjectExtension()).Append("\">").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Project>{").Append(ProjectGuid(reference)).Append("}</Project>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Name>").Append(reference.name).Append("</Name>").Append(k_WindowsNewline);
|
||||
// If the current assembly is a Player project, we want to project-reference the corresponding Player project
|
||||
var referenceName = m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, reference.name);
|
||||
|
||||
projectBuilder.Append(" <ProjectReference Include=\"").Append(referenceName).Append(GetProjectExtension()).Append("\">").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Project>{").Append(ProjectGuid(referenceName)).Append("}</Project>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" <Name>").Append(referenceName).Append("</Name>").Append(k_WindowsNewline);
|
||||
projectBuilder.Append(" </ProjectReference>").Append(k_WindowsNewline);
|
||||
}
|
||||
|
||||
@@ -741,16 +747,16 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
if (!string.IsNullOrEmpty(properties.RulesetPath))
|
||||
{
|
||||
lines.Add(@" <PropertyGroup>");
|
||||
lines.Add($" <CodeAnalysisRuleSet>{properties.RulesetPath.MakeAbsolutePath(ProjectDirectory).NormalizePathSeparators()}</CodeAnalysisRuleSet>");
|
||||
lines.Add($" <CodeAnalysisRuleSet>{properties.RulesetPath.MakeAbsolutePath().NormalizePathSeparators()}</CodeAnalysisRuleSet>");
|
||||
lines.Add(@" </PropertyGroup>");
|
||||
}
|
||||
|
||||
if (properties.Analyzers.Any())
|
||||
{
|
||||
lines.Add(@" <ItemGroup>");
|
||||
foreach (var analyzer in properties.Analyzers)
|
||||
foreach (var analyzer in properties.Analyzers.Distinct())
|
||||
{
|
||||
lines.Add($@" <Analyzer Include=""{analyzer.MakeAbsolutePath(ProjectDirectory).NormalizePathSeparators()}"" />");
|
||||
lines.Add($@" <Analyzer Include=""{analyzer.MakeAbsolutePath().NormalizePathSeparators()}"" />");
|
||||
}
|
||||
lines.Add(@" </ItemGroup>");
|
||||
}
|
||||
@@ -948,11 +954,14 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
return ".csproj";
|
||||
}
|
||||
|
||||
private string ProjectGuid(string assemblyName)
|
||||
{
|
||||
return m_GUIDGenerator.ProjectGuid(m_ProjectName, assemblyName);
|
||||
}
|
||||
|
||||
private string ProjectGuid(Assembly assembly)
|
||||
{
|
||||
return m_GUIDGenerator.ProjectGuid(
|
||||
m_ProjectName,
|
||||
m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, assembly.name));
|
||||
return ProjectGuid(m_AssemblyNameProvider.GetAssemblyName(assembly.outputPath, assembly.name));
|
||||
}
|
||||
|
||||
private string SolutionGuid(Assembly assembly)
|
||||
|
||||
@@ -1,31 +0,0 @@
|
||||
/*---------------------------------------------------------------------------------------------
|
||||
* Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
* Licensed under the MIT License. See License.txt in the project root for license information.
|
||||
*--------------------------------------------------------------------------------------------*/
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Microsoft.Unity.VisualStudio.Editor
|
||||
{
|
||||
internal static class SessionSettings
|
||||
{
|
||||
internal static string GetKey([CallerMemberName] string memberName = "")
|
||||
{
|
||||
return $"{typeof(SessionSettings).FullName}.{memberName}";
|
||||
}
|
||||
|
||||
public static bool PackageVersionChecked
|
||||
{
|
||||
get
|
||||
{
|
||||
return SessionState.GetBool(GetKey(), false);
|
||||
}
|
||||
set
|
||||
{
|
||||
SessionState.SetBool(GetKey(), value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +0,0 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4d1e1d921eed0044e9fe0cd3ab6444ba
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -11,8 +11,6 @@ using System.Net.Sockets;
|
||||
using Microsoft.Unity.VisualStudio.Editor.Messaging;
|
||||
using Microsoft.Unity.VisualStudio.Editor.Testing;
|
||||
using UnityEditor;
|
||||
using UnityEditor.PackageManager;
|
||||
using UnityEditor.PackageManager.Requests;
|
||||
using UnityEngine;
|
||||
using MessageType = Microsoft.Unity.VisualStudio.Editor.Messaging.MessageType;
|
||||
|
||||
@@ -34,16 +32,11 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
private static readonly object _incomingLock = new object();
|
||||
private static readonly object _clientsLock = new object();
|
||||
|
||||
private static ListRequest _listRequest;
|
||||
|
||||
static VisualStudioIntegration()
|
||||
{
|
||||
if (!VisualStudioEditor.IsEnabled)
|
||||
return;
|
||||
|
||||
if (!SessionSettings.PackageVersionChecked)
|
||||
_listRequest = UnityEditor.PackageManager.Client.List();
|
||||
|
||||
RunOnceOnUpdate(() =>
|
||||
{
|
||||
// Despite using ReuseAddress|!ExclusiveAddressUse, we can fail here:
|
||||
@@ -134,35 +127,8 @@ namespace Microsoft.Unity.VisualStudio.Editor
|
||||
OnMessage(args.Message);
|
||||
}
|
||||
|
||||
private static void HandleListRequestCompletion()
|
||||
{
|
||||
const string packageName = "com.unity.ide.visualstudio";
|
||||
|
||||
if (_listRequest.Status == StatusCode.Success)
|
||||
{
|
||||
var package = _listRequest.Result.FirstOrDefault(p => p.name == packageName);
|
||||
|
||||
if (package != null
|
||||
&& Version.TryParse(package.version, out var packageVersion)
|
||||
&& Version.TryParse(package.versions.latest, out var latestVersion)
|
||||
&& packageVersion < latestVersion)
|
||||
{
|
||||
Debug.LogWarning($"Visual Studio Editor Package version {package.versions.latest} is available, we strongly encourage you to update from the Unity Package Manager for a better Visual Studio integration");
|
||||
}
|
||||
|
||||
SessionSettings.PackageVersionChecked = true;
|
||||
}
|
||||
|
||||
_listRequest = null;
|
||||
}
|
||||
|
||||
private static void OnUpdate()
|
||||
{
|
||||
if (_listRequest != null && _listRequest.IsCompleted)
|
||||
{
|
||||
HandleListRequestCompletion();
|
||||
}
|
||||
|
||||
lock (_incomingLock)
|
||||
{
|
||||
while (_incoming.Count > 0)
|
||||
|
||||
Reference in New Issue
Block a user