-
Notifications
You must be signed in to change notification settings - Fork 668
LibG lookup logic update to include more clients and more tolerant #9309
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
Conversation
|
I didn't see any reviewers assigned so I took a look. Other than two minor comments, LGTM. |
|
Addressed all the comments, installing latest Civil3D to test. |
|
@mjkkirschner @aparajit-pratap ASM version from latest Civil3D: Maybe it is worth to test by copying the 225 final release into the install folder? |
| /// version info as Tuple of the file found in the installation based | ||
| /// on file search pattern. The returned list is sorted based on version | ||
| /// info.</returns> | ||
| [Obsolete("Function will be deprecated in Dynamo 3.0, please use FindProductInstallations2")] |
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 message seems a bit odd to me - in Dynamo 3.0 we can just use this method again - now we have to obsolete this method and use the new one.
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.
If no objection, I will change to say the function signature will change in Dynamo 3.0?
|
@QilongTang this looks solid - a couple thoughts for you, and can you add a test to the preloaderTests file which tries to find a faked folder using the lookup logic - I think some of the other tests in there should be an okay model to follow. |
|
I found a bug during unit testing in the case that when multiple ADSK products there delivering same version of ASM, I am going to try use Lookup<key,value> instead of Dictionary for version to ASM location mapping |
|
@QilongTang one thing I would like you to think about is making this same behavior work for clients who load ASM directly - like revit- did you get a chance to make this behavior work for those clients that call PreloadASM directly? - I think thats actually more important than making sandbox more robust. |
| [Obsolete("Function signature will change in Dynamo 3.0, please refer to FindProductInstallations2")] | ||
| public static IEnumerable FindProductInstallations(string productSearchPattern, string fileSearchPattern) | ||
| { | ||
| return FindProductInstallations2(new List<string>() { productSearchPattern }, fileSearchPattern); |
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.
Since the new function has a different parameter type than the old one, it can keep the same name, correct? You don't really need to append the 2 to the name?
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.
They have the same number of parameters, but because the types are sufficiently different I think it might be okay to have the same name.
Sometimes unexpected source level breaks occur when adding overloads -
https://stackoverflow.com/questions/1456785/a-definitive-guide-to-api-breaking-changes-in-net
I don't think we would hit that here since these are not interfaces and the types should not be overlapping.
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.
@mjkkirschner @aparajit-pratap Good point, I will keep the original function and remove the obsolete message. However, I can't keep the same function name because this will introduce ambiguity since the function is currently being called by reflection.
|
@mjkkirschner @aparajit-pratap All the CI tests pass, I had one error on @mjkkirschner I plan to add the libg folder validation in a different PR |
|
LGTM |
| new Version(223,0,1), | ||
| new Version(222,0,0), | ||
| new Version(221,0,0), | ||
| new Version(224,7,0) |
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.
@QilongTang I know this is just a test but double checking version 224 or 224.4 is not required?
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.
I can leave it there but as long as a newer version below is there, we will search by the latest so in this test it does not make a difference. Do you suggest another test which contains multiple newer versions within the same major?
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.
@alfarok This case of 224.7.0 falling back to 224.4.0 is equivalent to the test I added below of 225.4.0 falling back to 225.0.0
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.
@QilongTang Not a big deal, I wasn't sure why only 224,7,0 was removed. I also thought maybe it was supposed to by 224,4,0
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.
Great. I know this ASM could be confusing for multiple clients, let me find a good time to knowledge share with you guys.
| new Version(221,0,0), | ||
| // Notice the lookup version here is different than the actual found version below | ||
| // because there is no local mocked product with that specific ASM version installed | ||
| new Version(225,4,0) |
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.
should this be 225,0,0?
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.
We specifically want to make it 225,4,0 in this test because this test is to test the fall back case that user does not have an exact matching ASM locally but has a version within same major. In this case, we want to load that version instead of stepping down or fallback to ASM in libG folder
|
|
||
| }; | ||
|
|
||
| var newestASM = new Version(225, 4, 0); |
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 same question here, does the 4 not represent the minor version?
| versions, ref foundPath, rootFolder, (path) => { return mockedInstalledASMs; }); | ||
|
|
||
| // The found version in this case is a fallback of lowest version within same major which should be 225.0.0 | ||
| Assert.AreNotEqual(newestASM, foundVersion); |
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.
@alfarok See here, the newest (which is target version) and found are meant to be different.
|
Merging. |



Please Note:
DynamoRevitrepo will need to be cherry-picked into all the DynamoRevit Release branches that Dynamo supports. Contributors will be responsible for cherry-picking their reviewed commits to the other branches after aLGTMlabel is added to the PR.Purpose
DYN-974
As a Dynamo Client, I want LibG fallback to most compatible major version.
This PR:
Debug picture sample as below, you can see both Revit and Civil3D with ASM are found:

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
*.resxfilesAll tests pass using the self-service CI.

Running self-CI and all libG preload tests should pass including the new ones added in this PR:
Snapshot of UI changes, if any.
Changes to the API follow Semantic Versioning, and are documented in the API Changes document.
Reviewers
@aparajit-pratap @ColinDayOrg @mjkkirschner @alfarok
FYIs
@kronz