Skip to content

Commit 7adfbda

Browse files
authored
Editor plugin net46 (#1367)
* EditorPlugin build to net461 specifically for Unity 2019.2+ with Rider package. * fix compile * log EditorPlugin name * restore coping full editor_plugin * fix sln * update 2nd sln file
1 parent 6ea5a93 commit 7adfbda

File tree

6 files changed

+72
-9
lines changed

6 files changed

+72
-9
lines changed

resharper/resharper-unity.sln

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "tests.rider-yaml", "resharp
4141
EndProject
4242
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorPlugin.5.5.0f3", "..\unity\EditorPlugin\EditorPlugin.5.5.0f3.csproj", "{8970E10C-ADA7-4041-9A98-59AFABF3ED98}"
4343
EndProject
44+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorPluginNet46", "..\unity\EditorPlugin\EditorPluginNet46.csproj", "{97575D5A-587A-4E67-ABAE-646A623F338E}"
45+
EndProject
4446
Global
4547
GlobalSection(SolutionConfigurationPlatforms) = preSolution
4648
Debug|Any CPU = Debug|Any CPU
@@ -103,6 +105,10 @@ Global
103105
{8970E10C-ADA7-4041-9A98-59AFABF3ED98}.Debug|Any CPU.Build.0 = Debug|Any CPU
104106
{8970E10C-ADA7-4041-9A98-59AFABF3ED98}.Release|Any CPU.ActiveCfg = Release|Any CPU
105107
{8970E10C-ADA7-4041-9A98-59AFABF3ED98}.Release|Any CPU.Build.0 = Release|Any CPU
108+
{97575D5A-587A-4E67-ABAE-646A623F338E}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
109+
{97575D5A-587A-4E67-ABAE-646A623F338E}.Debug|Any CPU.Build.0 = Debug|Any CPU
110+
{97575D5A-587A-4E67-ABAE-646A623F338E}.Release|Any CPU.ActiveCfg = Release|Any CPU
111+
{97575D5A-587A-4E67-ABAE-646A623F338E}.Release|Any CPU.Build.0 = Release|Any CPU
106112
EndGlobalSection
107113
GlobalSection(SolutionProperties) = preSolution
108114
HideSolutionNode = FALSE
@@ -122,5 +128,6 @@ Global
122128
{653E0090-709A-4DB5-A35A-CE1F954E8362} = {9C7433E8-E8C8-4EAA-ADBC-A0B635734CF1}
123129
{AEF66645-4022-4032-A6D9-D770BC034E55} = {5B475CDF-F046-4823-A994-BD5261058461}
124130
{8970E10C-ADA7-4041-9A98-59AFABF3ED98} = {27FAB5DF-2272-44E7-9BCE-41508F24C07B}
131+
{97575D5A-587A-4E67-ABAE-646A623F338E} = {27FAB5DF-2272-44E7-9BCE-41508F24C07B}
125132
EndGlobalSection
126133
EndGlobal

rider/frontend.gradle

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ def annotationsTo = 'Extensions/com.intellij.resharper.unity/annotations'
7878

7979
def unityeditorplugin_path = "$projectDir/../unity/build/JetBrains.Rider.Unity.Editor.Plugin/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Repacked.dll"
8080
def unityeditorplugin_full_path = "$projectDir/../unity/build/JetBrains.Rider.Unity.Editor.Plugin.Full/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Full.Repacked.dll"
81+
def unityeditorplugin_net46_path = "$projectDir/../unity/build/JetBrains.Rider.Unity.Editor.Plugin.Net46/Assets/Plugins/Editor/JetBrains/JetBrains.Rider.Unity.Editor.Plugin.Net46.Repacked.dll"
8182

8283
tasks.withType(PrepareSandboxTask).configureEach {
8384
// Default dependsOn includes the standard Java build/jar task
@@ -105,6 +106,7 @@ tasks.withType(PrepareSandboxTask).configureEach {
105106
doLast {
106107
assert file(unityeditorplugin_path).exists()
107108
assert file(unityeditorplugin_full_path).exists()
109+
assert file(unityeditorplugin_net46_path).exists()
108110

109111
dllFiles.forEach({ f ->
110112
def file = file("$f")
@@ -125,6 +127,10 @@ tasks.withType(PrepareSandboxTask).configureEach {
125127
into "$intellij.pluginName/EditorPlugin"
126128
})
127129

130+
from(unityeditorplugin_net46_path, {
131+
into "$intellij.pluginName/EditorPlugin"
132+
})
133+
128134
dllFiles.forEach({ f ->
129135
def file = file(f)
130136
from(file, { into "$intellij.pluginName/dotnet" })
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
<PropertyGroup>
3+
<TargetFramework>net461</TargetFramework>
4+
<AssemblyName>JetBrains.Rider.Unity.Editor.Plugin.Net46</AssemblyName>
5+
<RootNamespace>JetBrains.Rider.Unity.Editor</RootNamespace>
6+
<DebugType>portable</DebugType>
7+
<DebugSymbols>true</DebugSymbols>
8+
<DefineConstants>UNITY_2017_3;RIDER_EDITOR_PLUGIN</DefineConstants>
9+
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
10+
<AssemblyOriginatorKeyFile>..\..\sign.snk</AssemblyOriginatorKeyFile>
11+
</PropertyGroup>
12+
<ItemGroup>
13+
<PackageReference Include="JetBrains.RdFramework" Version="1.0.0-preview3-14" />
14+
<PackageReference Include="JetBrains.Unity.Libs.2017.3.0f3" Version="2018.3.5" />
15+
<PackageReference Include="ILRepack.Lib.MSBuild.Task" Version="2.0.15.3" />
16+
</ItemGroup>
17+
<ItemGroup>
18+
<Compile Remove="AssetPostprocessors\CsprojAssetPostprocessor.cs" />
19+
<Compile Remove="AssetPostprocessors\PdbAssetPostprocessor.cs" />
20+
<Compile Remove="AssetPostprocessors\SlnAssetPostprocessor.cs" />
21+
<Compile Remove="RiderMenu.cs" />
22+
</ItemGroup>
23+
<!-- The ILRepack.targets file is automatically imported if it exists
24+
AND we are in Release. But we require it for Debug builds, too,
25+
as it's a required artifact for the backend plugin -->
26+
<PropertyGroup>
27+
<ILRepackTargetsFile>$(MSBuildThisFileDirectory)ILRepackNet46.targets</ILRepackTargetsFile>
28+
</PropertyGroup>
29+
<Import Project="$(ILRepackTargetsFile)" Condition="'$(Configuration)' != 'Release'" />
30+
</Project>
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<Project>
2+
<ItemGroup>
3+
<ILRepackInputAssemblies Include="$(OutputPath)$(AssemblyName).dll" />
4+
<ILRepackInputAssemblies Include="$(OutputPath)JetBrains.Lifetimes.dll" />
5+
<ILRepackInputAssemblies Include="$(OutputPath)JetBrains.RdFramework.dll" />
6+
</ItemGroup>
7+
<PropertyGroup>
8+
<ILRepackOutputAssembly>../build/$(AssemblyName)/Assets/Plugins/Editor/JetBrains/$(AssemblyName).Repacked.dll</ILRepackOutputAssembly>
9+
</PropertyGroup>
10+
<Target Name="RiderILRepack" AfterTargets="Build" Inputs="@(ILRepackInputAssemblies)" Outputs="$(ILRepackOutputAssembly)">
11+
<ItemGroup>
12+
<SearchDirectories Include="$(OutputPath)" />
13+
</ItemGroup>
14+
<ILRepack Parallel="true" Internalize="true" DebugInfo="true" InputAssemblies="@(ILRepackInputAssemblies)" LibraryPath="@(SearchDirectories)" OutputFile="$(ILRepackOutputAssembly)" />
15+
</Target>
16+
</Project>

unity/EditorPlugin/PluginEntryPoint.cs

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,10 @@ public static class PluginEntryPoint
3030
private static readonly RiderPathProvider ourRiderPathProvider;
3131
public static readonly List<ModelWithLifetime> UnityModels = new List<ModelWithLifetime>();
3232
private static readonly UnityEventCollector ourLogEventCollector;
33-
33+
private static bool ourInitialized;
34+
private static readonly ILog ourLogger = Log.GetLog("RiderPlugin");
35+
internal static string SlnFile;
36+
3437
// This an entry point
3538
static PluginEntryPoint()
3639
{
@@ -96,12 +99,6 @@ public static bool CallRider(string args)
9699
return OpenAssetHandler.CallRider(args);
97100
}
98101

99-
private static bool ourInitialized;
100-
101-
private static readonly ILog ourLogger = Log.GetLog("RiderPlugin");
102-
103-
internal static string SlnFile;
104-
105102
public static bool IsRiderDefaultEditor()
106103
{
107104
// When Unity is started by Rider tests
@@ -140,8 +137,9 @@ public static void Init()
140137

141138
if (PluginSettings.SelectedLoggingLevel >= LoggingLevel.VERBOSE)
142139
{
143-
var location = Assembly.GetExecutingAssembly().Location;
144-
Debug.Log($"Rider plugin initialized{(string.IsNullOrEmpty(location)? "" : " from: " + location )}. LoggingLevel: {PluginSettings.SelectedLoggingLevel}. Change it in Unity Preferences -> Rider. Logs path: {LogPath}.");
140+
var executingAssembly = Assembly.GetExecutingAssembly();
141+
var location = executingAssembly.Location;
142+
Debug.Log($"Rider plugin \"{executingAssembly.GetName().Name}\" initialized{(string.IsNullOrEmpty(location)? "" : " from: " + location )}. LoggingLevel: {PluginSettings.SelectedLoggingLevel}. Change it in Unity Preferences -> Rider. Logs path: {LogPath}.");
145143
}
146144

147145
var list = new List<ProtocolInstance>();

unity/JetBrains.Rider.Unity.Editor.sln

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorPlugin.5.5.0f3", "Edi
88
EndProject
99
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorPluginFull", "EditorPlugin\EditorPluginFull.csproj", "{C882D995-40E6-48C6-AEA6-E7E74F5CD385}"
1010
EndProject
11+
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "EditorPluginNet46", "EditorPlugin\EditorPluginNet46.csproj", "{053B1D9F-87D0-4E73-9063-0239413B0C07}"
12+
EndProject
1113
Global
1214
GlobalSection(SolutionConfigurationPlatforms) = preSolution
1315
Debug|Any CPU = Debug|Any CPU
@@ -30,5 +32,9 @@ Global
3032
{C882D995-40E6-48C6-AEA6-E7E74F5CD385}.Debug|Any CPU.Build.0 = Debug|Any CPU
3133
{C882D995-40E6-48C6-AEA6-E7E74F5CD385}.Release|Any CPU.ActiveCfg = Release|Any CPU
3234
{C882D995-40E6-48C6-AEA6-E7E74F5CD385}.Release|Any CPU.Build.0 = Release|Any CPU
35+
{053B1D9F-87D0-4E73-9063-0239413B0C07}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
36+
{053B1D9F-87D0-4E73-9063-0239413B0C07}.Debug|Any CPU.Build.0 = Debug|Any CPU
37+
{053B1D9F-87D0-4E73-9063-0239413B0C07}.Release|Any CPU.ActiveCfg = Release|Any CPU
38+
{053B1D9F-87D0-4E73-9063-0239413B0C07}.Release|Any CPU.Build.0 = Release|Any CPU
3339
EndGlobalSection
3440
EndGlobal

0 commit comments

Comments
 (0)