Skip to content

Conversation

Copilot
Copy link
Contributor

@Copilot Copilot AI commented Aug 29, 2025

  • Analyze the issue with hardcoded codegen includes in init-windows template
  • Scan codegen directory for existing spec files during template generation
  • Update template to use actual filenames when existing spec files are found
  • Add fallback to conditional includes when no existing files are present
  • Test the solution with existing projects
  • Add explanatory comments about Mustache template syntax for C++ developers

✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.

Microsoft Reviewers: Open in CodeFlow

@anupriya13
Copy link
Contributor

anupriya13 commented Aug 29, 2025

@copilot don't add a comment for developer to fix, we need to get the correct file name from..\codegen\<filename>.g.hfile

@Copilot Copilot AI changed the title [WIP] [Bug] init-windows adds incorrect name of Native Codegen File Include Fix init-windows template to use conditional codegen includes Aug 29, 2025
Copilot finished work on behalf of anupriya13 August 29, 2025 13:43
@Copilot Copilot AI requested a review from anupriya13 August 29, 2025 13:43
Copy link
Contributor Author

Copilot AI commented Aug 29, 2025

@copilot don't add a comment for developer to fix, we need to get the correct file name from..\codegen\<filename>.g.hfile

I've updated the solution to automatically detect existing codegen spec files instead of using TODO comments. The template now:

  1. Scans the windows/{projectName}/codegen/ directory for existing *Spec.g.h files during template generation
  2. If existing spec files are found, uses the actual filename and extracted module name
  3. Falls back to conditional __has_include checks when no existing files are found

This eliminates the need for manual developer intervention while handling both scenarios correctly. (commit b02696d)

@Copilot Copilot AI changed the title Fix init-windows template to use conditional codegen includes Fix init-windows template to automatically detect existing codegen spec files Aug 29, 2025
Copilot finished work on behalf of anupriya13 August 29, 2025 13:53
Copy link
Contributor

@sundaramramaswamy sundaramramaswamy left a comment

Choose a reason for hiding this comment

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

LGTM!

#include "codegen/Native{{ pascalName }}DataTypes.g.h"
#endif
#include "codegen/Native{{ pascalName }}Spec.g.h"
{{#hasExistingSpecFiles}}
Copy link
Contributor

Choose a reason for hiding this comment

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

@copilot Please add a preceding comment about these Mustache template nuances as these are foreign to regular C++ programmers.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added explanatory comments about the Mustache template syntax before both conditional include blocks to help C++ developers understand that these constructs will be processed during project generation. (commit a098073)

Copilot finished work on behalf of sundaramramaswamy September 30, 2025 03:22
Copy link
Contributor

@sundaramramaswamy sundaramramaswamy left a comment

Choose a reason for hiding this comment

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

LGTM

@sundaramramaswamy sundaramramaswamy marked this pull request as ready for review September 30, 2025 06:09
@sundaramramaswamy sundaramramaswamy requested a review from a team as a code owner September 30, 2025 06:09
@sundaramramaswamy
Copy link
Contributor

sundaramramaswamy commented Sep 30, 2025

/azp run

Copy link

Azure Pipelines successfully started running 2 pipeline(s).

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.

3 participants