A collection of dependency definitions.
Inheritance: ObjectDescriptionCollection
Exemplo n.º 1
0
 public bool ResolveDependencies(IProgressStatus statusMonitor, PackageCollection packages, out PackageCollection toUninstall, out DependencyCollection unresolved)
 {
     return store.ResolveDependencies (statusMonitor, packages, out toUninstall, out unresolved);
 }
Exemplo n.º 2
0
        static void ReadDependencies(DependencyCollection deps, DependencyCollection opDeps, XmlElement elem)
        {
            foreach (XmlElement dep in elem.SelectNodes ("Dependencies/Addin")) {
                AddinDependency adep = new AddinDependency ();
                adep.AddinId = dep.GetAttribute ("id");
                string v = dep.GetAttribute ("version");
                if (v.Length != 0)
                    adep.Version = v;
                deps.Add (adep);
            }

            foreach (XmlElement dep in elem.SelectNodes ("Dependencies/Assembly")) {
                AssemblyDependency adep = new AssemblyDependency ();
                adep.FullName = dep.GetAttribute ("name");
                adep.Package = dep.GetAttribute ("package");
                deps.Add (adep);
            }

            foreach (XmlElement mod in elem.SelectNodes ("Module"))
                ReadDependencies (opDeps, opDeps, mod);
        }
Exemplo n.º 3
0
 public bool ResolveDependencies(IProgressStatus statusMonitor, AddinRepositoryEntry[] addins, out PackageCollection resolved, out PackageCollection toUninstall, out DependencyCollection unresolved)
 {
     return store.ResolveDependencies (statusMonitor, addins, out resolved, out toUninstall, out unresolved);
 }
Exemplo n.º 4
0
 internal override void Read(BinaryXmlReader reader)
 {
     assemblies = (StringCollection) reader.ReadValue ("Assemblies", new StringCollection ());
     dataFiles = (StringCollection) reader.ReadValue ("DataFiles", new StringCollection ());
     dependencies = (DependencyCollection) reader.ReadValue ("Dependencies", new DependencyCollection (this));
     extensions = (ExtensionCollection) reader.ReadValue ("Extensions", new ExtensionCollection (this));
     ignorePaths = (StringCollection) reader.ReadValue ("IgnorePaths", new StringCollection ());
 }
Exemplo n.º 5
0
 public AddinInfo()
 {
     dependencies = new DependencyCollection ();
     optionalDependencies = new DependencyCollection ();
 }
Exemplo n.º 6
0
		internal abstract void Resolve (IProgressMonitor monitor, AddinStore service, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection required, DependencyCollection unresolved);
		internal override void Resolve (IProgressMonitor monitor, AddinStore service, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection installedRequired, DependencyCollection unresolved)
		{
			Addin ia = service.Registry.GetAddin (info.Id);
			
			if (ia != null) {
				Package p = AddinPackage.FromInstalledAddin (ia);
				if (!toUninstall.Contains (p))
					toUninstall.Add (p);
					
				if (!info.SupportsVersion (ia.Version)) {
				
					// This addin breaks the api of the currently installed one,
					// it has to be removed, together with all dependencies
					
					Addin[] ainfos = service.GetDependentAddins (info.Id, true);
					foreach (Addin ainfo in ainfos) {
						p = AddinPackage.FromInstalledAddin (ainfo);
						if (!toUninstall.Contains (p))
							toUninstall.Add (p);
					}
				}
			}
			
			foreach (Dependency dep in info.Dependencies) {
				service.ResolveDependency (monitor, dep, this, toInstall, toUninstall, installedRequired, unresolved);
			}
		}
Exemplo n.º 8
0
		public AddinInfo ()
		{
			dependencies = new DependencyCollection ();
			optionalDependencies = new DependencyCollection ();
			properties = new AddinPropertyCollectionImpl ();
		}
Exemplo n.º 9
0
        internal void ResolveDependency(IProgressMonitor monitor, Dependency dep, AddinPackage parentPackage, PackageCollection toInstall, PackageCollection toUninstall, PackageCollection installedRequired, DependencyCollection unresolved)
        {
            AddinDependency adep = dep as AddinDependency;
            if (adep == null)
                return;

            string nsid = Addin.GetFullId (parentPackage.Addin.Namespace, adep.AddinId, null);

            foreach (Package p in toInstall) {
                AddinPackage ap = p as AddinPackage;
                if (ap != null) {
                    if (Addin.GetIdName (ap.Addin.Id) == nsid && ((AddinInfo)ap.Addin).SupportsVersion (adep.Version))
                        return;
                }
            }

            ArrayList addins = new ArrayList ();
            addins.AddRange (service.Registry.GetAddins ());
            addins.AddRange (service.Registry.GetAddinRoots ());

            foreach (Addin addin in addins) {
                if (Addin.GetIdName (addin.Id) == nsid && addin.SupportsVersion (adep.Version)) {
                    AddinPackage p = AddinPackage.FromInstalledAddin (addin);
                    if (!installedRequired.Contains (p))
                        installedRequired.Add (p);
                    return;
                }
            }

            AddinRepositoryEntry[] avaddins = service.Repositories.GetAvailableAddins ();
            foreach (PackageRepositoryEntry avAddin in avaddins) {
                if (Addin.GetIdName (avAddin.Addin.Id) == nsid && ((AddinInfo)avAddin.Addin).SupportsVersion (adep.Version)) {
                    toInstall.Add (AddinPackage.FromRepository (avAddin));
                    return;
                }
            }
            unresolved.Add (adep);
        }
