Example #1
0
        public static async UniTask <ILifeTime> Warmup(this IViewsSettings settings, ILifeTime lifeTime)
        {
            var viewHandles = settings.Views;

            foreach (var viewResource in viewHandles)
            {
                var viewReference = viewResource.View;
                var view          = await viewReference.LoadGameObjectAssetTaskAsync(lifeTime);
            }
            return(lifeTime);
        }
Example #2
0
        private static string Fold(IViewsSettings opts, IViewsSettings settings, Func <IViewsSettings, string> par)
        {
            var nonDefault = par(opts);

            if (!string.IsNullOrWhiteSpace(nonDefault))
            {
                return(nonDefault);
            }

            return(par(settings));
        }
Example #3
0
 public SoufflotExecutor(string directoryToWatch, IViewsSettings settings, IMessenger messenger, int?port)
 {
     this.settings         = settings;
     this.port             = port;
     this.directoryToWatch = directoryToWatch;
     this.messenger        = messenger;
     this.binPath          = Path.Combine(directoryToWatch, "target\\bin");
     this.webServerBinPath = Path.Combine(directoryToWatch, "target\\web-server-bin");
     Directory.CreateDirectory(this.binPath);
     Directory.CreateDirectory(this.webServerBinPath);
     this.watcher = new FileSystemWatcher(this.binPath, "*.dll");
 }
Example #4
0
 public static async UniTask <ILifeTime> Warmup(this IViewsSettings settings, GameObject gameObject)
 {
     return(await settings.Warmup(gameObject.GetLifeTime()));
 }
Example #5
0
 public static async UniTask <ILifeTime> Warmup(this IViewsSettings settings, Scene scene)
 {
     return(await settings.Warmup(scene.GetLifeTime()));
 }
Example #6
0
        protected override int ExecuteInternalWithExitCode()
        {
            var opts = this.Options;
            var relativeProjectPath = "project/views.json";

            var directory = opts.Directory;

            if (string.IsNullOrWhiteSpace(directory))
            {
                directory = Environment.CurrentDirectory;
            }

            var settings = CompilerRunner.GetBuildSettings(directory, relativeProjectPath, new SharpJsonSerializer(), true);

            var            newViewSettings = new ViewsSettings();
            IViewsSettings optsSettings    = opts;

            newViewSettings.Imports    = optsSettings.Imports.Union(settings.Imports).ToArray();
            newViewSettings.References = optsSettings.References.Union(settings.References)
                                         .Select(x => new Reference {
                HintPath = x.HintPath, Name = x.Name
            })
                                         .Distinct(DelegatedEqualityComparer.Builder <Reference>().Build(x => x.Name))
                                         .ToArray();


            newViewSettings.LinkerPath = Fold(opts, settings, x => x.LinkerPath);
            newViewSettings.OutputFile = Fold(opts, settings, x => x.OutputFile);
            newViewSettings.RelativeIntermediateDirectory = Fold(opts, settings, x => x.RelativeIntermediateDirectory);
            newViewSettings.RelativeSourceDirectory       = Fold(opts, settings, x => x.RelativeSourceDirectory);
            newViewSettings.SecondaryOutputFile           = Fold(opts, settings, x => x.SecondaryOutputFile);
            newViewSettings.SkipSecondaryOutputFile       = opts.SkipSecondaryOutputFile || settings.SkipSecondaryOutputFile;


            if (opts.SingleRun)
            {
                var logFile = new StreamWriter(File.OpenWrite(Path.Combine(directory, "Logs", DateTime.Now.ToString("dd-MM-yyyy-hh-mm-ss"))));

                var logger = opts.Verbose
                        ? (ILogger) new TextWriterLogger(Console.Out)
                        : new NullLogger();

                using (var compiler = CompilerRunner.StartWatching(directory, settings, new ConsoleMessenger(), logger))
                {
                    if (compiler.Compile() == CompileResult.Success)
                    {
                        return(-1);
                    }

                    return(-2);
                }
            }


            using (var executor = new SoufflotExecutor(directory, settings, new ConsoleMessenger(), opts.Port))
            {
                executor.Run();
            }

            return(0);
        }