public static bool IsPackageInstalled(this PackageReference packageReference, DotNetProject project)
        {
            var packagesPath = new SolutionPackageRepositoryPath(project);
            var fileSystem   = new PhysicalFileSystem(packagesPath.PackageRepositoryPath);

            return(packageReference.IsPackageInstalled(fileSystem));
        }
        public static bool IsReferenceFromPackage(this ProjectReference projectReference)
        {
            if (!projectReference.IsAssemblyReference())
            {
                return(false);
            }

            var project = projectReference.OwnerProject as DotNetProject;

            if ((project == null) || !project.HasPackages())
            {
                return(false);
            }

            var assemblyFilePath = new FilePath(projectReference.GetFullAssemblyPath());

            if (assemblyFilePath.IsNullOrEmpty)
            {
                return(false);
            }

            var packagesPath     = new SolutionPackageRepositoryPath(project);
            var packagesFilePath = new FilePath(packagesPath.PackageRepositoryPath);

            return(assemblyFilePath.IsChildPathOf(packagesFilePath));
        }
		void CreatePackageManager (IProject project, PackageReferenceRepositoryHelper packageRefRepositoryHelper)
		{
			options = new TestablePackageManagementOptions ();
			options.PackagesDirectory = "packages";

			repositoryPaths = new SolutionPackageRepositoryPath (project, options);
			var pathResolver = new DefaultPackagePathResolver (repositoryPaths.PackageRepositoryPath);

			fakeFileSystem = new FakeFileSystem ();

			fakeFeedSourceRepository = new FakePackageRepository ();
			fakeSolutionSharedRepository = packageRefRepositoryHelper.FakeSharedSourceRepository;

			fakePackageOperationResolverFactory = new FakePackageOperationResolverFactory ();
			fakePackageOperationResolver = fakePackageOperationResolverFactory.FakeInstallPackageOperationResolver;

			var fakeSolutionPackageRepository = new FakeSolutionPackageRepository ();
			fakeSolutionPackageRepository.FileSystem = fakeFileSystem;
			fakeSolutionPackageRepository.PackagePathResolver = pathResolver;
			fakeSolutionPackageRepository.FakeSharedRepository = fakeSolutionSharedRepository;

			packageManager = new MonoDevelopPackageManager (fakeFeedSourceRepository,
				packageRefRepositoryHelper.FakeProjectSystem,
				fakeSolutionPackageRepository,
				fakePackageOperationResolverFactory);
		}
		public bool AnyMissingPackages ()
		{
			var packagesPath = new SolutionPackageRepositoryPath (Project);
			var fileSystem = new PhysicalFileSystem (packagesPath.PackageRepositoryPath);
			foreach (PackageReference packageReference in GetPackageReferences ()) {
				if (!packageReference.IsPackageInstalled (fileSystem)) {
					return true;
				}
			}
			return false;
		}
		public SolutionPackageRepository (
			ISolution solution,
			IMonoDevelopPackageRepositoryFactory repositoryFactory,
			PackageManagementOptions options)
		{
			this.repositoryFactory = repositoryFactory;
			repositoryPath = new SolutionPackageRepositoryPath(solution, options);
			CreatePackagePathResolver();
			CreateFileSystem();
			CreateRepository(ConfigSettingsFileSystem.CreateConfigSettingsFileSystem(solution));
		}
