public static void GenerateNativeBindings(string projectFile, string intermediateOutputPath) { intermediateOutputPath = PathHelper.MSBuildQuoteFixer(intermediateOutputPath); if (string.IsNullOrEmpty(projectFile) || !File.Exists(projectFile)) { throw new InvalidOperationException("The specified project is invalid or does not exist"); } var finalOutputDir = GetIntermediateOutputPath(projectFile, intermediateOutputPath); //TODO: Filter not expired generated file //NOTE: This is actually a shortcut. We delete everything and generate file. //This way we are sure that if a file has been deleted on project side, there is no "ghost file". //We must check 2 files tree and add/remove/update correctly //As we may not have a lot of extra file to generate to native this is not a priority yet. CleanIntermediateOutputPath(finalOutputDir); foreach (var currentProject in GetReferencedProjects(projectFile)) { string projectName = Path.GetFileNameWithoutExtension(currentProject); string workingDirectory = Path.GetDirectoryName(currentProject); foreach (var file in GetAllCSharpFiles(workingDirectory)) { string relativeOutputPath = Path.GetDirectoryName(file.Replace(workingDirectory, string.Empty).TrimStart(Path.DirectorySeparatorChar)); BindingClassGenerator.GenerateBindingClass(file, finalOutputDir + Path.DirectorySeparatorChar + projectName + Path.DirectorySeparatorChar + relativeOutputPath); } } }
public static void GenerateNativeBindings(string projectFile, string intermediateOutputPath) { intermediateOutputPath = PathHelper.MSBuildQuoteFixer(intermediateOutputPath); if (string.IsNullOrEmpty(projectFile) || !File.Exists(projectFile)) { throw new InvalidOperationException("The specified project is invalid or does not exist"); } var finalOutputDir = GetIntermediateOutputPath(projectFile, intermediateOutputPath); foreach (var currentProject in GetReferencedProjects(projectFile)) { string projectName = Path.GetFileNameWithoutExtension(currentProject); string workingDirectory = Path.GetDirectoryName(currentProject); foreach (var file in GetAllCSharpFiles(workingDirectory)) { string relativeOutputPath = Path.GetDirectoryName(file.Replace(workingDirectory, string.Empty).TrimStart(Path.DirectorySeparatorChar)); BindingClassGenerator.GenerateBindingClass(file, finalOutputDir + Path.DirectorySeparatorChar + projectName + Path.DirectorySeparatorChar + relativeOutputPath); } } }
private static List <string> FilterEligibleFiles(List <string> projectFiles) { return(projectFiles.Where(p => BindingClassGenerator.HasProxyInterfaces(p)).ToList()); }