protected ITaskItem ConvertPackageElement(ITaskItem project, PackageReference packageReference) { var id = packageReference.Id; var version = packageReference.Version; var targetFramework = packageReference.TargetFramework; var isDevelopmentDependency = packageReference.IsDevelopmentDependency; var requireReinstallation = packageReference.RequireReinstallation; var versionConstraint = packageReference.VersionConstraint; var item = new TaskItem(id); project.CopyMetadataTo(item); var packageDirectoryPath = GetPackageDirectoryPath(project.GetMetadata("FullPath"), id, version); item.SetMetadata("PackageDirectoryPath", packageDirectoryPath); item.SetMetadata("ProjectPath", project.GetMetadata("FullPath")); item.SetMetadata("IsDevelopmentDependency", isDevelopmentDependency.ToString()); item.SetMetadata("RequireReinstallation", requireReinstallation.ToString()); if (version != null) item.SetMetadata(Metadata.Version, version.ToString()); if (targetFramework != null) item.SetMetadata(Metadata.TargetFramework, targetFramework.GetShortFrameworkName()); if (versionConstraint != null) item.SetMetadata("VersionConstraint", versionConstraint.ToString()); return item; }
void CreateUpdatePackageInAllProjects(string packageId, SemanticVersion version) { fakeSolution = new FakePackageManagementSolution(); fakeSourceRepository = new FakePackageRepository(); var packageReference = new PackageReference(packageId, version, null, null, false, false); updatePackageInAllProjects = new UpdatePackageInAllProjects(packageReference, fakeSolution, fakeSourceRepository); }
public bool IsRestored (PackageReference packageReference) { return FakeSharedRepository.FakePackages.Any (package => { return (package.Id == packageReference.Id) && (package.Version == packageReference.Version); }); }
string ConvertToString(PackageReference packageReference) { return String.Format( "Id: {0}, Version: {1}", packageReference.Id, packageReference.Version); }
public IUpdatePackageActions CreateUpdatePackageInAllProjects( PackageReference packageReference, IPackageManagementSolution solution, IPackageRepository sourceRepository) { return new UpdatePackageInAllProjects(packageReference, solution, sourceRepository); }
void CreatePackageReference ( string packageId = "Id", bool requireReinstallation = false) { var version = new SemanticVersion ("1.2.3"); packageReference = new PackageReference (packageId, version, null, null, false, requireReinstallation); }
ReinstallPackageAction CreateReinstallPackageAction (IPackageManagementProject project, PackageReference packageReference) { ReinstallPackageAction action = project.CreateReinstallPackageAction (); action.PackageId = packageReference.Id; action.PackageVersion = packageReference.Version; return action; }
public UpdatePackageInAllProjects ( PackageReference packageReference, IPackageManagementSolution2 solution, IPackageRepository sourceRepository) { this.packageReference = packageReference; this.solution = solution; this.sourceRepository = sourceRepository; }
PackageReference AddPackageReferenceToProject ( string packageId = "Id", string version = "1.2.3") { var semanticVersion = new SemanticVersion (version); var packageReference = new PackageReference (packageId, semanticVersion, null, null, false, false); packagesFolderNode.PackageReferences.Add (packageReference); return packageReference; }
public IUpdatePackageActions CreateUpdatePackageInAllProjects( PackageReference packageReference, IPackageManagementSolution solution, IPackageRepository sourceRepository) { PackageReferencePassedToCreateUpdatePackageInAllProjects = packageReference; SolutionPassedToCreateUpdatePackageInAllProjects = solution; SourceRepositoryPassedToCreateUpdatePackageInAllProjects = sourceRepository; return FakeUpdatePackageInAllProjects; }
void Run (string packageId, string packageVersion) { var packageReference = new PackageReference ( packageId, new SemanticVersion (packageVersion), null, null, false); var node = new PackageReferenceNode (packageReference, true); reinstaller.Run (node); }
public PackageReferenceNode ( PackageReference packageReference, bool installed, bool pending = false, IPackageName updatedPackage = null) { PackageReference = packageReference; Installed = installed; IsInstallPending = pending; UpdatedVersion = GetUpdatedPackageVersion (updatedPackage); IsReinstallNeeded = packageReference.RequireReinstallation; }
void Run (string packageId, string packageVersion) { var packageReference = new PackageReference ( packageId, new SemanticVersion (packageVersion), null, null, false); var parentNode = new TestableProjectPackagesFolderNode (project.FakeDotNetProject, null); var node = new PackageReferenceNode (parentNode, packageReference, true); reinstaller.Run (node); }
public bool TryFindLatestPackageById(string id, out SemanticVersion latestVersion) { PackageReference reference = (from r in this.GetPackageReferences(id) orderby r.Version descending select r).FirstOrDefault <PackageReference>(); if (reference == null) { latestVersion = null; return(false); } latestVersion = reference.Version; return(true); }
public bool TryFindLatestPackageById(string id, out SemanticVersion latestVersion) { PackageReference reference = GetPackageReferences(id).OrderByDescending(r => r.Version) .FirstOrDefault(); if (reference == null) { latestVersion = null; return(false); } else { latestVersion = reference.Version; Debug.Assert(latestVersion != null); return(true); } }
public bool TryFindLatestPackageById(string id, bool includePrerelease, out IPackage package) { IEnumerable <PackageReference> references = GetPackageReferences(id); if (!includePrerelease) { references = references.Where(r => String.IsNullOrEmpty(r.Version.SpecialVersion)); } PackageReference reference = references.OrderByDescending(r => r.Version).FirstOrDefault(); if (reference != null) { package = GetPackage(reference); return(true); } else { package = null; return(false); } }
public bool TryFindLatestPackageById(string id, bool includePrerelease, out IPackage package) { IEnumerable <PackageReference> packageReferences = this.GetPackageReferences(id); if (!includePrerelease) { packageReferences = from r in packageReferences where string.IsNullOrEmpty(r.Version.SpecialVersion) select r; } PackageReference reference = (from r in packageReferences orderby r.Version descending select r).FirstOrDefault <PackageReference>(); if (reference != null) { package = this.GetPackage(reference); return(true); } package = null; return(false); }
private static bool IsValidReference(PackageReference reference) { return(!String.IsNullOrEmpty(reference.Id) && reference.Version != null); }
public bool IsRestored (PackageReference packageReference) { if (packageReference.Version == null) { return false; } return CreateLocalPackageRepository () .GetPackageLookupPaths (packageReference.Id, packageReference.Version) .Any (); }
public void AddFakePackageReference(string packageId, string version) { var packageReference = new PackageReference(packageId, new SemanticVersion(version), null, null, false, false); FakePackageReferences.Add(packageReference); }
public void DeleteEntry(string id, Version version) { var packageReference = new PackageReference(id, version, null); EntriesDeleted.Add(packageReference); }
bool IsPackageInstalled (PackageReference packageReference) { return projectManager.LocalRepository.Exists (packageReference.Id, packageReference.Version); }
public IVersionSpec GetConstraint(string packageId) { PackageReference packageReference = this.GetPackageReference(packageId); return(packageReference?.VersionConstraint); }
protected override bool IsPackageInstalled (PackageReference reference) { return PackageReferencesWithPackageInstalled.Contains (reference); }
void AddFileToLocalRepositoryLookupPath (PackageReference packageReference, string filePath) { filePath = filePath.ToNativePath (); var packageName = new PackageName (packageReference.Id, packageReference.Version); repository.LocalPackageRepository.AddPackageLookupPath (packageName, filePath); }
private static bool IsValidReference(PackageReference reference) { return !String.IsNullOrEmpty(reference.Id) && reference.Version != null; }
private IPackage GetPackage(PackageReference reference) { if (IsValidReference(reference)) { return SourceRepository.FindPackage(reference.Id, reference.Version); } return null; }
PackageReferenceNode CreatePackageReferenceNode (PackageReference reference, UpdatedPackagesInProject updatedPackages) { return new PackageReferenceNode ( reference, IsPackageInstalled (reference), false, updatedPackages.GetUpdatedPackage (reference.Id)); }
private IPackage GetPackage(PackageReference reference) => (!IsValidReference(reference) ? null : this.SourceRepository.FindPackage(reference.Id, reference.Version));
protected virtual bool IsPackageInstalled (PackageReference reference) { return reference.IsPackageInstalled (project.DotNetProject); }
public FrameworkName GetPackageTargetFramework(string packageId) { PackageReference packageReference = this.GetPackageReference(packageId); return(packageReference?.TargetFramework); }
void PackageIsInstalledInProject (PackageReference packageReference) { packagesFolderNode.PackageReferencesWithPackageInstalled.Add (packageReference); }
private static bool IsValidReference(PackageReference reference) => (!string.IsNullOrEmpty(reference.Id) && (reference.Version != null));
public PackageReference AddPackageReference (string packageId, string packageVersion) { var packageReference = new PackageReference ( packageId, new SemanticVersion (packageVersion), null, null, false, false); PackageReferences.Add (packageReference); return packageReference; }
void LogPackageAlreadyRestored (PackageReference packageReference) { logger.Log (MessageLevel.Debug, GettextCatalog.GetString ("Skipping '{0}' because it is already restored.", packageReference)); }
public PackageReferenceNode (PackageReference packageReference, bool installed, bool pending = false) { PackageReference = packageReference; Installed = installed; IsInstallPending = pending; }
void AddPackageReference(string packageId, string version) { var packageReference = new PackageReference(packageId, new Version(version), null); packageReferences.Add(packageReference); }
public void DeleteEntry(string id, SemanticVersion version) { var packageReference = new PackageReference(id, version, null, null, false, false); EntriesDeleted.Add(packageReference); }
bool IsPackageRestored (PackageReference packageReference) { return SolutionPackageRepository.IsRestored (packageReference); }