Exemplo n.º 10
0
        internal bool ResolveDependencies(IProgressMonitor monitor, PackageCollection packages, out PackageCollection toUninstall, out DependencyCollection unresolved)
        {
            PackageCollection requested = new PackageCollection();
            requested.AddRange (packages);

            unresolved = new DependencyCollection ();
            toUninstall = new PackageCollection ();
            PackageCollection installedRequired = new PackageCollection ();

            for (int n=0; n<packages.Count; n++) {
                Package p = packages [n];
                p.Resolve (monitor, this, packages, toUninstall, installedRequired, unresolved);
            }

            if (unresolved.Count != 0) {
                foreach (Dependency dep in unresolved)
                    monitor.ReportError (string.Format ("The package '{0}' could not be found in any repository", dep.Name), null);
                return false;
            }

            // Check that we are not uninstalling packages that are required
            // by packages being installed.

            foreach (Package p in installedRequired) {
                if (toUninstall.Contains (p)) {
                    // Only accept to uninstall this package if we are
                    // going to install a newer version.
                    bool foundUpgrade = false;
                    foreach (Package tbi in packages)
                        if (tbi.Equals (p) || tbi.IsUpgradeOf (p)) {
                            foundUpgrade = true;
                            break;
                        }
                    if (!foundUpgrade)
                        return false;
                }
            }

            // Check that we are not trying to uninstall from a directory from
            // which we don't have write permissions

            foreach (Package p in toUninstall) {
                AddinPackage ap = p as AddinPackage;
                if (ap != null) {
                    Addin ia = service.Registry.GetAddin (ap.Addin.Id);
                    if (File.Exists (ia.AddinFile) && !HasWriteAccess (ia.AddinFile)) {
                        monitor.ReportError (GetUninstallErrorNoRoot (ap.Addin), null);
                        return false;
                    }
                }
            }

            // Check that we are not installing two versions of the same addin

            PackageCollection resolved = new PackageCollection();
            resolved.AddRange (packages);

            bool error = false;

            for (int n=0; n<packages.Count; n++) {
                AddinPackage ap = packages [n] as AddinPackage;
                if (ap == null) continue;

                for (int k=n+1; k<packages.Count; k++) {
                    AddinPackage otherap = packages [k] as AddinPackage;
                    if (otherap == null) continue;

                    if (ap.Addin.Id == otherap.Addin.Id) {
                        if (ap.IsUpgradeOf (otherap)) {
                            if (requested.Contains (otherap)) {
                                monitor.ReportError ("Can't install two versions of the same add-in: '" + ap.Addin.Name + "'.", null);
                                error = true;
                            } else {
                                packages.RemoveAt (k);
                            }
                        } else if (otherap.IsUpgradeOf (ap)) {
                            if (requested.Contains (ap)) {
                                monitor.ReportError ("Can't install two versions of the same add-in: '" + ap.Addin.Name + "'.", null);
                                error = true;
                            } else {
                                packages.RemoveAt (n);
                                n--;
                            }
                        } else {
                            error = true;
                            monitor.ReportError ("Can't install two versions of the same add-in: '" + ap.Addin.Name + "'.", null);
                        }
                        break;
                    }
                }
            }

            return !error;
        }
Exemplo n.º 11
0
 public bool ResolveDependencies(IProgressStatus statusMonitor, PackageCollection packages, out PackageCollection toUninstall, out DependencyCollection unresolved)
 {
     IProgressMonitor monitor = ProgressStatusMonitor.GetProgressMonitor (statusMonitor);
     return ResolveDependencies (monitor, packages, out toUninstall, out unresolved);
 }
Exemplo n.º 12
0
 public bool ResolveDependencies(IProgressStatus statusMonitor, AddinRepositoryEntry[] addins, out PackageCollection resolved, out PackageCollection toUninstall, out DependencyCollection unresolved)
 {
     resolved = new PackageCollection ();
     for (int n=0; n<addins.Length; n++)
         resolved.Add (AddinPackage.FromRepository (addins [n]));
     return ResolveDependencies (statusMonitor, resolved, out toUninstall, out unresolved);
 }