Exemplo n.º 1
0
        private string GenerateBundle()
        {
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path=\"{dir}\"");

            logger.Info($"Preparing bundle output path: {options.JsonDirectory}.");
            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var bundlePath = Path.Join(options.JsonDirectory, "bundle.json");

            var descriptorPath = Path.Join(options.DescriptorDirectory, "schema.descriptor");

            var arguments = new[]
            {
                "--load_all_schema_on_schema_path",
                $"--bundle_json_out=\"{bundlePath}\"",
                $"--descriptor_set_out=\"{descriptorPath}\""
            }.Union(inputPaths).ToList();

            logger.Info("Generating schema bundle and descriptor.");
            logger.Trace($"Calling '{options.SchemaCompilerPath} {string.Join(" ", arguments)}'.");

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);

            logger.Info($"Generated bundle at {bundlePath}.");
            return(bundlePath);
        }
Exemplo n.º 2
0
        private void GenerateNativeTypesAndAst()
        {
            var files = options.SchemaInputDirs.SelectMany(dir =>
                                                           Directory.GetFiles(dir, "*.schema", SearchOption.AllDirectories));
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path={dir}");

            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var arguments = new[]
            {
                $@"--ast_json_out={options.JsonDirectory}"
            }.Union(inputPaths).Union(files).ToList();

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);
        }
Exemplo n.º 3
0
        private string GenerateBundle()
        {
            var files = options.SchemaInputDirs.SelectMany(dir =>
                                                           Directory.GetFiles(dir, "*.schema", SearchOption.AllDirectories));
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path={dir}");

            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var bundlePath = Path.Join(options.JsonDirectory, "bundle.json");

            var arguments = new[]
            {
                $@"--bundle_json_out={bundlePath}"
            }.Union(inputPaths).Union(files).ToList();

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);

            return(bundlePath);
        }
Exemplo n.º 4
0
        private void GenerateNativeTypesAndAst()
        {
            var files = options.SchemaInputDirs.SelectMany(dir =>
                                                           Directory.GetFiles(dir, "*.schema", SearchOption.AllDirectories));
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path={dir}");

            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);
            SystemTools.EnsureDirectoryEmpty(options.NetworkTypesOutputDirectory);
            SystemTools.EnsureDirectoryEmpty(options.NativeOutputDirectory);

            // Add all of the files we found to the command line.
            var arguments = new[]
            {
                $@"--csharp_out={options.NetworkTypesOutputDirectory}",
                $@"--ast_json_out={options.JsonDirectory}"
            }.Union(inputPaths).Union(files).ToList();

            SystemTools.RunRedirected(options.SchemaCompiler, arguments);
        }
Exemplo n.º 5
0
        private string GenerateBundle()
        {
            var inputPaths = options.SchemaInputDirs.Select(dir => $"--schema_path=\"{dir}\"");

            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var bundlePath = Path.Join(options.JsonDirectory, "bundle.json");

            var descriptorPath = Path.Join(options.DescriptorDirectory, "schema.descriptor");

            var arguments = new[]
            {
                "--load_all_schema_on_schema_path",
                $"--bundle_json_out=\"{bundlePath}\"",
                $"--descriptor_set_out=\"{descriptorPath}\""
            }.Union(inputPaths).ToList();

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);

            return(bundlePath);
        }
Exemplo n.º 6
0
        private string GenerateBundle()
        {
            var inputPaths = new List <string>();

            foreach (var schemaDir in options.SchemaInputDirs)
            {
                if (!Directory.Exists(schemaDir))
                {
                    logger.Error($"Schema source directory not found at path \"{schemaDir}\".");
                    continue;
                }

                inputPaths.Add($"--schema_path=\"{schemaDir}\"");
            }

            logger.Info($"Preparing bundle output path: {options.JsonDirectory}.");
            SystemTools.EnsureDirectoryEmpty(options.JsonDirectory);

            var bundlePath = Path.Join(options.JsonDirectory, "bundle.json");

            var descriptorPath = Path.Join(options.DescriptorDirectory, "schema.descriptor");

            var arguments = new[]
            {
                "--load_all_schema_on_schema_path",
                $"--bundle_json_out=\"{bundlePath}\"",
                $"--descriptor_set_out=\"{descriptorPath}\""
            }.Union(inputPaths).ToList();

            logger.Info("Generating schema bundle and descriptor.");
            logger.Trace($"Calling '{options.SchemaCompilerPath} {string.Join(" ", arguments)}'.");

            SystemTools.RunRedirected(options.SchemaCompilerPath, arguments);

            logger.Info($"Generated bundle at {bundlePath}.");
            return(bundlePath);
        }