IEnumerable<KeyValuePair<string, string>> GenerateInstructionsCore()
        {
            if (IncludeBinFiles)
                foreach (var source in from export in BuildOutputFiles
                                       from filePath in export
                                       let file = _fileSystem.GetFile(filePath)
                                       let packagePath = GetPackagePath(ExportName, export.Key, file)
                                       where file.Exists && FileMatchesDesiredFlavour(file)
                                       select new { packagePath, file })

                    yield return GetKey(source.packagePath, source.file.Path);


            if (IncludeContentFiles)
                foreach (var source in from export in ContentFiles
                                       from filePath in export
                                       let file = _fileSystem.GetFile(filePath)
                                       let packagePath = GetPackagePath("content", export.Key, file)
                                       where file.Exists
                                       select new { packagePath, file })
                    yield return GetKey(source.packagePath, source.file.Path);
            var rootPath = new OpenFileSystem.IO.Path(RootPath);
            var sourcePath = new OpenFileSystem.IO.Path("source");

            if (IncludeSourceFiles)
                foreach (var source in from exportPath in SourceFiles
                                       from filePath in exportPath
                                       let file = _fileSystem.GetFile(filePath)
                                       where file.Exists && IsBasePath(rootPath, file.Path)
                                       select new { packagePath = sourcePath.Combine(file.Parent.Path.MakeRelative(rootPath)), file })
                    yield return GetKey(source.packagePath, source.file.Path);

        }
Пример #2
0
        public static Uri ToUri(this OpenFileSystem.IO.Path path, string scheme = "file")
        {
            // Lots of horrible things happening here due to OFS messing up badly with UNC paths <sigh>.
            var normalized = path.Segments.JoinString("/");

            string server = string.Empty;

            if (_drives.Contains(path.Segments.First()) == false)
            {
                server     = path.Segments.First();
                normalized = path.Segments.Skip(1).JoinString("/");
            }
            return(new Uri(string.Format("{0}://{1}/{2}", scheme, server, normalized), UriKind.Absolute));
        }
Пример #3
0
        public msbuild_emitter()
        {
            _fileSystem       = new InMemoryFileSystem();
            _emitter          = new MSBuildInstructionEmitter(_fileSystem);
            RootDirectory     = _fileSystem.CreateTempDirectory();
            _emitter.RootPath = RootDirectory.Path;
            ProjectDirectory  = RootDirectory.GetDirectory("src").GetDirectory("Project");
            ProjectFile       = ProjectDirectory.GetFile("Project.csproj");

            BinDirectory
                          = _fileSystem.CreateTempDirectory();
            GacDirectory  = _fileSystem.CreateTempDirectory();
            TempDirectory = _fileSystem.CreateTempDirectory();
            BinPath       = new OpenFileSystem.IO.Path(System.IO.Path.Combine(_emitter.RootPath, "bin"));
        }
Пример #4
0
        public msbuild_emitter()
        {
            _fileSystem = new InMemoryFileSystem();
            _emitter = new MSBuildInstructionEmitter(_fileSystem);
            RootDirectory = _fileSystem.CreateTempDirectory();
            _emitter.RootPath = RootDirectory.Path;
            ProjectDirectory = RootDirectory.GetDirectory("src").GetDirectory("Project");
            ProjectFile = ProjectDirectory.GetFile("Project.csproj");

            BinDirectory 
                = _fileSystem.CreateTempDirectory();
            GacDirectory = _fileSystem.CreateTempDirectory();
            TempDirectory = _fileSystem.CreateTempDirectory();
            BinPath = new OpenFileSystem.IO.Path(System.IO.Path.Combine(_emitter.RootPath, "bin"));
        }
Пример #5
0
        IEnumerable <KeyValuePair <string, string> > GenerateInstructionsCore()
        {
            if (IncludeBinFiles)
            {
                foreach (var source in from export in BuildOutputFiles
                         from filePath in export
                         let file = _fileSystem.GetFile(filePath)
                                    let packagePath = GetPackagePath(ExportName, export.Key, file)
                                                      where file.Exists && FileMatchesDesiredFlavour(file)
                                                      select new { packagePath, file })
                {
                    yield return(GetKey(source.packagePath, source.file.Path));
                }
            }


            if (IncludeContentFiles)
            {
                foreach (var source in from export in ContentFiles
                         from filePath in export
                         let file = _fileSystem.GetFile(filePath)
                                    let packagePath = GetPackagePath("content", export.Key, file)
                                                      where file.Exists
                                                      select new { packagePath, file })
                {
                    yield return(GetKey(source.packagePath, source.file.Path));
                }
            }
            var rootPath   = new OpenFileSystem.IO.Path(RootPath);
            var sourcePath = new OpenFileSystem.IO.Path("source");

            if (IncludeSourceFiles)
            {
                foreach (var source in from exportPath in SourceFiles
                         from filePath in exportPath
                         let file = _fileSystem.GetFile(filePath)
                                    where file.Exists && IsBasePath(rootPath, file.Path)
                                    select new { packagePath = sourcePath.Combine(file.Parent.Path.MakeRelative(rootPath)), file })
                {
                    yield return(GetKey(source.packagePath, source.file.Path));
                }
            }
        }
Пример #6
0
        bool IsBasePath(OpenFileSystem.IO.Path path, OpenFileSystem.IO.Path absolutePath)
        {
            var basePathSegments     = path.Segments.ToList();
            var absolutePathSegments = absolutePath.Segments.ToList();

            if (absolutePathSegments.Count <= basePathSegments.Count)
            {
                return(false);
            }

            for (int i = 0; i < path.Segments.Count(); i++)
            {
                if (basePathSegments[i] != absolutePathSegments[i])
                {
                    return(false);
                }
            }
            return(true);
        }
Пример #7
0
 public static IFile ToZip(this IDirectory directory, Path path)
 {
     new FastZip().CreateZip(path.FullPath, directory.Path.FullPath, true, string.Empty);
     return(directory.FileSystem.GetFile(path.FullPath));
 }
Пример #8
0
 KeyValuePair <string, string> GetKey(string exportPath, OpenFileSystem.IO.Path absolutePath)
 {
     return(Key(exportPath, absolutePath));
 }