-
Notifications
You must be signed in to change notification settings - Fork 7
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
Dependency management #5
Conversation
What if the |
If In the case where:
|
And if they are different versions? Also, i dont see how duplicate librarys are ok. Godot doesnt like multiple classes with the same class names. |
Then the indirect dependency will be placed in the
This is a limitation of Godot. Libraries for Godot shouldn't be defining class names anyways since they pollute Godot's class scope and slow down script parsing. See this issue for an example Class names should only be used in user code (i.e. not a library/package) or in libraries that are not meant to be used in other libraries (e.g. Dialogic) |
So how are you supposed to instantiate custom |
via This is also something mentioned in the initial proposal:
|
What about datastructure librarys and stuff, non nodes. What if I want to make a tree library, right, do people want to do const Tree = preload("res://addons/treelib/tree.gd")
func _ready() -> void:
var t = Tree.new("root") Idk, it just seems like not using a good feature. |
Unfortunately, that "good feature" creates namespace issues in Godot. You mentioned that yourself. I have already laid out my plan for handling this problem in this thread. Do you have an alternate plan? |
So if the main project needs a addon, its |
add this dependency to godot.package to test: `"@bendn/test": "1.2.6"`
for now this - removes dry run - removes unforced update
Co-authored-by: Timothy Yuen <you-win@users.noreply.github.com>
dependency management
Godot is able to load resources in 2 different ways:
preload(path)
which allows for a relative pathload(path)
which requires an absolute pathThe idea is to scan each package that's downloaded and, for every
preload
andload
token found, take thepath
param and replace it with a new path that points to a versioned dependency.The idea
Given the below manifests:
godot.package
package.json of
my_package
Note that
other_package
is listed in thedependencies
sectionpackage.json of
other_package
The following flow will be followed:
godot.package
file will be parsed from the project's root directorymy_package
will be downloaded and extracted into theaddons/
directorypackage.json
file located inaddons/my_package/package.json
will be parsed for dependenciesother_package
will be downloaded and extracted into a newaddons/__gpm_deps/
directorypackage.json
file located inaddons/__gpm_deps/other_package/1.0.0/package.json
will be parsed for dependencies (notice that the package is versioned)load
andpreload
funcs and have their paths modifiedpreload
will be modified to use a relative path (preferred)load
will be modified to use an absolute path