示例#1
0
        public int Run()
        {
            if (options.ShouldShowHelp)
            {
                ShowHelpMessage();
                return(0);
            }

            if (!ValidateOptions())
            {
                ShowHelpMessage();
                return(1);
            }

            GenerateNativeTypesAndAst();

            var schemaFilesRaw  = SchemaFiles.GetSchemaFilesRaw(options.JsonDirectory, fileSystem).ToList();
            var schemaProcessor = new UnitySchemaProcessor(schemaFilesRaw);
            var globalEnumSet   = ExtractEnums(schemaProcessor.ProcessedSchemaFiles);

            foreach (var processedSchema in schemaProcessor.ProcessedSchemaFiles)
            {
                var job = new SingleGenerationJob(options.NativeOutputDirectory, processedSchema, fileSystem,
                                                  globalEnumSet);
                job.Run();
            }

            return(0);
        }
示例#2
0
        public int Run()
        {
            if (options.ShouldShowHelp)
            {
                ShowHelpMessage();
                return(0);
            }

            if (!ValidateOptions())
            {
                ShowHelpMessage();
                return(1);
            }

            GenerateNativeTypesAndAst();

            var schemaFilesRaw  = SchemaFiles.GetSchemaFilesRaw(options.JsonDirectory, fileSystem).ToList();
            var schemaProcessor = new UnitySchemaProcessor(schemaFilesRaw);
            var globalEnumSet   = ExtractEnums(schemaProcessor.ProcessedSchemaFiles);

            var aggegrateJob = new AggregateJob(fileSystem, options, schemaProcessor, globalEnumSet);
            var runner       = new JobRunner(fileSystem);

            runner.Run(new List <ICodegenJob> {
                aggegrateJob
            }, new[] { options.NativeOutputDirectory });

            return(0);
        }
示例#3
0
        public AggregateJob(IFileSystem fileSystem, CodeGeneratorOptions options,
                            UnitySchemaProcessor schemaProcessor,
                            HashSet <string> globalEnumSet) : base(options.NativeOutputDirectory, fileSystem)
        {
            InputFiles  = new List <string>();
            OutputFiles = new List <string>();

            foreach (var processedSchema in schemaProcessor.ProcessedSchemaFiles)
            {
                var job = new SingleGenerationJob(options.NativeOutputDirectory, processedSchema, fileSystem,
                                                  globalEnumSet);
                jobs.Add(job);

                foreach (var file in job.InputFiles)
                {
                    InputFiles.Add(file);
                }

                foreach (var file in job.OutputFiles)
                {
                    OutputFiles.Add(file);
                }
            }
        }