@@ -1580,15 +1580,26 @@ internal static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoV
15801580 }
15811581 }
15821582
1583- // We need to get the compatibility matrix from the cached package list
1584- // in order to show the correct compatibility matrix in the UI.
1585- // We are still running the risk of having a higher version of the local package
1586- // leading to a null result for the compatibility matrix.
1587- var cachedPackage = dynamoViewModel . PackageManagerClientViewModel . CachedPackageList
1588- . FirstOrDefault ( x => x . Name == pkg . Name ) ;
1589- var version = cachedPackage ? . Header . versions
1590- . FirstOrDefault ( v => v . version . Equals ( pkg . VersionName ) ) ;
1591- var compatibility_matrix = version ? . compatibility_matrix ;
1583+ // First check if the local package has the compatibility info
1584+ var compatibility_matrix = pkg . CompatibilityMatrix ?? pkg . Header ? . compatibility_matrix ;
1585+ //If we do not find compatibility info in the local package, we will check the cached packages
1586+ if ( compatibility_matrix == null )
1587+ {
1588+ // We need to get the compatibility matrix from the cached package list
1589+ // in order to show the correct compatibility matrix in the UI.
1590+ // We are still running the risk of having a higher version of the local package
1591+ // leading to a null result for the compatibility matrix, in which case we will not pre-fill the compatibility info..
1592+ var cachedPackage = dynamoViewModel . PackageManagerClientViewModel . CachedPackageList
1593+ . FirstOrDefault ( x => x . Name == pkg . Name ) ;
1594+ var version = cachedPackage ? . Header . versions
1595+ . FirstOrDefault ( v => v . version . Equals ( pkg . VersionName ) ) ;
1596+ compatibility_matrix = version ? . compatibility_matrix ?
1597+ . Select ( entry => new PackageCompatibility (
1598+ entry . name ,
1599+ entry . versions != null ? new List < string > ( entry . versions ) : null ,
1600+ entry . min ,
1601+ entry . max ) ) ;
1602+ }
15921603
15931604 var pkgViewModel = new PublishPackageViewModel ( dynamoViewModel )
15941605 {
@@ -1609,13 +1620,7 @@ internal static PublishPackageViewModel FromLocalPackage(DynamoViewModel dynamoV
16091620 CurrentPackageRootDirectories = new List < string > { pkg . RootDirectory } ,
16101621 //default retain folder structure to true when publishing a new version from local.
16111622 RetainFolderStructureOverride = retainFolderStructure ,
1612- CompatibilityMatrix = compatibility_matrix ?
1613- . Select ( entry => new PackageCompatibility (
1614- entry . name ,
1615- entry . versions != null ? new List < string > ( entry . versions ) : null ,
1616- entry . min ,
1617- entry . max ) )
1618- . ToList ( )
1623+ CompatibilityMatrix = compatibility_matrix ? . ToList ( ) ,
16191624 } ;
16201625
16211626 // add additional files
@@ -2570,7 +2575,7 @@ internal IEnumerable<string> BuildPackage()
25702575 Package . RepositoryUrl = RepositoryUrl ;
25712576 Package . CopyrightHolder = string . IsNullOrEmpty ( CopyrightHolder ) ? dynamoViewModel . Model . AuthenticationManager ? . Username : CopyrightHolder ;
25722577 Package . CopyrightYear = string . IsNullOrEmpty ( CopyrightYear ) ? DateTime . Now . Year . ToString ( ) : copyrightYear ;
2573- Package . Header . compatibility_matrix = CompatibilityMatrix ; // New - CompatibilityMatrix, Dynamo 3.5
2578+ Package . SetCompatibility ( CompatibilityMatrix ) ; // New - CompatibilityMatrix, Dynamo 3.5
25742579 Package . Header . release_notes_url = ReleaseNotesUrl ; // New - ReleaseNotesUrl, Dynamo 3.5
25752580
25762581 AppendPackageContents ( ) ;
0 commit comments