public DisposableFileSystem(bool automaticCleanup = true)
        {
            _automaticCleanup = automaticCleanup;

            RootPath = Path.GetTempFileName();
            File.Delete(RootPath);
            Directory.CreateDirectory(RootPath);
            DirectoryInfo = new DirectoryInfoWrapper(new DirectoryInfo(RootPath));
        }
Example #2
0
        public bool Build()
        {
            var projectFilesFinder = new Matcher();

            // Resolve all the project names
            var projectFilesToBuild = new List<string>();
            foreach(var pattern in _buildOptions.ProjectPatterns)
            {
                if (pattern.Contains("*"))
                {
                    // Requires globbing
                    projectFilesFinder.AddInclude(NormalizeGlobbingPattern(pattern));
                }
                else
                {
                    projectFilesToBuild.Add(pattern);
                }
            }

            var rootDirectory = Directory.GetCurrentDirectory();
            var patternSearchFolder = new DirectoryInfoWrapper(new DirectoryInfo(rootDirectory));
            var globbingProjects = projectFilesFinder.Execute(patternSearchFolder).Files.Select(file =>
                Path.Combine(rootDirectory, file));
            projectFilesToBuild.AddRange(globbingProjects);

            var sw = Stopwatch.StartNew();

            _cacheContextAccessor = new CacheContextAccessor();
            _cache = new Cache(_cacheContextAccessor);

            var globalSucess = true;
            foreach (var project in projectFilesToBuild)
            {
                var buildSuccess = BuildInternal(project);
                globalSucess &= buildSuccess;
            }

            _buildOptions.Reports.Information.WriteLine($"Total build time elapsed: { sw.Elapsed }");
            _buildOptions.Reports.Information.WriteLine($"Total projects built: { projectFilesToBuild.Count }");

            return globalSucess;
        }
        private void AddPackageFiles(string projectDirectory, IEnumerable<PackIncludeEntry> packageFiles, PackageBuilder packageBuilder, IList<DiagnosticMessage> diagnostics)
        {
            var rootDirectory = new DirectoryInfoWrapper(new DirectoryInfo(projectDirectory));

            foreach (var match in CollectAdditionalFiles(rootDirectory, packageFiles, _currentProject.ProjectFilePath, diagnostics))
            {
                packageBuilder.Files.Add(match);
            }
        }