Skip to content

Commit 1fe7aea

Browse files
arttu-peltonenEvergreen
authored andcommitted
Remove asmref usage from SRP tests
Currently in Unity 6, asmref files are sometimes used to bypass assembly visibility rules. In the future, asmref is no longer allowed so the current usage must be removed (see [RFC](https://docs.google.com/document/d/1SWAG19Ns5gnmbVl4WD-HT0f4DO2UVdiRj_YhX1o7J7E/edit#heading=h.9tfgs0fpr1tb)). This PR solves the sub-task [Remove asmref usage in SRP tests](https://jira.unity3d.com/browse/XPIPELINE-919), part of the broader task [XPIPELINE-904](https://jira.unity3d.com/browse/XPIPELINE-904) to completely remove asmref usage from SRP code. SRP tests used asmrefs in 3 places: 1) **HDRP_RuntimeTests project** where the test `012-SVL_Check` contains script `SVLChecker.cs` which needs access to `GenerateShaderVariantList` inside the `com.unity.testframework.graphics` package. However since that type is public, there is no need to inject this script into that assembly. We simply add an asmdef file which contains a reference to the `UnityEngine.TestTools.Graphics` assembly. 2) **VisualEffectGraph_HDRP project** contains an editor-only `TemplateEditor.cs` script which used asmref to inject itself into `Unity.VisualEffectGraph.Editor` assembly. This is unnecessary that assembly is already accessible, we can just wrap the code in `#if UNITY_EDITOR` instead. 3) **UniversalGraphicsTest_2D project** contains an editor-only `AdditionalMenuItems.cs` script which used asmref to inject itself into `UnityEditor.TestTools.Graphics` assembly from `com.unity.testframework.graphics` package. This was also unnecessary, just wrapping the code in `#if UNITY_EDITOR` is enough. This PR is a follow-up to earlier PRs https://github.cds.internal.unity3d.com/unity/unity/pull/47596 and https://github.cds.internal.unity3d.com/unity/unity/pull/47609.
1 parent 7b8d780 commit 1fe7aea

File tree

9 files changed

+7
-37
lines changed

9 files changed

+7
-37
lines changed

Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/HDRPDefaultResources/HDRenderPipelineGlobalSettings.asset

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -147,12 +147,12 @@ MonoBehaviour:
147147
m_AfterPostProcessCustomPostProcesses:
148148
m_InjectionPoint: 2
149149
m_CustomPostProcessTypesAsString:
150-
- TvMonochrome, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
150+
- TvMonochrome, HDRP_RuntimeTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
151151
beforeTransparentCustomPostProcesses: []
152152
beforePostProcessCustomPostProcesses: []
153153
afterPostProcessBlursCustomPostProcesses: []
154154
afterPostProcessCustomPostProcesses:
155-
- TvMonochrome, Assembly-CSharp, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
155+
- TvMonochrome, HDRP_RuntimeTests, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null
156156
beforeTAACustomPostProcesses: []
157157
defaultRenderingLayerMask: 257
158158
renderingLayerNames:

Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/012-SVL_Check.unity

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,7 @@ MonoBehaviour:
383383
m_PersistentCalls:
384384
m_Calls:
385385
- m_Target: {fileID: 2144884655}
386-
m_TargetAssemblyTypeName: SVLChecker, UnityEngine.TestTools.Graphics
386+
m_TargetAssemblyTypeName: SVLChecker, HDRP_RuntimeTests
387387
m_MethodName: Check
388388
m_Mode: 1
389389
m_Arguments:

Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/012-SVL_Check/SVL Checker.asmref

Lines changed: 0 additions & 3 deletions
This file was deleted.

Tests/SRPTests/Projects/HDRP_RuntimeTests/Assets/Scenes/012-SVL_Check/SVL Checker.asmref.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,8 @@
1-
using System.Collections;
2-
using System.Collections.Generic;
3-
using UnityEngine;
4-
using UnityEditor;
1+
#if UNITY_EDITOR
52
using System.IO;
3+
using UnityEditor;
4+
using UnityEngine;
65
using UnityEngine.TestTools.Graphics;
7-
using UnityEditor.TestTools.Graphics;
8-
96

107
public class AdditionalMenuItems : MonoBehaviour
118
{
@@ -86,3 +83,4 @@ static void SelectImageDirectory()
8683
}
8784
}
8885
}
86+
#endif

Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Assets/CommonAssets/Scripts/AssemblyReference.asmref

Lines changed: 0 additions & 3 deletions
This file was deleted.

Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Assets/CommonAssets/Scripts/AssemblyReference.asmref.meta

Lines changed: 0 additions & 7 deletions
This file was deleted.

Tests/SRPTests/Projects/UniversalGraphicsTest_2D/Assets/CommonAssets/Scripts/Editor.meta

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)