protected override void RunImpl()
        {
            var unityWorkerMenuGenerator = new UnityWorkerMenuGenerator();
            var workerCode = unityWorkerMenuGenerator.Generate(workerTypesToGenerate);

            Content.Add(Path.Combine(relativeEditorPath, workerFileName), workerCode);

            var buildSystemAssemblyGenerator = new BuildSystemAssemblyGenerator();
            var assemblyCode = buildSystemAssemblyGenerator.Generate();

            Content.Add(Path.Combine(relativeOutputPath, buildSystemFileName), assemblyCode);
        }
Esempio n. 2
0
        protected override void RunImpl()
        {
            logger.Info($"Generating {WorkerFileName}.");
            var workerCode = UnityWorkerMenuGenerator.Generate(workerTypesToGenerate);

            AddContent(Path.Combine(relativeEditorPath, WorkerFileName), workerCode);

            logger.Info($"Generating {BuildSystemFileName}.");
            var assemblyCode = BuildSystemAssemblyGenerator.Generate();

            AddContent(Path.Combine(relativeOutputPath, BuildSystemFileName), assemblyCode);

            logger.Info($"Generating {WorkerListFileName}.");
            AddContent(Path.Combine(relativeEditorPath, WorkerListFileName), string.Join(Environment.NewLine, workerTypesToGenerate));
        }
        public WorkerGenerationJob(CodegenJobOptions options, IFileSystem fileSystem, DetailsStore detailsStore)
            : base(options.AsEditor(), fileSystem, detailsStore)
        {
            const string jobName = nameof(WorkerGenerationJob);

            Logger.Trace($"Initialising {jobName}.");

            var workerTypesToGenerate = ExtractWorkerTypes(CodeGeneratorOptions.Instance.WorkerJsonDirectory);

            Logger.Trace($"Adding job target {WorkerFileName}.");
            AddJobTarget(Path.Combine(relativeEditorPath, WorkerFileName),
                         () => UnityWorkerMenuGenerator.Generate(workerTypesToGenerate));

            Logger.Trace($"Adding job target for {BuildSystemFileName}.");
            AddJobTarget(Path.Combine(relativeEditorPath, BuildSystemFileName),
                         () => BuildSystemAssemblyGenerator.Generate());

            Logger.Trace($"Adding job target for {WorkerListFileName}.");
            AddJobTarget(Path.Combine(relativeOutputPath, WorkerListFileName),
                         () => string.Join(Environment.NewLine, workerTypesToGenerate));

            Logger.Trace($"Finished initialising {jobName}.");
        }