void DrawStaticLibraryEntry(StaticLibraryEntry entry, float labelWidth, float indentWidth, bool isChild = false) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(indentWidth); var label = new GUIContent(entry.FileName, entry.Path); EditorGUILayout.LabelField(label, GUILayout.Width(labelWidth)); if (FileAndFolderEntryFactory.Exists(entry.Path)) { GUILayout.Space(SQUARE_BUTTON_SPACE_WIDTH); } else { Style.WarningIcon("File is missing"); } if (isChild) { GUILayout.Space(ENUM_POPUP_WIDTH); } else { EditorGUILayout.LabelField(entry.Add.ToString(), GUILayout.Width(ENUM_POPUP_WIDTH)); } EditorGUILayout.LabelField(entry.Link.ToString(), GUILayout.Width(ENUM_POPUP_WIDTH)); EditorGUILayout.EndHorizontal(); GUILayout.Space(2); }
public void AddResourceFile() { var pbx = LoadCopyOfOriginal(); var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.pdf"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is FileEntry); pbx.AddFileOrFolder(fileEntry); pbx.Save(); CompareFiles("AddResourceFile.pbxproj", pbx.SavePath); }
public void AddCustomStaticLibraryEntry() { var pbx = LoadCopyOfOriginal(); var path = Path.Combine(Application.dataPath, "Sample Data/Frameworks/test.a"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is StaticLibraryEntry); (fileEntry as StaticLibraryEntry).Link = LinkType.Optional; pbx.AddFileOrFolder(fileEntry); pbx.Save(); CompareFiles("AddCustomStaticLibrary.pbxproj", pbx.SavePath); }
public void AddCustomFrameworkEntry() { var rootPath = Path.Combine(Application.dataPath, "Sample Data/Frameworks"); var fwPath = Path.Combine(rootPath, "MyTest.framework"); var pbx = LoadCopyOfOriginal(); var fileEntry = FileAndFolderEntryFactory.Create(fwPath, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is FrameworkEntry); pbx.AddFileOrFolder(fileEntry); pbx.Save(); CompareFiles("AddCustomFramework.pbxproj", pbx.SavePath); }
void DrawFrameworkEntry(FrameworkEntry entry, float labelWidth, float indentWidth, bool isChild = false) { EditorGUILayout.BeginHorizontal(); GUILayout.Space(indentWidth); var label = new GUIContent(entry.FileName, entry.Path); EditorGUILayout.LabelField(label, GUILayout.Width(labelWidth)); if (FileAndFolderEntryFactory.Exists(entry.Path)) { GUILayout.Space(SQUARE_BUTTON_SPACE_WIDTH); } else { Style.WarningIcon("File is missing"); } if (isChild) { GUILayout.Space(ENUM_POPUP_WIDTH); } else { var add = entry.Embedded ? AddMethod.Copy : entry.Add; EditorGUILayout.LabelField(add.ToString(), GUILayout.Width(ENUM_POPUP_WIDTH)); } var link = entry.Embedded ? LinkType.Required : entry.Link; EditorGUILayout.LabelField(link.ToString(), GUILayout.Width(ENUM_POPUP_WIDTH)); if (entry.Embedded) { EditorGUILayout.LabelField("Embedded", GUILayout.Width(ENUM_POPUP_WIDTH)); } EditorGUILayout.EndHorizontal(); GUILayout.Space(2); }
public void AddEmbeddedFrameworkEntry() { var rootPath = Path.Combine(Application.dataPath, "Sample Data/Frameworks"); var fwPath = Path.Combine(rootPath, "MyTest.framework"); var pbx = LoadCopyOfOriginal(); var destPath = Path.Combine(pbx.PathToXcodeProject, "MyTest.framework"); long lastAccess = 0; if (File.Exists(destPath)) { lastAccess = File.GetLastAccessTime(destPath).Ticks; } var entry = FileAndFolderEntryFactory.CreateFrameworkEntry(fwPath, AddMethod.Link, LinkType.Required, true); pbx.AddFileOrFolder(entry); pbx.Save(); CompareFiles("AddEmbeddedFramework.pbxproj", pbx.SavePath); var updatedAccess = File.GetLastAccessTime(destPath).Ticks; Assert.Less(lastAccess, updatedAccess); Directory.Delete(destPath, true); }
void DrawFolderEntry(FolderEntry entry, int level, bool isChild = false) { EditorGUILayout.BeginHorizontal(); float indent = level * FOLDER_INDENT; GUILayout.Space(indent); float labelWidth = MaxFolderSectionWidth - indent; Style.FixedWidthLabel(entry.FileName, entry.Path, labelWidth); if (FileAndFolderEntryFactory.Exists(entry.Path)) { GUILayout.Space(SQUARE_BUTTON_SPACE_WIDTH); } else { Style.WarningIcon("Folder is missing"); } if (isChild) { GUILayout.Space(ENUM_POPUP_WIDTH); } else { EditorGUILayout.LabelField(entry.Add.ToString(), GUILayout.Width(ENUM_POPUP_WIDTH)); } EditorGUILayout.Space(); EditorGUILayout.EndHorizontal(); int nextLevel = level + 1; float nextIndentWidth = nextLevel * FOLDER_INDENT; float nextLabelWidth = MaxFolderSectionWidth - nextIndentWidth; DrawFileEntries(entry.Entries, nextLevel, nextLabelWidth, nextIndentWidth); }
public void AddSourceFile() { //TODO add compile flags var pbx = LoadCopyOfOriginal(); { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.m"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.mm"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.h"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is FileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.hpp"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is FileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.swift"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.asm"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.cpp"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.cc"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.c"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.cxx"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is SourceFileEntry); pbx.AddFileOrFolder(fileEntry); } { var path = Path.Combine(Application.dataPath, "Sample Data/Files/test.hxx"); var fileEntry = FileAndFolderEntryFactory.Create(path, AddMethod.Link); Assert.IsNotNull(fileEntry); Assert.IsTrue(fileEntry is FileEntry); pbx.AddFileOrFolder(fileEntry); } pbx.Save(); CompareFiles("AddSourceFile.pbxproj", pbx.SavePath); }