Aller au contenu
Skillpedia
Déploiement et cloud (DevOps)25k · #10058

gn-deps-debugging

Ce qu’il fait

Cette compétence aide votre IA à trouver et corriger les erreurs de dépendance dans GN. Elle s'adresse aux développeurs qui voient des erreurs sur les fichiers d'inclusion ou les contrôles de dépendances lors de la compilation d'un grand projet.

Quand l’utiliser

  • ✓Quand votre compilation échoue avec une erreur de dépendance ou de visibilité d'inclusion GN.
  • ✓Quand une vérification gn signale qu'un fichier d'en-tête n'est pas autorisé depuis une cible.
  • ✓Quand vous devez corriger une dépendance circulaire entre des cibles de compilation.

Lien du skill

https://github.com/chromium/chromium/blob/main/agents/skills/gn-deps-debugging/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/chromium/chromium/blob/main/agents/skills/gn-deps-debugging/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Ma compilation indique qu'un en-tête n'est pas visible depuis ma cible. Pouvez-vous trouver la bonne dépendance pour le corriger ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

L'IA lit l'erreur exacte, trouve la cible de compilation qui possède le fichier et celle qui possède l'en-tête, puis ajoute la plus petite dépendance correcte. Elle respecte les règles propres aux plateformes.

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

GN Dependency Debugging

Fix Chromium GN dependency metadata, include visibility, and DEPS rule failures by correcting the dependency graph accurately, not by adding broad dependencies that only make errors disappear.

Core principles

  1. Read the exact error first. Identify the including source file, the included header, the failing target, and the diagnostic category before editing.
  2. Find both owning targets. Determine which GN target owns the including file and which GN target owns the included header.
  3. Prefer the narrowest dependency. Add the dependency to the smallest target that needs it, not a parent or aggregate target.
  4. Preserve platform conditions. If the failing include is in a platform-specific file such as *_win.cc, add the dependency inside the matching platform block such as if (is_win).
  5. Use deps for implementation-only dependencies. If a symbol is used only in .cc files, keep the dependency private.
  6. Use public_deps only for public API exposure. If a public header exposes a type from another target in its declarations or inline code, downstream consumers may need that dependency transitively.
  7. Prefer forward declarations in headers. If a header only needs a pointer, reference, or return type declaration, forward declare and move the include to the .cc file when possible.
  8. Do not paper over architecture issues. Circular dependencies usually indicate the need to split an interface target, move shared abstractions, or invert dependencies.
  9. Avoid // nogncheck. Use it only for known GN limitations with conditional includes, and include the required bug reference if the local codebase already documents one.

Workflow

  1. Capture the failing command and output.

    • If the user provided a truncated error, ask for or rerun the relevant gn check or build command when an output directory and target are known.
    • Do not start a broad build just to reproduce unless the output directory and target are established.
  2. Classify the failure.

    • Read common-errors.md and map the diagnostic to one of the supported categories.
    • Extract the including file, included header, and target names from the diagnostic.
  3. Find the target that owns the including file.

    • Inspect nearby BUILD.gn files first.
    • Use GN queries when an output directory is known:
      gn refs out/Default //path/to/file.cc --all
      
    • Prefer the most specific non-aggregate target that directly lists the file or owns the source set containing it.
    • Check whether the file is platform-specific, such as *_win.cc, *_mac.mm, *_linux.cc, *_android.cc, or *_ios.mm. Platform-specific files usually require platform-specific dependencies.
  4. Find the target that owns the included header.

    • Search for the header in BUILD.gn sources lists.
    • If several targets list it, prefer the public/interface target intended for consumers.
    • Check whether the header belongs to a generated target, a public variable, or a private implementation target.
  5. Choose the correct fix.

    • Read dependency-patterns.md for deps vs public_deps, forward declaration, DEPS, and cycle handling rules.
    • If the include appears only in .cc, add a private deps entry.
    • If the include appears only in a platform-specific source file, add the private deps entry inside the matching platform condition, for example if (is_win).
    • If the include appears in a public header, first try to remove the include using a forward declaration. If the header must expose the dependency, add or promote the dependency to public_deps.
    • If a DEPS file blocks the include, verify whether the dependency direction is allowed by the architecture before adding include rules.
    • If adding the dependency creates a cycle, stop and redesign the dependency boundary instead of adding broader deps. When an output directory is known, use gn path <out_dir> //target_a //target_b to inspect the dependency chain that connects the targets.
  6. Validate the narrow change.

    • Run git cl format if BUILD.gn or DEPS files were edited.
    • Re-run the smallest relevant gn check or build command that reproduced the issue.
    • If
Questions fréquentes

Qu'est-ce que GN ?

GN est un outil de compilation utilisé par les grands projets logiciels pour décider comment les fichiers de code sont compilés et liés entre eux.

Pourquoi ne pas simplement ajouter une grande dépendance pour faire disparaître l'erreur ?

Une dépendance large peut masquer le vrai problème et ralentir les compilations. Cette compétence demande la correction la plus ciblée.

Quand ne faut-il pas utiliser cette compétence ?

Utilisez-la pour les erreurs de dépendance et d'inclusion. Pour les échecs de compilation, d'édition de liens ou d'exécution, une autre approche est préférable.

Détails

Description originale de l’auteur

Diagnose Chromium GN dependency and include-visibility failures, including BUILD.gn deps/public_deps, DEPS include rules, private headers, and circular dependencies. Use for build or gn check dependency errors, not C++/link/runtime/test failures.

repo: chromium/chromium

Popularité

Étoiles GitHub
25k
Position au classement
#10058
Licence
BSD-3-Clause
Mis à jour
02/11/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires