public void AddExternalLibraryDependency(string targetGuid, string filename, string remoteFileGuid, string projectPath, string remoteInfo)
{
PBXNativeTargetData target = this.nativeTargets[targetGuid];
filename = PBXPath.FixSlashes(filename);
projectPath = PBXPath.FixSlashes(projectPath);
string containerRef = this.FindFileGuidByRealPath(projectPath);
if (containerRef == null)
{
throw new Exception("No such project");
}
string guid = null;
foreach (ProjectReference reference in this.project.project.projectReferences)
{
if (reference.projectRef == containerRef)
{
guid = reference.group;
break;
}
}
if (guid == null)
{
throw new Exception("Malformed project: no project in project references");
}
PBXGroupData data2 = this.GroupsGet(guid);
string extension = Path.GetExtension(filename);
if (!FileTypeUtils.IsBuildableFile(extension))
{
throw new Exception("Wrong file extension");
}
PBXContainerItemProxyData data3 = PBXContainerItemProxyData.Create(containerRef, "2", remoteFileGuid, remoteInfo);
this.containerItems.AddEntry(data3);
string typeName = FileTypeUtils.GetTypeName(extension);
PBXReferenceProxyData data4 = PBXReferenceProxyData.Create(filename, typeName, data3.guid, "BUILT_PRODUCTS_DIR");
this.references.AddEntry(data4);
PBXBuildFileData buildFile = PBXBuildFileData.CreateFromFile(data4.guid, false, null);
this.BuildFilesAdd(targetGuid, buildFile);
this.BuildSectionAny(target, extension, false).files.AddGUID(buildFile.guid);
data2.children.AddGUID(data4.guid);
}