Skip to content

[Deferred] Update .groupproj references when a project file is renamed #12

Description

@darianmiller

Deferred from #11 (which now renames a program/library/package's
.dpr/.dpk, .dproj, and .res when the module name changes). Updating
.groupproj files was split out because it needs its own file handler
and carries higher risk.

Background

.groupproj is NOT in the default filespec (*.pas;*.dpr;*.dpk;*.dproj)
and, unlike .dproj, has no dedicated handler -- if scanned it would be
mis-tokenized as Pascal. When #11 renames a project's .dproj, any
.groupproj that references the old .dproj filename becomes stale.

A .groupproj references a renamed project in three places:

  • <Projects Include="path\Old.dproj">
  • <MSBuild Projects="path\Old.dproj"/> (inside the generated targets)
  • MSBuild target names derived from the project name by replacing
    non-alphanumeric characters with _ (e.g. Delphi_Lexer_TokenDump,
    plus :Clean / :Make variants and the CallTarget list).

Scope decisions carried over from #11

  • Discovery is opt-in: only act on .groupproj when *.groupproj is in
    the effective --filespec (consistent with the .res opt-in in Renaming a program/library/package name should also rename its .dpr/.dproj/.res files #11).
  • Target-name rewriting (the dot/dash -> underscore munging) is the
    fragile part and can corrupt the group if imperfect. Decide whether to
    do path references only, or full target-name rewriting, when picking
    this up. Path references (Projects Include / MSBuild Projects) are the
    build-critical ones; target names are cosmetic labels for a normal
    group build.

Fix approach

Add a dedicated raw-text .groupproj handler (mirroring
ProcessDprojFile: operate on the source string to preserve line
endings / BOM). When a project file is renamed via the #11 path, rewrite
matching .dproj path references (and, if in scope, the derived target
names) in every scanned .groupproj.

Acceptance criteria

  • .groupproj Projects Include and MSBuild Projects paths updated when a project is renamed
  • Target names updated, or explicitly documented as out of scope
  • Opt-in via *.groupproj in the filespec; line endings / BOM preserved
  • Group builds after a project rename
  • Test coverage for a .groupproj reference update

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions