예제 #1
0
        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);
                }
            }
        }
예제 #2
0
        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);
                }
            }
        }
예제 #3
0
 private static List <string> FilterEligibleFiles(List <string> projectFiles)
 {
     return(projectFiles.Where(p => BindingClassGenerator.HasProxyInterfaces(p)).ToList());
 }