Beispiel #1
0
        /// <summary>
        /// Adds all files in a single directory to a fileListsByAssetType
        /// </summary>
        /// <param name="fileListsByAssetType"></param>
        /// <param name="dirPath"></param>
        private void AddRequiredFilesSingleDirectory(FileListsByAssetType fileListsByAssetType, AssetPath dirPath)
        {
            string absolutePath = dirPath.AbsolutePath;

            string[] filePaths = Directory.EnumerateFiles(absolutePath).ToArray();

            // Need to first process the nuspec files, and then the asset files.
            // This because the asset files may depend on the files pointed at by the nuspec files.
            for (int i = 0; i < 2; i++)
            {
                foreach (string filePath in filePaths)
                {
                    if (i == 0)
                    {
                        if (NuspecFile.IsNuspecFile(filePath))
                        {
                            fileListsByAssetType.Append(GetDependencies(filePath, dirPath));
                        }
                    }
                    else
                    {
                        AssetType?assetType = AssetTypeOfFile(filePath);
                        if (assetType != null)
                        {
                            fileListsByAssetType.Add(dirPath.AbsolutePathToAssetPath(filePath), assetType.Value);
                        }
                    }
                }
            }
        }
Beispiel #2
0
        private IEnumerable<string> NuspecFileDepencyIds(string nuspecfileName)
        {
            var pathHelper = new TestPathHelper("NuspecTests/NuspecFiles");
            string nuspecAbsolutePath = pathHelper.rootToAbsolutePath("~/" + nuspecfileName);

            var nuspecFile = new NuspecFile(nuspecAbsolutePath);
            return nuspecFile.DependencyIds;
        }
Beispiel #3
0
        /// <summary>
        /// Reads the dependencies in a Nuspec file. These are directories.
        /// Accumulates the assets in those directories to in a FileListsByAssetType.
        /// This is then returned.
        ///
        /// This method calls the dependency resolver concurrently.
        /// </summary>
        /// <param name="absoluteNuspecPath">
        /// Path of the nuspec file
        /// </param>
        /// <param name="nuspecFileDirPath">
        /// The directory where the nuspec file is located.
        /// </param>
        /// <returns></returns>
        private FileListsByAssetType GetDependencies(string absoluteNuspecPath, AssetPath nuspecFileDirPath)
        {
            FileListsByAssetType fileListsByAssetType = new FileListsByAssetType();

            var nuspecFile = new NuspecFile(absoluteNuspecPath);
            List <AssetPath> dependencyAssetPaths = nuspecFile.DependencyIds.Select(d => nuspecFileDirPath.Create(d)).ToList();

            // Call the dependency resolver concurrently for each dependency
            foreach (AssetPath dependencyAssetPath in dependencyAssetPaths)
            {
                fileListsByAssetType.Append(GetRequiredFilesForDirectory(dependencyAssetPath));
            }

            return(fileListsByAssetType);
        }
        /// <summary>
        /// Reads the dependencies in a Nuspec file. These are directories.
        /// Accumulates the assets in those directories to in a FileListsByAssetType.
        /// This is then returned.
        /// 
        /// This method calls the dependency resolver concurrently.
        /// </summary>
        /// <param name="absoluteNuspecPath">
        /// Path of the nuspec file
        /// </param>
        /// <param name="nuspecFileDirPath">
        /// The directory where the nuspec file is located.
        /// </param>
        /// <returns></returns>
        private FileListsByAssetType GetDependencies(string absoluteNuspecPath, AssetPath nuspecFileDirPath)
        {
            FileListsByAssetType fileListsByAssetType = new FileListsByAssetType();

            var nuspecFile = new NuspecFile(absoluteNuspecPath);
            List<AssetPath> dependencyAssetPaths = nuspecFile.DependencyIds.Select(d => nuspecFileDirPath.Create(d)).ToList();

            // Call the dependency resolver concurrently for each dependency
            foreach (AssetPath dependencyAssetPath in dependencyAssetPaths)
            {
                fileListsByAssetType.Append(GetRequiredFilesForDirectory(dependencyAssetPath));
            }

            return fileListsByAssetType;
        }