com.wallstop-studios.dxmessaging 2.0.0-rc01 → 2.0.0-rc02
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll +0 -0
- package/Editor/Analyzers/Microsoft.CodeAnalysis.CSharp.dll.meta +33 -0
- package/{Analyzers → Editor/Analyzers}/WallstopStudios.DxMessaging.SourceGenerators.dll +0 -0
- package/{Analyzers → Editor/Analyzers}/WallstopStudios.DxMessaging.SourceGenerators.dll.meta +4 -2
- package/{Analyzers.meta → Editor/Analyzers.meta} +1 -1
- package/Editor/SetupCscRsp.cs +98 -19
- package/Editor/WallstopStudios.DxMessaging.Editor.asmdef +7 -10
- package/README.md +6 -6
- package/Runtime/WallstopStudios.DxMessaging.asmdef +1 -1
- package/Runtime/WallstopStudios.DxMessaging.asmdef.meta +7 -7
- package/SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators/WallstopStudios.DxMessaging.SourceGenerators.csproj +2 -2
- package/Tests/Runtime/WallstopStudios.DxMessaging.Tests.Runtime.asmdef +21 -21
- package/package.json +1 -1
- package/Analyzers/Microsoft.CodeAnalysis.pdb.meta +0 -7
- package/Analyzers/Microsoft.CodeAnalysis.xml +0 -38823
- package/Analyzers/Microsoft.CodeAnalysis.xml.meta +0 -7
- package/Analyzers/System.Reflection.Metadata.xml +0 -8202
- package/Analyzers/System.Reflection.Metadata.xml.meta +0 -7
- package/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.deps.json +0 -319
- package/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.deps.json.meta +0 -7
- package/Analyzers/WallstopStudios.DxMessaging.SourceGenerators.pdb.meta +0 -7
- /package/{Analyzers → Editor/Analyzers}/Microsoft.CodeAnalysis.dll +0 -0
- /package/{Analyzers → Editor/Analyzers}/Microsoft.CodeAnalysis.dll.meta +0 -0
- /package/{Analyzers → Editor/Analyzers}/System.Reflection.Metadata.dll +0 -0
- /package/{Analyzers → Editor/Analyzers}/System.Reflection.Metadata.dll.meta +0 -0
|
Binary file
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: f3159f12192b58547a5f8576eeca5fcf
|
|
3
|
+
PluginImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
serializedVersion: 2
|
|
6
|
+
iconMap: {}
|
|
7
|
+
executionOrder: {}
|
|
8
|
+
defineConstraints: []
|
|
9
|
+
isPreloaded: 0
|
|
10
|
+
isOverridable: 1
|
|
11
|
+
isExplicitlyReferenced: 0
|
|
12
|
+
validateReferences: 1
|
|
13
|
+
platformData:
|
|
14
|
+
- first:
|
|
15
|
+
Any:
|
|
16
|
+
second:
|
|
17
|
+
enabled: 0
|
|
18
|
+
settings: {}
|
|
19
|
+
- first:
|
|
20
|
+
Editor: Editor
|
|
21
|
+
second:
|
|
22
|
+
enabled: 1
|
|
23
|
+
settings:
|
|
24
|
+
DefaultValueInitialized: true
|
|
25
|
+
- first:
|
|
26
|
+
Windows Store Apps: WindowsStoreApps
|
|
27
|
+
second:
|
|
28
|
+
enabled: 0
|
|
29
|
+
settings:
|
|
30
|
+
CPU: AnyCPU
|
|
31
|
+
userData:
|
|
32
|
+
assetBundleName:
|
|
33
|
+
assetBundleVariant:
|
|
Binary file
|
package/{Analyzers → Editor/Analyzers}/WallstopStudios.DxMessaging.SourceGenerators.dll.meta
RENAMED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
fileFormatVersion: 2
|
|
2
2
|
guid: 6276058efb4d05248b64a4295f60baf6
|
|
3
|
+
labels:
|
|
4
|
+
- RoslynAnalyzer
|
|
3
5
|
PluginImporter:
|
|
4
6
|
externalObjects: {}
|
|
5
7
|
serializedVersion: 2
|
|
@@ -65,5 +67,5 @@ PluginImporter:
|
|
|
65
67
|
settings:
|
|
66
68
|
CPU: AnyCPU
|
|
67
69
|
userData:
|
|
68
|
-
assetBundleName:
|
|
69
|
-
assetBundleVariant:
|
|
70
|
+
assetBundleName:
|
|
71
|
+
assetBundleVariant:
|
package/Editor/SetupCscRsp.cs
CHANGED
|
@@ -2,9 +2,13 @@
|
|
|
2
2
|
|
|
3
3
|
namespace DxMessaging.Editor
|
|
4
4
|
{
|
|
5
|
+
using System;
|
|
6
|
+
using System.Collections.Generic;
|
|
5
7
|
using System.IO;
|
|
8
|
+
using System.Linq;
|
|
6
9
|
using UnityEditor;
|
|
7
10
|
using UnityEngine;
|
|
11
|
+
using Object = UnityEngine.Object;
|
|
8
12
|
|
|
9
13
|
[InitializeOnLoad]
|
|
10
14
|
public static class SetupCscRsp
|
|
@@ -13,49 +17,124 @@ namespace DxMessaging.Editor
|
|
|
13
17
|
Path.Combine(Application.dataPath, "..", "csc.rsp").Replace("\\", "/");
|
|
14
18
|
|
|
15
19
|
private static readonly string AnalyzerPathRelative =
|
|
16
|
-
"Packages/com.wallstop-studios.dxmessaging/Editor/
|
|
20
|
+
"Packages/com.wallstop-studios.dxmessaging/Editor/Analyzers/";
|
|
17
21
|
|
|
18
22
|
private static readonly string LibraryPathRelative =
|
|
19
|
-
"Library/PackageCache/com.wallstop-studios.dxmessaging/Editor/
|
|
23
|
+
"Library/PackageCache/com.wallstop-studios.dxmessaging/Editor/Analyzers/";
|
|
20
24
|
|
|
21
|
-
private static readonly string
|
|
25
|
+
private static readonly string SourceGeneratorDllName = "WallstopStudios.DxMessaging.SourceGenerators.dll";
|
|
26
|
+
|
|
27
|
+
private static readonly string[] RequiredDllNames =
|
|
28
|
+
{
|
|
29
|
+
SourceGeneratorDllName,
|
|
30
|
+
"Microsoft.CodeAnalysis.dll",
|
|
31
|
+
"Microsoft.CodeAnalysis.CSharp.dll",
|
|
32
|
+
"System.Reflection.Metadata.dll"
|
|
33
|
+
};
|
|
22
34
|
|
|
23
35
|
private static readonly string LibraryArgument = $"-a:\"{LibraryPathRelative}\"";
|
|
24
|
-
|
|
36
|
+
|
|
25
37
|
static SetupCscRsp()
|
|
26
38
|
{
|
|
27
39
|
EditorApplication.delayCall += EnsureCscRsp;
|
|
40
|
+
EditorApplication.delayCall += EnsureDLLsExistInAssets;
|
|
28
41
|
}
|
|
29
42
|
|
|
30
|
-
private static void
|
|
43
|
+
private static void EnsureDLLsExistInAssets()
|
|
31
44
|
{
|
|
32
|
-
|
|
45
|
+
HashSet<string> dllNames = new();
|
|
46
|
+
foreach (string dllGuid in AssetDatabase.FindAssets("t:DefaultAsset", new[] { "Assets" }))
|
|
33
47
|
{
|
|
34
|
-
|
|
48
|
+
string dllPath = AssetDatabase.GUIDToAssetPath(dllGuid);
|
|
49
|
+
if (!dllPath.EndsWith(".dll"))
|
|
35
50
|
{
|
|
36
|
-
|
|
37
|
-
AssetDatabase.ImportAsset("csc.rsp");
|
|
51
|
+
continue;
|
|
38
52
|
}
|
|
39
53
|
|
|
40
|
-
string
|
|
54
|
+
string dllName = Path.GetFileName(dllPath);
|
|
55
|
+
dllNames.Add(dllName);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
string[] dllRelativeDirectories = { LibraryPathRelative, AnalyzerPathRelative };
|
|
41
59
|
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
60
|
+
bool anyFound = false;
|
|
61
|
+
foreach (string requiredDllName in RequiredDllNames.Where(dllName => !dllNames.Contains(dllName)))
|
|
62
|
+
{
|
|
63
|
+
bool found = false;
|
|
64
|
+
foreach (string relativeDirectory in dllRelativeDirectories)
|
|
45
65
|
{
|
|
46
|
-
|
|
66
|
+
try
|
|
67
|
+
{
|
|
68
|
+
string sourceFile = $"{relativeDirectory}{requiredDllName}";
|
|
69
|
+
if (!File.Exists(sourceFile))
|
|
70
|
+
{
|
|
71
|
+
continue;
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const string pluginsDirectory = "Assets/Plugins/WallstopStudios.DxMessaging/";
|
|
75
|
+
string outputAsset = $"{pluginsDirectory}{requiredDllName}";
|
|
76
|
+
Directory.CreateDirectory(pluginsDirectory);
|
|
77
|
+
if (!File.Exists(outputAsset))
|
|
78
|
+
{
|
|
79
|
+
File.Copy($"{relativeDirectory}{requiredDllName}", outputAsset);
|
|
80
|
+
AssetDatabase.ImportAsset(outputAsset);
|
|
81
|
+
found = true;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
if (requiredDllName == SourceGeneratorDllName)
|
|
85
|
+
{
|
|
86
|
+
Object loadedDll = AssetDatabase.LoadMainAssetAtPath(outputAsset);
|
|
87
|
+
AssetDatabase.SetLabels(loadedDll, new[] { "RoslynAnalyzer" });
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
PluginImporter importer = AssetImporter.GetAtPath(outputAsset) as PluginImporter;
|
|
91
|
+
if (importer != null)
|
|
92
|
+
{
|
|
93
|
+
importer.SetCompatibleWithAnyPlatform(false);
|
|
94
|
+
importer.SetExcludeFromAnyPlatform("Editor", false);
|
|
95
|
+
importer.SetExcludeFromAnyPlatform("Standalone", false);
|
|
96
|
+
importer.SaveAndReimport();
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
break;
|
|
100
|
+
}
|
|
101
|
+
catch (Exception e)
|
|
47
102
|
{
|
|
48
|
-
|
|
49
|
-
File.AppendAllText(RspFilePath, $"{path}\n");
|
|
50
|
-
changed = true;
|
|
103
|
+
Debug.LogError($"Failed to copy {requiredDllName} to Assets, failed with {e}.");
|
|
51
104
|
}
|
|
52
105
|
}
|
|
53
106
|
|
|
54
|
-
|
|
107
|
+
anyFound |= found;
|
|
108
|
+
Debug.Log(
|
|
109
|
+
$"Missing required dll '{requiredDllName}', " +
|
|
110
|
+
$"{(found ? "creation successful." : "WARNING! Manual creation required.")}");
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
if (anyFound)
|
|
114
|
+
{
|
|
115
|
+
AssetDatabase.Refresh();
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
private static void EnsureCscRsp()
|
|
120
|
+
{
|
|
121
|
+
try
|
|
122
|
+
{
|
|
123
|
+
if (!File.Exists(RspFilePath))
|
|
55
124
|
{
|
|
125
|
+
File.WriteAllText(RspFilePath, string.Empty);
|
|
56
126
|
AssetDatabase.ImportAsset("csc.rsp");
|
|
57
|
-
Debug.Log("Updated csc.rsp.");
|
|
58
127
|
}
|
|
128
|
+
|
|
129
|
+
string rspContent = File.ReadAllText(RspFilePath);
|
|
130
|
+
if (rspContent.Contains(LibraryArgument))
|
|
131
|
+
{
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
File.AppendAllText(RspFilePath, $"{LibraryArgument}\n");
|
|
136
|
+
AssetDatabase.ImportAsset("csc.rsp");
|
|
137
|
+
Debug.Log("Updated csc.rsp.");
|
|
59
138
|
}
|
|
60
139
|
catch (IOException ex)
|
|
61
140
|
{
|
|
@@ -4,17 +4,14 @@
|
|
|
4
4
|
"references": [
|
|
5
5
|
"WallstopStudios.DxMessaging"
|
|
6
6
|
],
|
|
7
|
-
"includePlatforms": [
|
|
8
|
-
|
|
9
|
-
"allowUnsafeCode": true,
|
|
10
|
-
"overrideReferences": true,
|
|
11
|
-
"precompiledReferences": [
|
|
12
|
-
"Microsoft.CodeAnalysis.dll",
|
|
13
|
-
"System.Collections.Immutable.dll",
|
|
14
|
-
"System.Runtime.CompilerServices.Unsafe.dll",
|
|
15
|
-
"System.Reflection.Metadata.dll"
|
|
7
|
+
"includePlatforms": [
|
|
8
|
+
"Editor"
|
|
16
9
|
],
|
|
17
|
-
"
|
|
10
|
+
"excludePlatforms": [],
|
|
11
|
+
"allowUnsafeCode": false,
|
|
12
|
+
"overrideReferences": false,
|
|
13
|
+
"precompiledReferences": [],
|
|
14
|
+
"autoReferenced": true,
|
|
18
15
|
"defineConstraints": [],
|
|
19
16
|
"versionDefines": [],
|
|
20
17
|
"noEngineReferences": false
|
package/README.md
CHANGED
|
@@ -17,12 +17,12 @@ This project has a dependency on my [`Unity Helpers`](https://github.com/wallsto
|
|
|
17
17
|
DxMessaging is currently a bit slower (2-3x) than Unity's built in messaging solution (when running in Unity). [Source](./Tests/Runtime/Benchmarks/PerformanceTests.cs).
|
|
18
18
|
| Message Tech | Operations / Second |
|
|
19
19
|
| ------------ | ------------------- |
|
|
20
|
-
| Unity |
|
|
21
|
-
| DxMessaging (GameObject) - Normal |
|
|
22
|
-
| DxMessaging (Component) - Normal |
|
|
23
|
-
| DxMessaging (GameObject) - No-Copy |
|
|
24
|
-
| DxMessaging (Component) - No-Copy |
|
|
25
|
-
| DxMessaging (Untargeted) - No-Copy | 1,
|
|
20
|
+
| Unity | 2,101,721 |
|
|
21
|
+
| DxMessaging (GameObject) - Normal | 889,760 |
|
|
22
|
+
| DxMessaging (Component) - Normal | 869,437 |
|
|
23
|
+
| DxMessaging (GameObject) - No-Copy | 871,880 |
|
|
24
|
+
| DxMessaging (Component) - No-Copy | 899,361 |
|
|
25
|
+
| DxMessaging (Untargeted) - No-Copy | 1,239,673 |
|
|
26
26
|
|
|
27
27
|
# Functionality
|
|
28
28
|
While not as fast, DxMessaging offers *additional functionality* as compared to Unity's messaging solution.
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
fileFormatVersion: 2
|
|
2
|
-
guid: 184635fd03dde55408891bd932619c81
|
|
3
|
-
AssemblyDefinitionImporter:
|
|
4
|
-
externalObjects: {}
|
|
5
|
-
userData:
|
|
6
|
-
assetBundleName:
|
|
7
|
-
assetBundleVariant:
|
|
1
|
+
fileFormatVersion: 2
|
|
2
|
+
guid: 184635fd03dde55408891bd932619c81
|
|
3
|
+
AssemblyDefinitionImporter:
|
|
4
|
+
externalObjects: {}
|
|
5
|
+
userData:
|
|
6
|
+
assetBundleName:
|
|
7
|
+
assetBundleVariant:
|
|
@@ -6,11 +6,11 @@
|
|
|
6
6
|
</PropertyGroup>
|
|
7
7
|
|
|
8
8
|
<ItemGroup>
|
|
9
|
-
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.
|
|
9
|
+
<PackageReference Include="Microsoft.CodeAnalysis.Analyzers" Version="3.3.3">
|
|
10
10
|
<PrivateAssets>all</PrivateAssets>
|
|
11
11
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
|
12
12
|
</PackageReference>
|
|
13
|
-
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="
|
|
13
|
+
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="4.2.0">
|
|
14
14
|
<PrivateAssets>all</PrivateAssets>
|
|
15
15
|
</PackageReference>
|
|
16
16
|
<PackageReference Include="System.Collections.Immutable" Version="5.0.0">
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "WallstopStudios.DxMessaging.Tests.Runtime",
|
|
3
|
-
"rootNamespace": "DxMessaging.Tests",
|
|
4
|
-
"references": [
|
|
5
|
-
"UnityEngine.TestRunner",
|
|
6
|
-
"UnityEditor.TestRunner",
|
|
7
|
-
"WallstopStudios.DxMessaging"
|
|
8
|
-
],
|
|
9
|
-
"includePlatforms": [],
|
|
10
|
-
"excludePlatforms": [],
|
|
11
|
-
"allowUnsafeCode": false,
|
|
12
|
-
"overrideReferences": true,
|
|
13
|
-
"precompiledReferences": [
|
|
14
|
-
"nunit.framework.dll"
|
|
15
|
-
],
|
|
16
|
-
"autoReferenced":
|
|
17
|
-
"defineConstraints": [
|
|
18
|
-
"UNITY_INCLUDE_TESTS"
|
|
19
|
-
],
|
|
20
|
-
"versionDefines": [],
|
|
21
|
-
"noEngineReferences": false
|
|
1
|
+
{
|
|
2
|
+
"name": "WallstopStudios.DxMessaging.Tests.Runtime",
|
|
3
|
+
"rootNamespace": "DxMessaging.Tests",
|
|
4
|
+
"references": [
|
|
5
|
+
"UnityEngine.TestRunner",
|
|
6
|
+
"UnityEditor.TestRunner",
|
|
7
|
+
"WallstopStudios.DxMessaging"
|
|
8
|
+
],
|
|
9
|
+
"includePlatforms": [],
|
|
10
|
+
"excludePlatforms": [],
|
|
11
|
+
"allowUnsafeCode": false,
|
|
12
|
+
"overrideReferences": true,
|
|
13
|
+
"precompiledReferences": [
|
|
14
|
+
"nunit.framework.dll"
|
|
15
|
+
],
|
|
16
|
+
"autoReferenced": true,
|
|
17
|
+
"defineConstraints": [
|
|
18
|
+
"UNITY_INCLUDE_TESTS"
|
|
19
|
+
],
|
|
20
|
+
"versionDefines": [],
|
|
21
|
+
"noEngineReferences": false
|
|
22
22
|
}
|
package/package.json
CHANGED