/// <summary> /// The method will return true if: /// 1. If a transitive dependency from the lock file is now added to the central file. /// or /// 1. If there is a mistmatch between the RequestedVersion of a lock file dependency marked as CentralTransitive and the the version specified in the central package management file. /// or /// 2. If a central version that is a transitive dependency is removed from CPVM the lock file is invalidated. /// </summary> private static bool HasProjectTransitiveDependencyChanged( IDictionary <string, CentralPackageVersion> centralPackageVersions, IList <LockFileDependency> lockFileCentralTransitiveDependencies, IList <LockFileDependency> lockTransitiveDependencies) { // Transitive dependencies moved to be centraly managed will invalidate the lock file var transitiveDependenciesMovedToBeManagedCentrally = lockTransitiveDependencies.Where(dep => centralPackageVersions.ContainsKey(dep.Id)); if (transitiveDependenciesMovedToBeManagedCentrally.Any()) { return(true); } foreach (var lockFileDependencyEnforcedByCPV in lockFileCentralTransitiveDependencies) { if (centralPackageVersions.TryGetValue(lockFileDependencyEnforcedByCPV.Id, out var centralPackageVersion)) { if (centralPackageVersion != null && !EqualityUtility.EqualsWithNullCheck(lockFileDependencyEnforcedByCPV.RequestedVersion, centralPackageVersion.VersionRange)) { return(true); } continue; } // The central version was removed return(true); } return(false); }
public bool Equals(ProjectRestoreMetadata other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ProjectStyle == other.ProjectStyle && ProjectPath == other.ProjectPath && ProjectJsonPath == other.ProjectJsonPath && OutputPath == other.OutputPath && ProjectName == other.ProjectName && ProjectUniqueName == other.ProjectUniqueName && EqualityUtility.SequenceEqualWithNullCheck(Sources, other.Sources) && PackagesPath == other.PackagesPath && EqualityUtility.SequenceEqualWithNullCheck(ConfigFilePaths, other.ConfigFilePaths) && EqualityUtility.SequenceEqualWithNullCheck(FallbackFolders, other.FallbackFolders) && EqualityUtility.SequenceEqualWithNullCheck(TargetFrameworks, other.TargetFrameworks) && EqualityUtility.SequenceEqualWithNullCheck(OriginalTargetFrameworks, other.OriginalTargetFrameworks) && CrossTargeting == other.CrossTargeting && LegacyPackagesDirectory == other.LegacyPackagesDirectory && ValidateRuntimeAssets == other.ValidateRuntimeAssets && SkipContentFileWrite == other.SkipContentFileWrite && EqualityUtility.SequenceEqualWithNullCheck(Files, other.Files) && EqualityUtility.EqualsWithNullCheck(ProjectWideWarningProperties, other.ProjectWideWarningProperties)); }
public bool Equals(ProjectRestoreMetadata other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(ProjectStyle == other.ProjectStyle && PathUtility.GetStringComparerBasedOnOS().Equals(ProjectPath, other.ProjectPath) && PathUtility.GetStringComparerBasedOnOS().Equals(ProjectJsonPath, other.ProjectJsonPath) && PathUtility.GetStringComparerBasedOnOS().Equals(OutputPath, other.OutputPath) && PathUtility.GetStringComparerBasedOnOS().Equals(ProjectName, other.ProjectName) && PathUtility.GetStringComparerBasedOnOS().Equals(ProjectUniqueName, other.ProjectUniqueName) && Sources.OrderedEquals(other.Sources.Distinct(), source => source.Source, StringComparer.OrdinalIgnoreCase) && PathUtility.GetStringComparerBasedOnOS().Equals(PackagesPath, other.PackagesPath) && ConfigFilePaths.OrderedEquals(other.ConfigFilePaths, filePath => filePath, PathUtility.GetStringComparerBasedOnOS(), PathUtility.GetStringComparerBasedOnOS()) && FallbackFolders.OrderedEquals(other.FallbackFolders, fallbackFolder => fallbackFolder, PathUtility.GetStringComparerBasedOnOS(), PathUtility.GetStringComparerBasedOnOS()) && EqualityUtility.SequenceEqualWithNullCheck(TargetFrameworks, other.TargetFrameworks) && OriginalTargetFrameworks.OrderedEquals(other.OriginalTargetFrameworks, fw => fw, StringComparer.OrdinalIgnoreCase, StringComparer.OrdinalIgnoreCase) && CrossTargeting == other.CrossTargeting && LegacyPackagesDirectory == other.LegacyPackagesDirectory && ValidateRuntimeAssets == other.ValidateRuntimeAssets && SkipContentFileWrite == other.SkipContentFileWrite && EqualityUtility.SequenceEqualWithNullCheck(Files, other.Files) && EqualityUtility.EqualsWithNullCheck(ProjectWideWarningProperties, other.ProjectWideWarningProperties)); }
private static bool HasProjectDependencyChanged(IEnumerable <LibraryDependency> newDependencies, IEnumerable <LockFileDependency> lockFileDependencies) { // If the count is not the same, something has changed. // Otherwise we N^2 walk below determines whether anything has changed. var newPackageDependencies = newDependencies.Where(dep => dep.LibraryRange.TypeConstraint == LibraryDependencyTarget.Package); if (newPackageDependencies.Count() != lockFileDependencies.Count()) { return(true); } foreach (var dependency in newPackageDependencies) { var lockFileDependency = lockFileDependencies.FirstOrDefault(d => StringComparer.OrdinalIgnoreCase.Equals(d.Id, dependency.Name)); if (lockFileDependency == null || !EqualityUtility.EqualsWithNullCheck(lockFileDependency.RequestedVersion, dependency.LibraryRange.VersionRange)) { // dependency has changed and lock file is out of sync. return(true); } } // no dependency changed. Lock file is still valid. return(false); }
public static bool IsLockFileStillValid(DependencyGraphSpec dgSpec, PackagesLockFile nuGetLockFile) { var uniqueName = dgSpec.Restore.First(); var project = dgSpec.GetProjectSpec(uniqueName); // Validate all the direct dependencies foreach (var framework in project.TargetFrameworks) { var target = nuGetLockFile.Targets.FirstOrDefault( t => EqualityUtility.EqualsWithNullCheck(t.TargetFramework, framework.FrameworkName)); if (target != null) { var directDependencies = target.Dependencies.Where(dep => dep.Type == PackageDependencyType.Direct); if (HasProjectDependencyChanged(framework.Dependencies, directDependencies)) { // lock file is out of sync return(false); } } } // Validate all P2P references foreach (var p2p in dgSpec.Projects) { if (PathUtility.GetStringComparerBasedOnOS().Equals(p2p.RestoreMetadata.ProjectUniqueName, uniqueName)) { continue; } var projectName = Path.GetFileNameWithoutExtension(p2p.RestoreMetadata.ProjectPath); foreach (var framework in p2p.TargetFrameworks) { var target = nuGetLockFile.Targets.FirstOrDefault( t => EqualityUtility.EqualsWithNullCheck(t.TargetFramework, framework.FrameworkName)); if (target != null) { var projectDependency = target.Dependencies.FirstOrDefault( dep => dep.Type == PackageDependencyType.Project && PathUtility.GetStringComparerBasedOnOS().Equals(dep.Id, projectName)); if (HasP2PDependencyChanged(framework.Dependencies, projectDependency)) { // lock file is out of sync return(false); } } } } return(true); }
private static (bool, string) HasDirectPackageDependencyChanged(IEnumerable <LibraryDependency> newDependencies, IEnumerable <LockFileDependency> lockFileDependencies, NuGetFramework nuGetFramework) { // If the count is not the same, something has changed. // Otherwise the N^2 walk below determines whether anything has changed. var newPackageDependencies = newDependencies.Where(dep => dep.LibraryRange.TypeConstraint == LibraryDependencyTarget.Package); var newPackageDependenciesCount = newPackageDependencies.Count(); var lockFileDependenciesCount = lockFileDependencies.Count(); if (newPackageDependenciesCount != lockFileDependenciesCount) { return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_PackageReferencesHaveChanged, nuGetFramework.GetShortFolderName(), lockFileDependenciesCount > 0 ? string.Join(", ", lockFileDependencies.Select(e => e.Id + ":" + e.RequestedVersion.ToNormalizedString()).OrderBy(dep => dep)) : Strings.None, newPackageDependenciesCount > 0 ? string.Join(", ", newPackageDependencies.Select(e => e.LibraryRange.Name + ":" + e.LibraryRange.VersionRange.ToNormalizedString()).OrderBy(dep => dep)) : Strings.None) ); } foreach (var dependency in newPackageDependencies) { var lockFileDependency = lockFileDependencies.FirstOrDefault(d => StringComparer.OrdinalIgnoreCase.Equals(d.Id, dependency.Name)); if (lockFileDependency == null) { // dependency has changed and lock file is out of sync. return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_PackageReferenceAdded, dependency.Name, nuGetFramework.GetShortFolderName()) ); } if (!EqualityUtility.EqualsWithNullCheck(lockFileDependency.RequestedVersion, dependency.LibraryRange.VersionRange)) { // dependency has changed and lock file is out of sync. return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_PackageReferenceVersionChanged, dependency.Name, lockFileDependency.RequestedVersion.ToNormalizedString(), dependency.LibraryRange.VersionRange.ToNormalizedString()) ); } } // no dependency changed. Lock file is still valid. return(false, string.Empty); }
/// <summary> /// The method will return true if: /// 1. If a transitive dependency from the lock file is now added to the central file. /// or /// 1. If there is a mistmatch between the RequestedVersion of a lock file dependency marked as CentralTransitive and the the version specified in the central package management file. /// or /// 2. If a central version that is a transitive dependency is removed from CPVM the lock file is invalidated. /// </summary> private static (bool, string) HasProjectTransitiveDependencyChanged( IDictionary <string, CentralPackageVersion> centralPackageVersions, IList <LockFileDependency> lockFileCentralTransitiveDependencies, IList <LockFileDependency> lockTransitiveDependencies) { // Transitive dependencies moved to be centraly managed will invalidate the lock file LockFileDependency dependency = lockTransitiveDependencies.FirstOrDefault(dep => centralPackageVersions.ContainsKey(dep.Id)); if (dependency != null) { return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_ProjectTransitiveDependencyChanged, dependency.Id ) ); } foreach (var lockFileDependencyEnforcedByCPV in lockFileCentralTransitiveDependencies) { if (centralPackageVersions.TryGetValue(lockFileDependencyEnforcedByCPV.Id, out var centralPackageVersion)) { if (centralPackageVersion != null && !EqualityUtility.EqualsWithNullCheck(lockFileDependencyEnforcedByCPV.RequestedVersion, centralPackageVersion.VersionRange)) { return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_ProjectTransitiveDependencyVersionChanged, lockFileDependencyEnforcedByCPV.RequestedVersion.ToNormalizedString(), centralPackageVersion.VersionRange.ToNormalizedString() ) ); } continue; } // The central version was removed return(true, string.Format( CultureInfo.CurrentCulture, Strings.PackagesLockFile_CentralPackageVersionRemoved, lockFileDependencyEnforcedByCPV.Id ) ); } return(false, string.Empty); }
public bool Equals(DownloadDependency other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Name.Equals(other.Name, StringComparison.OrdinalIgnoreCase) && EqualityUtility.EqualsWithNullCheck(VersionRange, other.VersionRange)); }
public bool Equals(ProjectRestoreMetadataFrameworkInfo other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) && EqualityUtility.SequenceEqualWithNullCheck(ProjectReferences, other.ProjectReferences)); }
public bool Equals(ProjectRestoreMetadataFrameworkInfo other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) && ProjectReferences.OrderedEquals(other.ProjectReferences, e => e.ProjectPath, PathUtility.GetStringComparerBasedOnOS())); }
public bool Equals(LockFileDependency x, LockFileDependency y) { if (ReferenceEquals(x, y)) { return(true); } if (x == null || y == null) { return(false); } return(StringComparer.OrdinalIgnoreCase.Equals(x.Id, y.Id) && EqualityUtility.EqualsWithNullCheck(x.ResolvedVersion, y.ResolvedVersion)); }
public bool Equals(PackOptions other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(PackageType.SequenceEqualWithNullCheck(other.PackageType) && Mappings.SequenceEqualWithNullCheck(other.Mappings) && EqualityUtility.EqualsWithNullCheck(IncludeExcludeFiles, other.IncludeExcludeFiles)); }
public bool Equals(DependencyNode other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(IsProject == other.IsProject && string.Equals(Id, other.Id, StringComparison.OrdinalIgnoreCase) && EqualityUtility.EqualsWithNullCheck(NodeWarningProperties, other.NodeWarningProperties)); }
public bool Equals(TrustedSource other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(string.Equals(SourceName, other.SourceName, StringComparison.CurrentCultureIgnoreCase) && EqualityUtility.EqualsWithNullCheck(ServiceIndex, other.ServiceIndex) && EqualityUtility.SetEqualsWithNullCheck(Certificates, other.Certificates)); }
/// <summary> /// Equals implementation for VersionRange. /// </summary> public bool Equals(VersionRange other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(base.Equals(other) && IsFloating == other.IsFloating && EqualityUtility.EqualsWithNullCheck(Float, other.Float)); }
public bool Equals(TargetFrameworkInformation other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) && Dependencies.SequenceEqualWithNullCheck(other.Dependencies) && Imports.SequenceEqualWithNullCheck(other.Imports)); }
public bool Equals(WarningPropertiesCollection other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(ProjectWideWarningProperties, other.ProjectWideWarningProperties) && EqualityUtility.EqualsWithNullCheck(PackageSpecificWarningProperties, other.PackageSpecificWarningProperties) && EqualityUtility.OrderedEquals(ProjectFrameworks, other.ProjectFrameworks, (fx) => fx.Framework, orderComparer: StringComparer.OrdinalIgnoreCase, sequenceComparer: new NuGetFrameworkFullComparer())); }
private static bool HasProjectDependencyChanged(IEnumerable <LibraryDependency> newDependencies, IEnumerable <LockFileDependency> lockFileDependencies) { foreach (var dependency in newDependencies.Where(dep => dep.LibraryRange.TypeConstraint == LibraryDependencyTarget.Package)) { var lockFileDependency = lockFileDependencies.FirstOrDefault(d => StringComparer.OrdinalIgnoreCase.Equals(d.Id, dependency.Name)); if (lockFileDependency == null || !EqualityUtility.EqualsWithNullCheck(lockFileDependency.RequestedVersion, dependency.LibraryRange.VersionRange)) { // dependency has changed and lock file is out of sync. return(true); } } // no dependency changed. Lock file is still valid. return(false); }
public static void UpdatePackageReferenceMetadata( LockFile lockFile, FallbackPackagePathResolver pathResolver, PackageIdentity package) { var info = pathResolver.GetPackageInfo(package.Id, package.Version); if (info == null) { // don't do anything if package was not resolved on disk return; } var nuspecFilePath = info.PathResolver.GetManifestFilePath(package.Id, package.Version); var nuspecReader = new NuspecReader(nuspecFilePath); var developmentDependency = nuspecReader.GetDevelopmentDependency(); if (developmentDependency) { foreach (var frameworkInfo in lockFile.PackageSpec.TargetFrameworks .OrderBy(framework => framework.FrameworkName.ToString(), StringComparer.Ordinal)) { var dependency = frameworkInfo.Dependencies.First(dep => dep.Name.Equals(package.Id, StringComparison.OrdinalIgnoreCase)); if (dependency?.SuppressParent == LibraryIncludeFlagUtils.DefaultSuppressParent && dependency?.IncludeType == LibraryIncludeFlags.All) { var includeType = LibraryIncludeFlags.All & ~LibraryIncludeFlags.Compile; dependency.SuppressParent = LibraryIncludeFlags.All; dependency.IncludeType = includeType; // update lock file target libraries foreach (var target in lockFile.Targets .Where(t => EqualityUtility.EqualsWithNullCheck(t.TargetFramework, frameworkInfo.FrameworkName))) { var targetLibrary = target.GetTargetLibrary(package.Id); if (targetLibrary != null) { LockFileUtils.ExcludeItems(targetLibrary, includeType); } } } } } }
public bool Equals(SignatureLog other) { if (other == null) { return(false); } else if (ReferenceEquals(this, other)) { return(true); } return(Equals(Level, other.Level) && Equals(Code, other.Code) && EqualityUtility.EqualsWithNullCheck(LibraryId, other.LibraryId) && EqualityUtility.EqualsWithNullCheck(ProjectPath, other.ProjectPath) && EqualityUtility.EqualsWithNullCheck(Message, other.Message)); }
public bool Equals(TargetFrameworkInformation other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) && Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Name, StringComparer.OrdinalIgnoreCase) && Imports.SequenceEqualWithNullCheck(other.Imports) && AssetTargetFallback == other.AssetTargetFallback); }
private static bool HasP2PDependencyChanged(IEnumerable <LibraryDependency> newDependencies, IEnumerable <ProjectRestoreReference> projectRestoreReferences, LockFileDependency projectDependency, DependencyGraphSpec dgSpec) { if (projectDependency == null) { // project dependency doesn't exists in lock file so it's out of sync. return(true); } // If the count is not the same, something has changed. // Otherwise we N^2 walk below determines whether anything has changed. var transitivelyFlowingDependencies = newDependencies.Where( dep => dep.LibraryRange.TypeConstraint == LibraryDependencyTarget.Package && dep.SuppressParent != LibraryIncludeFlags.All); var transitivelyFlowingProjectReferences = projectRestoreReferences.Where(e => e.PrivateAssets != LibraryIncludeFlags.All); if (transitivelyFlowingDependencies.Count() + transitivelyFlowingProjectReferences.Count() != projectDependency.Dependencies.Count) { return(true); } foreach (var dependency in transitivelyFlowingDependencies) { var matchedP2PLibrary = projectDependency.Dependencies.FirstOrDefault(dep => StringComparer.OrdinalIgnoreCase.Equals(dep.Id, dependency.Name)); if (matchedP2PLibrary == null || !EqualityUtility.EqualsWithNullCheck(matchedP2PLibrary.VersionRange, dependency.LibraryRange.VersionRange)) { // P2P dependency has changed and lock file is out of sync. return(true); } } foreach (var dependency in transitivelyFlowingProjectReferences) { var referenceSpec = dgSpec.GetProjectSpec(dependency.ProjectUniqueName); var matchedP2PLibrary = projectDependency.Dependencies.FirstOrDefault(dep => StringComparer.OrdinalIgnoreCase.Equals(dep.Id, referenceSpec.Name)); if (matchedP2PLibrary == null) // Do not check the version for the projects, or else https://github.com/nuget/home/issues/7935 { // P2P dependency has changed and lock file is out of sync. return(true); } } // no dependency changed. Lock file is still valid. return(false); }
public bool Equals(LockFileDependency x, LockFileDependency y) { if (ReferenceEquals(x, y)) { return(true); } if (x == null || y == null) { return(false); } return(LockFileDependencyIdVersionComparer.Default.Equals(x, y) && x.Type == y.Type && EqualityUtility.EqualsWithNullCheck(x.RequestedVersion, y.RequestedVersion) && EqualityUtility.SequenceEqualWithNullCheck(x.Dependencies, y.Dependencies)); }
public bool Equals(LibraryDependency other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(AutoReferenced == other.AutoReferenced && EqualityUtility.EqualsWithNullCheck(LibraryRange, other.LibraryRange) && EqualityUtility.EqualsWithNullCheck(Type, other.Type) && IncludeType == other.IncludeType && SuppressParent == other.SuppressParent); }
public bool Equals(LockFile other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(Version == other.Version && ProjectFileDependencyGroups.OrderedEquals(other.ProjectFileDependencyGroups, group => group.FrameworkName, StringComparer.OrdinalIgnoreCase) && Libraries.OrderedEquals(other.Libraries, library => library.Name, StringComparer.OrdinalIgnoreCase) && Targets.OrderedEquals(other.Targets, target => target.Name, StringComparer.Ordinal) && PackageFolders.SequenceEqual(other.PackageFolders) && EqualityUtility.EqualsWithNullCheck(PackageSpec, other.PackageSpec)); }
public bool Equals(LockFileDependency other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(StringComparer.OrdinalIgnoreCase.Equals(Id, other.Id) && EqualityUtility.EqualsWithNullCheck(ResolvedVersion, other.ResolvedVersion) && EqualityUtility.EqualsWithNullCheck(RequestedVersion, other.RequestedVersion) && EqualityUtility.SequenceEqualWithNullCheck(Dependencies, other.Dependencies) && Sha512 == other.Sha512 && Type == other.Type); }
public bool Equals(TargetFrameworkInformation other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(EqualityUtility.EqualsWithNullCheck(FrameworkName, other.FrameworkName) && Dependencies.OrderedEquals(other.Dependencies, dependency => dependency.Name, StringComparer.OrdinalIgnoreCase) && Imports.SequenceEqualWithNullCheck(other.Imports) && AssetTargetFallback == other.AssetTargetFallback && DownloadDependencies.OrderedEquals(other.DownloadDependencies, dep => dep) && FrameworkReferences.OrderedEquals(other.FrameworkReferences, fr => fr) && string.Equals(RuntimeIdentifierGraphPath, other.RuntimeIdentifierGraphPath)); }
public bool Equals(LibraryDependency other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } return(AutoReferenced == other.AutoReferenced && EqualityUtility.EqualsWithNullCheck(LibraryRange, other.LibraryRange) && EqualityUtility.EqualsWithNullCheck(Type, other.Type) && IncludeType == other.IncludeType && SuppressParent == other.SuppressParent && NoWarn.SequenceEqualWithNullCheck(other.NoWarn) && GeneratePathProperty == other.GeneratePathProperty); }
public bool Equals(PackageSpec other) { if (other == null) { return(false); } if (ReferenceEquals(this, other)) { return(true); } // Name and FilePath are not used for comparison since they are not serialized to JSON. return(Title == other.Title && EqualityUtility.EqualsWithNullCheck(Version, other.Version) && IsDefaultVersion == other.IsDefaultVersion && HasVersionSnapshot == other.HasVersionSnapshot && Description == other.Description && Summary == other.Summary && ReleaseNotes == other.ReleaseNotes && EqualityUtility.SequenceEqualWithNullCheck(Authors, other.Authors) && EqualityUtility.SequenceEqualWithNullCheck(Owners, other.Owners) && ProjectUrl == other.ProjectUrl && IconUrl == other.IconUrl && LicenseUrl == other.LicenseUrl && RequireLicenseAcceptance == other.RequireLicenseAcceptance && Copyright == other.Copyright && Language == other.Language && EqualityUtility.EqualsWithNullCheck(BuildOptions, other.BuildOptions) && EqualityUtility.SequenceEqualWithNullCheck(Tags, other.Tags) && EqualityUtility.SequenceEqualWithNullCheck(ContentFiles, other.ContentFiles) && EqualityUtility.SequenceEqualWithNullCheck(Dependencies, other.Dependencies) && EqualityUtility.DictionaryOfSequenceEquals(Scripts, other.Scripts) && EqualityUtility.DictionaryEquals(PackInclude, other.PackInclude, (s, o) => StringComparer.Ordinal.Equals(s, o)) && EqualityUtility.EqualsWithNullCheck(PackOptions, other.PackOptions) && EqualityUtility.SequenceEqualWithNullCheck(TargetFrameworks, other.TargetFrameworks) && EqualityUtility.EqualsWithNullCheck(RuntimeGraph, other.RuntimeGraph) && EqualityUtility.EqualsWithNullCheck(RestoreMetadata, other.RestoreMetadata)); }
private static bool HasP2PDependencyChanged(IEnumerable <LibraryDependency> newDependencies, LockFileDependency projectDependency) { if (projectDependency == null) { // project dependency doesn't exists in lock file so it's out of sync. return(true); } foreach (var dependency in newDependencies.Where(dep => dep.LibraryRange.TypeConstraint == LibraryDependencyTarget.Package)) { var matchedP2PLibrary = projectDependency.Dependencies.FirstOrDefault(dep => StringComparer.OrdinalIgnoreCase.Equals(dep.Id, dependency.Name)); if (matchedP2PLibrary == null || !EqualityUtility.EqualsWithNullCheck(matchedP2PLibrary.VersionRange, dependency.LibraryRange.VersionRange)) { // P2P dependency has changed and lock file is out of sync. return(true); } } // no dependency changed. Lock file is still valid. return(false); }