Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ private class AsyncTask
internal Action<IAndroidLogcatTaskResult> integrateAction;
}

CustomSampler m_Sampler;
static readonly Unity.Profiling.ProfilerMarker s_AsyncWorkMarker = new Unity.Profiling.ProfilerMarker("AndroidLogcat Async Work");

private Queue<AsyncTask> m_AsyncTaskQueue = new Queue<AsyncTask>();
private Queue<IntegrationTask> m_IntegrateTaskQueue = new Queue<IntegrationTask>();
Expand Down Expand Up @@ -52,8 +52,6 @@ internal void Initialize()
m_Runtime.Update += IntegrateMainThread;
ThreadPool.QueueUserWorkItem(WorkerThread);

m_Sampler = CustomSampler.Create("AndroidLogcat Async Work");

s_MainThread = Thread.CurrentThread;
}

Expand Down Expand Up @@ -115,9 +113,9 @@ private void WorkerThread(object o)

try
{
m_Sampler.Begin();
s_AsyncWorkMarker.Begin();
var result = task.asyncAction.Invoke(task.taskData);
m_Sampler.End();
s_AsyncWorkMarker.End();

if (task.integrateAction != null)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using NUnit.Framework;
using UnityEditor;
using UnityEditor.Compilation;
using Assembly = System.Reflection.Assembly;
using Unity.Android.Logcat;

class AndroidLogcatNetTests
{
Expand All @@ -32,14 +32,14 @@ private UnityEditor.Compilation.Assembly GetLogcatAssembly()
[Test]
public void ValidateAssemblyReferences()
{
var logcatAssembly = GetLogcatAssembly();

var expectedReferences = new List<string>(new[]
{
"mscorlib",
"System",
"System.Xml.Linq",
"UnityEngine.IMGUIModule",
"UnityEngine.ScriptingModule",
"UnityEngine.UICommonModule",
"UnityEngine.CoreModule",
"UnityEngine.VideoModule",
"UnityEngine.TextRenderingModule",
Expand All @@ -48,11 +48,14 @@ public void ValidateAssemblyReferences()
"UnityEngine.ImageConversionModule",
"UnityEngine.JSONSerializeModule",
"UnityEditor.CoreModule",
"Unity.Scripting",
"UnityEngine.TypeRegistryModule",
Comment on lines +51 to +52

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1

ValidateAssemblyReferences now fails on supported older Editors, including the Unity 2021.3 validation job. Those Editors do not reference the newly introduced assemblies, such as Unity.Scripting and UnityEngine.TypeRegistryModule. Adding these names to expectedReferences makes them mandatory because the final assertion requires every reference count to equal one. The test assembly has no Editor-version constraint, so older CI jobs still execute this check. Select the expected references by Editor version while retaining the loaded-assembly inspection.

🤖 Helpful? 👍/👎

});

var referencedCount = expectedReferences.ToDictionary(s => s, s => 0);

var references = Assembly.ReflectionOnlyLoadFrom(logcatAssembly.outputPath).GetReferencedAssemblies().Select(a => a.Name);
// ReflectionOnlyLoadFrom is unsupported on CoreCLR; inspect the loaded assembly instead.
var references = typeof(AndroidLogcatConsoleWindow).Assembly.GetReferencedAssemblies().Select(a => a.Name);
foreach (var r in references)
{
Assert.Contains(r, expectedReferences, $"Unexpected reference '{r}'");
Expand Down