Beispiel #1
0
        public void StoreResultToBuildCache(BuildResult result)
        {
            var bc = BuildCache;

            foreach (var f in result.RecompiledLast)
            {
                if (f.TakenFromBuildCache)
                {
                    continue;
                }
                if (f.Type != FileCompilationType.TypeScript || (f.SourceInfo != null && !f.SourceInfo.IsEmpty) ||
                    f.LocalImports.Count != 0 || f.ModuleImports.Count != 0)
                {
                    continue;
                }
                if (bc.FindTSFileBuildCache(f.Owner.HashOfContent, ConfigurationBuildCacheId) !=
                    null)
                {
                    continue;
                }
                var fbc = new TSFileBuildCache();
                fbc.ConfigurationId = ConfigurationBuildCacheId;
                fbc.ContentHash     = f.Owner.HashOfContent;
                fbc.DtsOutput       = f.DtsLink?.Owner.Utf8Content;
                fbc.JsOutput        = f.Output;
                fbc.MapLink         = f.MapLink;
                bc.Store(fbc);
            }
        }
Beispiel #2
0
        public void StoreResultToBuildCache(BuildResult result)
        {
            var bc = Owner.ProjectOptions.BuildCache;

            foreach (var f in result.RecompiledIncrementaly)
            {
                if (f.TakenFromBuildCache)
                {
                    continue;
                }
                if (f.Diagnostics.Count != 0)
                {
                    continue;
                }
                switch (f.Type)
                {
                case FileCompilationType.TypeScript:
                case FileCompilationType.EsmJavaScript:
                {
                    var fbc = new TSFileBuildCache();
                    fbc.ConfigurationId = Owner.ProjectOptions.ConfigurationBuildCacheId;
                    fbc.ContentHash     = f.Owner.HashOfContent;
                    fbc.Output          = f.Output;
                    fbc.MapLink         = f.MapLink;
                    MakeSourceInfoRelative(f.SourceInfo, f.Owner.Parent.FullPath);
                    fbc.SourceInfo = f.SourceInfo;
                    fbc.TranspilationDependencies = f.TranspilationDependencies;
                    bc.Store(fbc);
                    f.TakenFromBuildCache = true;
                    //_owner.Logger.Info("Storing to cache " + f.Owner.FullPath);
                    break;
                }

                case FileCompilationType.Css:
                case FileCompilationType.ImportedCss:
                {
                    var fbc = new TSFileBuildCache();
                    fbc.ConfigurationId           = 0;
                    fbc.ContentHash               = f.Owner.HashOfContent;
                    fbc.Output                    = f.Output;
                    fbc.TranspilationDependencies = f.TranspilationDependencies;
                    bc.Store(fbc);
                    f.TakenFromBuildCache = true;
                    //_owner.Logger.Info("Storing to cache " + f.Owner.FullPath);
                    break;
                }
                }
            }
        }