예제 #1
0
        /// <summary>
        /// Find paths to repositories that are included in the project.
        /// </summary>
        /// <param name="dependencies">Dependencies to search for local repositories.</param>
        /// <returns>Set of repository paths in the project.</returns>
        public static HashSet <string> FindLocalRepos(ICollection <Dependency> dependencies)
        {
            // Find all repositories embedded in the project.
            var repos      = new HashSet <string>();
            var projectUri = GradleResolver.RepoPathToUri(Path.GetFullPath("."));

            foreach (var reposAndSources in
                     PlayServicesResolver.GetRepos(dependencies: dependencies))
            {
                var repoUri = reposAndSources.Key;
                if (repoUri.StartsWith(projectUri))
                {
                    repos.Add(Uri.UnescapeDataString(repoUri.Substring(projectUri.Length + 1)));
                }
            }
            return(repos);
        }
        /// <summary>
        /// Find paths to repositories that are included in the project.
        /// </summary>
        /// <param name="dependencies">Dependencies to search for local repositories.</param>
        /// <returns>Set of repository paths in the project.</returns>
        public static HashSet <string> FindLocalRepos(ICollection <Dependency> dependencies)
        {
            // Find all repositories embedded in the project.
            var repos       = new HashSet <string>();
            var projectPath = FileUtils.PosixPathSeparators(Path.GetFullPath("."));

            foreach (var reposAndSources in
                     PlayServicesResolver.GetRepos(dependencies: dependencies))
            {
                var repoUri = reposAndSources.Key;
                if (repoUri.StartsWith(PlayServicesResolver.FILE_SCHEME))
                {
                    var fullPath = repoUri.Substring(PlayServicesResolver.FILE_SCHEME.Length);
                    if (fullPath.StartsWith(projectPath))
                    {
                        repos.Add(fullPath.Substring(projectPath.Length + 1));
                    }
                }
            }
            return(repos);
        }