Skip to content

Commit

Permalink
Add initial solution and code examples (microsoft#102)
Browse files Browse the repository at this point in the history
* Initial commit of Reunion Common Entrypoint

* Rename Common to SampleWinRT

* Care and Feeding of WinRT code

* Add ARM64 target

* Flat C API sample

* Extend sample slightly, fix publishing files

* Update References

* Add a simple test (that doesn't work yet)

* Move to a shared project

* Replace "Universal" DLL with a regular C++/WinRT DLL
Publish "flat C" headers to common output directory
Ensure test execution can find the implementation binary

* Change namespaces, fix up solutions, make test work

* Get a UWP unit test building

* Update to new cppwinrt package

* Include ARM64 in builds, add 'build everything' script

* Add means to test UWP, identity, etc in one shared file

* Rename test projects

* PR feedback

* PR feedback

* PR feedback
  • Loading branch information
jonwis authored Jul 6, 2020
1 parent bf108ae commit 4e3f4fe
Show file tree
Hide file tree
Showing 53 changed files with 2,124 additions and 34 deletions.
126 changes: 126 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -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
12 changes: 12 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -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
43 changes: 9 additions & 34 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -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/

Expand Down Expand Up @@ -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/
19 changes: 19 additions & 0 deletions DevCmd.cmd
Original file line number Diff line number Diff line change
@@ -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
)
28 changes: 28 additions & 0 deletions Directory.Build.props
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="utf-8"?>
<!-- Copyright (c) Microsoft Corporation. All rights reserved. Licensed under the MIT License. See LICENSE in the project root for license information. -->
<!-- This is a special MSBuild file that is parsed before everything else when MSBuild detects it in our directory structure.
Adding Sdk="Microsoft.NET.Sdk" to a project causes NuGet files to be generated very early on, so we need these defines to be here
to ensure that all of our build output files end up in the same location. This is parsed too late when put in mux.controls.props. -->
<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="$(BuildingWithBuildExe) != 'true'">
<IsTDPConfiguration>false</IsTDPConfiguration>
<IsTDPConfiguration Condition="'$(Configuration)' == 'Debug_test'">true</IsTDPConfiguration>
<Configuration Condition="'$(Configuration)' == 'Debug_test'">Debug</Configuration>

<BaseOutputPath>$(MSBuildThisFileDirectory)BuildOutput\$(Configuration)\</BaseOutputPath>
<BaseOutputPath Condition="'$(Configuration)' == 'Debug_test'">$(MSBuildThisFileDirectory)BuildOutput\Debug\</BaseOutputPath>
<OutDir>$(BaseOutputPath)\$(Platform)\</OutDir>

<!-- For native projects that use Win32 to mean x86, override the OutDir
property to provide consistency between projects. -->
<OutDir Condition="'$(Platform)' == 'Win32'">$(BaseOutputPath)\x86\</OutDir>

<OutputPath>$(OutDir)\$(MSBuildProjectName)\</OutputPath>

<BaseIntermediateOutputPath>$(MSBuildThisFileDirectory)BuildOutput\Int\$(MSBuildProjectName)\obj\$(Platform)$(Configuration)\</BaseIntermediateOutputPath>
<IntDir>$(BaseIntermediateOutputPath)</IntDir>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
<GeneratedFilesDir>$(BaseIntermediateOutputPath)Generated Files\</GeneratedFilesDir>
<GenerateProjectSpecificOutputFolder>True</GenerateProjectSpecificOutputFolder>
</PropertyGroup>
</Project>
133 changes: 133 additions & 0 deletions ProjectReunion.sln
Original file line number Diff line number Diff line change
@@ -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
Loading

0 comments on commit 4e3f4fe

Please sign in to comment.