-
Notifications
You must be signed in to change notification settings - Fork 92
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #194 from microsoft/nmetulev/wcrapis2
Updates to how WCR APIs show up in the app
- Loading branch information
Showing
27 changed files
with
512 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,6 @@ internal enum HardwareAccelerator | |
{ | ||
CPU, | ||
DML, | ||
QNN | ||
QNN, | ||
WCRAPI | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -52,7 +52,7 @@ private void ExecuteSharedCodeEnumGeneration(SourceProductionContext context, Im | |
{ | ||
var filePath = type!.Locations[0].SourceTree?.FilePath; | ||
|
||
if (filePath != null) | ||
if (filePath != null && !filePath.Contains(@"\obj\")) | ||
{ | ||
if (!filePaths.Contains(filePath)) | ||
{ | ||
|
@@ -66,7 +66,15 @@ private void ExecuteSharedCodeEnumGeneration(SourceProductionContext context, Im | |
foreach (var filePath in filePaths) | ||
{ | ||
var fileName = Path.GetFileNameWithoutExtension(filePath); | ||
if (File.Exists(Path.ChangeExtension(filePath, ".xaml"))) | ||
var extension = Path.GetExtension(filePath); | ||
var filePathWithoutExtension = filePath.Substring(0, filePath.Length - extension.Length); | ||
if (fileName.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase) && File.Exists(filePathWithoutExtension)) | ||
{ | ||
fileName = Path.GetFileNameWithoutExtension(filePathWithoutExtension); | ||
sourceBuilder.AppendLine($" {fileName}Cs,"); | ||
sourceBuilder.AppendLine($" {fileName}Xaml,"); | ||
} | ||
else if (File.Exists(Path.ChangeExtension(filePath, ".xaml"))) | ||
{ | ||
sourceBuilder.AppendLine($" {fileName}Cs,"); | ||
sourceBuilder.AppendLine($" {fileName}Xaml,"); | ||
|
@@ -89,14 +97,22 @@ private void ExecuteSharedCodeEnumGeneration(SourceProductionContext context, Im | |
{ | ||
var fileName = Path.GetFileNameWithoutExtension(filePath); | ||
var filePathXaml = Path.ChangeExtension(filePath, ".xaml"); | ||
if (File.Exists(filePathXaml)) | ||
var extension = Path.GetExtension(filePath); | ||
var filePathWithoutExtension = filePath.Substring(0, filePath.Length - extension.Length); | ||
if (fileName.EndsWith(".xaml", StringComparison.InvariantCultureIgnoreCase) && File.Exists(filePathWithoutExtension)) | ||
{ | ||
fileName = Path.GetFileNameWithoutExtension(fileName); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{fileName}Cs => \"{fileName}.xaml.cs\","); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{fileName}Xaml => \"{fileName}.xaml\","); | ||
} | ||
else if (File.Exists(filePathXaml)) | ||
{ | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{Path.GetFileNameWithoutExtension(filePath)}Xaml => \"{Path.GetFileName(filePathXaml)}\","); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{Path.GetFileNameWithoutExtension(filePath)}Cs => \"{Path.GetFileName(filePath)}\","); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{fileName}Xaml => \"{Path.GetFileName(filePathXaml)}\","); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{fileName}Cs => \"{Path.GetFileName(filePath)}\","); | ||
} | ||
else | ||
{ | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{Path.GetFileNameWithoutExtension(filePath)} => \"{Path.GetFileName(filePath)}\","); | ||
sourceBuilder.AppendLine($" SharedCodeEnum.{fileName} => \"{Path.GetFileName(filePath)}\","); | ||
} | ||
} | ||
|
||
|
@@ -111,6 +127,17 @@ private void ExecuteSharedCodeEnumGeneration(SourceProductionContext context, Im | |
{ | ||
var fileName = Path.GetFileNameWithoutExtension(filePath); | ||
var filePathXaml = Path.ChangeExtension(filePath, ".xaml"); | ||
var extension = Path.GetExtension(filePath); | ||
var filePathWithoutExtension = filePath.Substring(0, filePath.Length - extension.Length); | ||
|
||
// handle .xaml.cs files | ||
if (File.Exists(filePathWithoutExtension)) | ||
{ | ||
filePathXaml = filePathWithoutExtension; | ||
fileName = Path.GetFileNameWithoutExtension(fileName); | ||
} | ||
|
||
Check failure on line 139 in AIDevGallery.SourceGenerator/SamplesSourceGenerator.cs
|
||
|
||
if (File.Exists(filePathXaml)) | ||
{ | ||
var fileContentXaml = XamlSourceCleanUp(File.ReadAllText(filePathXaml)); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,5 +4,6 @@ internal enum HardwareAccelerator | |
{ | ||
CPU, | ||
DML, | ||
QNN | ||
QNN, | ||
WCRAPI | ||
} |
File renamed without changes.
Oops, something went wrong.