Skip to content

add scriptdir to project packages#6874

Merged
waruqi merged 1 commit intoxmake-io:devfrom
Shiffted:fix-project-packages
Sep 30, 2025
Merged

add scriptdir to project packages#6874
waruqi merged 1 commit intoxmake-io:devfrom
Shiffted:fix-project-packages

Conversation

@Shiffted
Copy link
Contributor

Allows project local packages to properly use add_versionfiles and add_patches. Added explicit checks to rulesdir and port since these are implicit and may conflict with project setups. Using os.projectdir() here works correctly with the --project parameter, whereas using the packages actual scriptdir does not.

Previously they would try to look into os.curdir()/nil/.

@gemini-code-assist
Copy link
Contributor

Summary of Changes

Hello @Shiffted, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed!

This pull request addresses a critical issue where project-local packages failed to correctly resolve their scriptdir, leading to problems with features like add_versionfiles and add_patches. By explicitly setting the scriptdir for these packages to the project directory and introducing conditional checks for repository-less packages in rulesdir and port file handling, this change ensures robust and predictable behavior for project-specific package configurations.

Highlights

  • Corrected scriptdir for project-local packages: Ensures that project-local packages correctly identify their script directory by explicitly setting it to os.projectdir() during instantiation, resolving issues with add_versionfiles and add_patches.
  • Improved rulesdir resolution: Adds an explicit check in the rulesdir function to prevent packages without an associated repository (i.e., project-local packages) from attempting to resolve a rulesdir incorrectly.
  • Refined port file handling: Modifies the package installation logic to only attempt copying a ported xmake.lua from a port directory if the package belongs to a repository, avoiding unnecessary operations for project-local packages.
Using Gemini Code Assist

The full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips.

Invoking Gemini

You can request assistance from Gemini at any point by creating a comment using either /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

Customization

To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a .gemini/ folder in the base of the repository. Detailed instructions can be found here.

Limitations & Feedback

Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here.

You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension.

Footnotes

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution.

Copy link
Contributor

@gemini-code-assist gemini-code-assist bot left a comment

Choose a reason for hiding this comment

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

Code Review

This pull request correctly addresses an issue with project-local packages by ensuring scriptdir is properly set to the project directory. This allows functionalities like add_versionfiles and add_patches to work as expected. The added guards in rulesdir and for copying the ported xmake.lua prevent incorrect behavior for packages without a repository structure. The changes are logical and improve the robustness of package handling. I have one minor suggestion to improve the readability of the logic in _instance:rulesdir.

@Shiffted Shiffted force-pushed the fix-project-packages branch from dabb0e9 to a2a4d76 Compare September 30, 2025 09:02
@Shiffted Shiffted force-pushed the fix-project-packages branch from a2a4d76 to c99d1ee Compare September 30, 2025 09:09
@waruqi waruqi added this to the v3.0.4 milestone Sep 30, 2025
@waruqi waruqi merged commit c5a738c into xmake-io:dev Sep 30, 2025
22 checks passed
@Shiffted Shiffted deleted the fix-project-packages branch November 2, 2025 19:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants