Skip to content

add package api checking#6850

Merged
waruqi merged 4 commits intoxmake-io:devfrom
Shiffted:check_package_api
Sep 29, 2025
Merged

add package api checking#6850
waruqi merged 4 commits intoxmake-io:devfrom
Shiffted:check_package_api

Conversation

@Shiffted
Copy link
Contributor

@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 significantly enhances the robustness of Xmake's package management by introducing a comprehensive system for validating package API configurations. It establishes a dedicated framework for checking package definitions, integrates these checks into the package loading workflow, and generalizes the existing API checking infrastructure to support both build targets and packages. This ensures greater consistency and correctness in how packages are defined and used within the Xmake ecosystem.

Highlights

  • New Package API Checking Module: A new module, check_api.lua, has been introduced to centralize the logic for validating package API configurations, allowing for systematic checks across package definitions.
  • Integration of Package API Checks: The package loading process in package.lua now incorporates the new check_api module, ensuring that package API configurations are validated immediately after their environments are loaded.
  • Generic API Checker Refactoring: The core api_checker.lua module has been refactored to be more generic, enabling API checks to apply not only to targets but also to packages, with functions like _check_instance and check_instances replacing target-specific counterparts.
  • New Package Kind Checker: A specific checker, api.package.kind, has been added to validate the kind configuration for packages, ensuring it adheres to a predefined set of acceptable values such as 'binary', 'toolchain', 'library', or 'template'.
  • Enhanced check Command: The check command plugin (main.lua) now intelligently loads required packages when api or api.package checkers are invoked, providing the necessary context for the new package API validation.
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

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 introduces a new mechanism for checking package APIs, starting with a checker for the kind attribute. The implementation is well-structured, generalizing the existing API checker to work with both targets and packages. I've found a critical bug that could lead to a crash and a medium-severity robustness issue. After addressing these, the changes should be solid.

@Shiffted Shiffted marked this pull request as draft September 24, 2025 01:23
@waruqi
Copy link
Member

waruqi commented Sep 26, 2025

Does it ready now?

@Shiffted
Copy link
Contributor Author

Shiffted commented Sep 26, 2025

Does it ready now?

I would still like to add project.packges, even if they aren't package instances we can still check some apis with them. Otherwise, I would add another checkers() function so the package checkers are not shown in the check plugin.

@Shiffted
Copy link
Contributor Author

@waruqi Can I make it public or is there some other way to access it here?

@waruqi
Copy link
Member

waruqi commented Sep 28, 2025

I would still like to add , even if they aren't package instances we can still check some apis with them. Otherwise, I would add another function so the package checkers are not shown in the check plugin.project.packges``checkers()

core.project.project/required_packages + core.package.package/load_from_project

@Shiffted Shiffted marked this pull request as ready for review September 29, 2025 09:35
@waruqi waruqi merged commit 25c60fd into xmake-io:dev Sep 29, 2025
22 checks passed
@waruqi waruqi added this to the v3.0.4 milestone Sep 29, 2025
@Shiffted Shiffted deleted the check_package_api 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