Beispiel #6
0
 public SolutionPackageRepository(
     ISolution solution,
     IMonoDevelopPackageRepositoryFactory repositoryFactory,
     ISettingsProvider settingsProvider)
 {
     this.repositoryFactory = repositoryFactory;
     repositoryPath         = new SolutionPackageRepositoryPath(solution, settingsProvider);
     CreatePackagePathResolver();
     CreateFileSystem();
     CreateRepository(ConfigSettingsFileSystem.CreateConfigSettingsFileSystem(solution));
 }
		public SolutionPackageRepository (
			ISolution solution,
			IMonoDevelopPackageRepositoryFactory repositoryFactory,
			ISettingsProvider settingsProvider)
		{
			this.repositoryFactory = repositoryFactory;
			repositoryPath = new SolutionPackageRepositoryPath(solution, settingsProvider);
			CreatePackagePathResolver();
			CreateFileSystem();
			CreateRepository(ConfigSettingsFileSystem.CreateConfigSettingsFileSystem(solution));
		}
 public SolutionPackageRepository(
     ISolution solution,
     IMonoDevelopPackageRepositoryFactory repositoryFactory,
     PackageManagementOptions options)
 {
     this.repositoryFactory = repositoryFactory;
     repositoryPath         = new SolutionPackageRepositoryPath(solution, options);
     CreatePackagePathResolver();
     CreateFileSystem();
     CreateRepository(ConfigSettingsFileSystem.CreateConfigSettingsFileSystem(solution));
 }
Beispiel #9
0
        public bool AnyMissingPackages()
        {
            var packagesPath = new SolutionPackageRepositoryPath(Project);
            var fileSystem   = new PhysicalFileSystem(packagesPath.PackageRepositoryPath);

            foreach (PackageReference packageReference in GetPackageReferences())
            {
                if (!packageReference.IsPackageInstalled(fileSystem))
                {
                    return(true);
                }
            }
            return(false);
        }
		public static bool IsReferenceFromPackage (this ProjectReference projectReference)
		{
			if (!projectReference.IsAssemblyReference ())
				return false;

			var project = projectReference.OwnerProject as DotNetProject;
			if ((project == null) || !project.HasPackages ())
				return false;

			var assemblyFilePath = new FilePath (projectReference.GetFullAssemblyPath ());
			if (assemblyFilePath.IsNullOrEmpty)
				return false;

			var packagesPath = new SolutionPackageRepositoryPath (project);
			var packagesFilePath = new FilePath (packagesPath.PackageRepositoryPath);

			return assemblyFilePath.IsChildPathOf (packagesFilePath);
		}
		static Task<AnalyzersFromAssembly> GetProjectDiagnosticsAsync (Project project, string language, CancellationToken cancellationToken)
		{
			if (project == null)
				return Task.FromResult (AnalyzersFromAssembly.Empty);
			AnalyzersFromAssembly result;
			if (diagnosticCache.TryGetValue(project, out result)) 
				return Task.FromResult (result);

			result = new AnalyzersFromAssembly ();

			var dotNetProject = project as DotNetProject;
			if (dotNetProject != null) {
				var proxy = new DotNetProjectProxy (dotNetProject);
				if (proxy.HasPackages ()) {
					var packagesPath = new SolutionPackageRepositoryPath (proxy);
					foreach (var file in Directory.EnumerateFiles (packagesPath.PackageRepositoryPath, "*.dll", SearchOption.AllDirectories)) {
						cancellationToken.ThrowIfCancellationRequested ();
						try {
							var asm = Assembly.LoadFrom (file);
							result.AddAssembly (asm);
						} catch (Exception) {
						}
					}
				}
			}
			diagnosticCache[project] = result;
			return Task.FromResult (result);
		}
		void CreateSolutionPackageRepositoryPath (ISolution solution)
		{
			repositoryPath = new SolutionPackageRepositoryPath (solution, settingsProvider);
		}
		void CreateSolutionPackageRepositoryPath ()
		{
			repositoryPath = new SolutionPackageRepositoryPath (project, settingsProvider);
		}
		void CreateSolutionPackageRepositoryPath (ISolution solution)
		{
			repositoryPath = new SolutionPackageRepositoryPath (solution, options);
		}
		void CreateSolutionPackageRepositoryPath ()
		{
			repositoryPath = new SolutionPackageRepositoryPath (project, options);
		}
		public static bool IsPackageInstalled (this PackageReference packageReference, DotNetProject project)
		{
			var packagesPath = new SolutionPackageRepositoryPath (project);
			var fileSystem = new PhysicalFileSystem (packagesPath.PackageRepositoryPath);
			return packageReference.IsPackageInstalled (fileSystem);
		}