Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor PackageDependencies property #9803

Merged
merged 10 commits into from
Jun 27, 2019

Conversation

scottmitchell
Copy link
Collaborator

@scottmitchell scottmitchell commented Jun 19, 2019

Purpose

This PR addresses https://jira.autodesk.com/browse/DYN-1997 and also simplifies the package dependency collection process.
This PR removes LoadedPackageDependencies property and refactors PackageDependencies property/collection and PackageDependencyInfo object.

  • Only one package should be listed as a dependency for a node
  • By default, the original deserialized package dependency should be maintained
  • API to override the original dependency with the local dependency
  • Unit test
  • Adds new PackageInfo type.
  • Adds IsLoaded property to PackageDependencyInfo
  • Simplifies package dependency collection process

This should fix the case found by @QilongTang where a node can have two package dependencies when multiple packages are loaded with the same custom node. Previously, both the deserialized package dependency and the collected package dependency of a single node could be contained in the PackageDependencies property of a workspace. Now, the original package dependency is maintained until it is voided using VoidNodeDependency(). After the original dependency has been voided, the local package dependency will be used for serialization.

Declarations

Check these if you believe they are true

  • The code base is in a better state after this PR
  • Is documented according to the standards
  • The level of testing this PR includes is appropriate
  • User facing strings, if any, are extracted into *.resx files
  • All tests pass using the self-service CI.
  • Snapshot of UI changes, if any.
  • Changes to the API follow Semantic Versioning, and are documented in the API Changes document.

Reviewers

@mjkkirschner @aparajit-pratap @QilongTang @ColinDayOrg

@mjkkirschner
Copy link
Member

mjkkirschner commented Jun 19, 2019

so this does not address the underlying issue right? (as you said above) - the point brought up by @ColinDayOrg - that likely which package is loaded depends on load order. IE if you restart Dynamo you might load packages in a different order than if install them manually in a single session.

@scottmitchell
Copy link
Collaborator Author

@mjkkirschner Right, this PR just allows package dependency collection to deal with cases where multiple packages, or versions of packages, are able to resolve nodes. The underlying issue will be addressed later, as the outcome of @aparajit-pratap 's spike into the issue.

@mjkkirschner
Copy link
Member

@scottmitchell this looks good to me - can you also cherry pick to 2.3 branch.

bool matchFound = false;
// Check if the target package is installed and loaded.
foreach (var loadedPackage in ws.LoadedPackageDependencies)
if (package.IsLoaded)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Much easier to refresh UI now, great. The only question is that how costly to maintain this property on each node add operation, would love to know how slow it is

@QilongTang
Copy link
Contributor

LGTM

@aparajit-pratap
Copy link
Contributor

aparajit-pratap commented Jun 21, 2019

@scottmitchell I have a DYN file with package dependency as clockwork 1.x and the same package installed. However when I load the file, I still see package dependency 1.x to be missing (in red). I tried the same thing with 2.x; existing DYN file with package dependency serialized as 2.x, and 2.x locally installed. Same issue; 2.x is still missing in view extension.

Could you please test manually at your end to verify.

@mjkkirschner
Copy link
Member

@scottmitchell since we all missed that bug except @aparajit-pratap 🦅 - can we add a test for it?

@scottmitchell scottmitchell merged commit ffed170 into DynamoDS:master Jun 27, 2019
scottmitchell added a commit to scottmitchell/Dynamo that referenced this pull request Jun 28, 2019
* Refactor PackageDependencies property

* Add test to verify multiple packages not listed as dependencies for one node

* Keep original package dependency by default and add API to void original package dependency

* Add comment

* Move helper methods out of properties region

* Fix IsLoaded logic

* Update test .dyn to avoid serialization test failures

* Exclude new dyn from serialization tests

* Use preexisting method to exclude test dyn from serialization tests
scottmitchell added a commit that referenced this pull request Jun 28, 2019
* Refactor PackageDependencies property

* Add test to verify multiple packages not listed as dependencies for one node

* Keep original package dependency by default and add API to void original package dependency

* Add comment

* Move helper methods out of properties region

* Fix IsLoaded logic

* Update test .dyn to avoid serialization test failures

* Exclude new dyn from serialization tests

* Use preexisting method to exclude test dyn from serialization tests
mjkkirschner pushed a commit that referenced this pull request Aug 3, 2019
* Refactor PackageDependencies property

* Add test to verify multiple packages not listed as dependencies for one node

* Keep original package dependency by default and add API to void original package dependency

* Add comment

* Move helper methods out of properties region

* Fix IsLoaded logic

* Update test .dyn to avoid serialization test failures

* Exclude new dyn from serialization tests

* Use preexisting method to exclude test dyn from serialization tests
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants