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

GDScript: Implement get_dependencies() (reverted) #90860

Merged
merged 1 commit into from
Apr 29, 2024

Conversation

vnen
Copy link
Member

@vnen vnen commented Apr 18, 2024

The parser and analyzer now track the dependencies of the script and return the list when the resource loader ask for them.

What is considered a dependency:

  • Any preload() call.
  • The base script this one extends.
  • Any identifier, including types, that refers to global scripts.
  • Any autoload singleton reference.

Fix #90643

P.S.: Initially I included the @icon path as a dependency, but I removed it since it's only relevant in the editor context. I don't think it's even accessible in a release build, so it shouldn't impact exporting the project.

The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
@vnen vnen requested a review from a team as a code owner April 18, 2024 14:57
@AThousandShips AThousandShips added this to the 4.x milestone Apr 18, 2024
@akien-mga akien-mga changed the title GDScript: Implement get_dependencies() GDScript: Implement get_dependencies() Apr 29, 2024
@akien-mga akien-mga modified the milestones: 4.x, 4.3 Apr 29, 2024
Copy link
Member

@akien-mga akien-mga left a comment

Choose a reason for hiding this comment

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

Looks good to me.

I wonder to what extent this may solve or help address some of the issues we're having with refactoring named classes with circular dependencies, or first-time load of projects before the class name cache has been created.

@akien-mga akien-mga merged commit c4733e8 into godotengine:master Apr 29, 2024
16 checks passed
@akien-mga
Copy link
Member

Thanks!

@vnen vnen deleted the gdscript-get-dependencies branch May 2, 2024 18:01
@akien-mga akien-mga changed the title GDScript: Implement get_dependencies() GDScript: Implement get_dependencies() (reverted) May 13, 2024
@akien-mga
Copy link
Member

Reverted by #91908 to solve #91726.
#90643 was thus reopened.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ResourceFormatLoaderGDScript::get_dependencies always returns an empty list
3 participants