/// <inheritdoc/> public ReturnCode Run() { if (!m_Parameters.WriteLinkXML) { return(ReturnCode.SuccessNotRun); } var linker = LinkXmlGenerator.CreateDefault(); foreach (var writeResult in m_Results.WriteResults) { linker.AddTypes(writeResult.Value.includedTypes); #if UNITY_2021_1_OR_NEWER linker.AddSerializedClass(writeResult.Value.includedSerializeReferenceFQN); #else if (writeResult.Value.GetType().GetProperty("includedSerializeReferenceFQN") != null) { linker.AddSerializedClass(writeResult.Value.GetType().GetProperty("includedSerializeReferenceFQN").GetValue(writeResult.Value) as System.Collections.Generic.IEnumerable <string>); } #endif } var linkPath = m_Parameters.GetOutputFilePathForIdentifier(k_LinkXml); linker.Save(linkPath); return(ReturnCode.Success); }
public void CreateDefault_DoesNotConvert_UnexpectedUnityEditorTypes() { var unexpectedType = typeof(UnityEditor.BuildPipeline); var link = LinkXmlGenerator.CreateDefault(); link.AddTypes(new[] { unexpectedType }); link.Save(k_LinkFile); var xml = ReadLinkXML(k_LinkFile, out int assemblyCount, out int typeCount); Assert.AreEqual(assemblyCount, 1); Assert.AreEqual(typeCount, 1); AssertTypePreserved(xml, unexpectedType); }
public ReturnCode Run() { if (!m_Parameters.WriteLinkXML) { return(ReturnCode.SuccessNotRun); } var linker = LinkXmlGenerator.CreateDefault(); foreach (var writeResult in m_Results.WriteResults) { linker.AddTypes(writeResult.Value.includedTypes); } var linkPath = m_Parameters.GetOutputFilePathForIdentifier(k_LinkXml); linker.Save(linkPath); return(ReturnCode.Success); }
public void CreateDefault_Converts_ExpectedUnityEditorTypes() { var types = LinkXmlGenerator.GetEditorTypeConversions(); var editorTypes = types.Select(x => x.Key).ToArray(); var runtimeTypes = types.Select(x => x.Value).ToArray(); var assemblies = runtimeTypes.Select(x => x.Assembly).Distinct().ToArray(); var link = LinkXmlGenerator.CreateDefault(); link.AddTypes(editorTypes); link.Save(k_LinkFile); var xml = ReadLinkXML(k_LinkFile, out int assemblyCount, out int typeCount); Assert.AreEqual(assemblyCount, assemblies.Length); Assert.AreEqual(typeCount, runtimeTypes.Length); foreach (var t in runtimeTypes) { AssertTypePreserved(xml, t); } }