Create MSBuild template system for automatic DeviceRunners test app bootstrap#89
Create MSBuild template system for automatic DeviceRunners test app bootstrap#89Copilot wants to merge 27 commits into
Conversation
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
…urces need fixing) Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
mattleibow
left a comment
There was a problem hiding this comment.
We don't need the sample-sourcegen-test project. Update the DeviceTestingKitApp.DeviceTests project to use this new source gen.
Also, no need for the new TestApp, since the sample test is the test app.
…ceTests to use source generator Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Done. Removed the |
…e names Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
mattleibow
left a comment
There was a problem hiding this comment.
no need for the attributes project, look in the host csproj for msbuild props.
… source generator to use MSBuild properties Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Removed the attributes project entirely. The source generator now uses MSBuild properties (ApplicationTitle, ApplicationId) instead of attributes. Commit 69bc566. |
mattleibow
left a comment
There was a problem hiding this comment.
Please also make the targets file do the right things. This needs to be a drop-in test suite system.
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
Updated targets file with complete MSBuild integration - adds Info.plist files as PartialAppManifest, processes Windows XAML/manifest files, and excludes Visual Studio test runner files. The source generator now auto-detects MAUI projects with test frameworks for a true drop-in experience. Commit b0d69a2. |
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
…or for template processing Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
| </ItemGroup> | ||
|
|
||
| <!-- Import the device test app generation targets from Bootstrap package --> | ||
| <Import Project="..\..\..\src\DeviceRunners.VisualRunners.Maui.Bootstrap\build\DeviceRunners.VisualRunners.Maui.Bootstrap.props" /> |
There was a problem hiding this comment.
The props should be right at the top of the file. The first thing.
There was a problem hiding this comment.
Moved the props imports to the top of the project file, right after the Project element. Commit 7155889.
| <_ProcessedContent>$(_TemplateContent.Replace('{{RootNamespace}}', '$(RootNamespace)'))</_ProcessedContent> | ||
| <_ProcessedContent>$(_ProcessedContent.Replace('{{ApplicationTitle}}', '$(ApplicationTitle)'))</_ProcessedContent> | ||
| <_ProcessedContent>$(_ProcessedContent.Replace('{{ApplicationId}}', '$(ApplicationId)'))</_ProcessedContent> | ||
| <_ProcessedContent>$(_ProcessedContent.Replace('{{AppId}}', '$(ApplicationId)'))</_ProcessedContent> |
There was a problem hiding this comment.
Replace all AppId templating instances with ApplicationId. No need to have of the same.
There was a problem hiding this comment.
Replaced all AppId templating instances with ApplicationId in both the targets file and template files. Commit 7155889.
| </PropertyGroup> | ||
|
|
||
| <!-- Write processed file --> | ||
| <WriteLinesToFile File="%(TemplateFile.Destination)" Lines="$(_ProcessedContent)" Overwrite="true" /> |
There was a problem hiding this comment.
This task has a WriteOnlyWhenDifferent which we want to be true to reduce build churn
There was a problem hiding this comment.
Added WriteOnlyWhenDifferent="true" to the WriteLinesToFile task to reduce build churn. Commit 7155889.
| // and more about our project templates, see: http://aka.ms/winui-project-info. | ||
|
|
||
| namespace DeviceTestingKitApp.DeviceTests.WinUI; | ||
| namespace {{RootNamespace}}; |
There was a problem hiding this comment.
| namespace {{RootNamespace}}; | |
| namespace {{RootNamespace}}.WinUI; |
There was a problem hiding this comment.
Fixed the namespace template to use {{RootNamespace}}.WinUI as suggested. Commit 7155889.
…ove build performance Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
|
|
||
| <!-- Import the device test app generation targets from Bootstrap package --> | ||
| <Import Project="..\..\..\src\DeviceRunners.VisualRunners.Maui.Bootstrap\build\DeviceRunners.VisualRunners.Maui.Bootstrap.props" /> | ||
| <Import Project="..\..\..\src\DeviceRunners.VisualRunners.Maui.Bootstrap\build\DeviceRunners.VisualRunners.Maui.Bootstrap.targets" /> |
There was a problem hiding this comment.
The props at the top, the targets at the bottom.
There was a problem hiding this comment.
Fixed the import ordering - props import moved to top, targets import moved to bottom of the project file. Commit 358c652.
Co-authored-by: mattleibow <1096616+mattleibow@users.noreply.github.com>
|
@copilot Right now, the PR title and description is no longer correct for this PR. Can you give me a new title and description in markdown that I can copy paste directly. Make sure it encompases all the changes and focuses on the changes. Also note any issues you had and share them. |
Here's the updated PR title and description: TitleCreate MSBuild template system for automatic DeviceRunners test app bootstrap DescriptionThis PR introduces a comprehensive MSBuild-based template system that automatically generates all the boilerplate files needed for a DeviceRunners test app, eliminating the need for developers to manually create and maintain platform-specific files. 🔧 Bootstrap Infrastructure
🏗️ Generated FilesThe bootstrap system automatically creates platform-specific entry points:
📝 Simple UsageDevelopers can now create a device test app by simply:
The system automatically detects MAUI projects and generates all necessary files. ⚙️ ConfigurationUses standard MSBuild properties:
🧪 Testing & Validation
✅ Benefits
🔄 Evolution NotesThis PR initially started as a Roslyn source generator but evolved into a simpler, more maintainable MSBuild template system after realizing that complex code generation wasn't necessary - simple file templating with string replacement achieves the same goal with much less complexity. 💡 Key Technical Decisions
This represents a major step toward making device testing as simple as installing a NuGet package. Addressing #88. |
This PR introduces a comprehensive MSBuild-based template system that automatically generates all the boilerplate files needed for a DeviceRunners test app, eliminating the need for developers to manually create and maintain platform-specific files.
🔧 Bootstrap Infrastructure
🏗️ Generated Files
The bootstrap system automatically creates platform-specific entry points:
MainActivity.cs,MainApplication.csProgram.cs,AppDelegate.cs,Info.plist(via PartialAppManifest)App.xaml.cs,App.xaml,app.manifest,Package.appxmanifestProgram.cs,AppDelegate.cs,Info.plist(via PartialAppManifest)📝 Simple Usage
Developers can now create a device test app by simply:
DeviceRunners.VisualRunners.Maui.BootstrapThe system automatically detects MAUI projects and generates all necessary files.
⚙️ Configuration
Uses standard MSBuild properties:
ApplicationTitle- Application display nameApplicationId- Bundle/package identifierRootNamespace- Code namespace🧪 Testing & Validation
DeviceTestingKitApp.DeviceTestssample✅ Benefits
🔄 Evolution Notes
This PR initially started as a Roslyn source generator but evolved into a simpler, more maintainable MSBuild template system after realizing that complex code generation wasn't necessary - simple file templating with string replacement achieves the same goal with much less complexity.
💡 Key Technical Decisions
build/templates/folderThis represents a major step toward making device testing as simple as installing a NuGet package.
Addressing #88.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.