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);
        }
Beispiel #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);

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

            return(0);
        }
Beispiel #3
0
        public int Run()
        {
            if (!ValidateOptions())
            {
                ShowHelpMessage();
                return(1);
            }

            if (options.ShouldShowHelp)
            {
                ShowHelpMessage();
                return(0);
            }

            var jobGenerator   = new JobGenerator(fileSystem);
            var schemaFilesRaw = SchemaFiles.GetSchemaFilesRaw(options.JsonDirectory, fileSystem)
                                 .Where(f => string.IsNullOrEmpty(options.Package) || f.package == options.Package)
                                 .ToList();
            var jobs = jobGenerator.GenerateJobs(schemaFilesRaw, options);

            var jobRunner = new JobRunner(fileSystem);

            jobRunner.Run(jobs, new List <string>()
            {
                options.OutputDir
            });

            return(0);
        }