-
Notifications
You must be signed in to change notification settings - Fork 635
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
Enable package node migration for Dynamo Core 2.0+ graphs #9306
Conversation
…d with packages for 2.0+ graphs
var priorNames = libraryServices.GetPriorNames(); | ||
FunctionDescriptor functionDescriptor; | ||
|
||
// Attempt to located a newer migrated version of the node |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sic(locate)?
FunctionDescriptor functionDescriptor; | ||
|
||
// Attempt to located a newer migrated version of the node | ||
if (priorNames.ContainsKey(mangledName)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just use TryGetValue
. You can check for the key and get the value at the key at the same time.
… JSON 2.0+ graphs
public ElementResolver ElementResolver { get; set; } | ||
//map of all loaded assemblies including LoadFrom context assemblies | ||
private Dictionary<string, List<Assembly>> loadedAssemblies; | ||
|
||
[Obsolete("This function will be removed in Dynamo 3.0, please use new NodeReadConverter method with additional parameters to support node migration.")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
constructor
@mjkkirschner @aparajit-pratap Hey guys, I think this one is ready for a final look when you get a free moment. |
@alfarok Question on nodeModel nodes renaming, instead of dong what you put as example, can I rename the node in the opposite way below?
|
@alfarok did you ever investigate if you could get rid of this
? |
I think some tests will break as they count the number of packages loaded from the test/pkgs folder. |
@QilongTang I haven't tried that but my assumption is that it could be used to migrate the node in the opposite direction? I think it makes more sense for the classes to be renamed so nodes can more clearly be traced back to their origin and keeps the 2 in sync. The library basically does the opposite when it was reorganized and now none of the locations truly represent the code locations/classes. |
@mjkkirschner I don't think it is required but am also a bit nervous about removing it thinking it may have been added for some strange edge case? What do you think? Also the self-serve is running one last time so I will update any tests that rely of the package count if required. |
@alfarok Good to know! I think people need to be aware of this is the preferred way |
this.manager = manager; | ||
this.libraryServices = libraryServices; | ||
this.nodeFactory = nodeFactory; | ||
this.isTestMode = isTestMode; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor but I think we avoid using this
as per existing coding conventions (which may have been forgotten along the way). Also if you use Resharper you'll see that a lot of these things are highlighted by the tool.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is the old code and this file in particular is filled with this
. Removing it in certain areas creates ambiguity between constructor parameters and class properties, such as above
nodeFactory.ResolveType(unresolvedName, out newType); | ||
|
||
if (newType != null) // If resolved update the type | ||
{ type = newType; } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here it is preferred to have a single curly brace on a line (don't know what happened to coding conventions once followed by the team):
// If resolved update the type
if (newType != null)
{
type = newType;
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oh wow, if we would like to get this topic up, please fix all the comments in this PR so they are in the same format 😉
//[space][Comment]
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry comments without a space were copied from the constructor I made obsolete, I would never commit such a crime 😂
@alfarok other than the harping about coding conventions this looks good to me. Thanks! |
@aparajit-pratap 🚨 🚓 guilty as charged, I don't think I've ever seen that doc before though |
LGTM |
…onal test package
Purpose
QNTM-5547
This PR restores the previous (1.3 and older) behavior for package node migration for JSON graphs (2.0+). For example, you can now migrate a packaged node that was built against Core 2.0 but was later renamed. We previously handled 1.3 (XML) to 2.0 (JSON) but never 2.0 to 2.0+.
Package Migration Strategies:
ZeroTouch nodes => Use a
Migrations.XML
file located in the packagesbin
folderNodeModel derived nodes => Use the
AlsoKnownAs
attribute on the classExamples:
MyZeroTouchLib.MyNodes.SayHello
toMyZeroTouchLib.MyNodes.SayHelloRENAMED
SampleLibraryUI.Examples.DropDownExample
toSampleLibraryUI.Examples.DropDownExampleRENAMED
Testing
migrations.xml
for ZeroTouch nodes[AlsoKnownAs]
attribute for the NodeModel nodeTest Cases:
Declarations
Check these if you believe they are true
*.resx
filesReviewers
@mjkkirschner @aparajit-pratap @QilongTang
FYIs
@johnpierson