Separated gestalt from NUI core code#47
Conversation
The former gestalt asset and module using classes have been moved into nui-gestalt5. The module nui-gestalt7 is a copy of nui-gestalt5 that has been updated to gestalt 7, due to API differences between the two versions.
…ltModuleClassLibrary.
|
Big fan overall! It enables Terasology to decouple these dependencies while upgrading, and it seems like it's a good thing for NUI too, as the API annotations weren't exactly for NUI's benefit. Refactored
|
The ModuleClassLibrary parameters have been renamed to urn instead, as they are treated as a ResourceUrn.
|
I've just pushed a commit that should rename the In terms of the areas of NUI that modules's shouldn't have access to, The NUI core libraries don't do any network/filesystem access directly that I'm aware of. The
There's an updated list of packages needed to get Terasology working with these changes here, although it's essentially everything in nui apart from the packages listed above. If #27 and gestalt 7 can remove the need for the whitelist afterwards though, then that's even better. |
|
I'm interested in moving forward with this quickly so we can keep up the momentum that's going in to Tersasology-on-gestalt-v7. I haven't seen anything in this PR that's raised red flags for me, but I hesitate to be the one to give it the "1 approving review" go-ahead because (a) a lot of the diff is from code moved from one place to another, and I'm not sure if any of it needs special attention, and (b) I don't have the experience with either NUI's implementation or usage to guess what the problems might be. The other question I have is: after we do approve this, how do we release the result? If NUI 2.0 users will be migrating to this, it doesn't make much sense to call it 1.5. |
DarkWeird
left a comment
There was a problem hiding this comment.
Looks good for me.
Maybe you count major version to v3? :D
merged from BenjaminAmos/gestalt-separation
Description
This pull request attempts to move all gestalt-using code out of the NUI core libraries (
nui-input,nui-reflectandnui). It does this for additional portability to non-gestalt platforms, as well as to make it easier to support both gestalt-5 and gestalt-7 within the same branch. This should hopefully make it easier to maintain NUI, as it effectively combines the1.0and2.0branches together. This does introduce some breaking changes, however their effect on UI code should be minimal. This will require some changes in implementing engine code though.The new
nui-gestalt5andnui-gestalt7libraries contain the previously gestalt-specific code but I have not changed the packages at the moment for compatibility reasons. They are essentially copies of each other but for their respective gestalt versions. As the asset classes are not typically changed as frequenly as the UI widgets, keeping thenui-gestalt5andnui-gestalt7in sync should be mostly possible as a temporary measure.I am not entirely sure about the
ClassLibrarychanges made here but I felt using potentially gestalt-specific patterns e.g. module urns as class look-up identifiers, was not suitably generic.This is a potential solution to #43 and an alternative to #46. This does not preserve any unique
2.xcommits though, as these changes are based on the considerably more up-to-date1.xbranch. I am not aware of any functional changes present in2.xare not present in1.x.Summary of Changes
@APIannotations fromnui,nui-inputandnui-reflectpackage-info.javafiles not containing package-level documentationUISkinno longer inherits fromAssetand no longer depends onUISkinDataUISkinDatahad been moved intonui-gestalt5/nui-gestalt7for compatibility. It is now just a wrapper around aUISkinUISkinAssetfromnui-gestalt5/nui-gestalt7is an asset containing aUISkininstancenui-gestalt5andnui-gestalt7ClassLibraryinterface to be less gestalt-specificMigration
Removed
@APIannotationsIn order for modules to have access to NUI packages after these changes, you will need to add the relevant packages to the API package whitelist.
Moved gestalt-dependant classes into
nui-gestalt5/nui-gestalt7If using gestalt 5, then you should add a dependency on the
nui-gestalt5package e.g.implementation 'org.terasology.nui:nui-gestalt5'If using gestalt 7, then you should add a dependency on the
nui-gestalt7package e.g.implementation 'org.terasology.nui:nui-gestalt7'Refactored
ClassLibraryto be less gestalt-specificIn most cases, if you were using
AbstractClassLibrary, you should now useModuleClassLibraryinstead.ModuleClassLibraryis a re-named version of the formerAbstractClassLibrarybase class. If you usedDefaultClassLibrary, then you should now useDefaultModuleClassLibraryinstead. In the baseClassLibraryinterface, allResourceUrnparameters have been replaced withStringparameters. This also applies toClassMetadata.ResourceUrnmethod overloadshave been moved into
ModuleClassLibrary.UISkinno longer inherits fromAssetand no longer depends onUISkinDataWhenever you were previously using
UISkinas an asset type, you now useUISkinAssetinstead e.g.To obtain a
UISkininstance from aUISkinAsset, call theUISKin.getSkin()method.Notes
nui-gestalt-separationbranch, specifically BenjaminAmos/Terasology@36a8fb6. No changes were required in module code, apart fromWordlyTooltip, which was not using the standardAssets.getSkinmethod.