public IEnumerator CorrectGuid() { CreateFolder($"{Application.dataPath}/Plugins"); CopyScriptToAssetsFolder(Application.dataPath, "SimpleCSharpScript.cs", k_EmptyCSharpScript); CopyScriptToAssetsFolder($"{Application.dataPath}/Plugins", "Plugin.cs", k_EmptyCSharpScript); yield return(new RecompileScripts(true)); m_ProjectGeneration.Sync(); var dir = Directory.GetParent(Application.dataPath).FullName; var scriptProjectFile = Path.Combine(dir, "Assembly-CSharp.csproj"); var scriptPluginProjectFile = Path.Combine(dir, "Assembly-CSharp-firstpass.csproj"); Assert.IsTrue(File.Exists(scriptProjectFile)); Assert.IsTrue(File.Exists(scriptPluginProjectFile)); XmlDocument scriptProject = XMLUtilities.FromFile(scriptProjectFile); XmlDocument scriptPluginProject = XMLUtilities.FromFile(scriptPluginProjectFile); var xmlNamespaces = new XmlNamespaceManager(scriptProject.NameTable); xmlNamespaces.AddNamespace("msb", "http://schemas.microsoft.com/developer/msbuild/2003"); Assert.AreEqual(scriptPluginProject.SelectSingleNode("/msb:Project/msb:PropertyGroup/msb:ProjectGuid", xmlNamespaces).InnerText, scriptProject.SelectSingleNode("/msb:Project/msb:ItemGroup/msb:ProjectReference/msb:Project", xmlNamespaces).InnerText); }
public IEnumerator IncludesScriptsInPlugins() { CreateFolder($"{Application.dataPath}/Test"); CreateFolder($"{Application.dataPath}/Test/Hello"); CopyScriptToAssetsFolder($"{Application.dataPath}/Test", "Test.asmdef", @"{ ""name"" : ""Test"" }"); CopyScriptToAssetsFolder($"{Application.dataPath}/Test", "Script.cs", " "); CopyScriptToAssetsFolder($"{Application.dataPath}/Test", "Doc.txt", " "); CopyScriptToAssetsFolder($"{Application.dataPath}/Test/Hello", "Hello.txt", " "); var dir = Directory.GetParent(Application.dataPath).FullName; m_CsProjPath = Path.Combine(dir, "Test.csproj"); yield return(new RecompileScripts(true)); m_ProjectGeneration.Sync(); var sourceFiles = new[] { "Test/Script.cs" }; var textFiles = new[] { "Test/Test.asmdef", "Test/Doc.txt", "Test/Hello/Hello.txt" }; var projectXml = XMLUtilities.FromFile(m_CsProjPath); XMLUtilities.AssertCompileItemsMatchExactly(projectXml, sourceFiles); XMLUtilities.AssertNonCompileItemsMatchExactly(projectXml, textFiles); }
public IEnumerator EditorPluginsReferencePlugin() { CreateFolder($"{Application.dataPath}/Plugins"); CreateFolder($"{Application.dataPath}/Plugins/Editor"); CopyScriptToAssetsFolder($"{Application.dataPath}/Plugins", "Plugin.cs", k_EmptyCSharpScript); CopyScriptToAssetsFolder($"{Application.dataPath}/Plugins/Editor", "EditorPlugin.cs", k_EmptyCSharpScript); var dir = Directory.GetParent(Application.dataPath).FullName; m_CsProjPath = Path.Combine(dir, "Assembly-CSharp-Editor-firstpass.csproj"); yield return(new RecompileScripts(true)); m_ProjectGeneration.Sync(); var projectReferences = new[] { "Assembly-CSharp-firstpass", "Unity.Rider.Editor", "AsmdefResponse" }; var expectedReferencesEditor = new[] { "System", "System.Xml", "System.Core", "UnityEngine", "UnityEditor", "UnityEditor.Graphs" }; var projectXml = XMLUtilities.FromFile(m_CsProjPath); XMLUtilities.AssertReferencesContainAll(projectXml, expectedReferencesEditor); XMLUtilities.AssertProjectReferencesMatchExactly(projectXml, projectReferences); }
public IEnumerator DoesNotIncludeNonCSharpFiles() { CopyScriptToAssetsFolder(Application.dataPath, "SimpleCSharpScript.cs", k_EmptyCSharpScript); CopyScriptToAssetsFolder(Application.dataPath, "ClassDiagram1.cd", " "); CopyScriptToAssetsFolder(Application.dataPath, "text.txt", " "); CopyScriptToAssetsFolder(Application.dataPath, "Test.shader", " "); var dir = Directory.GetParent(Application.dataPath).FullName; m_CsProjPath = Path.Combine(dir, "Assembly-CSharp.csproj"); yield return(new RecompileScripts(true)); m_ProjectGeneration.Sync(); var csProj = XMLUtilities.FromFile(m_CsProjPath); XMLUtilities.AssertCompileItemsMatchExactly(csProj, new [] { "SimpleCSharpScript.cs" }); XMLUtilities.AssertNonCompileItemsMatchExactly(csProj, new [] { "text.txt", "ClassDiagram1.cd", "Test.shader" }); }
public IEnumerator ReferencesPlugins() { CreateFolder($"{Application.dataPath}/Plugins"); CopyScriptToAssetsFolder(Application.dataPath, "SimpleCSharpScript.cs", k_EmptyCSharpScript); CopyScriptToAssetsFolder($"{Application.dataPath}/Plugins", "Plugin.cs", k_EmptyCSharpScript); var dir = Directory.GetParent(Application.dataPath).FullName; m_CsProjPath = Path.Combine(dir, "Assembly-CSharp.csproj"); yield return(new RecompileScripts(true)); m_ProjectGeneration.Sync(); var projectReferences = new[] { "Assembly-CSharp-firstpass", "Unity.Rider.Editor", "AsmdefResponse" }; var projectXml = XMLUtilities.FromFile(m_CsProjPath); XMLUtilities.AssertProjectReferencesMatchExactly(projectXml, projectReferences); }