diff --git a/.editorconfig b/.editorconfig new file mode 100644 index 00000000000..ae478b7a9d1 --- /dev/null +++ b/.editorconfig @@ -0,0 +1,126 @@ +root = true + +# Rules in this file were initially inferred by Visual Studio IntelliCode from the S:\Repos\dep.controls codebase based on best match to current usage at 11/15/2018 +# You can modify the rules from these initially generated values to suit your own policies +# You can learn more about editorconfig here: https://docs.microsoft.com/en-us/visualstudio/ide/editorconfig-code-style-settings-reference +[*.cs] + +#Core editorconfig formatting - indentation + +#use soft tabs (spaces) for indentation +indent_style = space +indent_size = 4 +charset = utf-8-bom +end_of_line = crlf + +#Formatting - indentation options + +#indent switch case contents. +csharp_indent_case_contents = true +#csharp_indent_case_contents_when_block +csharp_indent_case_contents_when_block = true +#indent switch labels +csharp_indent_switch_labels = true + +#Formatting - new line options + +#place catch statements on a new line +csharp_new_line_before_catch = true +#place else statements on a new line +csharp_new_line_before_else = true +#require braces to be on a new line for accessors, methods, object_collection, control_blocks, types, properties, and lambdas (also known as "Allman" style) +csharp_new_line_before_open_brace = accessors, methods, object_collection, control_blocks, types, properties, lambdas + +#Formatting - organize using options + +#do not place System.* using directives before other using directives +dotnet_sort_system_directives_first = false + +#Formatting - spacing options + +#require NO space between a cast and the value +csharp_space_after_cast = false +#require a space before the colon for bases or interfaces in a type declaration +csharp_space_after_colon_in_inheritance_clause = true +#require a space after a keyword in a control flow statement such as a for loop +csharp_space_after_keywords_in_control_flow_statements = true +#require a space before the colon for bases or interfaces in a type declaration +csharp_space_before_colon_in_inheritance_clause = true +#remove space within empty argument list parentheses +csharp_space_between_method_call_empty_parameter_list_parentheses = false +#remove space between method call name and opening parenthesis +csharp_space_between_method_call_name_and_opening_parenthesis = false +#do not place space characters after the opening parenthesis and before the closing parenthesis of a method call +csharp_space_between_method_call_parameter_list_parentheses = false +#remove space within empty parameter list parentheses for a method declaration +csharp_space_between_method_declaration_empty_parameter_list_parentheses = false +#place a space character after the opening parenthesis and before the closing parenthesis of a method declaration parameter list. +csharp_space_between_method_declaration_parameter_list_parentheses = false + +#Formatting - wrapping options + +#leave code block on single line +csharp_preserve_single_line_blocks = true +#leave statements and member declarations on the same line +csharp_preserve_single_line_statements = true + +#Style - expression bodied member options + +#prefer block bodies for accessors +csharp_style_expression_bodied_accessors = false:suggestion +#prefer block bodies for constructors +csharp_style_expression_bodied_constructors = false:suggestion +#prefer block bodies for methods +csharp_style_expression_bodied_methods = false:suggestion +#prefer block bodies for properties +csharp_style_expression_bodied_properties = false:suggestion + +#Style - expression level options + +#prefer out variables to be declared before the method call +csharp_style_inlined_variable_declaration = false:suggestion +#prefer the language keyword for member access expressions, instead of the type name, for types that have a keyword to represent them +dotnet_style_predefined_type_for_member_access = true:suggestion + +#Style - implicit and explicit types + +#prefer explicit type over var to declare variables with built-in system types such as int +csharp_style_var_for_built_in_types = false:none +#prefer explicit type over var when the type is already mentioned on the right-hand side of a declaration +csharp_style_var_when_type_is_apparent = false:none + +#Style - language keyword and framework type options + +#prefer the language keyword for local variables, method parameters, and class members, instead of the type name, for types that have a keyword to represent them +dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion + +#Style - qualification options + +#prefer events not to be prefaced with this. or Me. in Visual Basic +dotnet_style_qualification_for_event = false:suggestion +#prefer fields not to be prefaced with this. or Me. in Visual Basic +dotnet_style_qualification_for_field = false:suggestion +#prefer methods not to be prefaced with this. or Me. in Visual Basic +dotnet_style_qualification_for_method = false:suggestion +#prefer properties not to be prefaced with this. or Me. in Visual Basic +dotnet_style_qualification_for_property = false:suggestion + +# IDE0008: Use explicit type +csharp_style_var_elsewhere = false:none + +[**.{cpp,h,idl}] +indent_style = space +indent_size = 4 +charset = utf-8-bom +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = crlf + + +[**.{xaml,xml}] +indent_style = space +indent_size = 4 +charset = utf-8-bom +insert_final_newline = true +trim_trailing_whitespace = true +end_of_line = crlf \ No newline at end of file diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 00000000000..762759f3449 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,12 @@ +* text=auto + +# Force specific files that git doesn't know should always be CRLF +*.idl text eol=crlf +*.h text eol=crlf +*.cpp text eol=crlf +*.sln text eol=crlf +*.props text eol=crlf +*.targets text eol=crlf +*proj text eol=crlf +*.cmd text eol=crlf +*.ps1 text eol=crlf \ No newline at end of file diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 00000000000..c6e8458f0bf --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,36 @@ +name: Build CI Master + +# Controls when the action will run. Triggers the workflow on pull requests +# for the target branch +on: + pull_request: + branches: [ master ] + +jobs: + build: + runs-on: windows-latest + + steps: + - name: checkout project + uses: actions/checkout@v2 + + - name: setup msbuild + uses: microsoft/setup-msbuild@v1 + + - name: setup nuget + uses: NuGet/setup-nuget@v1.0.2 + + - name: restore project packages + run: nuget restore ProjectReunion.sln + + - name: build x86 + run: msbuild /m /p:Configuration=Release,Platform=x86 ProjectReunion.sln + + - name: build x64 + run: msbuild /m /p:Configuration=Release,Platform=x64 ProjectReunion.sln + + - name: build ARM + run: msbuild /m /p:Configuration=Release,Platform=ARM ProjectReunion.sln + + - name: build ARM64 + run: msbuild /m /p:Configuration=Release,Platform=ARM64 ProjectReunion.sln diff --git a/.gitignore b/.gitignore index 611428faba1..c17abf860cf 100644 --- a/.gitignore +++ b/.gitignore @@ -36,6 +36,9 @@ bld/ # Uncomment if you have tasks that create the project's static files in wwwroot #wwwroot/ +# Visual Studio code +.vscode/ + # Visual Studio 2017 auto generated files Generated\ Files/ @@ -316,38 +319,10 @@ __pycache__/ # Tabs Studio *.tss -# Telerik's JustMock configuration file -*.jmconfig - -# BizTalk build output -*.btp.cs -*.btm.cs -*.odx.cs -*.xsd.cs - -# OpenCover UI analysis results -OpenCover/ - -# Azure Stream Analytics local run output -ASALocalRun/ - -# MSBuild Binary and Structured Log -*.binlog - -# NVidia Nsight GPU debugger configuration file -*.nvuser - -# MFractors (Xamarin productivity tool) working folder -.mfractor/ - -# Local History for Visual Studio -.localhistory/ - -# BeatPulse healthcheck temp database -healthchecksdb - -# Backup folder for Package Reference Convert tool in Visual Studio 2017 -MigrationBackup/ +# Dump files +[Dd]ump[Ff]iles/ +*.dmp -# Ionide (cross platform F# VS Code tools) working folder -.ionide/ +# Build output root +BuildOutput/ +.nuget/ diff --git a/DevCmd.cmd b/DevCmd.cmd new file mode 100644 index 00000000000..f99561fb414 --- /dev/null +++ b/DevCmd.cmd @@ -0,0 +1,19 @@ +@echo OFF + +pushd %~dp0 + +set PATH=%PATH%;%~dp0\tools + +call %~dp0\tools\addaliases.cmd + +"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -Latest -requires Microsoft.Component.MSBuild -property InstallationPath > %TEMP%\vsinstalldir.txt + +set /p _VSINSTALLDIR15=<%TEMP%\vsinstalldir.txt + +call "%_VSINSTALLDIR15%\Common7\Tools\VsDevCmd.bat" + +pushd %~dp0 + +if '%1%' neq '/PreserveContext' ( + cmd /k +) \ No newline at end of file diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 00000000000..87d90e78d65 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,28 @@ + + + + + + false + true + Debug + + $(MSBuildThisFileDirectory)BuildOutput\$(Configuration)\ + $(MSBuildThisFileDirectory)BuildOutput\Debug\ + $(BaseOutputPath)\$(Platform)\ + + + $(BaseOutputPath)\x86\ + + $(OutDir)\$(MSBuildProjectName)\ + + $(MSBuildThisFileDirectory)BuildOutput\Int\$(MSBuildProjectName)\obj\$(Platform)$(Configuration)\ + $(BaseIntermediateOutputPath) + $(BaseIntermediateOutputPath) + $(BaseIntermediateOutputPath)Generated Files\ + True + + diff --git a/ProjectReunion.sln b/ProjectReunion.sln new file mode 100644 index 00000000000..f9312be23ae --- /dev/null +++ b/ProjectReunion.sln @@ -0,0 +1,133 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 16 +VisualStudioVersion = 16.0.30011.22 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "dev", "dev", "{448ED2E5-0B37-4D97-9E6B-8C10A507976A}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleWinRT", "SampleWinRT", "{428CCA9E-ADC5-4917-B51B-7D13E35950C5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "docs", "docs", "{F3659DFF-232D-46E0-967E-61FCC9A1132F}" + ProjectSection(SolutionItems) = preProject + docs\contributor-guide.md = docs\contributor-guide.md + docs\faq.md = docs\faq.md + docs\README.md = docs\README.md + docs\roadmap.md = docs\roadmap.md + EndProjectSection +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C9998FB7-6EFA-43B5-BD19-7533405784D6}" + ProjectSection(SolutionItems) = preProject + CODE_OF_CONDUCT.md = CODE_OF_CONDUCT.md + nuget.config = nuget.config + privacy.md = privacy.md + README.md = README.md + SECURITY.md = SECURITY.md + EndProjectSection +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleWinRT", "dev\SampleWinRT\SampleWinRT.vcxitems", "{0DE4FEFE-5471-4B50-B74B-D817A02B7F0D}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SampleFlatC", "SampleFlatC", "{8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "SampleFlatC", "dev\SampleFlatC\SampleFlatC.vcxitems", "{CDCE22EC-F7BF-43D4-95D8-2E786229A4E5}" +EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "test", "test", "{8630F7AA-2969-4DC9-8700-9B468C1DC21D}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppShared", "test\CppShared\CppShared.vcxitems", "{682DED8C-3A27-48CD-866D-E853EA2024DE}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ProjectReunion_DLL", "dev\ProjectReunion_DLL\ProjectReunion_DLL.vcxproj", "{B73AD907-6164-4294-88FB-F3C9C10DA1F1}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppTest_Win32", "test\CppTest\CppTest.vcxproj", "{C62688A1-16A0-4729-B6ED-842F4FAA29F3}" +EndProject +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CppTest_UWP", "test\CppTest_UWP\CppTest_UWP.vcxproj", "{B1A6F5EC-5418-4354-BACF-F7D998EE960D}" +EndProject +Global + GlobalSection(SharedMSBuildProjectFiles) = preSolution + dev\SampleWinRT\SampleWinRT.vcxitems*{0de4fefe-5471-4b50-b74b-d817a02b7f0d}*SharedItemsImports = 9 + test\CppShared\CppShared.vcxitems*{682ded8c-3a27-48cd-866d-e853ea2024de}*SharedItemsImports = 9 + test\CppShared\CppShared.vcxitems*{b1a6f5ec-5418-4354-bacf-f7d998ee960d}*SharedItemsImports = 4 + dev\SampleFlatC\SampleFlatC.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4 + dev\SampleWinRT\SampleWinRT.vcxitems*{b73ad907-6164-4294-88fb-f3c9c10da1f1}*SharedItemsImports = 4 + test\CppShared\CppShared.vcxitems*{c62688a1-16a0-4729-b6ed-842f4faa29f3}*SharedItemsImports = 4 + dev\SampleFlatC\SampleFlatC.vcxitems*{cdce22ec-f7bf-43d4-95d8-2e786229a4e5}*SharedItemsImports = 9 + EndGlobalSection + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|ARM = Debug|ARM + Debug|ARM64 = Debug|ARM64 + Debug|x64 = Debug|x64 + Debug|x86 = Debug|x86 + Release|ARM = Release|ARM + Release|ARM64 = Release|ARM64 + Release|x64 = Release|x64 + Release|x86 = Release|x86 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|ARM.ActiveCfg = Debug|ARM + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|ARM.Build.0 = Debug|ARM + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|ARM64.Build.0 = Debug|ARM64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|x64.ActiveCfg = Debug|x64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|x64.Build.0 = Debug|x64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|x86.ActiveCfg = Debug|Win32 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Debug|x86.Build.0 = Debug|Win32 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|ARM.ActiveCfg = Release|ARM + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|ARM.Build.0 = Release|ARM + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|ARM64.ActiveCfg = Release|ARM64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|ARM64.Build.0 = Release|ARM64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|x64.ActiveCfg = Release|x64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|x64.Build.0 = Release|x64 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|x86.ActiveCfg = Release|Win32 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1}.Release|x86.Build.0 = Release|Win32 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|ARM.ActiveCfg = Debug|ARM + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|ARM.Build.0 = Debug|ARM + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|x64.ActiveCfg = Debug|x64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|x64.Build.0 = Debug|x64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|x86.ActiveCfg = Debug|Win32 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Debug|x86.Build.0 = Debug|Win32 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|ARM.ActiveCfg = Release|ARM + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|ARM.Build.0 = Release|ARM + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|ARM64.ActiveCfg = Release|ARM64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|x64.ActiveCfg = Release|x64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|x64.Build.0 = Release|x64 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|x86.ActiveCfg = Release|Win32 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3}.Release|x86.Build.0 = Release|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|ARM.ActiveCfg = Debug|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|ARM.Build.0 = Debug|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|ARM.Deploy.0 = Debug|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|ARM64.ActiveCfg = Debug|ARM64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|ARM64.Deploy.0 = Debug|ARM64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x64.ActiveCfg = Debug|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x64.Build.0 = Debug|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x64.Deploy.0 = Debug|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x86.ActiveCfg = Debug|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x86.Build.0 = Debug|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Debug|x86.Deploy.0 = Debug|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|ARM.ActiveCfg = Release|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|ARM.Build.0 = Release|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|ARM.Deploy.0 = Release|ARM + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|ARM64.ActiveCfg = Release|ARM64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|ARM64.Deploy.0 = Release|ARM64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x64.ActiveCfg = Release|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x64.Build.0 = Release|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x64.Deploy.0 = Release|x64 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x86.ActiveCfg = Release|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x86.Build.0 = Release|Win32 + {B1A6F5EC-5418-4354-BACF-F7D998EE960D}.Release|x86.Deploy.0 = Release|Win32 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(NestedProjects) = preSolution + {428CCA9E-ADC5-4917-B51B-7D13E35950C5} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A} + {0DE4FEFE-5471-4B50-B74B-D817A02B7F0D} = {428CCA9E-ADC5-4917-B51B-7D13E35950C5} + {8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A} + {CDCE22EC-F7BF-43D4-95D8-2E786229A4E5} = {8A5C2FE6-86D7-4AAA-BE2E-924B8E03B888} + {682DED8C-3A27-48CD-866D-E853EA2024DE} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D} + {B73AD907-6164-4294-88FB-F3C9C10DA1F1} = {448ED2E5-0B37-4D97-9E6B-8C10A507976A} + {C62688A1-16A0-4729-B6ED-842F4FAA29F3} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D} + {B1A6F5EC-5418-4354-BACF-F7D998EE960D} = {8630F7AA-2969-4DC9-8700-9B468C1DC21D} + EndGlobalSection + GlobalSection(ExtensibilityGlobals) = postSolution + SolutionGuid = {4B3D7591-CFEC-4762-9A07-ABE99938FB77} + EndGlobalSection +EndGlobal diff --git a/build_all.cmd b/build_all.cmd new file mode 100644 index 00000000000..7e563368adc --- /dev/null +++ b/build_all.cmd @@ -0,0 +1,18 @@ +if not exist ".\.nuget" mkdir ".\.nuget" +if not exist ".\.nuget\nuget.exe" powershell -Command "Invoke-WebRequest https://dist.nuget.org/win-x86-commandline/latest/nuget.exe -OutFile .\.nuget\nuget.exe" + +call .nuget\nuget.exe restore ProjectReunion.sln -configfile nuget.config + +call :dobuild release x86 +call :dobuild release arm +call :dobuild release arm64 +call :dobuild release x64 +call :dobuild debug x86 +call :dobuild debug arm +call :dobuild debug arm64 +call :dobuild debug x64 +goto :eof + +:dobuild +call msbuild /m /p:Configuration=%1,Platform=%2 ProjectReunion.sln +goto :eof \ No newline at end of file diff --git a/dev/ProjectReunion_DLL/ProjectReunion.def b/dev/ProjectReunion_DLL/ProjectReunion.def new file mode 100644 index 00000000000..12f33c35aa2 --- /dev/null +++ b/dev/ProjectReunion_DLL/ProjectReunion.def @@ -0,0 +1,7 @@ +EXPORTS + DllCanUnloadNow = WINRT_CanUnloadNow PRIVATE + DllGetActivationFactory = WINRT_GetActivationFactory PRIVATE + + SampleFlatApiCreate + CloseSampleFlatApi + GetSampleFlatApiString diff --git a/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj b/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj new file mode 100644 index 00000000000..c5279f24a6a --- /dev/null +++ b/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj @@ -0,0 +1,356 @@ + + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {B73AD907-6164-4294-88FB-F3C9C10DA1F1} + Win32Proj + Microsoft.ProjectReunion + 10.0 + true + true + true + true + 2 + + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + true + v142 + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + DynamicLibrary + false + v142 + true + Unicode + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + true + Microsoft.ProjectReunion + + + true + Microsoft.ProjectReunion + + + true + Microsoft.ProjectReunion + + + true + Microsoft.ProjectReunion + + + false + Microsoft.ProjectReunion + + + false + Microsoft.ProjectReunion + + + false + Microsoft.ProjectReunion + + + false + Microsoft.ProjectReunion + + + + Use + Level3 + true + WIN32;_DEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + WIN32;_DEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + _DEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + _DEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + true + true + WIN32;NDEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + true + true + WIN32;NDEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + true + true + NDEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + Use + Level3 + true + true + true + NDEBUG;PROJECTREUNIONDLL_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) + true + pch.h + + + Windows + true + true + DebugFull + false + onecore.lib;onecoreuap.lib;%(AdditionalDependencies) + ProjectReunion.def + + + + + + + + Create + Create + Create + Create + Create + Create + Create + Create + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + + + + + \ No newline at end of file diff --git a/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj.filters b/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj.filters new file mode 100644 index 00000000000..a38b946c9dc --- /dev/null +++ b/dev/ProjectReunion_DLL/ProjectReunion_DLL.vcxproj.filters @@ -0,0 +1,36 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + + + Source Files + + + Source Files + + + + + + Source Files + + + \ No newline at end of file diff --git a/dev/ProjectReunion_DLL/packages.config b/dev/ProjectReunion_DLL/packages.config new file mode 100644 index 00000000000..730d206108b --- /dev/null +++ b/dev/ProjectReunion_DLL/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/dev/ProjectReunion_DLL/pch.cpp b/dev/ProjectReunion_DLL/pch.cpp new file mode 100644 index 00000000000..64b7eef6d6b --- /dev/null +++ b/dev/ProjectReunion_DLL/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/dev/ProjectReunion_DLL/pch.h b/dev/ProjectReunion_DLL/pch.h new file mode 100644 index 00000000000..9b50d2c274d --- /dev/null +++ b/dev/ProjectReunion_DLL/pch.h @@ -0,0 +1,12 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + diff --git a/dev/SampleFlatC/README.md b/dev/SampleFlatC/README.md new file mode 100644 index 00000000000..12c3c3556b9 --- /dev/null +++ b/dev/SampleFlatC/README.md @@ -0,0 +1,59 @@ +# Adding a new Flat C API Component + +This directory is a sample of adding an API with a "flat C" style to Project Reunion. +Flat C APIs define an ABI using C-based headers exported from a DLL. Apps can use the +APIs from an import library or through a projection that applies a wrapper. + +## Adding the shared project + +1. In Visual Studio, right-click the `dev` node in the Solution and choose "New Solution Folder" +2. Pick a name for your new project (the rest of this example uses `Muffins`) +3. Right-click the `Muffins` solution folder and use "Add > New Project" +4. Use the "Shared Items Project", set the name (`Muffins`) +4. For path use the solution root plus `\\dev` - the final path will be in `\\dev\\Muffins` + +## Reference the project + +1. Right-click the **ProjectReunion** project, use "Add > Reference" +2. Choose `Muffins` from the list of "Shared" items + +## Add public header + +1. Right-click the shared project and use "Add > New Item" +2. From the "Installed > Visual C++ > Code" list, select "Header (.h)" +3. Pick a good name (for the rest of this example, we'll use `Muffins` again, so "muffins.h") +5. Define the ABI for the implementation + +Follow the example of [SampleFlatC](./SampleFlatC.h): + +* Use `STDAPI` and `STDAPI_(type)` to define entrypoints +* Use scoped enumerations (like `enum class`) instead of preprocessor definitions + +## Add implementation + +1. Add `.cpp` files that implement the APIs in the usual way +2. For code using C++-with-exceptions use an appropriate exception guard + +## Publish header + +1. In the `.vcxitems` for the new project, manually add something like this, per [SampleFlatC.vcxitems](./SampleFlatC.vcxitems) + +```xml + + + + +``` + +## Adding exports + +1. In [ProjectReunion.def](../dll/ProjectReunion.def) add the list of exported methods + +## Other notes + +Be sure to add the copyright and license marker to all source files: + +```c++ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. +``` \ No newline at end of file diff --git a/dev/SampleFlatC/SampleFlatC.cpp b/dev/SampleFlatC/SampleFlatC.cpp new file mode 100644 index 00000000000..34408aeaffe --- /dev/null +++ b/dev/SampleFlatC/SampleFlatC.cpp @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#include "pch.h" +#include "SampleFlatC.h" +#include + +struct MyRealType +{ + std::wstring theString; +}; + +STDAPI SampleFlatApiCreate( + _In_ LPCWSTR theString, + _Outptr_ HSAMPLEFLATAPI* sampleFlat) try +{ + RETURN_HR_IF(E_INVALIDARG, !theString); + auto real = std::make_unique(); + real->theString = theString; + *sampleFlat = reinterpret_cast(real.release()); + return S_OK; +} +CATCH_RETURN(); + +STDAPI_(VOID) CloseSampleFlatApi(HSAMPLEFLATAPI sampleFlat) try +{ + auto real = std::unique_ptr(reinterpret_cast(sampleFlat)); + // Do something with 'real', the destructor will clean it up +} +CATCH_LOG(); + +STDAPI GetSampleFlatApiString( + _In_ HSAMPLEFLATAPI sampleFlat, + _Outptr_ LPWSTR* theString) try +{ + auto real = reinterpret_cast(sampleFlat); + auto cloned = wil::make_cotaskmem_string(real->theString.data()); + *theString = cloned.release(); + return S_OK; +} +CATCH_RETURN(); diff --git a/dev/SampleFlatC/SampleFlatC.h b/dev/SampleFlatC/SampleFlatC.h new file mode 100644 index 00000000000..c57ebcf7ddb --- /dev/null +++ b/dev/SampleFlatC/SampleFlatC.h @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#pragma once +#include + +DECLARE_HANDLE(HSAMPLEFLATAPI); + +STDAPI SampleFlatApiCreate( + _In_ LPCWSTR theString, + _Outptr_ HSAMPLEFLATAPI* sampleFlat); + +STDAPI_(VOID) CloseSampleFlatApi( + HSAMPLEFLATAPI sampleFlat); + +STDAPI GetSampleFlatApiString( + _In_ HSAMPLEFLATAPI sampleFlat, + _Outptr_ LPWSTR* theString); + +// Include from the NuGet package Microsoft.Windows.ImplementationLibrary +// before this file to have this handy lifecycle helper for C++ light up + +#ifdef __WIL_RESOURCE + +namespace wil +{ + using unique_sampleflat_handle = unique_any; +} + +#endif diff --git a/dev/SampleFlatC/SampleFlatC.vcxitems b/dev/SampleFlatC/SampleFlatC.vcxitems new file mode 100644 index 00000000000..3a78bbcd6d5 --- /dev/null +++ b/dev/SampleFlatC/SampleFlatC.vcxitems @@ -0,0 +1,29 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {cdce22ec-f7bf-43d4-95d8-2e786229a4e5} + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/dev/SampleWinRT/README.md b/dev/SampleWinRT/README.md new file mode 100644 index 00000000000..0d2573f56e4 --- /dev/null +++ b/dev/SampleWinRT/README.md @@ -0,0 +1,52 @@ +# Adding a new WinRT Component + +This directory is a sample of adding a WinRT component to Project Reunion. +WinRT-based APIs are defined using [MIDL3](https://docs.microsoft.com/en-us/uwp/midl-3/) +and typically [implemented with C++/WinRT](https://github.com/Microsoft/cppwinrt). It's +straightforward to add a new component in this manner. + +## Adding the shared project + +1. In Visual Studio, right-click the `dev` node in the Solution and choose "New Solution Folder" +2. Pick a name for your new project (the rest of this example uses `Muffins`) +3. Right-click the `Muffins` solution folder and use "Add > New Project" +4. Use the "Shared Items Project", set the name (`Muffins`) +4. For path use the solution root plus `\\dev` - the final path will be in `\\dev\\Muffins` + +## Reference the project + +1. Right-click the **ProjectReunion** project, use "Add > Reference" +2. Choose `Muffins` from the list of "Shared" items + +## Add IDL and implementation + +1. Right-click the shared project and use "Add > New Item" +2. From the Installed > Visual C++ > Code list, select "Midl File (.idl)" +3. Pick a good name (for the rest of this example, we'll use `Muffins` again, so "muffins.idl") +4. Remove the default `import ...` statements that visual studio generates + +Follow the example of [SampleWinRT](./SampleWinRT.idl): + +* Use `Microsoft.Muffins` as the namespace +* Add types and classes as necessary + +Add a header and `.cpp` file and an implementation. + +Be sure to add the copyright and license marker to all source files: + +```c++ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. +``` + +Add any C++/WinRT projected headers used by the implementation to +the [pch.h](../ProjectReunion_DLL/pch.h) to reduce compilation times. + +## Testing + +1. Add a new file to the [CppShared](../../test/CppShared/CppShared.vcxitems) +2. Follow the existing pattern of adding a `TEST_CLASS` with `TEST_METHOD` for facets of your implementation +3. Build the project and use the Visual Studio Test Explorer to run all tests + +For very large surfaces with lots of tests, add a new directory under `test` +with its own shared items project. diff --git a/dev/SampleWinRT/SampleWinRT.cpp b/dev/SampleWinRT/SampleWinRT.cpp new file mode 100644 index 00000000000..8c9e9f6d116 --- /dev/null +++ b/dev/SampleWinRT/SampleWinRT.cpp @@ -0,0 +1,6 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#include +#include +#include diff --git a/dev/SampleWinRT/SampleWinRT.h b/dev/SampleWinRT/SampleWinRT.h new file mode 100644 index 00000000000..59498bbf55d --- /dev/null +++ b/dev/SampleWinRT/SampleWinRT.h @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#pragma once + +#include + +namespace winrt::Microsoft::ProjectReunion::implementation +{ + struct Common + { + Common() = default; + + static void Initialize() + { + } + + static hstring AppIdentity() + { + static winrt::hstring fullName = GetFullIdentityString(); + return fullName; + } + + static bool IsAppContainer() + { + static bool isAppContainer = wil::get_token_is_app_container(); + return isAppContainer; + } + + static bool HasIdentity() + { + return !AppIdentity().empty(); + } + + static winrt::hstring GetFullIdentityString() + { + winrt::hstring identityString; + WCHAR idNameBuffer[PACKAGE_FULL_NAME_MAX_LENGTH]; + UINT32 idNameBufferLen = ARRAYSIZE(idNameBuffer); + if (::GetCurrentPackageFullName(&idNameBufferLen, idNameBuffer) == ERROR_SUCCESS) + { + identityString = idNameBuffer; + } + + return identityString; + } + }; +} +namespace winrt::Microsoft::ProjectReunion::factory_implementation +{ + struct Common : CommonT + { + }; +} diff --git a/dev/SampleWinRT/SampleWinRT.idl b/dev/SampleWinRT/SampleWinRT.idl new file mode 100644 index 00000000000..dfd83fd9644 --- /dev/null +++ b/dev/SampleWinRT/SampleWinRT.idl @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +namespace Microsoft.ProjectReunion +{ + static runtimeclass Common + { + static void Initialize(); + + static String AppIdentity { get; }; + + static Boolean IsAppContainer{ get; }; + static Boolean HasIdentity{ get; }; + }; +} diff --git a/dev/SampleWinRT/SampleWinRT.vcxitems b/dev/SampleWinRT/SampleWinRT.vcxitems new file mode 100644 index 00000000000..c1a254ef28e --- /dev/null +++ b/dev/SampleWinRT/SampleWinRT.vcxitems @@ -0,0 +1,29 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {0de4fefe-5471-4b50-b74b-d817a02b7f0d} + SampleWinRT + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/nuget.config b/nuget.config new file mode 100644 index 00000000000..7cfef561f86 --- /dev/null +++ b/nuget.config @@ -0,0 +1,12 @@ + + + + + + + + + + + + \ No newline at end of file diff --git a/test/CppShared/CppShared.vcxitems b/test/CppShared/CppShared.vcxitems new file mode 100644 index 00000000000..db9bc098e41 --- /dev/null +++ b/test/CppShared/CppShared.vcxitems @@ -0,0 +1,19 @@ + + + + $(MSBuildAllProjects);$(MSBuildThisFileFullPath) + true + {682ded8c-3a27-48cd-866d-e853ea2024de} + + + + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory) + + + + + + + + + \ No newline at end of file diff --git a/test/CppShared/TestMany.cpp b/test/CppShared/TestMany.cpp new file mode 100644 index 00000000000..95eecf18e18 --- /dev/null +++ b/test/CppShared/TestMany.cpp @@ -0,0 +1,55 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#include "pch.h" + +using namespace Microsoft::VisualStudio::CppUnitTestFramework; + +namespace ProjectReunionCppTest +{ + TEST_CLASS(FlatApiTests) + { + public: + + TEST_METHOD(Creates) + { + wil::unique_sampleflat_handle temp; + Assert::IsTrue(SUCCEEDED(::SampleFlatApiCreate(L"kittens", &temp))); + Assert::IsTrue(SUCCEEDED(::SampleFlatApiCreate(L"puppies", &temp))); + Assert::IsTrue(FAILED(::SampleFlatApiCreate(nullptr, &temp))); + } + + TEST_METHOD(CloseNullOk) + { + CloseSampleFlatApi(nullptr); + } + + TEST_METHOD(StringRoundTrip) + { + const wchar_t* tasty = L"muffins"; + wil::unique_sampleflat_handle temp; + THROW_IF_FAILED(::SampleFlatApiCreate(tasty, &temp)); + wil::unique_cotaskmem_string stored; + Assert::IsTrue(SUCCEEDED(::GetSampleFlatApiString(temp.get(), &stored))); + Assert::IsNotNull(stored.get()); + Assert::AreEqual(tasty, stored.get()); + } + }; + + TEST_CLASS(WinRtApiTests) + { +#if PRTEST_MODE_UWP + TEST_METHOD(ContainerTests) + { + Assert::IsTrue(winrt::Microsoft::ProjectReunion::Common::IsAppContainer()); + Assert::IsTrue(winrt::Microsoft::ProjectReunion::Common::HasIdentity()); + } +#else + TEST_METHOD(ContainerTests) + { + Assert::IsFalse(winrt::Microsoft::ProjectReunion::Common::IsAppContainer()); + Assert::IsFalse(winrt::Microsoft::ProjectReunion::Common::HasIdentity()); + } +#endif + }; +} diff --git a/test/CppTest/CppTest.vcxproj b/test/CppTest/CppTest.vcxproj new file mode 100644 index 00000000000..bea22d152f6 --- /dev/null +++ b/test/CppTest/CppTest.vcxproj @@ -0,0 +1,337 @@ + + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Debug + x64 + + + Release + x64 + + + + 16.0 + {C62688A1-16A0-4729-B6ED-842F4FAA29F3} + Win32Proj + ProjectReunionCppTest + 10.0 + NativeUnitTestProject + CppTest_Win32 + + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + true + v142 + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + DynamicLibrary + false + v142 + true + Unicode + false + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + false + + + false + + + true + + + true + + + true + + + true + + + false + + + false + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + WIN32;NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + WIN32;NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + WIN32;_DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + WIN32;_DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + _DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + _DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Use + Level3 + true + true + true + $(VCInstallDir)UnitTest\include;%(AdditionalIncludeDirectories);$(OutDir)\..\ProjectReunion_DLL + NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=0 + true + pch.h + + + Windows + true + true + $(VCInstallDir)UnitTest\lib;%(AdditionalLibraryDirectories);$(OutDir)\..\ProjectReunion_DLL + onecore.lib;onecoreuap.lib;Microsoft.ProjectReunion.lib;%(AdditionalDependencies) + + + + + Create + + + + + + + + + + + {b73ad907-6164-4294-88fb-f3c9c10da1f1} + true + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/test/CppTest/Cpptest.vcxproj.filters b/test/CppTest/Cpptest.vcxproj.filters new file mode 100644 index 00000000000..3454eda5a97 --- /dev/null +++ b/test/CppTest/Cpptest.vcxproj.filters @@ -0,0 +1,30 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Source Files + + + + + Header Files + + + + + + \ No newline at end of file diff --git a/test/CppTest/packages.config b/test/CppTest/packages.config new file mode 100644 index 00000000000..730d206108b --- /dev/null +++ b/test/CppTest/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/CppTest/pch.cpp b/test/CppTest/pch.cpp new file mode 100644 index 00000000000..64b7eef6d6b --- /dev/null +++ b/test/CppTest/pch.cpp @@ -0,0 +1,5 @@ +// pch.cpp: source file corresponding to the pre-compiled header + +#include "pch.h" + +// When you are using pre-compiled headers, this source file is necessary for compilation to succeed. diff --git a/test/CppTest/pch.h b/test/CppTest/pch.h new file mode 100644 index 00000000000..7e0c18c5192 --- /dev/null +++ b/test/CppTest/pch.h @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. See LICENSE in the project root for license information. + +#ifndef PCH_H +#define PCH_H +#endif //PCH_H + +#include +#include +#include +#include "CppUnitTest.h" + +// Test-specific headers, lifted here +#include +#include diff --git a/test/CppTest_UWP/App.cpp b/test/CppTest_UWP/App.cpp new file mode 100644 index 00000000000..600b0b8f3b4 --- /dev/null +++ b/test/CppTest_UWP/App.cpp @@ -0,0 +1,122 @@ +#include "pch.h" + +#include "App.h" +#include "MainPage.h" + +using namespace winrt; +using namespace Windows::ApplicationModel; +using namespace Windows::ApplicationModel::Activation; +using namespace Windows::Foundation; +using namespace Windows::UI::Xaml; +using namespace Windows::UI::Xaml::Controls; +using namespace Windows::UI::Xaml::Navigation; +using namespace ProjectReunionCppTest_UWP; +using namespace ProjectReunionCppTest_UWP::implementation; + +/// +/// Initializes the singleton application object. This is the first line of authored code +/// executed, and as such is the logical equivalent of main() or WinMain(). +/// +App::App() +{ + InitializeComponent(); + Suspending({ this, &App::OnSuspending }); + +#if defined _DEBUG && !defined DISABLE_XAML_GENERATED_BREAK_ON_UNHANDLED_EXCEPTION + UnhandledException([this](IInspectable const&, UnhandledExceptionEventArgs const& e) + { + if (IsDebuggerPresent()) + { + auto errorMessage = e.Message(); + __debugbreak(); + } + }); +#endif +} + +/// +/// Invoked when the application is launched normally by the end user. Other entry points +/// will be used such as when the application is launched to open a specific file. +/// +/// Details about the launch request and process. +void App::OnLaunched(LaunchActivatedEventArgs const& e) +{ + Frame rootFrame{ nullptr }; + if (auto content = Window::Current().Content()) + { + rootFrame = content.try_as(); + } + + // Do not repeat app initialization when the Window already has content, + // just ensure that the window is active + if (!rootFrame) + { + // Create a Frame to act as the navigation context and associate it with + // a SuspensionManager key + rootFrame = Frame(); + + rootFrame.NavigationFailed({ this, &App::OnNavigationFailed }); + + if (e.PreviousExecutionState() == ApplicationExecutionState::Terminated) + { + // Restore the saved session state only when appropriate, scheduling the + // final launch steps after the restore is complete + } + + if (!e.PrelaunchActivated()) + { + if (!rootFrame.Content()) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(xaml_typename(), box_value(e.Arguments())); + } + // Place the frame in the current Window + Window::Current().Content(rootFrame); + // Ensure the current window is active + winrt::Microsoft::VisualStudio::TestPlatform::TestExecutor::WinRTCore::UnitTestClient::CreateDefaultUI(); + Window::Current().Activate(); + } + } + else + { + if (!e.PrelaunchActivated()) + { + if (!rootFrame.Content() ) + { + // When the navigation stack isn't restored navigate to the first page, + // configuring the new page by passing required information as a navigation + // parameter + rootFrame.Navigate(xaml_typename(), box_value(e.Arguments())); + } + // Ensure the current window is active + winrt::Microsoft::VisualStudio::TestPlatform::TestExecutor::WinRTCore::UnitTestClient::CreateDefaultUI(); + Window::Current().Activate(); + } + } + + winrt::Microsoft::VisualStudio::TestPlatform::TestExecutor::WinRTCore::UnitTestClient::Run(e.Arguments()); +} + +/// +/// Invoked when application execution is being suspended. Application state is saved +/// without knowing whether the application will be terminated or resumed with the contents +/// of memory still intact. +/// +/// The source of the suspend request. +/// Details about the suspend request. +void App::OnSuspending([[maybe_unused]] IInspectable const& sender, [[maybe_unused]] SuspendingEventArgs const& e) +{ + // Save application state and stop any background activity +} + +/// +/// Invoked when Navigation to a certain page fails +/// +/// The Frame which failed navigation +/// Details about the navigation failure +void App::OnNavigationFailed(IInspectable const&, NavigationFailedEventArgs const& e) +{ + throw hresult_error(E_FAIL, hstring(L"Failed to load Page ") + e.SourcePageType().Name); +} diff --git a/test/CppTest_UWP/App.h b/test/CppTest_UWP/App.h new file mode 100644 index 00000000000..5b8bc820716 --- /dev/null +++ b/test/CppTest_UWP/App.h @@ -0,0 +1,14 @@ +#pragma once +#include "App.xaml.g.h" + +namespace winrt::ProjectReunionCppTest_UWP::implementation +{ + struct App : AppT + { + App(); + + void OnLaunched(Windows::ApplicationModel::Activation::LaunchActivatedEventArgs const&); + void OnSuspending(IInspectable const&, Windows::ApplicationModel::SuspendingEventArgs const&); + void OnNavigationFailed(IInspectable const&, Windows::UI::Xaml::Navigation::NavigationFailedEventArgs const&); + }; +} diff --git a/test/CppTest_UWP/App.idl b/test/CppTest_UWP/App.idl new file mode 100644 index 00000000000..15b57e6a171 --- /dev/null +++ b/test/CppTest_UWP/App.idl @@ -0,0 +1,3 @@ +namespace ProjectReunionCppTest_UWP +{ +} diff --git a/test/CppTest_UWP/App.xaml b/test/CppTest_UWP/App.xaml new file mode 100644 index 00000000000..344d0b4994e --- /dev/null +++ b/test/CppTest_UWP/App.xaml @@ -0,0 +1,7 @@ + + + diff --git a/test/CppTest_UWP/Assets/LockScreenLogo.scale-200.png b/test/CppTest_UWP/Assets/LockScreenLogo.scale-200.png new file mode 100644 index 00000000000..735f57adb5d Binary files /dev/null and b/test/CppTest_UWP/Assets/LockScreenLogo.scale-200.png differ diff --git a/test/CppTest_UWP/Assets/SplashScreen.scale-200.png b/test/CppTest_UWP/Assets/SplashScreen.scale-200.png new file mode 100644 index 00000000000..023e7f1feda Binary files /dev/null and b/test/CppTest_UWP/Assets/SplashScreen.scale-200.png differ diff --git a/test/CppTest_UWP/Assets/Square150x150Logo.scale-200.png b/test/CppTest_UWP/Assets/Square150x150Logo.scale-200.png new file mode 100644 index 00000000000..af49fec1a54 Binary files /dev/null and b/test/CppTest_UWP/Assets/Square150x150Logo.scale-200.png differ diff --git a/test/CppTest_UWP/Assets/Square44x44Logo.scale-200.png b/test/CppTest_UWP/Assets/Square44x44Logo.scale-200.png new file mode 100644 index 00000000000..ce342a2ec8a Binary files /dev/null and b/test/CppTest_UWP/Assets/Square44x44Logo.scale-200.png differ diff --git a/test/CppTest_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png b/test/CppTest_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png new file mode 100644 index 00000000000..f6c02ce97e0 Binary files /dev/null and b/test/CppTest_UWP/Assets/Square44x44Logo.targetsize-24_altform-unplated.png differ diff --git a/test/CppTest_UWP/Assets/StoreLogo.png b/test/CppTest_UWP/Assets/StoreLogo.png new file mode 100644 index 00000000000..7385b56c0e4 Binary files /dev/null and b/test/CppTest_UWP/Assets/StoreLogo.png differ diff --git a/test/CppTest_UWP/Assets/Wide310x150Logo.scale-200.png b/test/CppTest_UWP/Assets/Wide310x150Logo.scale-200.png new file mode 100644 index 00000000000..288995b397f Binary files /dev/null and b/test/CppTest_UWP/Assets/Wide310x150Logo.scale-200.png differ diff --git a/test/CppTest_UWP/CppTest_UWP.vcxproj b/test/CppTest_UWP/CppTest_UWP.vcxproj new file mode 100644 index 00000000000..40f501ffb20 --- /dev/null +++ b/test/CppTest_UWP/CppTest_UWP.vcxproj @@ -0,0 +1,207 @@ + + + + + {b1a6f5ec-5418-4354-bacf-f7d998ee960d} + ProjectReunionCppTest_UWP + true + true + true + true + CppTest_UWP + en-US + 15.0 + true + Windows Store + 10.0.18362.0 + 10.0.17134.0 + 10.0 + 15.0 + NativeUnitTestProject + false + + + + + Debug + ARM + + + Debug + ARM64 + + + Debug + Win32 + + + Debug + x64 + + + Release + ARM + + + Release + ARM64 + + + Release + Win32 + + + Release + x64 + + + + Application + v142 + Unicode + + + true + true + + + false + true + false + + + + + + + + + + + + + + + + + Use + pch.h + $(IntDir)pch.pch + Level4 + %(AdditionalOptions) /bigobj + + /DWINRT_NO_MAKE_DETECTION %(AdditionalOptions) + + + WIN32_LEAN_AND_MEAN;WINRT_LEAN_AND_MEAN;%(PreprocessorDefinitions) + + + false + + + + + _DEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=1 + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(OutDir)\..\ProjectReunion_DLL + + + $(OutDir)\..\ProjectReunion_DLL + WindowsApp.lib;%(AdditionalDependencies);Microsoft.ProjectReunion.lib + + + + + NDEBUG;%(PreprocessorDefinitions);PRTEST_MODE_UWP=1 + %(AdditionalIncludeDirectories);$(MSBuildThisFileDirectory);$(OutDir)\..\ProjectReunion_DLL + + + true + true + $(OutDir)\..\ProjectReunion_DLL + WindowsApp.lib;%(AdditionalDependencies);Microsoft.ProjectReunion.lib + + + + + + App.xaml + + + MainPage.xaml + + + + + Designer + + + Designer + + + + + Designer + + + + + + + + + + + + + + Create + + + App.xaml + + + MainPage.xaml + + + + + + App.xaml + + + MainPage.xaml + + + + + + + false + + + + + + {b73ad907-6164-4294-88fb-f3c9c10da1f1} + true + + + + + + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + + \ No newline at end of file diff --git a/test/CppTest_UWP/CppTest_UWP.vcxproj.filters b/test/CppTest_UWP/CppTest_UWP.vcxproj.filters new file mode 100644 index 00000000000..28f03343af7 --- /dev/null +++ b/test/CppTest_UWP/CppTest_UWP.vcxproj.filters @@ -0,0 +1,60 @@ + + + + + + + + + + + + + + + + + + + + + + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + Assets + + + + + + + + {e48dc53e-40b1-40cb-970a-f89935452892} + + + + + + + + + + \ No newline at end of file diff --git a/test/CppTest_UWP/MainPage.cpp b/test/CppTest_UWP/MainPage.cpp new file mode 100644 index 00000000000..c5881919445 --- /dev/null +++ b/test/CppTest_UWP/MainPage.cpp @@ -0,0 +1,29 @@ +#include "pch.h" +#include "MainPage.h" +#include "MainPage.g.cpp" + +using namespace winrt; +using namespace Windows::UI::Xaml; + +namespace winrt::ProjectReunionCppTest_UWP::implementation +{ + MainPage::MainPage() + { + InitializeComponent(); + } + + int32_t MainPage::MyProperty() + { + throw hresult_not_implemented(); + } + + void MainPage::MyProperty(int32_t /* value */) + { + throw hresult_not_implemented(); + } + + void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&) + { + myButton().Content(box_value(L"Clicked")); + } +} diff --git a/test/CppTest_UWP/MainPage.h b/test/CppTest_UWP/MainPage.h new file mode 100644 index 00000000000..8ad851dc5a4 --- /dev/null +++ b/test/CppTest_UWP/MainPage.h @@ -0,0 +1,23 @@ +#pragma once + +#include "MainPage.g.h" + +namespace winrt::ProjectReunionCppTest_UWP::implementation +{ + struct MainPage : MainPageT + { + MainPage(); + + int32_t MyProperty(); + void MyProperty(int32_t value); + + void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args); + }; +} + +namespace winrt::ProjectReunionCppTest_UWP::factory_implementation +{ + struct MainPage : MainPageT + { + }; +} diff --git a/test/CppTest_UWP/MainPage.idl b/test/CppTest_UWP/MainPage.idl new file mode 100644 index 00000000000..b10b8aa3ec7 --- /dev/null +++ b/test/CppTest_UWP/MainPage.idl @@ -0,0 +1,9 @@ +namespace ProjectReunionCppTest_UWP +{ + [default_interface] + runtimeclass MainPage : Windows.UI.Xaml.Controls.Page + { + MainPage(); + Int32 MyProperty; + } +} diff --git a/test/CppTest_UWP/MainPage.xaml b/test/CppTest_UWP/MainPage.xaml new file mode 100644 index 00000000000..83c13614a1b --- /dev/null +++ b/test/CppTest_UWP/MainPage.xaml @@ -0,0 +1,13 @@ + + + + + + diff --git a/test/CppTest_UWP/Package.appxmanifest b/test/CppTest_UWP/Package.appxmanifest new file mode 100644 index 00000000000..7677c71e080 --- /dev/null +++ b/test/CppTest_UWP/Package.appxmanifest @@ -0,0 +1,32 @@ + + + + + + ProjectReunionCppTest_UWP + ProjectReunion + Assets\StoreLogo.png + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/test/CppTest_UWP/PropertySheet.props b/test/CppTest_UWP/PropertySheet.props new file mode 100644 index 00000000000..e34141b019c --- /dev/null +++ b/test/CppTest_UWP/PropertySheet.props @@ -0,0 +1,16 @@ + + + + + + + + \ No newline at end of file diff --git a/test/CppTest_UWP/log.txt b/test/CppTest_UWP/log.txt new file mode 100644 index 00000000000..d1f64a9e123 Binary files /dev/null and b/test/CppTest_UWP/log.txt differ diff --git a/test/CppTest_UWP/packages.config b/test/CppTest_UWP/packages.config new file mode 100644 index 00000000000..730d206108b --- /dev/null +++ b/test/CppTest_UWP/packages.config @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/test/CppTest_UWP/pch.cpp b/test/CppTest_UWP/pch.cpp new file mode 100644 index 00000000000..bcb5590be1b --- /dev/null +++ b/test/CppTest_UWP/pch.cpp @@ -0,0 +1 @@ +#include "pch.h" diff --git a/test/CppTest_UWP/pch.h b/test/CppTest_UWP/pch.h new file mode 100644 index 00000000000..1d1c4d158d7 --- /dev/null +++ b/test/CppTest_UWP/pch.h @@ -0,0 +1,24 @@ +#pragma once +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +// Test-specific headers, lifted here +#include +#include