initial commit
This commit is contained in:
Родитель
68d678e043
Коммит
7fb819fc8d
|
@ -0,0 +1,155 @@
|
|||
# editorconfig.org
|
||||
|
||||
# top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# Default settings:
|
||||
# A newline ending every file
|
||||
# Use 4 spaces as indentation
|
||||
[*]
|
||||
insert_final_newline = true
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
||||
[project.json]
|
||||
indent_size = 2
|
||||
|
||||
# C# files
|
||||
[*.cs]
|
||||
# New line preferences
|
||||
csharp_new_line_before_open_brace = all
|
||||
csharp_new_line_before_else = true
|
||||
csharp_new_line_before_catch = true
|
||||
csharp_new_line_before_finally = true
|
||||
csharp_new_line_before_members_in_object_initializers = true
|
||||
csharp_new_line_before_members_in_anonymous_types = true
|
||||
csharp_new_line_between_query_expression_clauses = true
|
||||
|
||||
# Indentation preferences
|
||||
csharp_indent_block_contents = true
|
||||
csharp_indent_braces = false
|
||||
csharp_indent_case_contents = true
|
||||
csharp_indent_switch_labels = true
|
||||
csharp_indent_labels = one_less_than_current
|
||||
|
||||
# avoid this. unless absolutely necessary
|
||||
dotnet_style_qualification_for_field = false:suggestion
|
||||
dotnet_style_qualification_for_property = false:suggestion
|
||||
dotnet_style_qualification_for_method = false:suggestion
|
||||
dotnet_style_qualification_for_event = false:suggestion
|
||||
|
||||
# only use var when it's obvious what the variable type is
|
||||
csharp_style_var_for_built_in_types = false:none
|
||||
csharp_style_var_when_type_is_apparent = false:suggestion
|
||||
csharp_style_var_elsewhere = false:suggestion
|
||||
|
||||
# use language keywords instead of BCL types
|
||||
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
|
||||
dotnet_style_predefined_type_for_member_access = true:suggestion
|
||||
|
||||
# name all constant fields using PascalCase
|
||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.severity = suggestion
|
||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.symbols = constant_fields
|
||||
dotnet_naming_rule.constant_fields_should_be_pascal_case.style = pascal_case_style
|
||||
|
||||
dotnet_naming_symbols.constant_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.constant_fields.required_modifiers = const
|
||||
|
||||
dotnet_naming_style.pascal_case_style.capitalization = pascal_case
|
||||
|
||||
# static fields should have s_ prefix
|
||||
dotnet_naming_symbols.static_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.static_fields.required_modifiers = static
|
||||
|
||||
dotnet_naming_style.static_prefix_style.capitalization = camel_case
|
||||
|
||||
# internal and private fields should be _camelCase
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.severity = suggestion
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.symbols = private_internal_fields
|
||||
dotnet_naming_rule.camel_case_for_private_internal_fields.style = camel_case_underscore_style
|
||||
|
||||
dotnet_naming_symbols.private_internal_fields.applicable_kinds = field
|
||||
dotnet_naming_symbols.private_internal_fields.applicable_accessibilities = private, internal
|
||||
|
||||
dotnet_naming_style.camel_case_underscore_style.required_prefix = _
|
||||
dotnet_naming_style.camel_case_underscore_style.capitalization = camel_case
|
||||
|
||||
# Code style defaults
|
||||
dotnet_sort_system_directives_first = true
|
||||
csharp_preserve_single_line_blocks = true
|
||||
csharp_preserve_single_line_statements = false
|
||||
|
||||
# Expression-level preferences
|
||||
dotnet_style_object_initializer = true:suggestion
|
||||
dotnet_style_collection_initializer = true:suggestion
|
||||
dotnet_style_explicit_tuple_names = true:suggestion
|
||||
dotnet_style_coalesce_expression = true:suggestion
|
||||
dotnet_style_null_propagation = true:suggestion
|
||||
|
||||
# Expression-bodied members
|
||||
csharp_style_expression_bodied_methods = false:none
|
||||
csharp_style_expression_bodied_constructors = false:none
|
||||
csharp_style_expression_bodied_operators = false:none
|
||||
csharp_style_expression_bodied_properties = true:suggestion
|
||||
csharp_style_expression_bodied_indexers = true:none
|
||||
csharp_style_expression_bodied_accessors = true:none
|
||||
|
||||
# Pattern matching
|
||||
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
|
||||
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
|
||||
csharp_style_inlined_variable_declaration = true:suggestion
|
||||
|
||||
# Null checking preferences
|
||||
csharp_style_throw_expression = true:suggestion
|
||||
csharp_style_conditional_delegate_call = true:suggestion
|
||||
|
||||
# Space preferences
|
||||
csharp_space_after_cast = false
|
||||
csharp_space_after_colon_in_inheritance_clause = true
|
||||
csharp_space_after_comma = true
|
||||
csharp_space_after_dot = false
|
||||
csharp_space_after_keywords_in_control_flow_statements = true
|
||||
csharp_space_after_semicolon_in_for_statement = true
|
||||
csharp_space_around_binary_operators = before_and_after
|
||||
csharp_space_around_declaration_statements = do_not_ignore
|
||||
csharp_space_before_colon_in_inheritance_clause = true
|
||||
csharp_space_before_comma = false
|
||||
csharp_space_before_dot = false
|
||||
csharp_space_before_open_square_brackets = false
|
||||
csharp_space_before_semicolon_in_for_statement = false
|
||||
csharp_space_between_empty_square_brackets = false
|
||||
csharp_space_between_method_call_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_call_name_and_opening_parenthesis = false
|
||||
csharp_space_between_method_call_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
|
||||
csharp_space_between_method_declaration_name_and_open_parenthesis = false
|
||||
csharp_space_between_method_declaration_parameter_list_parentheses = false
|
||||
csharp_space_between_parentheses = false
|
||||
csharp_space_between_square_brackets = false
|
||||
|
||||
# C++ Files
|
||||
[*.{cpp,h,in}]
|
||||
curly_bracket_next_line = true
|
||||
indent_brace_style = Allman
|
||||
|
||||
# Xml project files
|
||||
[*.{csproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
|
||||
indent_size = 2
|
||||
|
||||
# Xml build files
|
||||
[*.builds]
|
||||
indent_size = 2
|
||||
|
||||
# Xml files
|
||||
[*.{xml,stylecop,resx,ruleset}]
|
||||
indent_size = 2
|
||||
|
||||
# Xml config files
|
||||
[*.{props,targets,config,nuspec}]
|
||||
indent_size = 2
|
||||
|
||||
# Shell scripts
|
||||
[*.sh]
|
||||
end_of_line = lf
|
||||
[*.{cmd, bat}]
|
||||
end_of_line = crlf
|
|
@ -0,0 +1,289 @@
|
|||
# Catch all for anything we forgot. Add rules if you get CRLF to LF warnings.
|
||||
* text=auto
|
||||
|
||||
# Text files that should be normalized to LF in odb.
|
||||
*.cs text eol=lf diff=csharp
|
||||
*.xaml text
|
||||
*.config text
|
||||
*.c text
|
||||
*.h text
|
||||
*.cpp text
|
||||
*.hpp text
|
||||
*.sln text
|
||||
*.csproj text
|
||||
*.vcxproj text
|
||||
*.md text
|
||||
*.tt text
|
||||
*.sh text
|
||||
*.ps1 text
|
||||
*.cmd text
|
||||
*.bat text
|
||||
*.markdown text
|
||||
*.msbuild text
|
||||
# Binary files that should not be normalized or diffed
|
||||
*.png binary
|
||||
*.jpg binary
|
||||
*.gif binary
|
||||
*.ico binary
|
||||
*.rc binary
|
||||
*.pfx binary
|
||||
*.snk binary
|
||||
*.dll binary
|
||||
*.exe binary
|
||||
*.lib binary
|
||||
*.exp binary
|
||||
*.pdb binary
|
||||
*.sdf binary
|
||||
*.7z binary
|
||||
# Generated file should just use CRLF, it's fiiine
|
||||
SolutionInfo.cs text eol=crlf diff=csharp
|
||||
*.mht filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppam filter=lfs diff=lfs merge=lfs -text
|
||||
*.wmv filter=lfs diff=lfs merge=lfs -text
|
||||
*.btif filter=lfs diff=lfs merge=lfs -text
|
||||
*.fla filter=lfs diff=lfs merge=lfs -text
|
||||
*.qt filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlam filter=lfs diff=lfs merge=lfs -text
|
||||
*.xm filter=lfs diff=lfs merge=lfs -text
|
||||
*.djvu filter=lfs diff=lfs merge=lfs -text
|
||||
*.woff filter=lfs diff=lfs merge=lfs -text
|
||||
*.a filter=lfs diff=lfs merge=lfs -text
|
||||
*.bak filter=lfs diff=lfs merge=lfs -text
|
||||
*.lha filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.xltm filter=lfs diff=lfs merge=lfs -text
|
||||
*.eol filter=lfs diff=lfs merge=lfs -text
|
||||
*.ipa filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttf filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvm filter=lfs diff=lfs merge=lfs -text
|
||||
*.cmx filter=lfs diff=lfs merge=lfs -text
|
||||
*.dng filter=lfs diff=lfs merge=lfs -text
|
||||
*.xltx filter=lfs diff=lfs merge=lfs -text
|
||||
*.fli filter=lfs diff=lfs merge=lfs -text
|
||||
*.wmx filter=lfs diff=lfs merge=lfs -text
|
||||
*.jxr filter=lfs diff=lfs merge=lfs -text
|
||||
*.pyv filter=lfs diff=lfs merge=lfs -text
|
||||
*.s7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.csv filter=lfs diff=lfs merge=lfs -text
|
||||
*.pptm filter=lfs diff=lfs merge=lfs -text
|
||||
*.rz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlsx filter=lfs diff=lfs merge=lfs -text
|
||||
*.bh filter=lfs diff=lfs merge=lfs -text
|
||||
*.dat filter=lfs diff=lfs merge=lfs -text
|
||||
*.mid filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpga filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogg filter=lfs diff=lfs merge=lfs -text
|
||||
*.s3m filter=lfs diff=lfs merge=lfs -text
|
||||
*.mar filter=lfs diff=lfs merge=lfs -text
|
||||
*.movie filter=lfs diff=lfs merge=lfs -text
|
||||
*.pptx filter=lfs diff=lfs merge=lfs -text
|
||||
*.dll filter=lfs diff=lfs merge=lfs -text
|
||||
*.docm filter=lfs diff=lfs merge=lfs -text
|
||||
*.m3u filter=lfs diff=lfs merge=lfs -text
|
||||
*.mov filter=lfs diff=lfs merge=lfs -text
|
||||
*.aac filter=lfs diff=lfs merge=lfs -text
|
||||
*.jar filter=lfs diff=lfs merge=lfs -text
|
||||
*.midi filter=lfs diff=lfs merge=lfs -text
|
||||
*.mobi filter=lfs diff=lfs merge=lfs -text
|
||||
*.potm filter=lfs diff=lfs merge=lfs -text
|
||||
*.woff2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.cab filter=lfs diff=lfs merge=lfs -text
|
||||
*.dmg filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdf filter=lfs diff=lfs merge=lfs -text
|
||||
*.war filter=lfs diff=lfs merge=lfs -text
|
||||
*.bz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.icns filter=lfs diff=lfs merge=lfs -text
|
||||
*.slk filter=lfs diff=lfs merge=lfs -text
|
||||
*.wbmp filter=lfs diff=lfs merge=lfs -text
|
||||
*.xpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.xmind filter=lfs diff=lfs merge=lfs -text
|
||||
*.3g2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.m4v filter=lfs diff=lfs merge=lfs -text
|
||||
*.pic filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvi filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvp filter=lfs diff=lfs merge=lfs -text
|
||||
*.xls filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpgv filter=lfs diff=lfs merge=lfs -text
|
||||
*.mka filter=lfs diff=lfs merge=lfs -text
|
||||
*.swf filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvs filter=lfs diff=lfs merge=lfs -text
|
||||
*.wav filter=lfs diff=lfs merge=lfs -text
|
||||
*.ecelp4800 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mng filter=lfs diff=lfs merge=lfs -text
|
||||
*.pps filter=lfs diff=lfs merge=lfs -text
|
||||
*.whl filter=lfs diff=lfs merge=lfs -text
|
||||
*.arj filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzh filter=lfs diff=lfs merge=lfs -text
|
||||
*.raw filter=lfs diff=lfs merge=lfs -text
|
||||
*.rlc filter=lfs diff=lfs merge=lfs -text
|
||||
*.sgi filter=lfs diff=lfs merge=lfs -text
|
||||
*.tar filter=lfs diff=lfs merge=lfs -text
|
||||
*.au filter=lfs diff=lfs merge=lfs -text
|
||||
*.dcm filter=lfs diff=lfs merge=lfs -text
|
||||
*.GIF filter=lfs diff=lfs merge=lfs -text
|
||||
*.resources filter=lfs diff=lfs merge=lfs -text
|
||||
*.txz filter=lfs diff=lfs merge=lfs -text
|
||||
*.rar filter=lfs diff=lfs merge=lfs -text
|
||||
*.sil filter=lfs diff=lfs merge=lfs -text
|
||||
*.bk filter=lfs diff=lfs merge=lfs -text
|
||||
*.DS_Store filter=lfs diff=lfs merge=lfs -text
|
||||
*.ief filter=lfs diff=lfs merge=lfs -text
|
||||
*.JPEG filter=lfs diff=lfs merge=lfs -text
|
||||
*.pbm filter=lfs diff=lfs merge=lfs -text
|
||||
*.png filter=lfs diff=lfs merge=lfs -text
|
||||
*.sketch filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.nef filter=lfs diff=lfs merge=lfs -text
|
||||
*.oga filter=lfs diff=lfs merge=lfs -text
|
||||
*.zip filter=lfs diff=lfs merge=lfs -text
|
||||
*.ecelp7470 filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlt filter=lfs diff=lfs merge=lfs -text
|
||||
*.exe filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4 filter=lfs diff=lfs merge=lfs -text
|
||||
*.pnm filter=lfs diff=lfs merge=lfs -text
|
||||
*.ttc filter=lfs diff=lfs merge=lfs -text
|
||||
*.wdp filter=lfs diff=lfs merge=lfs -text
|
||||
*.xbm filter=lfs diff=lfs merge=lfs -text
|
||||
*.ecelp9600 filter=lfs diff=lfs merge=lfs -text
|
||||
*.pot filter=lfs diff=lfs merge=lfs -text
|
||||
*.wvx filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvu filter=lfs diff=lfs merge=lfs -text
|
||||
*.asf filter=lfs diff=lfs merge=lfs -text
|
||||
*.dxf filter=lfs diff=lfs merge=lfs -text
|
||||
*.flv filter=lfs diff=lfs merge=lfs -text
|
||||
*.mdi filter=lfs diff=lfs merge=lfs -text
|
||||
*.pcx filter=lfs diff=lfs merge=lfs -text
|
||||
*.tiff filter=lfs diff=lfs merge=lfs -text
|
||||
*.bzip2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.deb filter=lfs diff=lfs merge=lfs -text
|
||||
*.graffle filter=lfs diff=lfs merge=lfs -text
|
||||
*.h261 filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppm filter=lfs diff=lfs merge=lfs -text
|
||||
*.tif filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppt filter=lfs diff=lfs merge=lfs -text
|
||||
*.fbs filter=lfs diff=lfs merge=lfs -text
|
||||
*.gzip filter=lfs diff=lfs merge=lfs -text
|
||||
*.o filter=lfs diff=lfs merge=lfs -text
|
||||
*.sub filter=lfs diff=lfs merge=lfs -text
|
||||
*.z filter=lfs diff=lfs merge=lfs -text
|
||||
*.alz filter=lfs diff=lfs merge=lfs -text
|
||||
*.BMP filter=lfs diff=lfs merge=lfs -text
|
||||
*.dotm filter=lfs diff=lfs merge=lfs -text
|
||||
*.key filter=lfs diff=lfs merge=lfs -text
|
||||
*.rgb filter=lfs diff=lfs merge=lfs -text
|
||||
*.f4v filter=lfs diff=lfs merge=lfs -text
|
||||
*.iso filter=lfs diff=lfs merge=lfs -text
|
||||
*.ai filter=lfs diff=lfs merge=lfs -text
|
||||
*.dtshd filter=lfs diff=lfs merge=lfs -text
|
||||
*.fpx filter=lfs diff=lfs merge=lfs -text
|
||||
*.shar filter=lfs diff=lfs merge=lfs -text
|
||||
*.img filter=lfs diff=lfs merge=lfs -text
|
||||
*.rmf filter=lfs diff=lfs merge=lfs -text
|
||||
*.xz filter=lfs diff=lfs merge=lfs -text
|
||||
*.eot filter=lfs diff=lfs merge=lfs -text
|
||||
*.wma filter=lfs diff=lfs merge=lfs -text
|
||||
*.cpio filter=lfs diff=lfs merge=lfs -text
|
||||
*.cr2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.adp filter=lfs diff=lfs merge=lfs -text
|
||||
*.mpeg filter=lfs diff=lfs merge=lfs -text
|
||||
*.npx filter=lfs diff=lfs merge=lfs -text
|
||||
*.pdb filter=lfs diff=lfs merge=lfs -text
|
||||
*.PNG filter=lfs diff=lfs merge=lfs -text
|
||||
*.xwd filter=lfs diff=lfs merge=lfs -text
|
||||
*.egg filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppsx filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp4a filter=lfs diff=lfs merge=lfs -text
|
||||
*.pages filter=lfs diff=lfs merge=lfs -text
|
||||
*.baml filter=lfs diff=lfs merge=lfs -text
|
||||
*.bin filter=lfs diff=lfs merge=lfs -text
|
||||
*.class filter=lfs diff=lfs merge=lfs -text
|
||||
*.h264 filter=lfs diff=lfs merge=lfs -text
|
||||
*.lib filter=lfs diff=lfs merge=lfs -text
|
||||
*.mmr filter=lfs diff=lfs merge=lfs -text
|
||||
*.dot filter=lfs diff=lfs merge=lfs -text
|
||||
*.gif filter=lfs diff=lfs merge=lfs -text
|
||||
*.JPG filter=lfs diff=lfs merge=lfs -text
|
||||
*.m4a filter=lfs diff=lfs merge=lfs -text
|
||||
*.so filter=lfs diff=lfs merge=lfs -text
|
||||
*.tgz filter=lfs diff=lfs merge=lfs -text
|
||||
*.thmx filter=lfs diff=lfs merge=lfs -text
|
||||
*.3ds filter=lfs diff=lfs merge=lfs -text
|
||||
*.bmp filter=lfs diff=lfs merge=lfs -text
|
||||
*.ogv filter=lfs diff=lfs merge=lfs -text
|
||||
*.xif filter=lfs diff=lfs merge=lfs -text
|
||||
*.aiff filter=lfs diff=lfs merge=lfs -text
|
||||
*.dts filter=lfs diff=lfs merge=lfs -text
|
||||
*.rip filter=lfs diff=lfs merge=lfs -text
|
||||
*.vob filter=lfs diff=lfs merge=lfs -text
|
||||
*.7z filter=lfs diff=lfs merge=lfs -text
|
||||
*.fh filter=lfs diff=lfs merge=lfs -text
|
||||
*.flac filter=lfs diff=lfs merge=lfs -text
|
||||
*.g3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpm filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppsm filter=lfs diff=lfs merge=lfs -text
|
||||
*.potx filter=lfs diff=lfs merge=lfs -text
|
||||
*.zipx filter=lfs diff=lfs merge=lfs -text
|
||||
*.dsk filter=lfs diff=lfs merge=lfs -text
|
||||
*.ico filter=lfs diff=lfs merge=lfs -text
|
||||
*.ktx filter=lfs diff=lfs merge=lfs -text
|
||||
*.lz filter=lfs diff=lfs merge=lfs -text
|
||||
*.numbers filter=lfs diff=lfs merge=lfs -text
|
||||
*.3gp filter=lfs diff=lfs merge=lfs -text
|
||||
*.fst filter=lfs diff=lfs merge=lfs -text
|
||||
*.scpt filter=lfs diff=lfs merge=lfs -text
|
||||
*.epub filter=lfs diff=lfs merge=lfs -text
|
||||
*.rmvb filter=lfs diff=lfs merge=lfs -text
|
||||
*.webm filter=lfs diff=lfs merge=lfs -text
|
||||
*.docx filter=lfs diff=lfs merge=lfs -text
|
||||
*.pgm filter=lfs diff=lfs merge=lfs -text
|
||||
*.pya filter=lfs diff=lfs merge=lfs -text
|
||||
*.rtf filter=lfs diff=lfs merge=lfs -text
|
||||
*.smv filter=lfs diff=lfs merge=lfs -text
|
||||
*.tga filter=lfs diff=lfs merge=lfs -text
|
||||
*.cur filter=lfs diff=lfs merge=lfs -text
|
||||
*.dwg filter=lfs diff=lfs merge=lfs -text
|
||||
*.lvp filter=lfs diff=lfs merge=lfs -text
|
||||
*.pyo filter=lfs diff=lfs merge=lfs -text
|
||||
*.apk filter=lfs diff=lfs merge=lfs -text
|
||||
*.ar filter=lfs diff=lfs merge=lfs -text
|
||||
*.caf filter=lfs diff=lfs merge=lfs -text
|
||||
*.doc filter=lfs diff=lfs merge=lfs -text
|
||||
*.h263 filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlsm filter=lfs diff=lfs merge=lfs -text
|
||||
*.mp3 filter=lfs diff=lfs merge=lfs -text
|
||||
*.mxu filter=lfs diff=lfs merge=lfs -text
|
||||
*.wax filter=lfs diff=lfs merge=lfs -text
|
||||
*.gz filter=lfs diff=lfs merge=lfs -text
|
||||
*.mj2 filter=lfs diff=lfs merge=lfs -text
|
||||
*.otf filter=lfs diff=lfs merge=lfs -text
|
||||
*.udf filter=lfs diff=lfs merge=lfs -text
|
||||
*.aif filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzma filter=lfs diff=lfs merge=lfs -text
|
||||
*.pyc filter=lfs diff=lfs merge=lfs -text
|
||||
*.weba filter=lfs diff=lfs merge=lfs -text
|
||||
*.webp filter=lfs diff=lfs merge=lfs -text
|
||||
*.cgm filter=lfs diff=lfs merge=lfs -text
|
||||
*.mkv filter=lfs diff=lfs merge=lfs -text
|
||||
*.ppa filter=lfs diff=lfs merge=lfs -text
|
||||
*.uvh filter=lfs diff=lfs merge=lfs -text
|
||||
*.xpi filter=lfs diff=lfs merge=lfs -text
|
||||
*.psd filter=lfs diff=lfs merge=lfs -text
|
||||
*.xlsb filter=lfs diff=lfs merge=lfs -text
|
||||
*.tbz filter=lfs diff=lfs merge=lfs -text
|
||||
*.wim filter=lfs diff=lfs merge=lfs -text
|
||||
*.ape filter=lfs diff=lfs merge=lfs -text
|
||||
*.avi filter=lfs diff=lfs merge=lfs -text
|
||||
*.dex filter=lfs diff=lfs merge=lfs -text
|
||||
*.dra filter=lfs diff=lfs merge=lfs -text
|
||||
*.dvb filter=lfs diff=lfs merge=lfs -text
|
||||
*.jpg filter=lfs diff=lfs merge=lfs -text
|
||||
*.xla filter=lfs diff=lfs merge=lfs -text
|
||||
*.fvt filter=lfs diff=lfs merge=lfs -text
|
||||
*.lzo filter=lfs diff=lfs merge=lfs -text
|
||||
*.pea filter=lfs diff=lfs merge=lfs -text
|
||||
*.ras filter=lfs diff=lfs merge=lfs -text
|
||||
*.tlz filter=lfs diff=lfs merge=lfs -text
|
||||
*.viv filter=lfs diff=lfs merge=lfs -text
|
||||
*.winmd filter=lfs diff=lfs merge=lfs -text
|
|
@ -0,0 +1,9 @@
|
|||
# A CODEOWNERS file uses a pattern that follows the same rules used in gitignore files.
|
||||
# The pattern is followed by one or more GitHub usernames or team names using the
|
||||
# standard @username or @org/team-name format. You can also refer to a user by an
|
||||
# email address that has been added to their GitHub account, for example user@example.com
|
||||
|
||||
.github/* @reactiveui/event-builder
|
||||
|
||||
* @reactiveui/event-builder
|
||||
version.json @reactiveui/event-builder
|
|
@ -0,0 +1 @@
|
|||
collective: reactiveui
|
|
@ -0,0 +1,4 @@
|
|||
template: |
|
||||
## What's Changed
|
||||
|
||||
$CHANGES
|
|
@ -1,7 +1,5 @@
|
|||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
|
@ -19,18 +17,18 @@
|
|||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
build/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
# Visual Studio 2015 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
# Visual Studio code
|
||||
.vscode/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
|
@ -45,29 +43,20 @@ TestResult.xml
|
|||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
# DNX
|
||||
*.lock.json
|
||||
artifacts/
|
||||
**/Properties/launchSettings.json
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
|
@ -84,6 +73,7 @@ StyleCopReport.xml
|
|||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
*.binlog
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
@ -96,8 +86,6 @@ ipch/
|
|||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
|
@ -105,9 +93,6 @@ ipch/
|
|||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
|
@ -128,14 +113,6 @@ _TeamCity*
|
|||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
|
@ -167,42 +144,31 @@ publish/
|
|||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# TODO: Comment the next line if you want to checkin your web deploy settings
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
**/packages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
!**/packages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
#!**/packages/repositories.config
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
# Windows Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
# Windows Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
# Windows Store app package directory
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
|
@ -216,19 +182,11 @@ ClientBin/
|
|||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
node_modules/
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
|
@ -239,19 +197,15 @@ _UpgradeReport_Files/
|
|||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
@ -261,7 +215,6 @@ FakesAssemblies/
|
|||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
@ -269,9 +222,6 @@ node_modules/
|
|||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
|
@ -282,49 +232,22 @@ _Pvt_Extensions
|
|||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
# Tools
|
||||
tools/
|
||||
|
||||
# ReactiveUI
|
||||
artifacts/
|
||||
src/ReactiveUI.Events*/Events_*.cs
|
||||
|
||||
# macOS
|
||||
.DS_Store
|
||||
|
||||
src/*.Tests/**/ApiApprovalTests*.received.txt
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# 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/
|
||||
# Fody Weavers (for tests)
|
||||
src/Tools/
|
|
@ -0,0 +1,3 @@
|
|||
# Contributor Code of Conduct
|
||||
|
||||
If you’re being harassed, noticed someone else being harassed, or have any other concerns, please <a href="mailto:hello@reactiveui.net">contact us immediately</a>. Your reports will be taken seriously and will not be dismissed or argued with. All members, committers and volunteers in this community are required to act according to the <a href="https://reactiveui.net/code-of-conduct/">Code of Conduct</a>. These guidelines help steer our interactions and strive to keep ReactiveUI a positive, growing project, community and help us provide and ensure a safe environment for everyone. When referring to a group of people, we aim to use gender-neutral terms like "team", "folks", "everyone". (For details, we recommend <a href="https://modelviewculture.com/pieces/gendered-language-feature-or-bug-in-software-documentation" target="_blank">this post</a>).</p>
|
|
@ -0,0 +1,15 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<Authors>.NET Foundation and Contributors</Authors>
|
||||
<Copyright>Copyright (c) .NET Foundation and Contributors</Copyright>
|
||||
<PackageLicenseExpression>MIT</PackageLicenseExpression>
|
||||
<PackageProjectUrl>https://github.com/reactiveui/reactiveui.eventbuilder</PackageProjectUrl>
|
||||
<PackageIconUrl>https://github.com/reactiveui/styleguide/blob/master/logo/main.png?raw=true</PackageIconUrl>
|
||||
<Owners>xpaulbettsx;ghuntley</Owners>
|
||||
<PackageTags>reactive extensions;async;observable;LINQ;netstandard</PackageTags>
|
||||
<PackageReleaseNotes>https://github.com/reactiveui/reactiveui.eventbuilder/releases</PackageReleaseNotes>
|
||||
<RepositoryUrl>https://github.com/reactiveui/reactiveui.eventbuilder</RepositoryUrl>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
</PropertyGroup>
|
||||
</Project>
|
6
LICENSE
6
LICENSE
|
@ -1,6 +1,8 @@
|
|||
MIT License
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2019 ReactiveUI
|
||||
Copyright (c) .NET Foundation and Contributors
|
||||
|
||||
All rights reserved.
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
|
|
|
@ -0,0 +1,46 @@
|
|||
## Event Builder
|
||||
|
||||
![](http://f.cl.ly/items/1307401C3x2g3F2p2Z36/Logo.png)
|
||||
|
||||
[![NuGet Stats](https://img.shields.io/nuget/v/reactiveui.eventbuilder.svg)](https://www.nuget.org/packages/reactiveui.eventbuilder) [![Build Status](https://dev.azure.com/dotnet/ReactiveUI/_apis/build/status/Splat-CI)](https://dev.azure.com/dotnet/ReactiveUI/_build/latest?definitionId=48) [![Code Coverage](https://codecov.io/gh/reactiveui/splat/branch/master/graph/badge.svg)](https://codecov.io/gh/reactiveui/splat)
|
||||
<br>
|
||||
<a href="https://www.nuget.org/packages/reactiveui.eventbuilder">
|
||||
<img src="https://img.shields.io/nuget/dt/splat.svg">
|
||||
</a>
|
||||
<a href="#backers">
|
||||
<img src="https://opencollective.com/reactiveui/backers/badge.svg">
|
||||
</a>
|
||||
<a href="#sponsors">
|
||||
<img src="https://opencollective.com/reactiveui/sponsors/badge.svg">
|
||||
</a>
|
||||
<a href="https://reactiveui.net/slack">
|
||||
<img src="https://img.shields.io/badge/chat-slack-blue.svg">
|
||||
</a>
|
||||
|
||||
### What does it do?
|
||||
|
||||
The EventBuilder will convert events within an assembly and create observable wrappers for them.
|
||||
|
||||
It can generate the observables for the following:
|
||||
* System Platforms, such as Xamarin (iOS/Android/TVOS/Tizen), UWP
|
||||
* NuGet packages
|
||||
* Assemblies.
|
||||
|
||||
There is a MSBuild Task version and a global tool version.
|
||||
|
||||
### How do I install?
|
||||
|
||||
** To Come **
|
||||
|
||||
## Contribute
|
||||
|
||||
ReactiveUI EventBuilder is developed under an OSI-approved open source license, making it freely usable and distributable, even for commercial use. Because of our Open Collective model for funding and transparency, we are able to funnel support and funds through to our contributors and community. We ❤ the people who are involved in this project, and we’d love to have you on board, especially if you are just getting started or have never contributed to open-source before.
|
||||
|
||||
So here's to you, lovely person who wants to join us — this is how you can support us:
|
||||
|
||||
* [Responding to questions on StackOverflow](https://stackoverflow.com/questions/tagged/reactiveui)
|
||||
* [Passing on knowledge and teaching the next generation of developers](http://ericsink.com/entries/dont_use_rxui.html)
|
||||
* [Donations](https://reactiveui.net/donate) and [Corporate Sponsorships](https://reactiveui.net/sponsorship)
|
||||
* [Asking your employer to reciprocate and contribute to open-source](https://github.com/github/balanced-employee-ip-agreement)
|
||||
* Submitting documentation updates where you see fit or lacking.
|
||||
* Making contributions to the code base.
|
|
@ -0,0 +1,19 @@
|
|||
trigger:
|
||||
- master
|
||||
- rel/*
|
||||
- preview/*
|
||||
|
||||
pr:
|
||||
- master
|
||||
- rel/*
|
||||
- preview/*
|
||||
|
||||
resources:
|
||||
repositories:
|
||||
- repository: templates
|
||||
type: github
|
||||
name: ReactiveUI/ReactiveUI.Cake.Recipe
|
||||
endpoint: reactiveui
|
||||
|
||||
jobs:
|
||||
- template: Azure/azure-pipelines.yml@templates # Template reference
|
|
@ -0,0 +1,38 @@
|
|||
#load nuget:https://www.myget.org/F/reactiveui/api/v2?package=ReactiveUI.Cake.Recipe&prerelease
|
||||
|
||||
Environment.SetVariableNames();
|
||||
|
||||
// Whitelisted Packages
|
||||
var packageWhitelist = new[]
|
||||
{
|
||||
MakeAbsolute(File("./src/Splat/Splat.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Autofac/Splat.Autofac.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.DryIoc/Splat.DryIoc.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Ninject/Splat.Ninject.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.SimpleInjector/Splat.SimpleInjector.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Log4Net/Splat.Log4Net.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.NLog/Splat.NLog.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Serilog/Splat.Serilog.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Microsoft.Extensions.Logging/Splat.Microsoft.Extensions.Logging.csproj")),
|
||||
};
|
||||
|
||||
var packageTestWhitelist = new[]
|
||||
{
|
||||
MakeAbsolute(File("./src/Splat.Tests/Splat.Tests.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Autofac.Tests/Splat.Autofac.Tests.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.DryIoc.Tests/Splat.DryIoc.Tests.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.Ninject.Tests/Splat.Ninject.Tests.csproj")),
|
||||
MakeAbsolute(File("./src/Splat.SimpleInjector.Tests/Splat.SimpleInjector.Tests.csproj")),
|
||||
};
|
||||
|
||||
BuildParameters.SetParameters(context: Context,
|
||||
buildSystem: BuildSystem,
|
||||
title: "ReactiveUI.EventBuilder",
|
||||
whitelistPackages: packageWhitelist,
|
||||
whitelistTestPackages: packageTestWhitelist,
|
||||
artifactsDirectory: "./artifacts",
|
||||
sourceDirectory: "./src");
|
||||
|
||||
ToolSettings.SetToolSettings(context: Context);
|
||||
|
||||
Build.Run();
|
|
@ -0,0 +1,2 @@
|
|||
@echo off
|
||||
powershell -ExecutionPolicy Unrestricted ./build.ps1 %CAKE_ARGS% %*
|
|
@ -0,0 +1,2 @@
|
|||
#!/usr/bin/env bash
|
||||
CAKE_VERSION=0.33.0
|
|
@ -0,0 +1,112 @@
|
|||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent
|
||||
|
||||
[string] $CakeVersion = ''
|
||||
foreach($line in Get-Content "$PSScriptRoot\build.config")
|
||||
{
|
||||
if ($line -like 'CAKE_VERSION=*') {
|
||||
$CakeVersion = $line.SubString(13)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if ([string]::IsNullOrEmpty($CakeVersion)) {
|
||||
'Failed to parse Cake Version'
|
||||
exit 1
|
||||
}
|
||||
|
||||
# Make sure tools folder exists
|
||||
$ToolPath = Join-Path $PSScriptRoot "tools"
|
||||
if (!(Test-Path $ToolPath)) {
|
||||
Write-Verbose "Creating tools directory..."
|
||||
New-Item -Path $ToolPath -Type Directory -Force | out-null
|
||||
}
|
||||
|
||||
|
||||
if ($PSVersionTable.PSEdition -ne 'Core') {
|
||||
# Attempt to set highest encryption available for SecurityProtocol.
|
||||
# PowerShell will not set this by default (until maybe .NET 4.6.x). This
|
||||
# will typically produce a message for PowerShell v2 (just an info
|
||||
# message though)
|
||||
try {
|
||||
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48)
|
||||
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't
|
||||
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is
|
||||
# installed (.NET 4.5 is an in-place upgrade).
|
||||
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48
|
||||
} catch {
|
||||
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3'
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# INSTALL .NET CORE CLI
|
||||
###########################################################################
|
||||
|
||||
Function Remove-PathVariable([string]$VariableToRemove)
|
||||
{
|
||||
$SplitChar = ';'
|
||||
if ($IsMacOS -or $IsLinux) {
|
||||
$SplitChar = ':'
|
||||
}
|
||||
|
||||
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
|
||||
if ($path -ne $null)
|
||||
{
|
||||
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
|
||||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "User")
|
||||
}
|
||||
|
||||
$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
|
||||
if ($path -ne $null)
|
||||
{
|
||||
$newItems = $path.Split($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
|
||||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process")
|
||||
}
|
||||
}
|
||||
|
||||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
|
||||
###########################################################################
|
||||
# INSTALL CAKE
|
||||
###########################################################################
|
||||
|
||||
# Make sure Cake has been installed.
|
||||
[string] $CakeExePath = ''
|
||||
[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version}
|
||||
|
||||
if ($CakeInstalledVersion -eq $CakeVersion) {
|
||||
# Cake found locally
|
||||
$CakeExePath = (Get-Command dotnet-cake).Source
|
||||
}
|
||||
else {
|
||||
$CakePath = Join-Path $ToolPath ".store\cake.tool\$CakeVersion"
|
||||
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
|
||||
|
||||
|
||||
if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) {
|
||||
|
||||
if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf))
|
||||
{
|
||||
& dotnet tool uninstall --tool-path $ToolPath Cake.Tool
|
||||
}
|
||||
|
||||
& dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool
|
||||
if ($LASTEXITCODE -ne 0)
|
||||
{
|
||||
'Failed to install cake'
|
||||
exit 1
|
||||
}
|
||||
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1)
|
||||
}
|
||||
}
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
& "$CakeExePath" ./build.cake --bootstrap
|
||||
if ($LASTEXITCODE -eq 0)
|
||||
{
|
||||
& "$CakeExePath" ./build.cake $args
|
||||
}
|
||||
exit $LASTEXITCODE
|
|
@ -0,0 +1,51 @@
|
|||
#!/usr/bin/env bash
|
||||
# Define varibles
|
||||
SCRIPT_DIR=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
|
||||
source $SCRIPT_DIR/build.config
|
||||
TOOLS_DIR=$SCRIPT_DIR/tools
|
||||
CAKE_EXE=$TOOLS_DIR/dotnet-cake
|
||||
CAKE_PATH=$TOOLS_DIR/.store/cake.tool/$CAKE_VERSION
|
||||
|
||||
# Make sure the tools folder exist.
|
||||
if [ ! -d "$TOOLS_DIR" ]; then
|
||||
mkdir "$TOOLS_DIR"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# INSTALL CAKE
|
||||
###########################################################################
|
||||
export DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1
|
||||
export DOTNET_CLI_TELEMETRY_OPTOUT=1
|
||||
export DOTNET_SYSTEM_NET_HTTP_USESOCKETSHTTPHANDLER=0
|
||||
|
||||
CAKE_INSTALLED_VERSION=$(dotnet-cake --version 2>&1)
|
||||
|
||||
if [ "$CAKE_VERSION" != "$CAKE_INSTALLED_VERSION" ]; then
|
||||
if [ ! -f "$CAKE_EXE" ] || [ ! -d "$CAKE_PATH" ]; then
|
||||
if [ -f "$CAKE_EXE" ]; then
|
||||
dotnet tool uninstall --tool-path $TOOLS_DIR Cake.Tool
|
||||
fi
|
||||
|
||||
echo "Installing Cake $CAKE_VERSION..."
|
||||
dotnet tool install --tool-path $TOOLS_DIR --version $CAKE_VERSION Cake.Tool
|
||||
if [ $? -ne 0 ]; then
|
||||
echo "An error occured while installing Cake."
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
|
||||
# Make sure that Cake has been installed.
|
||||
if [ ! -f "$CAKE_EXE" ]; then
|
||||
echo "Could not find Cake.exe at '$CAKE_EXE'."
|
||||
exit 1
|
||||
fi
|
||||
else
|
||||
CAKE_EXE="dotnet-cake"
|
||||
fi
|
||||
|
||||
###########################################################################
|
||||
# RUN BUILD SCRIPT
|
||||
###########################################################################
|
||||
|
||||
# Start Cake
|
||||
(exec "$CAKE_EXE" --bootstrap) && (exec "$CAKE_EXE" "$@")
|
|
@ -0,0 +1,7 @@
|
|||
[Paths]
|
||||
Tools=./tools
|
||||
Addins=./tools/Addins
|
||||
Modules=./tools/Modules
|
||||
|
||||
[NuGet]
|
||||
UseInProcessClient=true
|
|
@ -0,0 +1,161 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddCtorToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddFieldToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.FieldDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMethodToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateDelegateDeclaration(Mono.Cecil.TypeDefinition,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateGenericArguments(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference[]")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetBaseTypes(Mono.Cecil.TypeDefinition)~System.Collections.Generic.IEnumerable{Mono.Cecil.TypeDefinition}")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetMethodAttributes(Mono.Cecil.MethodDefinition)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetPropertyAttributes(System.CodeDom.MemberAttributes,System.CodeDom.MemberAttributes)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetTypeName(Mono.Cecil.TypeReference)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDotNetTypeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ModifyCodeTypeReference(System.CodeDom.CodeTypeReference,System.String)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateGenericParameters(Mono.Cecil.IGenericParameterProvider,System.CodeDom.CodeTypeParameterCollection)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1503:Braces should not be omitted", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateMethodParameters(Mono.Cecil.IMethodSignature,System.CodeDom.CodeParameterDeclarationExpressionCollection,System.Collections.Generic.HashSet{System.String},System.Boolean)")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.defaultWhitelistedNamespacePrefixes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.defaultWhitelistedNamespacePrefixes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.OperatorNameMap")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.OperatorNameMap")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.SkipAttributeNames")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.SkipAttributeNames")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddCtorToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddCtorToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddFieldToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.FieldDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddFieldToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.FieldDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMethodToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMethodToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ConvertAttributeToCode(System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},Mono.Cecil.CustomAttribute)~System.Object")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ConvertAttributeToCode(System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},Mono.Cecil.CustomAttribute)~System.Object")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateCodeTypeReference(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateCodeTypeReference(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeAttributeDeclarationCollection")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeAttributeDeclarationCollection")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateDelegateDeclaration(Mono.Cecil.TypeDefinition,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateDelegateDeclaration(Mono.Cecil.TypeDefinition,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateGenericArguments(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference[]")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateGenericArguments(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference[]")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreatePublicApiForAssembly(Mono.Cecil.AssemblyDefinition,System.Func{Mono.Cecil.TypeDefinition,System.Boolean},System.Boolean,System.String[],System.Collections.Generic.HashSet{System.String})~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreatePublicApiForAssembly(Mono.Cecil.AssemblyDefinition,System.Func{Mono.Cecil.TypeDefinition,System.Boolean},System.Boolean,System.String[],System.Collections.Generic.HashSet{System.String})~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.FormatParameterConstant(Mono.Cecil.IConstantProvider)~System.Object")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.FormatParameterConstant(Mono.Cecil.IConstantProvider)~System.Object")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GenerateCodeAttributeDeclaration(System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},Mono.Cecil.CustomAttribute)~System.CodeDom.CodeAttributeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GenerateCodeAttributeDeclaration(System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},Mono.Cecil.CustomAttribute)~System.CodeDom.CodeAttributeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GenerateEvent(Mono.Cecil.EventDefinition,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeMember")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GenerateEvent(Mono.Cecil.EventDefinition,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeMember")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetBaseTypes(Mono.Cecil.TypeDefinition)~System.Collections.Generic.IEnumerable{Mono.Cecil.TypeDefinition}")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetBaseTypes(Mono.Cecil.TypeDefinition)~System.Collections.Generic.IEnumerable{Mono.Cecil.TypeDefinition}")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetMethodAttributes(Mono.Cecil.MethodDefinition)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetMethodAttributes(Mono.Cecil.MethodDefinition)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetPropertyAttributes(System.CodeDom.MemberAttributes,System.CodeDom.MemberAttributes)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetPropertyAttributes(System.CodeDom.MemberAttributes,System.CodeDom.MemberAttributes)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetTypeName(Mono.Cecil.TypeReference)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetTypeName(Mono.Cecil.TypeReference)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.HasVisiblePropertyMethod(System.CodeDom.MemberAttributes)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.HasVisiblePropertyMethod(System.CodeDom.MemberAttributes)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsCompilerGenerated(Mono.Cecil.IMemberDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsCompilerGenerated(Mono.Cecil.IMemberDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDelegate(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDelegate(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDotNetTypeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDotNetTypeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsExtensionMethod(Mono.Cecil.ICustomAttributeProvider)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsExtensionMethod(Mono.Cecil.ICustomAttributeProvider)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsHidingMethod(Mono.Cecil.MethodDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsHidingMethod(Mono.Cecil.MethodDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.MakeReadonly(System.CodeDom.CodeTypeReference)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.MakeReadonly(System.CodeDom.CodeTypeReference)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ModifyCodeTypeReference(System.CodeDom.CodeTypeReference,System.String)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ModifyCodeTypeReference(System.CodeDom.CodeTypeReference,System.String)~System.CodeDom.CodeTypeReference")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.NormaliseGeneratedCode(System.IO.StringWriter)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.NormaliseGeneratedCode(System.IO.StringWriter)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.NormaliseLineEndings(System.String)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.NormaliseLineEndings(System.String)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateGenericParameters(Mono.Cecil.IGenericParameterProvider,System.CodeDom.CodeTypeParameterCollection)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateGenericParameters(Mono.Cecil.IGenericParameterProvider,System.CodeDom.CodeTypeParameterCollection)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateMethodParameters(Mono.Cecil.IMethodSignature,System.CodeDom.CodeParameterDeclarationExpressionCollection,System.Collections.Generic.HashSet{System.String},System.Boolean)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateMethodParameters(Mono.Cecil.IMethodSignature,System.CodeDom.CodeParameterDeclarationExpressionCollection,System.Collections.Generic.HashSet{System.String},System.Boolean)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.RemoveUnnecessaryWhiteSpace(System.String)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.RemoveUnnecessaryWhiteSpace(System.String)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeAttribute(Mono.Cecil.CustomAttribute,System.Collections.Generic.HashSet{System.String})~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeAttribute(Mono.Cecil.CustomAttribute,System.Collections.Generic.HashSet{System.String})~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeType(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldIncludeType(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldOutputBaseType(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.ShouldOutputBaseType(Mono.Cecil.TypeDefinition)~System.Boolean")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1400:Access modifier should be declared", Justification = "NuGet Inclusion", Scope = "type", Target = "~T:PublicApiGenerator.CecilEx")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Readability", "RCS1018:Add default access modifier.", Justification = "NuGet Inclusion", Scope = "type", Target = "~T:PublicApiGenerator.CecilEx")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:Symbols should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:Symbols should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetPropertyAttributes(System.CodeDom.MemberAttributes,System.CodeDom.MemberAttributes)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1003:Symbols should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetPropertyAttributes(System.CodeDom.MemberAttributes,System.CodeDom.MemberAttributes)~System.CodeDom.MemberAttributes")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1009:Closing parenthesis should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.RemoveUnnecessaryWhiteSpace(System.String)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1122:Use string.Empty for empty strings", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GetTypeName(Mono.Cecil.TypeReference)~System.String")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1305:Specify IFormatProvider", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateGenericArguments(Mono.Cecil.TypeReference)~System.CodeDom.CodeTypeReference[]")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreatePublicApiForAssembly(Mono.Cecil.AssemblyDefinition,System.Func{Mono.Cecil.TypeDefinition,System.Boolean},System.Boolean,System.String[],System.Collections.Generic.HashSet{System.String})~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GenerateCodeAttributeDeclaration(System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},Mono.Cecil.CustomAttribute)~System.CodeDom.CodeAttributeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1513:Closing brace should be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateGenericParameters(Mono.Cecil.IGenericParameterProvider,System.CodeDom.CodeTypeParameterCollection)")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "RCS1001:Add braces (when expression spans over multiple lines).", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters should be on same line or separate lines", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.GeneratePublicApi(System.Reflection.Assembly,System.Type[],System.Boolean,System.String[],System.String[])~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1117:Parameters should be on same line or separate lines", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.NormaliseGeneratedCode(System.IO.StringWriter)~System.String")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMemberToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.IMemberDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeAttributeDeclarationCollection")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateCustomAttributes(Mono.Cecil.ICustomAttributeProvider,System.CodeDom.CodeAttributeDeclarationCollection,System.Func{System.CodeDom.CodeTypeReference,System.CodeDom.CodeTypeReference},System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.PopulateMethodParameters(Mono.Cecil.IMethodSignature,System.CodeDom.CodeParameterDeclarationExpressionCollection,System.Collections.Generic.HashSet{System.String},System.Boolean)")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1116:Split parameters should start on line after declaration", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.RemoveUnnecessaryWhiteSpace(System.String)~System.String")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1000:Keywords should be spaced correctly", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1209:Using alias directives should be placed after other using directives", Justification = "NuGet Inclusion")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1210:Using directives should be ordered alphabetically by namespace", Justification = "NuGet Inclusion")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1208:System using directives should be placed before other using directives", Justification = "NuGet Inclusion")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:Elements should appear in the correct order", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.OperatorNameMap")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.OrderingRules", "SA1201:Elements should appear in the correct order", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.SkipAttributeNames")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1825:Avoid zero-length array allocations.", Justification = "NuGet Inclusion", Scope = "member", Target = "~F:PublicApiGenerator.ApiGenerator.defaultWhitelistedNamespacePrefixes")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMethodToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("Globalization", "CA1307:Specify StringComparison", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.IsDotNetTypeMember(Mono.Cecil.IMemberDefinition,System.String[])~System.Boolean")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1512:Single-line comments should not be followed by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddPropertyToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.PropertyDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.AddMethodToTypeDeclaration(System.CodeDom.CodeTypeDeclaration,Mono.Cecil.MethodDefinition,System.Collections.Generic.HashSet{System.String})")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1515:Single-line comment should be preceded by blank line", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.LayoutRules", "SA1520:Use braces consistently", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateTypeDeclaration(Mono.Cecil.TypeDefinition,System.String[],System.Collections.Generic.HashSet{System.String})~System.CodeDom.CodeTypeDeclaration")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.MaintainabilityRules", "SA1402:File may only contain a single type", Justification = "NuGet Inclusion", Scope = "type", Target = "~T:PublicApiGenerator.CecilEx")]
|
||||
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.SpacingRules", "SA1005:Single line comments should begin with single space", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.CreateInitialiserExpression(Mono.Cecil.CustomAttributeArgument)~System.CodeDom.CodeExpression")]
|
||||
[assembly: System.Diagnostics.CodeAnalysis.SuppressMessage("StyleCop.CSharp.ReadabilityRules", "SA1111:Closing parenthesis should be on line of last parameter", Justification = "NuGet Inclusion", Scope = "member", Target = "~M:PublicApiGenerator.ApiGenerator.RemoveUnnecessaryWhiteSpace(System.String)~System.String")]
|
|
@ -0,0 +1,62 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<NoWarn>$(NoWarn);VSX1000</NoWarn>
|
||||
<Platform>AnyCPU</Platform>
|
||||
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
|
||||
<RepositoryType>git</RepositoryType>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)analyzers.ruleset</CodeAnalysisRuleSet>
|
||||
<IsTestProject>$(MSBuildProjectName.Contains('Tests'))</IsTestProject>
|
||||
<DebugType>Embedded</DebugType>
|
||||
<!-- Optional: Publish the repository URL in the built .nupkg (in the NuSpec <Repository> element) -->
|
||||
<PublishRepositoryUrl>true</PublishRepositoryUrl>
|
||||
<!-- Optional: Embed source files that are not tracked by the source control manager in the PDB -->
|
||||
<EmbedUntrackedSources>true</EmbedUntrackedSources>
|
||||
<!-- Optional: Include PDB in the built .nupkg -->
|
||||
<AllowedOutputExtensionsInPackageBuildOutputFolder>$(AllowedOutputExtensionsInPackageBuildOutputFolder);.pdb</AllowedOutputExtensionsInPackageBuildOutputFolder>
|
||||
<!-- disable sourcelink on mono, to workaround https://github.com/dotnet/sourcelink/issues/155 -->
|
||||
<EnableSourceLink Condition=" '$(OS)' != 'Windows_NT' AND '$(MSBuildRuntimeType)' != 'Core' ">false</EnableSourceLink>
|
||||
<EnableSourceControlManagerQueries>$(EnableSourceLink)</EnableSourceControlManagerQueries>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(IsTestProject)">
|
||||
<CodeAnalysisRuleSet>$(MSBuildThisFileDirectory)analyzers.tests.ruleset</CodeAnalysisRuleSet>
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup Condition="$(IsTestProject)">
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.0.1" />
|
||||
<PackageReference Include="xunit" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.console" Version="2.4.1" />
|
||||
<PackageReference Include="xunit.runner.visualstudio" Version="2.4.1" />
|
||||
<PackageReference Include="Xunit.StaFact" Version="0.3.18" />
|
||||
<PackageReference Include="Shouldly" Version=" 3.0.2" />
|
||||
<PackageReference Include="Microsoft.Reactive.Testing" Version="4.0.0" />
|
||||
<PackageReference Include="PublicApiGenerator" Version="8.1.0" />
|
||||
</ItemGroup>
|
||||
<ItemGroup Condition="$(IsTestProject)">
|
||||
<Compile Include="$(MSBuildThisFileDirectory)ApiGeneratorGlobalSuppressions.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup Condition="'$(IsTestProject)' != 'true' and '$(SourceLinkEnabled)' != 'false'">
|
||||
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="1.0.0-beta2-18618-05" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="$(MSBuildThisFileDirectory)..\LICENSE" Pack="true" PackagePath="LICENSE" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Nerdbank.GitVersioning" Version="2.3.38" PrivateAssets="all" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="stylecop.analyzers" Version="1.1.1-rc.114" PrivateAssets="all" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.FxCopAnalyzers" Version="2.6.3" PrivateAssets="all" />
|
||||
<PackageReference Include="Roslynator.Analyzers" Version="2.1.0-rc" PrivateAssets="All" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<AdditionalFiles Include="$(MSBuildThisFileDirectory)stylecop.json" Link="stylecop.json" />
|
||||
</ItemGroup>
|
||||
|
||||
<Import Project="..\Directory.build.props" />
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,30 @@
|
|||
<Project>
|
||||
<PropertyGroup>
|
||||
<Product>$(AssemblyName) ($(TargetFramework))</Product>
|
||||
</PropertyGroup>
|
||||
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('net4'))">
|
||||
<DefineConstants>$(DefineConstants);NET_45;XAML</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('uap'))">
|
||||
<DefineConstants>$(DefineConstants);NETFX_CORE;XAML;WINDOWS_UWP</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS'))">
|
||||
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac'))">
|
||||
<DefineConstants>$(DefineConstants);MONO;COCOA</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.TVOS'))">
|
||||
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('Xamarin.WatchOS'))">
|
||||
<DefineConstants>$(DefineConstants);MONO;UIKIT;COCOA</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('MonoAndroid'))">
|
||||
<DefineConstants>$(DefineConstants);MONO;ANDROID</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="$(TargetFramework.StartsWith('tizen'))">
|
||||
<DefineConstants>$(DefineConstants);TIZEN</DefineConstants>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using EventBuilder.Core.Reflection;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static EventBuilder.Core.Reflection.XmlSyntaxFactory;
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Benchmarks
|
||||
{
|
||||
[ClrJob]
|
||||
[CoreJob]
|
||||
[MemoryDiagnoser]
|
||||
[MarkdownExporterAttribute.GitHub]
|
||||
public class CommentGenerator
|
||||
{
|
||||
private static readonly string[] _testValues = { "This is a test {0}.", "Test2 this is a test {0}" };
|
||||
private static readonly string[] _testValuesTypes = { "System.Blah1", "System.Blah2" };
|
||||
|
||||
/// <summary>
|
||||
/// A benchmark which tests the <see cref="XmlSyntaxFactory.GenerateSummarySeeAlsoComment(string, string)"/> method.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public void GenerateSummarySeeAlsoCommentBenchmark()
|
||||
{
|
||||
for (int i = 0; i < _testValues.Length * 5; ++i)
|
||||
{
|
||||
int currentIndex = i % _testValues.Length;
|
||||
var testValue = _testValues[currentIndex];
|
||||
var testValueType = _testValuesTypes[currentIndex];
|
||||
var syntax = XmlSyntaxFactory.GenerateSummarySeeAlsoComment(testValue, testValueType);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,7 @@
|
|||
<Project>
|
||||
<Import Project="$(MSBuildThisFileDirectory)..\..\..\Directory.build.props" />
|
||||
|
||||
<PropertyGroup>
|
||||
<CodeAnalysisRuleSet></CodeAnalysisRuleSet>
|
||||
</PropertyGroup>
|
||||
</Project>
|
|
@ -0,0 +1,16 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="benchmarkdotnet" Version="0.11.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EventBuilder.Core\EventBuilder.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Attributes;
|
||||
using BenchmarkDotNet.Order;
|
||||
using EventBuilder.Core;
|
||||
|
||||
namespace EventBuilder.Benchmarks
|
||||
{
|
||||
/// <summary>
|
||||
/// Benchmarks for the NavigationStack and the RoutingState objects.
|
||||
/// </summary>
|
||||
[ClrJob]
|
||||
[CoreJob]
|
||||
[MemoryDiagnoser]
|
||||
[MarkdownExporterAttribute.GitHub]
|
||||
public class NavigationStackBenchmark
|
||||
{
|
||||
private static string _referenceAssembliesLocation = PlatformHelper.IsRunningOnMono() ?
|
||||
@"/Library/Frameworks/Libraries/mono" :
|
||||
@"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework";
|
||||
|
||||
/// <summary>
|
||||
/// Benchmark for when navigating to a new view model.
|
||||
/// </summary>
|
||||
[Benchmark]
|
||||
public Task Navigate()
|
||||
{
|
||||
var platforms = Enum.GetValues(typeof(AutoPlatform)).OfType<AutoPlatform>();
|
||||
return EventGenerator.ExtractEventsFromAssemblies(Path.GetTempPath(), Guid.NewGuid().ToString(), _referenceAssembliesLocation, platforms);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,26 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using BenchmarkDotNet.Running;
|
||||
|
||||
namespace ReactiveUI.Benchmarks
|
||||
{
|
||||
/// <summary>
|
||||
/// Class which hosts the main entry point into the application.
|
||||
/// </summary>
|
||||
public static class Program
|
||||
{
|
||||
/// <summary>
|
||||
/// The main entry point into the benchmarking application.
|
||||
/// </summary>
|
||||
/// <param name="args">Arguments from the command line.</param>
|
||||
public static void Main(string[] args) => BenchmarkSwitcher.FromAssembly(typeof(Program).Assembly).Run(args);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommandLine;
|
||||
|
||||
namespace EventBuilder.CommandOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// A base class for commonly shared options.
|
||||
/// </summary>
|
||||
public abstract class CommandLineOptionsBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the path where to output the contents.
|
||||
/// </summary>
|
||||
[Option('o', "output-path", Required = true, HelpText = "The directory path where to output the contents.")]
|
||||
public string OutputPath { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the output file prefix.
|
||||
/// </summary>
|
||||
[Option("output-prefix", Required = true, HelpText = "Specify a prefix for the output file based on the platforms selected. Each platform output file will contain this prefix.")]
|
||||
public string OutputPrefix { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommandLine;
|
||||
|
||||
namespace EventBuilder.CommandOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// A options class that represent when the user wants to generate from their own custom list of assemblies and search directories.
|
||||
/// </summary>
|
||||
[Verb("generate-custom", HelpText = "Generate from own specified assembly paths and search directories.")]
|
||||
public class CustomAssembliesCommandLineOptions : CommandLineOptionsBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the reference assemblies.
|
||||
/// </summary>
|
||||
[Option('s', "search-directories", Required = true, HelpText = "Specify a search directories where to search for additional support libraries.")]
|
||||
public IEnumerable<string> SearchDirectories { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the assemblies.
|
||||
/// Manual generation using the specified assemblies. Use with --platform=NONE.
|
||||
/// </summary>
|
||||
[Option('a', "assemblies", Required = true, HelpText = "List of assemblies to process.")]
|
||||
public IEnumerable<string> Assemblies { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using CommandLine;
|
||||
|
||||
namespace EventBuilder.CommandOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Command line options for working in a NuGet package mode.
|
||||
/// </summary>
|
||||
[Verb("generate-nuget", HelpText = "Generate from a specified NuGet package.")]
|
||||
public class NugetCommandLineOptions : CommandLineOptionsBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the platform.
|
||||
/// </summary>
|
||||
[Option('p', "package", Required = true, HelpText = "The name of the NuGet package.")]
|
||||
public string NugetPackageName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference assemblies.
|
||||
/// </summary>
|
||||
[Option('v', "version", Required = true, HelpText = "Specify the NuGet version number.")]
|
||||
public string NugetVersion { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference assemblies.
|
||||
/// </summary>
|
||||
[Option('t', "target-framework", Required = true, HelpText = "Specify the Target framework to extract for.")]
|
||||
public string TargetFramework { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using CommandLine;
|
||||
using EventBuilder.Core;
|
||||
|
||||
namespace EventBuilder.CommandOptions
|
||||
{
|
||||
/// <summary>
|
||||
/// Command line options for the platform based generation.
|
||||
/// </summary>
|
||||
[Verb("generate-platform", HelpText = "Generate from a predetermined platform.")]
|
||||
public class PlatformCommandLineOptions : CommandLineOptionsBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets or sets the platform.
|
||||
/// </summary>
|
||||
[Option('p', "platforms", Separator = ',', Required = true, HelpText = "Platform to automatically generate. Possible options include: ANDROID, IOS, WPF, MAC, TIZEN, UWP, XAMFORMS, WINFORMS, TVOS, ESSENTIALS")]
|
||||
public IEnumerable<AutoPlatform> Platforms { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets or sets the reference assemblies.
|
||||
/// </summary>
|
||||
[Option('r', "reference", Required = false, HelpText = "Specify a Reference Assemblies location to override the default.")]
|
||||
public string ReferenceAssemblies { get; set; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,21 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<OutputType>Exe</OutputType>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
<AssemblyName>EventBuilder</AssemblyName>
|
||||
<RootNamespace>EventBuilder</RootNamespace>
|
||||
<LangVersion>latest</LangVersion>
|
||||
<PackAsTool>true</PackAsTool>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="commandlineparser" Version="2.4.3" />
|
||||
<PackageReference Include="Serilog.Settings.AppSettings" Version="2.2.2" />
|
||||
<PackageReference Include="serilog.sinks.coloredconsole" Version="3.0.1" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="4.0.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EventBuilder.Core\EventBuilder.Core.csproj" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,23 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
namespace EventBuilder.Console
|
||||
{
|
||||
/// <summary>
|
||||
/// The exit/return code (aka %ERRORLEVEL%) on application exit.
|
||||
/// </summary>
|
||||
public enum ExitCode
|
||||
{
|
||||
/// <summary>
|
||||
/// Success
|
||||
/// </summary>
|
||||
Success = 0,
|
||||
|
||||
/// <summary>
|
||||
/// Error
|
||||
/// </summary>
|
||||
Error = 1,
|
||||
}
|
||||
}
|
|
@ -0,0 +1,86 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using CommandLine;
|
||||
using CommandLine.Text;
|
||||
using EventBuilder.CommandOptions;
|
||||
using EventBuilder.Core;
|
||||
using Serilog;
|
||||
using Serilog.Events;
|
||||
using Parser = CommandLine.Parser;
|
||||
|
||||
namespace EventBuilder.Console
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
private static string _referenceAssembliesLocation = PlatformHelper.IsRunningOnMono() ?
|
||||
@"/Library/Frameworks/Libraries/mono" :
|
||||
@"C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ReferenceAssemblies\Microsoft\Framework";
|
||||
|
||||
public static async Task<int> Main(string[] args)
|
||||
{
|
||||
Log.Logger = new LoggerConfiguration()
|
||||
.MinimumLevel.Verbose()
|
||||
.WriteTo.ColoredConsole(LogEventLevel.Information)
|
||||
.WriteTo.File("EventBuilder.Log")
|
||||
.CreateLogger();
|
||||
|
||||
// allow app to be debugged in visual studio.
|
||||
if (args.Length == 0 && Debugger.IsAttached)
|
||||
{
|
||||
args = "generate-platform --platforms=uwp --output-path=test.txt".Split(' ');
|
||||
}
|
||||
|
||||
var parserResult = new Parser(parserSettings => parserSettings.CaseInsensitiveEnumValues = true)
|
||||
.ParseArguments<CustomAssembliesCommandLineOptions, PlatformCommandLineOptions>(args);
|
||||
|
||||
var result = await parserResult.MapResult(
|
||||
async (PlatformCommandLineOptions options) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(options.ReferenceAssemblies))
|
||||
{
|
||||
_referenceAssembliesLocation = options.ReferenceAssemblies;
|
||||
}
|
||||
|
||||
await EventGenerator.ExtractEventsFromAssemblies(options.OutputPath, options.OutputPrefix, _referenceAssembliesLocation, options.Platforms).ConfigureAwait(false);
|
||||
|
||||
return ExitCode.Success;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex.ToString());
|
||||
return ExitCode.Error;
|
||||
}
|
||||
},
|
||||
async (CustomAssembliesCommandLineOptions options) =>
|
||||
{
|
||||
try
|
||||
{
|
||||
await EventGenerator.ExtractEventsFromAssemblies(options.OutputPath, options.OutputPrefix, options.Assemblies, options.SearchDirectories).ConfigureAwait(false);
|
||||
|
||||
return ExitCode.Success;
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Log.Fatal(ex.ToString());
|
||||
return ExitCode.Error;
|
||||
}
|
||||
},
|
||||
_ =>
|
||||
{
|
||||
System.Console.WriteLine(HelpText.AutoBuild(parserResult));
|
||||
return Task.FromResult(ExitCode.Error);
|
||||
}).ConfigureAwait(false);
|
||||
|
||||
return (int)result;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"profiles": {
|
||||
"EventBuilder.Console": {
|
||||
"commandName": "Project",
|
||||
"commandLineArgs": "generate-platform --platforms=\"essentials\" --reference=\"C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/Common7/IDE/ReferenceAssemblies/Microsoft/Framework\" --output-path=\"C:/source/reactiveui/reactiveui-rewrite/src/ReactiveUI.Events\" --output-prefix=\"Events_\""
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,65 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
namespace EventBuilder.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// The event builder platform.
|
||||
/// </summary>
|
||||
public enum AutoPlatform
|
||||
{
|
||||
/// <summary>
|
||||
/// Android platform.
|
||||
/// </summary>
|
||||
Android,
|
||||
|
||||
#pragma warning disable SA1300 // Element should begin with upper-case letter
|
||||
/// <summary>
|
||||
/// iOS platform.
|
||||
/// </summary>
|
||||
iOS,
|
||||
#pragma warning restore SA1300 // Element should begin with upper-case letter
|
||||
|
||||
/// <summary>
|
||||
/// Mac platform.
|
||||
/// </summary>
|
||||
Mac,
|
||||
|
||||
/// <summary>
|
||||
/// Tizen platform.
|
||||
/// </summary>
|
||||
Tizen4,
|
||||
|
||||
/// <summary>
|
||||
/// WPF platform.
|
||||
/// </summary>
|
||||
WPF,
|
||||
|
||||
/// <summary>
|
||||
/// Xamarin Forms platform.
|
||||
/// </summary>
|
||||
XamForms,
|
||||
|
||||
/// <summary>
|
||||
/// UWP platform.
|
||||
/// </summary>
|
||||
UWP,
|
||||
|
||||
/// <summary>
|
||||
/// Win Forms platform.
|
||||
/// </summary>
|
||||
Winforms,
|
||||
|
||||
/// <summary>
|
||||
/// TV OS platform.
|
||||
/// </summary>
|
||||
TVOS,
|
||||
|
||||
/// <summary>
|
||||
/// Xamarin Essentials platform.
|
||||
/// </summary>
|
||||
Essentials
|
||||
}
|
||||
}
|
|
@ -0,0 +1,20 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netstandard2.0</TargetFramework>
|
||||
<LangVersion>latest</LangVersion>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="Templates\HeaderTemplate.txt" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="ICSharpCode.Decompiler" Version="4.0.0.4521" />
|
||||
<PackageReference Include="Microsoft.CodeAnalysis.CSharp" Version="3.0.0" />
|
||||
<PackageReference Include="nuget.protocol" Version="5.0.0" />
|
||||
<PackageReference Include="polly" Version="7.1.0" />
|
||||
<PackageReference Include="serilog" Version="2.8.0" />
|
||||
<PackageReference Include="stubble.core" Version="1.2.7" />
|
||||
<PackageReference Include="system.collections.immutable" Version="1.5.0" />
|
||||
</ItemGroup>
|
||||
</Project>
|
|
@ -0,0 +1,92 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using EventBuilder.Core.Extractors.PlatformExtractors;
|
||||
using EventBuilder.Core.Reflection;
|
||||
using EventBuilder.Core.Reflection.Resolvers;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
using Serilog;
|
||||
|
||||
namespace EventBuilder.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Processes the specified platform and saves out a specified template.
|
||||
/// </summary>
|
||||
public static class EventGenerator
|
||||
{
|
||||
private static readonly INamespaceResolver[] _resolvers =
|
||||
{
|
||||
new PublicEventNamespaceResolver(),
|
||||
new PublicStaticEventNamespaceResolver(),
|
||||
new DelegateTemplateNamespaceResolver()
|
||||
};
|
||||
|
||||
private static readonly IDictionary<AutoPlatform, IPlatformExtractor> _platformExtractors = new IPlatformExtractor[]
|
||||
{
|
||||
new Android(),
|
||||
new Essentials(),
|
||||
new iOS(),
|
||||
new Mac(),
|
||||
new Tizen(),
|
||||
new TVOS(),
|
||||
new UWP(),
|
||||
new Winforms(),
|
||||
new WPF(),
|
||||
new XamForms(),
|
||||
}.ToImmutableDictionary(x => x.Platform);
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the events and delegates from the specified platform.
|
||||
/// </summary>
|
||||
/// <param name="outputPath">The path where to output the files.</param>
|
||||
/// <param name="prefix">The prefix to add to the start of the output file.</param>
|
||||
/// <param name="defaultReferenceAssemblyLocation">A directory path to where reference assemblies can be located.</param>
|
||||
/// <param name="platforms">The platforms to generate for.</param>
|
||||
/// <returns>A task to monitor the progress.</returns>
|
||||
public static async Task ExtractEventsFromAssemblies(string outputPath, string prefix, string defaultReferenceAssemblyLocation, IEnumerable<AutoPlatform> platforms)
|
||||
{
|
||||
foreach (var platform in platforms)
|
||||
{
|
||||
Log.Information("Processing platform {0}", platform);
|
||||
var platformExtractor = _platformExtractors[platform];
|
||||
await platformExtractor.Extract(defaultReferenceAssemblyLocation).ConfigureAwait(false);
|
||||
|
||||
await ExtractEventsFromAssemblies(outputPath, prefix + platform, platformExtractor.Assemblies, platformExtractor.SearchDirectories).ConfigureAwait(false);
|
||||
Log.Information("Finished platform {0}", platform);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the events and delegates from the specified platform.
|
||||
/// </summary>
|
||||
/// <param name="outputPath">The path where to output the files.</param>
|
||||
/// <param name="prefix">The prefix to add to the start of the output file.</param>
|
||||
/// <param name="assemblyPaths">The paths to the assemblies to extract.</param>
|
||||
/// <param name="searchDirectories">Paths to any directories to search for supporting libraries.</param>
|
||||
/// <returns>A task to monitor the progress.</returns>
|
||||
public static async Task ExtractEventsFromAssemblies(string outputPath, string prefix, IEnumerable<string> assemblyPaths, IEnumerable<string> searchDirectories)
|
||||
{
|
||||
var compilation = RoslynHelpers.GetCompilation(assemblyPaths, searchDirectories);
|
||||
|
||||
var compilationOutputSyntax = SyntaxFactory.CompilationUnit().WithMembers(SyntaxFactory.List<MemberDeclarationSyntax>(_resolvers.SelectMany(x => x.Create(compilation))));
|
||||
|
||||
using (StreamWriter streamWriter = new StreamWriter(Path.Combine(outputPath, prefix + ".cs")))
|
||||
{
|
||||
await streamWriter.WriteAsync(await TemplateManager.GetTemplateAsync(TemplateManager.HeaderTemplate).ConfigureAwait(false)).ConfigureAwait(false);
|
||||
await streamWriter.WriteAsync(Environment.NewLine).ConfigureAwait(false);
|
||||
await streamWriter.WriteAsync(compilationOutputSyntax.NormalizeWhitespace(elasticTrivia: true).ToString()).ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Extracts information from a platform, assembly or nuget package.
|
||||
/// </summary>
|
||||
public interface IExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the assemblies.
|
||||
/// </summary>
|
||||
List<string> Assemblies { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the cecil search directories.
|
||||
/// Cecil when run on Mono needs some direction as to the location of the platform specific MSCORLIB.
|
||||
/// </summary>
|
||||
List<string> SearchDirectories { get; }
|
||||
}
|
||||
}
|
|
@ -0,0 +1,56 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using EventBuilder.Core.NuGet;
|
||||
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
|
||||
namespace EventBuilder.Core.Extractors
|
||||
{
|
||||
/// <summary>
|
||||
/// A extractor which will extract assembly information from a NuGet package.
|
||||
/// </summary>
|
||||
public class NuGetExtractor : IExtractor
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public List<string> Assemblies { get; } = new List<string>();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public List<string> SearchDirectories { get; } = new List<string>();
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the data using the specified target framework.
|
||||
/// </summary>
|
||||
/// <param name="targetFrameworkName">The name of the target framework to extract.</param>
|
||||
/// <param name="packages">The packages to extract the information from.</param>
|
||||
/// <param name="supportPackages">The packages for support purposes.</param>
|
||||
/// <returns>A task to monitor the progress.</returns>
|
||||
public Task Extract(string targetFrameworkName, IEnumerable<PackageIdentity> packages, IEnumerable<PackageIdentity> supportPackages = null)
|
||||
{
|
||||
var targetFramework = targetFrameworkName.ToFramework();
|
||||
return Extract(targetFramework, packages, supportPackages);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extracts the data using the specified target framework.
|
||||
/// </summary>
|
||||
/// <param name="targetFramework">The target framework to extract.</param>
|
||||
/// <param name="packages">The packages to extract the information from.</param>
|
||||
/// <param name="supportPackages">The packages for support purposes.</param>
|
||||
/// <returns>A task to monitor the progress.</returns>
|
||||
public async Task Extract(NuGetFramework targetFramework, IEnumerable<PackageIdentity> packages, IEnumerable<PackageIdentity> supportPackages = null)
|
||||
{
|
||||
var results = (await NuGetPackageHelper.DownloadPackageAndGetLibFilesAndFolder(packages, supportPackages, targetFramework).ConfigureAwait(false)).ToList();
|
||||
Assemblies.AddRange(results.SelectMany(x => x.files));
|
||||
SearchDirectories.AddRange(results.Select(x => x.folder));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// The Android platform.
|
||||
/// </summary>
|
||||
/// <seealso cref="BasePlatform" />
|
||||
public class Android : BasePlatform
|
||||
{
|
||||
private const string DesiredVersion = "v8.1";
|
||||
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.Android;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
var sdks = new List<string>();
|
||||
SearchDirectories.Add(Path.Combine(referenceAssembliesLocation, "MonoAndroid", "v1.0"));
|
||||
sdks.AddRange(Directory.GetFiles(
|
||||
Path.Combine(referenceAssembliesLocation, "MonoAndroid"),
|
||||
"Mono.Android.dll",
|
||||
SearchOption.AllDirectories));
|
||||
|
||||
// Pin to a particular framework version https://github.com/reactiveui/ReactiveUI/issues/1517
|
||||
var latestVersion = sdks.Last(x => x.Contains(DesiredVersion));
|
||||
Assemblies.Add(latestVersion);
|
||||
SearchDirectories.Add(Path.GetDirectoryName(latestVersion));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Base platform.
|
||||
/// </summary>
|
||||
public abstract class BasePlatform : IPlatformExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Initializes a new instance of the <see cref="BasePlatform"/> class.
|
||||
/// </summary>
|
||||
protected BasePlatform()
|
||||
{
|
||||
Assemblies = new List<string>();
|
||||
SearchDirectories = new List<string>();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract AutoPlatform Platform { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<string> Assemblies { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public List<string> SearchDirectories { get; }
|
||||
|
||||
/// <inheritdoc />
|
||||
public abstract Task Extract(string referenceAssembliesLocation);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,44 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using EventBuilder.Core.NuGet;
|
||||
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Versioning;
|
||||
|
||||
using Serilog;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Xamarin Essentials platform.
|
||||
/// </summary>
|
||||
public class Essentials : NuGetExtractor, IPlatformExtractor
|
||||
{
|
||||
private readonly PackageIdentity[] _packageNames =
|
||||
{
|
||||
new PackageIdentity("Xamarin.Essentials", new NuGetVersion("1.1.0")),
|
||||
};
|
||||
|
||||
private readonly PackageIdentity[] _supportPackages =
|
||||
{
|
||||
new PackageIdentity("NetStandard.Library", new NuGetVersion("2.0.3")),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public AutoPlatform Platform => AutoPlatform.Essentials;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Extract(string assemblyReferencePath)
|
||||
{
|
||||
return Extract(FrameworkConstants.CommonFrameworks.NetStandard20, _packageNames);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,28 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Interface representing a platform assemblies and events.
|
||||
/// </summary>
|
||||
public interface IPlatformExtractor : IExtractor
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the event builder platform.
|
||||
/// </summary>
|
||||
AutoPlatform Platform { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Extract details about the platform.
|
||||
/// </summary>
|
||||
/// <param name="referenceAssembliesLocation">The location for reference assemblies if needed.</param>
|
||||
/// <returns>A task to monitor the progress.</returns>
|
||||
Task Extract(string referenceAssembliesLocation);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,37 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Mac platform assemblies and events.
|
||||
/// </summary>
|
||||
public class Mac : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.Mac;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
var assemblies =
|
||||
Directory.GetFiles(
|
||||
Path.Combine(referenceAssembliesLocation, "Xamarin.Mac"),
|
||||
"Xamarin.Mac.dll",
|
||||
SearchOption.AllDirectories);
|
||||
|
||||
var latestVersion = assemblies.Last();
|
||||
Assemblies.Add(latestVersion);
|
||||
|
||||
SearchDirectories.Add(Path.GetDirectoryName(latestVersion));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using EventBuilder.Core.NuGet;
|
||||
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Versioning;
|
||||
|
||||
using Serilog;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Tizen platform assemblies and events.
|
||||
/// </summary>
|
||||
public class Tizen : NuGetExtractor, IPlatformExtractor
|
||||
{
|
||||
private readonly PackageIdentity[] _packageNames = new[]
|
||||
{
|
||||
new PackageIdentity("Tizen.Net", new NuGetVersion("5.0.0.14562")),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public AutoPlatform Platform => AutoPlatform.Tizen4;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
return Extract(FrameworkConstants.CommonFrameworks.NetStandard20, _packageNames);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,32 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// UWP platform assemblies and events.
|
||||
/// </summary>
|
||||
public class UWP : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.UWP;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
if (PlatformHelper.IsRunningOnMono())
|
||||
{
|
||||
throw new NotSupportedException("Building events for UWP on Mac is not implemented yet.");
|
||||
}
|
||||
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Windows Kits\10\UnionMetadata\10.0.17763.0\Windows.winmd");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// WPF platform assemblies and events.
|
||||
/// </summary>
|
||||
public class WPF : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.WPF;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="NotSupportedException">Building events for WPF on Mac is not implemented.</exception>
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
if (PlatformHelper.IsRunningOnMono())
|
||||
{
|
||||
throw new NotSupportedException("Building events for WPF on Mac is not implemented.");
|
||||
}
|
||||
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\WindowsBase.dll");
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationCore.dll");
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\PresentationFramework.dll");
|
||||
|
||||
SearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1");
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Win Forms platform assemblies and events.
|
||||
/// </summary>
|
||||
public class Winforms : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.Winforms;
|
||||
|
||||
/// <inheritdoc />
|
||||
/// <exception cref="NotSupportedException">Building events for Winforms on Mac is not implemented.</exception>
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
if (PlatformHelper.IsRunningOnMono())
|
||||
{
|
||||
throw new NotSupportedException("Building events for Winforms on Mac is not implemented.");
|
||||
}
|
||||
|
||||
// BackgroundWorker
|
||||
// EventLog
|
||||
// FileSystemWatcher
|
||||
// PerformanceCounter
|
||||
// Process
|
||||
// SerialPort
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.dll");
|
||||
|
||||
// DataSet
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Data.dll");
|
||||
|
||||
// DirectoryEntry
|
||||
// DirectorySearcher
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.DirectoryServices.dll");
|
||||
|
||||
// PrintDocument
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Drawing.dll");
|
||||
|
||||
// MessageQueue
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Messaging.dll");
|
||||
|
||||
// BindingNavigator
|
||||
// ToolStripButton
|
||||
// ToolStripLabel
|
||||
// ToolStripButton
|
||||
// ToolStripButton
|
||||
// ToolStripButton
|
||||
// ToolStripSeparator
|
||||
// ToolStripTextBox
|
||||
// ToolStripSeparator
|
||||
// ToolStripButton
|
||||
// ToolStripButton
|
||||
// ToolStripSeparator
|
||||
// BindingSource
|
||||
// Button
|
||||
// CheckBox
|
||||
// CheckedListBox
|
||||
// ColorDialog
|
||||
// ComboBox
|
||||
// ContextMenuStrip
|
||||
// DataGridView
|
||||
// DateTimePicker
|
||||
// DomainUpDown
|
||||
// ErrorProvider
|
||||
// WebBrowser
|
||||
// VScrollBar
|
||||
// TreeView
|
||||
// ToolStripContainer
|
||||
// TrackBar
|
||||
// ToolStrip
|
||||
// SplitContainer
|
||||
// TabControl
|
||||
// TabPage
|
||||
// TableLayoutPanel
|
||||
// TextBox
|
||||
// TabPage
|
||||
// StatusStrip
|
||||
// Splitter
|
||||
// RichTextBox
|
||||
// RadioButton
|
||||
// PropertyGrid
|
||||
// ProgressBar
|
||||
// PrintPreviewControl
|
||||
// PictureBox
|
||||
// Panel
|
||||
// NumericUpDown
|
||||
// MonthCalendar
|
||||
// MaskedTextBox
|
||||
// ListView
|
||||
// ListBox
|
||||
// LinkLabel
|
||||
// Label
|
||||
// HScrollBar
|
||||
// GroupBox
|
||||
// FlowLayoutPanel
|
||||
// MenuStrip
|
||||
// FolderBrowserDialog
|
||||
// FontDialog
|
||||
// HelpProvider
|
||||
// ImageList
|
||||
// NotifyIcon
|
||||
// OpenFileDialog
|
||||
// PageSetupDialog
|
||||
// PrintDialog
|
||||
// PrintPreviewDialog
|
||||
// SaveFileDialog
|
||||
// Timer
|
||||
// ToolTip
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Windows.Forms.dll");
|
||||
|
||||
// Chart
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.Windows.Forms.DataVisualization.dll");
|
||||
|
||||
// ServiceController
|
||||
Assemblies.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1\System.ServiceProcess.dll");
|
||||
|
||||
SearchDirectories.Add(@"C:\Program Files (x86)\Reference Assemblies\Microsoft\Framework\.NETFramework\v4.6.1");
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// Xamarin Forms assemblies and events.
|
||||
/// </summary>
|
||||
public class XamForms : NuGetExtractor, IPlatformExtractor
|
||||
{
|
||||
private readonly PackageIdentity[] _packageNames = new[]
|
||||
{
|
||||
new PackageIdentity("Xamarin.Forms", new NuGetVersion("3.4.0.1039999")),
|
||||
};
|
||||
|
||||
/// <inheritdoc />
|
||||
public AutoPlatform Platform => AutoPlatform.XamForms;
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
return Extract(FrameworkConstants.CommonFrameworks.NetStandard20, _packageNames);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,40 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <inheritdoc />
|
||||
/// <summary>
|
||||
/// iOS platform assemblies and events.
|
||||
/// </summary>
|
||||
[SuppressMessage("StyleCop.CSharp.NamingRules", "SA1300:Element should begin with upper-case letter", Justification = "iOS special naming scheme.")]
|
||||
public class iOS : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.iOS;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
var assemblies =
|
||||
Directory.GetFiles(
|
||||
Path.Combine(referenceAssembliesLocation, "Xamarin.iOS"),
|
||||
"Xamarin.iOS.dll",
|
||||
SearchOption.AllDirectories);
|
||||
|
||||
var latestVersion = assemblies.Last();
|
||||
Assemblies.Add(latestVersion);
|
||||
|
||||
SearchDirectories.Add(Path.GetDirectoryName(latestVersion));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,42 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core.Extractors.PlatformExtractors
|
||||
{
|
||||
/// <summary>
|
||||
/// TV OS platform assemblies and events.
|
||||
/// </summary>
|
||||
public class TVOS : BasePlatform
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public override AutoPlatform Platform => AutoPlatform.TVOS;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Task Extract(string referenceAssembliesLocation)
|
||||
{
|
||||
if (PlatformHelper.IsRunningOnMono())
|
||||
{
|
||||
referenceAssembliesLocation = Path.Combine(referenceAssembliesLocation, "Xamarin.iOS.framework/Versions/Current/lib/mono");
|
||||
}
|
||||
|
||||
var assemblies =
|
||||
Directory.GetFiles(
|
||||
Path.Combine(referenceAssembliesLocation, "Xamarin.TVOS"),
|
||||
"Xamarin.TVOS.dll",
|
||||
SearchOption.AllDirectories);
|
||||
|
||||
var latestVersion = assemblies.Last();
|
||||
Assemblies.Add(latestVersion);
|
||||
|
||||
SearchDirectories.Add(Path.GetDirectoryName(latestVersion));
|
||||
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,93 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Versioning;
|
||||
|
||||
namespace EventBuilder.Core.NuGet
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper class which will convert framework identifier strings to their nuget framework.
|
||||
/// </summary>
|
||||
public static class NuGetFrameworkHelper
|
||||
{
|
||||
private static readonly Dictionary<string, NuGetFramework> _nugetFrameworks;
|
||||
|
||||
/// <summary>
|
||||
/// Initializes static members of the <see cref="NuGetFrameworkHelper"/> class.
|
||||
/// </summary>
|
||||
static NuGetFrameworkHelper()
|
||||
{
|
||||
_nugetFrameworks = new Dictionary<string, NuGetFramework>(StringComparer.InvariantCultureIgnoreCase);
|
||||
foreach (var property in typeof(FrameworkConstants.CommonFrameworks).GetProperties(BindingFlags.NonPublic | BindingFlags.Static))
|
||||
{
|
||||
_nugetFrameworks[property.Name] = (NuGetFramework)property.GetValue(null);
|
||||
}
|
||||
|
||||
// Some special cases for .net standard/.net app core since they require the '.' character in the numbers.
|
||||
_nugetFrameworks["NetStandard1.0"] = FrameworkConstants.CommonFrameworks.NetStandard10;
|
||||
_nugetFrameworks["NetStandard1.1"] = FrameworkConstants.CommonFrameworks.NetStandard11;
|
||||
_nugetFrameworks["NetStandard1.2"] = FrameworkConstants.CommonFrameworks.NetStandard12;
|
||||
_nugetFrameworks["NetStandard1.3"] = FrameworkConstants.CommonFrameworks.NetStandard13;
|
||||
_nugetFrameworks["NetStandard1.4"] = FrameworkConstants.CommonFrameworks.NetStandard14;
|
||||
_nugetFrameworks["NetStandard1.5"] = FrameworkConstants.CommonFrameworks.NetStandard15;
|
||||
_nugetFrameworks["NetStandard1.6"] = FrameworkConstants.CommonFrameworks.NetStandard16;
|
||||
_nugetFrameworks["NetStandard1.7"] = FrameworkConstants.CommonFrameworks.NetStandard17;
|
||||
_nugetFrameworks["NetStandard2.0"] = FrameworkConstants.CommonFrameworks.NetStandard20;
|
||||
_nugetFrameworks["NetStandard2.1"] = FrameworkConstants.CommonFrameworks.NetStandard21;
|
||||
_nugetFrameworks["UAP"] = FrameworkConstants.CommonFrameworks.UAP10;
|
||||
_nugetFrameworks["UAP10.0"] = FrameworkConstants.CommonFrameworks.UAP10;
|
||||
_nugetFrameworks["NetCoreApp1.0"] = FrameworkConstants.CommonFrameworks.NetCoreApp10;
|
||||
_nugetFrameworks["NetCoreApp1.1"] = FrameworkConstants.CommonFrameworks.NetCoreApp11;
|
||||
_nugetFrameworks["NetCoreApp2.0"] = FrameworkConstants.CommonFrameworks.NetCoreApp20;
|
||||
_nugetFrameworks["NetCoreApp2.1"] = FrameworkConstants.CommonFrameworks.NetCoreApp21;
|
||||
_nugetFrameworks["NetCoreApp2.2"] = FrameworkConstants.CommonFrameworks.NetCoreApp22;
|
||||
_nugetFrameworks["NetCoreApp3.0"] = FrameworkConstants.CommonFrameworks.NetCoreApp30;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extension method for getting the framework from the framework name.
|
||||
/// </summary>
|
||||
/// <param name="frameworkName">The name of the framework.</param>
|
||||
/// <returns>The framework.</returns>
|
||||
public static NuGetFramework ToFramework(this string frameworkName)
|
||||
{
|
||||
_nugetFrameworks.TryGetValue(frameworkName, out var framework);
|
||||
|
||||
return framework;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a package identity if the framework is package based.
|
||||
/// </summary>
|
||||
/// <param name="framework">The framework to check.</param>
|
||||
/// <returns>The package details or null if none is available.</returns>
|
||||
public static PackageIdentity ToPackageIdentity(this NuGetFramework framework)
|
||||
{
|
||||
if (!framework.IsPackageBased)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
if (framework.Framework.StartsWith(".NETStandard", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new PackageIdentity("NETStandard.Library", new NuGetVersion(framework.Version));
|
||||
}
|
||||
|
||||
if (framework.Framework.StartsWith(".NETCoreApp", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
return new PackageIdentity("Microsoft.NETCore.App", new NuGetVersion(framework.Version));
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using NuGet.Common;
|
||||
|
||||
namespace EventBuilder.Core.NuGet
|
||||
{
|
||||
/// <summary>
|
||||
/// A logger provider for the NuGet clients API.
|
||||
/// </summary>
|
||||
internal class NuGetLogger : ILogger
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public void Log(LogLevel level, string data)
|
||||
{
|
||||
switch (level)
|
||||
{
|
||||
case LogLevel.Warning:
|
||||
Serilog.Log.Warning(data);
|
||||
break;
|
||||
case LogLevel.Error:
|
||||
Serilog.Log.Error(data);
|
||||
break;
|
||||
case LogLevel.Information:
|
||||
Serilog.Log.Information(data);
|
||||
break;
|
||||
case LogLevel.Debug:
|
||||
Serilog.Log.Debug(data);
|
||||
break;
|
||||
default:
|
||||
Serilog.Log.Verbose(data);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void Log(ILogMessage message)
|
||||
{
|
||||
Log(message.Level, message.Message);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task LogAsync(LogLevel level, string data)
|
||||
{
|
||||
Log(level, data);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public Task LogAsync(ILogMessage message)
|
||||
{
|
||||
Log(message);
|
||||
return Task.CompletedTask;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogDebug(string data)
|
||||
{
|
||||
Serilog.Log.Debug(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogError(string data)
|
||||
{
|
||||
Serilog.Log.Error(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogInformation(string data)
|
||||
{
|
||||
Serilog.Log.Information(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogInformationSummary(string data)
|
||||
{
|
||||
Serilog.Log.Information(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogMinimal(string data)
|
||||
{
|
||||
Serilog.Log.Information(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogVerbose(string data)
|
||||
{
|
||||
Serilog.Log.Verbose(data);
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void LogWarning(string data)
|
||||
{
|
||||
Serilog.Log.Warning(data);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,122 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using NuGet.Configuration;
|
||||
using NuGet.Frameworks;
|
||||
using NuGet.Packaging;
|
||||
using NuGet.Packaging.Core;
|
||||
using NuGet.Protocol;
|
||||
using NuGet.Protocol.Core.Types;
|
||||
|
||||
namespace EventBuilder.Core.NuGet
|
||||
{
|
||||
/// <summary>
|
||||
/// A helper class for handling NuGet packages.
|
||||
/// </summary>
|
||||
public static class NuGetPackageHelper
|
||||
{
|
||||
// Bunch of NuGet based objects we can cache and only create once.
|
||||
private static readonly string _globalPackagesPath = SettingsUtility.GetGlobalPackagesFolder(new XPlatMachineWideSetting().Settings);
|
||||
private static readonly NuGetLogger _logger = new NuGetLogger();
|
||||
private static readonly PackageDownloadContext _downloadContext = new PackageDownloadContext(NullSourceCacheContext.Instance);
|
||||
private static readonly List<Lazy<INuGetResourceProvider>> _providers;
|
||||
|
||||
static NuGetPackageHelper()
|
||||
{
|
||||
_providers = new List<Lazy<INuGetResourceProvider>>();
|
||||
_providers.AddRange(Repository.Provider.GetCoreV3());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Downloads the specified packages and returns the files and directories where the package NuGet package lives.
|
||||
/// </summary>
|
||||
/// <param name="packageIdentities">The identities of the packages to find.</param>
|
||||
/// <param name="supportPackageIdentities">Any support libraries where the directories should be included but not the files.</param>
|
||||
/// <param name="framework">Optional framework parameter which will force NuGet to evaluate as the specified Framework. If null it will use .NET Standard 2.0.</param>
|
||||
/// <param name="nugetSource">Optional v3 nuget source. Will default to default nuget.org servers.</param>
|
||||
/// <param name="token">A cancellation token.</param>
|
||||
/// <returns>The directory where the NuGet packages are unzipped to.</returns>
|
||||
public static async Task<IEnumerable<(string folder, IEnumerable<string> files)>> DownloadPackageAndGetLibFilesAndFolder(IEnumerable<PackageIdentity> packageIdentities, IEnumerable<PackageIdentity> supportPackageIdentities = null, NuGetFramework framework = null, PackageSource nugetSource = null, CancellationToken token = default)
|
||||
{
|
||||
// If the user hasn't selected a default framework to extract, select .NET Standard 2.0
|
||||
framework = framework ?? FrameworkConstants.CommonFrameworks.NetStandard20;
|
||||
|
||||
// Get our support libraries together. We will grab the default for the framework passed in if it's packaged based.
|
||||
var defaultSupportLibrary = framework?.ToPackageIdentity() == null ? Enumerable.Empty<PackageIdentity>() : new[] { framework.ToPackageIdentity() };
|
||||
supportPackageIdentities = (supportPackageIdentities ?? Array.Empty<PackageIdentity>()).Concat(defaultSupportLibrary).Distinct();
|
||||
|
||||
// Combine together the primary/secondary packages, boolean value to indicate if we should download.
|
||||
IEnumerable<(PackageIdentity packageIdentity, bool includeFiles)> packagesToDownload = packageIdentities.Select(x => (x, true))
|
||||
.Concat(supportPackageIdentities.Select(x => (x, false)));
|
||||
|
||||
return await Task.WhenAll(packagesToDownload
|
||||
.Select(x => CopyPackageLibraryItems(x.packageIdentity, nugetSource, framework, x.includeFiles, token)))
|
||||
.ConfigureAwait(false);
|
||||
}
|
||||
|
||||
private static async Task<(string folder, IEnumerable<string> files)> CopyPackageLibraryItems(PackageIdentity package, PackageSource nugetSource, NuGetFramework framework, bool includeFilesInOutput, CancellationToken token)
|
||||
{
|
||||
var directory = EnsureDirectory(package.ToString());
|
||||
|
||||
// If the file already exists (since it has the version number), assumed it was already grabbed previously and use that.
|
||||
if (Directory.Exists(directory))
|
||||
{
|
||||
return (directory, Directory.GetFiles(directory, "*.dll", SearchOption.AllDirectories));
|
||||
}
|
||||
|
||||
// Use the provided nuget package source, or use nuget.org
|
||||
var source = new SourceRepository(nugetSource ?? new PackageSource("https://api.nuget.org/v3/index.json"), _providers);
|
||||
|
||||
// Get the download resource from the nuget client API. This is basically a DI locator.
|
||||
var downloadResource = await source.GetResourceAsync<DownloadResource>(token).ConfigureAwait(false);
|
||||
|
||||
// Download the resource into the global packages path. We get a result which allows us to copy or do other operations based on the files.
|
||||
var downloadResults = await downloadResource.GetDownloadResourceResultAsync(
|
||||
package,
|
||||
_downloadContext,
|
||||
_globalPackagesPath,
|
||||
_logger,
|
||||
token).ConfigureAwait(false);
|
||||
|
||||
if (downloadResults.Status != DownloadResourceResultStatus.Available && downloadResults.Status != DownloadResourceResultStatus.AvailableWithoutStream)
|
||||
{
|
||||
return default;
|
||||
}
|
||||
|
||||
// Get all the folders in our lib and build directory of our nuget. These are the general contents we include in our projects.
|
||||
var groups = (await Task.WhenAll(downloadResults.PackageReader.GetLibItemsAsync(token), downloadResults.PackageReader.GetBuildItemsAsync(token)).ConfigureAwait(false)).SelectMany(x => x);
|
||||
|
||||
// Select our groups that match our selected framework and have content.
|
||||
var groupFiles = groups.Where(x => !x.HasEmptyFolder && x.TargetFramework == framework).SelectMany(x => x.Items).ToList();
|
||||
|
||||
// Extract the files, don't bother copying the XML file contents.
|
||||
var packageFileExtractor = new PackageFileExtractor(groupFiles, XmlDocFileSaveMode.Skip);
|
||||
|
||||
// Copy the files to our extractor cache directory.
|
||||
var outputFiles = await downloadResults.PackageReader.CopyFilesAsync(directory, groupFiles, packageFileExtractor.ExtractPackageFile, _logger, token).ConfigureAwait(false);
|
||||
|
||||
// Return the folder, if we aren't excluding files return all the assemblies.
|
||||
return (directory, includeFilesInOutput ? outputFiles.Where(x => x.EndsWith(".dll", StringComparison.OrdinalIgnoreCase)) : Enumerable.Empty<string>());
|
||||
}
|
||||
|
||||
private static string EnsureDirectory(string subDirectory)
|
||||
{
|
||||
var packageUnzipPath = Path.Combine(Path.GetTempPath(), "EventBuilder.NuGet", subDirectory);
|
||||
|
||||
if (!Directory.Exists(packageUnzipPath))
|
||||
{
|
||||
Directory.CreateDirectory(packageUnzipPath);
|
||||
}
|
||||
|
||||
return packageUnzipPath;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,29 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace EventBuilder.Core
|
||||
{
|
||||
/// <summary>
|
||||
/// Platform helper methods.
|
||||
/// </summary>
|
||||
public static class PlatformHelper
|
||||
{
|
||||
private static readonly Lazy<bool> _IsRunningOnMono = new Lazy<bool>(() => !RuntimeInformation.IsOSPlatform(OSPlatform.Windows));
|
||||
|
||||
/// <summary>
|
||||
/// Determines whether the platform is running on mono.
|
||||
/// </summary>
|
||||
/// <returns>
|
||||
/// <c>true</c> if [is running on mono]; otherwise, <c>false</c>.
|
||||
/// </returns>
|
||||
public static bool IsRunningOnMono()
|
||||
{
|
||||
return _IsRunningOnMono.Value;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,9 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Runtime.CompilerServices;
|
||||
|
||||
[assembly: InternalsVisibleTo("EventBuilder.Benchmarks")]
|
||||
[assembly: InternalsVisibleTo("EventBuilder.Tests")]
|
|
@ -0,0 +1,198 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICSharpCode.Decompiler.Metadata;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation;
|
||||
using ICSharpCode.Decompiler.Util;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Compilation
|
||||
{
|
||||
/// <summary>
|
||||
/// This class is based on ICSharpCode.Decompiler SimpleCompiler.
|
||||
/// This has been changed to allow searching through reference types.
|
||||
/// </summary>
|
||||
/// <summary>
|
||||
/// Simple compilation implementation.
|
||||
/// </summary>
|
||||
internal class EventBuilderCompiler : ICompilation
|
||||
{
|
||||
private readonly KnownTypeCache _knownTypeCache;
|
||||
private readonly List<IModule> _assemblies = new List<IModule>();
|
||||
private readonly List<IModule> _referencedAssemblies = new List<IModule>();
|
||||
private bool _initialized;
|
||||
private INamespace _rootNamespace;
|
||||
|
||||
public EventBuilderCompiler(IEnumerable<IModuleReference> modules, IEnumerable<string> searchDirectories)
|
||||
{
|
||||
_knownTypeCache = new KnownTypeCache(this);
|
||||
Init(modules, searchDirectories.ToList());
|
||||
}
|
||||
|
||||
protected EventBuilderCompiler()
|
||||
{
|
||||
}
|
||||
|
||||
public IModule MainModule
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
throw new InvalidOperationException("Compilation isn't initialized yet");
|
||||
}
|
||||
|
||||
return _assemblies.FirstOrDefault();
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<IModule> Modules
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
throw new InvalidOperationException("Compilation isn't initialized yet");
|
||||
}
|
||||
|
||||
return _assemblies;
|
||||
}
|
||||
}
|
||||
|
||||
public IReadOnlyList<IModule> ReferencedModules
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!_initialized)
|
||||
{
|
||||
throw new InvalidOperationException("Compilation isn't initialized yet");
|
||||
}
|
||||
|
||||
return _referencedAssemblies;
|
||||
}
|
||||
}
|
||||
|
||||
public INamespace RootNamespace
|
||||
{
|
||||
get
|
||||
{
|
||||
INamespace ns = LazyInit.VolatileRead(ref _rootNamespace);
|
||||
if (ns != null)
|
||||
{
|
||||
return ns;
|
||||
}
|
||||
|
||||
if (!_initialized)
|
||||
{
|
||||
throw new InvalidOperationException("Compilation isn't initialized yet");
|
||||
}
|
||||
|
||||
return LazyInit.GetOrSet(ref _rootNamespace, CreateRootNamespace());
|
||||
}
|
||||
}
|
||||
|
||||
public StringComparer NameComparer => StringComparer.Ordinal;
|
||||
|
||||
public CacheManager CacheManager { get; } = new CacheManager();
|
||||
|
||||
public virtual INamespace GetNamespaceForExternAlias(string alias)
|
||||
{
|
||||
if (string.IsNullOrEmpty(alias))
|
||||
{
|
||||
return RootNamespace;
|
||||
}
|
||||
|
||||
// SimpleCompilation does not support extern aliases; but derived classes might.
|
||||
return null;
|
||||
}
|
||||
|
||||
public IType FindType(KnownTypeCode typeCode)
|
||||
{
|
||||
return _knownTypeCache.FindType(typeCode);
|
||||
}
|
||||
|
||||
protected void Init(IEnumerable<IModuleReference> mainAssemblies, IReadOnlyCollection<string> searchDirectories)
|
||||
{
|
||||
if (mainAssemblies == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(mainAssemblies));
|
||||
}
|
||||
|
||||
if (searchDirectories == null)
|
||||
{
|
||||
throw new ArgumentNullException(nameof(searchDirectories));
|
||||
}
|
||||
|
||||
var context = new SimpleTypeResolveContext(this);
|
||||
_assemblies.AddRange(mainAssemblies.Select(x => x.Resolve(context)));
|
||||
|
||||
List<IModule> referencedAssemblies = new List<IModule>();
|
||||
|
||||
var referenceModulesToProcess = new Stack<IAssemblyReference>(_assemblies.SelectMany(x => x.PEFile.AssemblyReferences));
|
||||
var assemblyReferencesVisited = new HashSet<string>();
|
||||
|
||||
while (referenceModulesToProcess.Count > 0)
|
||||
{
|
||||
var currentAssemblyReference = referenceModulesToProcess.Pop();
|
||||
|
||||
if (assemblyReferencesVisited.Contains(currentAssemblyReference.FullName))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
assemblyReferencesVisited.Add(currentAssemblyReference.FullName);
|
||||
|
||||
IModule asm;
|
||||
try
|
||||
{
|
||||
var currentModule = currentAssemblyReference.Resolve(searchDirectories);
|
||||
|
||||
if (currentModule == null)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
asm = ((IModuleReference)currentModule).Resolve(context);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
throw new InvalidOperationException("Tried to initialize compilation with an invalid assembly reference. (Forgot to load the assembly reference ? - see CecilLoader)");
|
||||
}
|
||||
|
||||
if (asm != null)
|
||||
{
|
||||
referencedAssemblies.Add(asm);
|
||||
foreach (var element in asm.PEFile.AssemblyReferences)
|
||||
{
|
||||
referenceModulesToProcess.Push(element);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
_referencedAssemblies.AddRange(referencedAssemblies);
|
||||
_initialized = true;
|
||||
}
|
||||
|
||||
protected virtual INamespace CreateRootNamespace()
|
||||
{
|
||||
var namespaces = new List<INamespace>();
|
||||
foreach (var module in _assemblies)
|
||||
{
|
||||
// SimpleCompilation does not support extern aliases; but derived classes might.
|
||||
// CreateRootNamespace() is virtual so that derived classes can change the global namespace.
|
||||
namespaces.Add(module.RootNamespace);
|
||||
for (int i = 0; i < _referencedAssemblies.Count; i++)
|
||||
{
|
||||
namespaces.Add(_referencedAssemblies[i].RootNamespace);
|
||||
}
|
||||
}
|
||||
|
||||
return new MergedNamespace(this, namespaces.ToArray());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,59 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation;
|
||||
using ICSharpCode.Decompiler.Util;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Compilation
|
||||
{
|
||||
/// <summary>
|
||||
/// Cache for KnownTypeReferences.
|
||||
/// Based on https://github.com/icsharpcode/ILSpy/blob/master/ICSharpCode.Decompiler/TypeSystem/Implementation/KnownTypeCache.cs
|
||||
/// and the ILSpy project.
|
||||
/// </summary>
|
||||
internal sealed class KnownTypeCache
|
||||
{
|
||||
private readonly ICompilation _compilation;
|
||||
private readonly IType[] _knownTypes = new IType[(int)KnownTypeCode.MemoryOfT + 1];
|
||||
|
||||
public KnownTypeCache(ICompilation compilation)
|
||||
{
|
||||
_compilation = compilation;
|
||||
}
|
||||
|
||||
public IType FindType(KnownTypeCode typeCode)
|
||||
{
|
||||
IType type = LazyInit.VolatileRead(ref _knownTypes[(int)typeCode]);
|
||||
if (type != null)
|
||||
{
|
||||
return type;
|
||||
}
|
||||
|
||||
return LazyInit.GetOrSet(ref _knownTypes[(int)typeCode], SearchType(typeCode));
|
||||
}
|
||||
|
||||
private IType SearchType(KnownTypeCode typeCode)
|
||||
{
|
||||
KnownTypeReference typeRef = KnownTypeReference.Get(typeCode);
|
||||
if (typeRef == null)
|
||||
{
|
||||
return SpecialType.UnknownType;
|
||||
}
|
||||
|
||||
var typeName = new TopLevelTypeName(typeRef.Namespace, typeRef.Name, typeRef.TypeParameterCount);
|
||||
foreach (IModule asm in _compilation.Modules)
|
||||
{
|
||||
var typeDef = asm.GetTypeDefinition(typeName);
|
||||
if (typeDef != null)
|
||||
{
|
||||
return typeDef;
|
||||
}
|
||||
}
|
||||
|
||||
return new UnknownType(typeName);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,52 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using ICSharpCode.Decompiler.Metadata;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Compilation
|
||||
{
|
||||
internal static class PathSearchExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Resolves the specified full assembly name.
|
||||
/// </summary>
|
||||
/// <param name="reference">A reference with details about the assembly.</param>
|
||||
/// <param name="targetAssemblyDirectories">The directories potentially containing the assemblies.</param>
|
||||
/// <param name="parameters">Parameters to provide to the reflection system..</param>
|
||||
/// <returns>The assembly definition.</returns>
|
||||
public static PEFile Resolve(this IAssemblyReference reference, IEnumerable<string> targetAssemblyDirectories, PEStreamOptions parameters = PEStreamOptions.PrefetchMetadata)
|
||||
{
|
||||
var dllName = reference.Name + ".dll";
|
||||
|
||||
var fullPath = targetAssemblyDirectories.Select(x => Path.Combine(x, dllName)).FirstOrDefault(File.Exists);
|
||||
if (fullPath == null)
|
||||
{
|
||||
dllName = reference.Name + ".winmd";
|
||||
fullPath = targetAssemblyDirectories.Select(x => Path.Combine(x, dllName)).FirstOrDefault(File.Exists);
|
||||
}
|
||||
|
||||
// NB: This hacks WinRT's weird mscorlib to just use the regular one
|
||||
// We forget why this was needed, maybe it's not needed anymore?
|
||||
if (reference.Name.IndexOf("mscorlib", StringComparison.InvariantCultureIgnoreCase) >= 0 && reference.Name.Contains("255"))
|
||||
{
|
||||
fullPath =
|
||||
Environment.ExpandEnvironmentVariables(
|
||||
@"%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\mscorlib.dll");
|
||||
}
|
||||
|
||||
if (fullPath == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
return new PEFile(fullPath, parameters);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,165 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Generators
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates code syntax based on the Delegate based methodology
|
||||
/// where we derive from a base class and override methods.
|
||||
/// We provide an observable in this case.
|
||||
/// </summary>
|
||||
internal static class DelegateGenerator
|
||||
{
|
||||
private static readonly QualifiedNameSyntax _subjectNamespace = QualifiedName(IdentifierName("ReactiveUI"), IdentifierName("Events"));
|
||||
private static readonly GenericNameSyntax _subjectType = GenericName(Identifier("SingleAwaitSubject"));
|
||||
|
||||
/// <summary>
|
||||
/// Generate our namespace declarations. These will contain our helper classes.
|
||||
/// </summary>
|
||||
/// <param name="declarations">The declarations to add.</param>
|
||||
/// <returns>An array of namespace declarations.</returns>
|
||||
internal static IEnumerable<NamespaceDeclarationSyntax> Generate(IEnumerable<(ITypeDefinition typeDefinition, bool isAbstract, IEnumerable<IMethod> methods)> declarations) => declarations.GroupBy(x => x.typeDefinition.Namespace)
|
||||
.Select(x => NamespaceDeclaration(IdentifierName(x.Key)).WithMembers(List<MemberDeclarationSyntax>(GenerateClasses(x))));
|
||||
|
||||
/// <summary>
|
||||
/// Generates our helper classes with the observables.
|
||||
/// </summary>
|
||||
/// <param name="declarations">Our class declarations along with the methods we want to generate the values for.</param>
|
||||
/// <returns>The generated class declarations.</returns>
|
||||
private static IEnumerable<ClassDeclarationSyntax> GenerateClasses(IEnumerable<(ITypeDefinition typeDefinition, bool isAbstract, IEnumerable<IMethod> methods)> declarations)
|
||||
{
|
||||
foreach (var declaration in declarations)
|
||||
{
|
||||
var modifiers = declaration.typeDefinition.IsAbstract || declaration.isAbstract
|
||||
? TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.AbstractKeyword), Token(SyntaxKind.PartialKeyword))
|
||||
: TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.PartialKeyword));
|
||||
yield return ClassDeclaration(declaration.typeDefinition.Name + "Rx")
|
||||
.WithModifiers(modifiers)
|
||||
.WithMembers(List(GenerateObservableMembers(declaration.methods)))
|
||||
.WithBaseList(BaseList(SingletonSeparatedList<BaseTypeSyntax>(SimpleBaseType(IdentifierName(declaration.typeDefinition.GenerateFullGenericName())))))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("Wraps delegates events from {0} into Observables.", declaration.typeDefinition.GenerateFullGenericName()))
|
||||
.WithObsoleteAttribute(declaration.typeDefinition);
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<MemberDeclarationSyntax> GenerateObservableMembers(IEnumerable<IMethod> methods)
|
||||
{
|
||||
var methodDeclarations = new List<MethodDeclarationSyntax>();
|
||||
var fieldDeclarations = new List<FieldDeclarationSyntax>();
|
||||
var propertyDeclarations = new List<PropertyDeclarationSyntax>();
|
||||
|
||||
foreach (var method in methods)
|
||||
{
|
||||
var observableName = "_" + char.ToLowerInvariant(method.Name[0]) + method.Name.Substring(1);
|
||||
methodDeclarations.Add(GenerateMethodDeclaration(observableName, method));
|
||||
fieldDeclarations.Add(GenerateFieldDeclaration(observableName, method));
|
||||
propertyDeclarations.Add(GeneratePropertyDeclaration(observableName, method));
|
||||
}
|
||||
|
||||
return fieldDeclarations.Cast<MemberDeclarationSyntax>().Concat(propertyDeclarations).Concat(methodDeclarations);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Produces the property declaration for the observable.
|
||||
/// </summary>
|
||||
/// <param name="observableName">The field name of the observable.</param>
|
||||
/// <param name="method">The method we are abstracting.</param>
|
||||
/// <returns>The property declaration.</returns>
|
||||
private static PropertyDeclarationSyntax GeneratePropertyDeclaration(string observableName, IMethod method)
|
||||
{
|
||||
// Produces:
|
||||
// public System.IObservable<type> MethodNameObs => _observableName;
|
||||
return PropertyDeclaration(method.GenerateObservableTypeArguments().GenerateObservableType(), Identifier(method.Name + "Obs"))
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword)))
|
||||
.WithObsoleteAttribute(method)
|
||||
.WithExpressionBody(ArrowExpressionClause(IdentifierName(observableName)))
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("Gets an observable which signals when the {0} method is invoked.", method.FullName));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Produces the field declaration which contains the subject.
|
||||
/// </summary>
|
||||
/// <param name="observableName">The field name of the observable.</param>
|
||||
/// <param name="method">The method we are abstracting.</param>
|
||||
/// <returns>The field declaration.</returns>
|
||||
private static FieldDeclarationSyntax GenerateFieldDeclaration(string observableName, IMethod method)
|
||||
{
|
||||
// Produces:
|
||||
// private readonly ReactiveUI.Events.SingleAwaitSubject<type> _methodName = new ReactiveUI.Events.SingleAwaitSubject<type>();
|
||||
var typeName = QualifiedName(_subjectNamespace, _subjectType.WithTypeArgumentList(method.GenerateObservableTypeArguments()));
|
||||
|
||||
return FieldDeclaration(VariableDeclaration(typeName)
|
||||
.WithVariables(
|
||||
SingletonSeparatedList(
|
||||
VariableDeclarator(Identifier(observableName))
|
||||
.WithInitializer(
|
||||
EqualsValueClause(
|
||||
ObjectCreationExpression(typeName).WithArgumentList(ArgumentList()))))))
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PrivateKeyword), Token(SyntaxKind.ReadOnlyKeyword)));
|
||||
}
|
||||
|
||||
private static MethodDeclarationSyntax GenerateMethodDeclaration(string observableName, IMethod method)
|
||||
{
|
||||
// Produces:
|
||||
// /// <inheritdoc />
|
||||
// public override void MethodName(params..) => _methodName.OnNext(...);
|
||||
InvocationExpressionSyntax methodBody = InvocationExpression(MemberAccessExpression(SyntaxKind.SimpleMemberAccessExpression, IdentifierName(observableName), IdentifierName("OnNext")));
|
||||
|
||||
var methodParameterList = GenerateMethodParameters(method);
|
||||
|
||||
// If we have any members call our observables with the parameters.
|
||||
if (method.Parameters.Count > 0)
|
||||
{
|
||||
// If we have only one member, just pass that directly, since our observable will have one generic type parameter.
|
||||
// If we have more than one parameter we have to pass them by value tuples, since observables only have one generic type parameter.
|
||||
if (method.Parameters.Count == 1)
|
||||
{
|
||||
methodBody = methodBody.WithArgumentList(method.Parameters[0].GenerateArgumentList());
|
||||
}
|
||||
else
|
||||
{
|
||||
methodBody = methodBody.WithArgumentList(method.Parameters.GenerateTupleArgumentList());
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
methodBody = methodBody.WithArgumentList(RoslynHelpers.ReactiveUnitArgumentList);
|
||||
}
|
||||
|
||||
return MethodDeclaration(PredefinedType(Token(SyntaxKind.VoidKeyword)), method.Name)
|
||||
.WithExpressionBody(ArrowExpressionClause(methodBody))
|
||||
.WithParameterList(methodParameterList)
|
||||
.WithObsoleteAttribute(method)
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.OverrideKeyword)))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.InheritdocSyntax)
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken));
|
||||
}
|
||||
|
||||
private static ParameterListSyntax GenerateMethodParameters(IMethod method)
|
||||
{
|
||||
if (method.Parameters.Count == 0)
|
||||
{
|
||||
return ParameterList();
|
||||
}
|
||||
|
||||
return ParameterList(
|
||||
SeparatedList(
|
||||
method.Parameters.Select(
|
||||
x => Parameter(Identifier(x.Name))
|
||||
.WithType(IdentifierName(x.Type.GenerateFullGenericName())))));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,114 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Generators
|
||||
{
|
||||
internal abstract class EventGeneratorBase : IEventGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate our namespace declarations. These will contain our helper classes.
|
||||
/// </summary>
|
||||
/// <param name="declarations">The declarations to add.</param>
|
||||
/// <returns>An array of namespace declarations.</returns>
|
||||
public abstract IEnumerable<NamespaceDeclarationSyntax> Generate(IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> declarations);
|
||||
|
||||
/// <summary>
|
||||
/// Generates an observable declaration that wraps a event.
|
||||
/// </summary>
|
||||
/// <param name="eventDetails">The details of the event to wrap.</param>
|
||||
/// <param name="dataObjectName">The name of the item where the event is stored.</param>
|
||||
/// <returns>The property declaration.</returns>
|
||||
protected static PropertyDeclarationSyntax GenerateEventWrapperObservable(IEvent eventDetails, string dataObjectName)
|
||||
{
|
||||
// Produces:
|
||||
// public System.IObservable<eventArgs, eventHandler> EventName => System.Reactive.Linq.Observable.FromEventPattern();
|
||||
var eventArgsName = eventDetails.GetEventArgsName();
|
||||
|
||||
if (eventArgsName == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var eventArgsType = IdentifierName(eventArgsName);
|
||||
var observableEventArgType = TypeArgumentList(SingletonSeparatedList<TypeSyntax>(eventArgsType)).GenerateObservableType();
|
||||
|
||||
var returnType = eventDetails.ReturnType.GenerateFullGenericName();
|
||||
|
||||
SyntaxTokenList modifiers = eventDetails.IsStatic
|
||||
? TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.StaticKeyword))
|
||||
: TokenList(Token(SyntaxKind.PublicKeyword));
|
||||
|
||||
return PropertyDeclaration(observableEventArgType, eventDetails.Name)
|
||||
.WithModifiers(modifiers)
|
||||
.WithExpressionBody(
|
||||
ArrowExpressionClause(
|
||||
InvocationExpression(
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
InvocationExpression(
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName("System.Reactive.Linq.Observable"),
|
||||
GenericName(
|
||||
Identifier("FromEventPattern"))
|
||||
.WithTypeArgumentList(
|
||||
TypeArgumentList(
|
||||
SeparatedList<TypeSyntax>(
|
||||
new SyntaxNodeOrToken[]
|
||||
{
|
||||
IdentifierName(returnType),
|
||||
Token(SyntaxKind.CommaToken),
|
||||
eventArgsType
|
||||
})))))
|
||||
.WithArgumentList(
|
||||
ArgumentList(
|
||||
SeparatedList<ArgumentSyntax>(
|
||||
new SyntaxNodeOrToken[]
|
||||
{
|
||||
GenerateArgumentEventAccessor(SyntaxKind.AddAssignmentExpression, eventDetails.Name, dataObjectName),
|
||||
Token(SyntaxKind.CommaToken),
|
||||
GenerateArgumentEventAccessor(SyntaxKind.SubtractAssignmentExpression, eventDetails.Name, dataObjectName)
|
||||
}))),
|
||||
IdentifierName("Select")))
|
||||
.WithArgumentList(
|
||||
ArgumentList(
|
||||
SingletonSeparatedList(
|
||||
Argument(
|
||||
SimpleLambdaExpression(
|
||||
Parameter(
|
||||
Identifier("x")),
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName("x"),
|
||||
IdentifierName("EventArgs")))))))))
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken))
|
||||
.WithObsoleteAttribute(eventDetails)
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("Gets an observable which signals when when the {0} event triggers.", eventDetails.FullName));
|
||||
}
|
||||
|
||||
private static ArgumentSyntax GenerateArgumentEventAccessor(SyntaxKind accessor, string eventName, string dataObjectName)
|
||||
{
|
||||
return Argument(
|
||||
SimpleLambdaExpression(
|
||||
Parameter(
|
||||
Identifier("x")),
|
||||
AssignmentExpression(
|
||||
accessor,
|
||||
MemberAccessExpression(
|
||||
SyntaxKind.SimpleMemberAccessExpression,
|
||||
IdentifierName(dataObjectName),
|
||||
IdentifierName(eventName)),
|
||||
IdentifierName("x"))));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Generators
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates based on events in the base code.
|
||||
/// </summary>
|
||||
internal interface IEventGenerator
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a compilation unit based on generating event observable wrappers.
|
||||
/// </summary>
|
||||
/// <param name="values">The values to generate for.</param>
|
||||
/// <returns>The new compilation unit.</returns>
|
||||
IEnumerable<NamespaceDeclarationSyntax> Generate(IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> values);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,101 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Generators
|
||||
{
|
||||
internal class InstanceEventGenerator : EventGeneratorBase
|
||||
{
|
||||
private const string DataFieldName = "_data";
|
||||
|
||||
public override IEnumerable<NamespaceDeclarationSyntax> Generate(IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> declarations) => declarations.GroupBy(x => x.typeDefinition.Namespace)
|
||||
.Select(x => NamespaceDeclaration(IdentifierName(x.Key)).WithMembers(List<MemberDeclarationSyntax>(GenerateClasses(x.Key, x))));
|
||||
|
||||
private static ClassDeclarationSyntax GenerateStaticClass(string namespaceName, IEnumerable<ITypeDefinition> declarations)
|
||||
{
|
||||
// Produces:
|
||||
// public static class EventExtensions
|
||||
// contents of members above
|
||||
return ClassDeclaration("EventExtensions")
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.StaticKeyword)))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("A class that contains extension methods to wrap events for classes contained within the {0} namespace.", namespaceName))
|
||||
.WithMembers(List<MemberDeclarationSyntax>(declarations.Select(declaration =>
|
||||
{
|
||||
var eventsClassName = IdentifierName(declaration.Name + "Events");
|
||||
return MethodDeclaration(eventsClassName, Identifier("Events"))
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.StaticKeyword)))
|
||||
.WithParameterList(ParameterList(SingletonSeparatedList(
|
||||
Parameter(Identifier("item"))
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.ThisKeyword)))
|
||||
.WithType(IdentifierName(declaration.GenerateFullGenericName())))))
|
||||
.WithExpressionBody(ArrowExpressionClause(
|
||||
ObjectCreationExpression(eventsClassName)
|
||||
.WithArgumentList(ArgumentList(SingletonSeparatedList(Argument(IdentifierName("item")))))))
|
||||
.WithSemicolonToken(Token(SyntaxKind.SemicolonToken))
|
||||
.WithObsoleteAttribute(declaration)
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("A wrapper class which wraps all the events contained within the {0} class.", declaration.GenerateFullGenericName()));
|
||||
})));
|
||||
}
|
||||
|
||||
private static ConstructorDeclarationSyntax GenerateEventWrapperClassConstructor(ITypeDefinition typeDefinition)
|
||||
{
|
||||
return ConstructorDeclaration(
|
||||
Identifier(typeDefinition.Name + "Events"))
|
||||
.WithModifiers(
|
||||
TokenList(
|
||||
Token(SyntaxKind.PublicKeyword)))
|
||||
.WithParameterList(
|
||||
ParameterList(
|
||||
SingletonSeparatedList(
|
||||
Parameter(
|
||||
Identifier("data"))
|
||||
.WithType(
|
||||
IdentifierName(typeDefinition.GenerateFullGenericName())))))
|
||||
.WithBody(Block(SingletonList(
|
||||
ExpressionStatement(
|
||||
AssignmentExpression(SyntaxKind.SimpleAssignmentExpression, IdentifierName(DataFieldName), IdentifierName("data"))))))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("Initializes a new instance of the {0} class.", typeDefinition.GenerateFullGenericName(), ("data", "The class that is being wrapped.")));
|
||||
}
|
||||
|
||||
private static FieldDeclarationSyntax GenerateEventWrapperField(ITypeDefinition typeDefinition)
|
||||
{
|
||||
return FieldDeclaration(VariableDeclaration(IdentifierName(typeDefinition.GenerateFullGenericName()))
|
||||
.WithVariables(SingletonSeparatedList(VariableDeclarator(Identifier(DataFieldName)))))
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PrivateKeyword), Token(SyntaxKind.ReadOnlyKeyword)));
|
||||
}
|
||||
|
||||
private static ClassDeclarationSyntax GenerateEventWrapperClass(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)
|
||||
{
|
||||
var members = new List<MemberDeclarationSyntax> { GenerateEventWrapperField(typeDefinition), GenerateEventWrapperClassConstructor(typeDefinition) };
|
||||
members.AddRange(events.OrderBy(x => x.Name).Select(x => GenerateEventWrapperObservable(x, DataFieldName)).Where(x => x != null));
|
||||
|
||||
return ClassDeclaration(typeDefinition.Name + "Events")
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword)))
|
||||
.WithMembers(List(members))
|
||||
.WithObsoleteAttribute(typeDefinition)
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("A class which wraps the events contained within the {0} class as observables.", typeDefinition.GenerateFullGenericName()));
|
||||
}
|
||||
|
||||
private IEnumerable<ClassDeclarationSyntax> GenerateClasses(string namespaceName, IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> declarations)
|
||||
{
|
||||
var classes = new List<ClassDeclarationSyntax>();
|
||||
|
||||
var orderedTypeDeclarations = declarations.OrderBy(x => x.typeDefinition.Name).ToList();
|
||||
|
||||
classes.Add(GenerateStaticClass(namespaceName, orderedTypeDeclarations.Select(x => x.typeDefinition)));
|
||||
classes.AddRange(orderedTypeDeclarations.Select(x => GenerateEventWrapperClass(x.typeDefinition, x.events)));
|
||||
|
||||
return classes;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,43 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Generators
|
||||
{
|
||||
internal class StaticEventGenerator : EventGeneratorBase
|
||||
{
|
||||
/// <summary>
|
||||
/// Generate our namespace declarations. These will contain our helper classes.
|
||||
/// </summary>
|
||||
/// <param name="declarations">The declarations to add.</param>
|
||||
/// <returns>An array of namespace declarations.</returns>
|
||||
public override IEnumerable<NamespaceDeclarationSyntax> Generate(IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> declarations) => declarations.GroupBy(x => x.typeDefinition.Namespace)
|
||||
.Select(x => NamespaceDeclaration(IdentifierName(x.Key)).WithMembers(List<MemberDeclarationSyntax>(GenerateClasses(x.Key, x))));
|
||||
|
||||
private static ClassDeclarationSyntax GenerateStaticClass(string namespaceName, ITypeDefinition typeDefinition, IEnumerable<IEvent> events)
|
||||
{
|
||||
// Produces:
|
||||
// public static class EventExtensions
|
||||
// contents of members above
|
||||
return ClassDeclaration("Events")
|
||||
.WithModifiers(TokenList(Token(SyntaxKind.PublicKeyword), Token(SyntaxKind.StaticKeyword)))
|
||||
.WithLeadingTrivia(XmlSyntaxFactory.GenerateSummarySeeAlsoComment("A class that contains extension methods to wrap events contained within static classes within the {0} namespace.", namespaceName))
|
||||
.WithMembers(List<MemberDeclarationSyntax>(events.OrderBy(x => x.Name).Select(x => GenerateEventWrapperObservable(x, typeDefinition.GenerateFullGenericName()))));
|
||||
}
|
||||
|
||||
private IEnumerable<ClassDeclarationSyntax> GenerateClasses(string namespaceName, IEnumerable<(ITypeDefinition typeDefinition, IEnumerable<IEvent> events)> declarations)
|
||||
{
|
||||
return declarations.OrderBy(x => x.typeDefinition.Name).Select(x => GenerateStaticClass(namespaceName, x.typeDefinition, x.events));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,176 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Concurrent;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using ICSharpCode.Decompiler.TypeSystem.Implementation;
|
||||
using Serilog;
|
||||
|
||||
namespace EventBuilder.Core.Reflection
|
||||
{
|
||||
/// <summary>
|
||||
/// Extension methods associated with the System.Reflection.Metadata and ICSharpCode.Decompiler based classes.
|
||||
/// </summary>
|
||||
internal static class ReflectionExtensions
|
||||
{
|
||||
private static readonly ConcurrentDictionary<ICompilation, ImmutableDictionary<string, ImmutableList<ITypeDefinition>>> _typeNameMapping = new ConcurrentDictionary<ICompilation, ImmutableDictionary<string, ImmutableList<ITypeDefinition>>>();
|
||||
private static readonly ConcurrentDictionary<ICompilation, ImmutableList<ITypeDefinition>> _publicNonGenericTypeMapping = new ConcurrentDictionary<ICompilation, ImmutableList<ITypeDefinition>>();
|
||||
private static readonly ConcurrentDictionary<ICompilation, ImmutableList<ITypeDefinition>> _publicEventsTypeMapping = new ConcurrentDictionary<ICompilation, ImmutableList<ITypeDefinition>>();
|
||||
|
||||
private static readonly ConcurrentDictionary<string, string> _fullToBuiltInTypes = new ConcurrentDictionary<string, string>
|
||||
{
|
||||
["System.Boolean"] = "bool",
|
||||
["System.Byte"] = "byte",
|
||||
["System.SByte"] = "sbyte",
|
||||
["System.Char"] = "char",
|
||||
["System.Decimal"] = "decimal",
|
||||
["System.Double"] = "double",
|
||||
["System.Single"] = "float",
|
||||
["System.Int32"] = "int",
|
||||
["System.UInt32"] = "uint",
|
||||
["System.Int64"] = "long",
|
||||
["System.UInt64"] = "ulong",
|
||||
["System.Object"] = "object",
|
||||
["System.Int16"] = "short",
|
||||
["System.UInt16"] = "ushort",
|
||||
["System.String"] = "string",
|
||||
};
|
||||
|
||||
/// <summary>
|
||||
/// Get all type definitions where they have public events, aren't generic (no type parameters == 0), and they are public.
|
||||
/// </summary>
|
||||
/// <param name="compilation">The compilation unit.</param>
|
||||
/// <returns>A enumerable of type definitions that match the criteria.</returns>
|
||||
public static IEnumerable<ITypeDefinition> GetPublicTypesWithNotStaticEvents(this ICompilation compilation)
|
||||
{
|
||||
var list = GetPublicTypeDefinitionsWithEvents(compilation);
|
||||
return list
|
||||
.Where(x => x.Events.Any(eventDetails => !eventDetails.IsStatic))
|
||||
.OrderBy(x => x.Namespace)
|
||||
.ThenBy(x => x.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get all type definitions where they have public events, aren't generic (no type parameters == 0), and they are public.
|
||||
/// </summary>
|
||||
/// <param name="compilation">The compilation unit.</param>
|
||||
/// <returns>A enumerable of type definitions that match the criteria.</returns>
|
||||
public static IEnumerable<ITypeDefinition> GetPublicTypesWithStaticEvents(this ICompilation compilation)
|
||||
{
|
||||
var list = GetPublicTypeDefinitionsWithEvents(compilation);
|
||||
return list
|
||||
.Where(x => x.Events.Any(eventDetails => eventDetails.IsStatic))
|
||||
.OrderBy(x => x.Namespace)
|
||||
.ThenBy(x => x.Name);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets type definitions matching the full name and in the reference and main libraries.
|
||||
/// </summary>
|
||||
/// <param name="compilation">The compilation to scan.</param>
|
||||
/// <param name="name">The name of the item to get.</param>
|
||||
/// <returns>The name of the items.</returns>
|
||||
public static IReadOnlyCollection<ITypeDefinition> GetReferenceTypeDefinitionsWithFullName(this ICompilation compilation, string name)
|
||||
{
|
||||
var map = _typeNameMapping.GetOrAdd(compilation, comp => comp.ReferencedModules.Concat(compilation.Modules).SelectMany(x => x.TypeDefinitions).GroupBy(x => x.FullName).ToImmutableDictionary(x => x.Key, x => x.ToImmutableList()));
|
||||
|
||||
return map.GetValueOrDefault(name);
|
||||
}
|
||||
|
||||
public static string GetBuiltInType(string typeName)
|
||||
{
|
||||
if (_fullToBuiltInTypes.TryGetValue(typeName, out var builtInName))
|
||||
{
|
||||
return builtInName;
|
||||
}
|
||||
|
||||
return typeName;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of non-generic public type definitions.
|
||||
/// </summary>
|
||||
/// <param name="compilation">The compilation to get the type definitions from.</param>
|
||||
/// <returns>The list of type definitions.</returns>
|
||||
public static IImmutableList<ITypeDefinition> GetPublicNonGenericTypeDefinitions(this ICompilation compilation)
|
||||
{
|
||||
return _publicNonGenericTypeMapping.GetOrAdd(
|
||||
compilation,
|
||||
comp => comp.GetAllTypeDefinitions().Where(x => x.Accessibility == Accessibility.Public && x.TypeParameterCount == 0).OrderBy(x => x.FullName)
|
||||
.ToImmutableList());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a string form of the type and generic arguments for a type.
|
||||
/// </summary>
|
||||
/// <param name="currentType">The type to generate the arguments for.</param>
|
||||
/// <returns>A type descriptor including the generic arguments.</returns>
|
||||
public static string GenerateFullGenericName(this IType currentType)
|
||||
{
|
||||
var sb = new StringBuilder(GetBuiltInType(currentType.FullName));
|
||||
|
||||
if (currentType.TypeParameterCount > 0)
|
||||
{
|
||||
sb.Append("<")
|
||||
.Append(string.Join(", ", currentType.TypeArguments.Select(GenerateFullGenericName)))
|
||||
.Append(">");
|
||||
}
|
||||
|
||||
return sb.ToString();
|
||||
}
|
||||
|
||||
public static string GetEventArgsName(this IEvent eventDetails)
|
||||
{
|
||||
ICompilation compilation = eventDetails.Compilation;
|
||||
|
||||
// Find the EventArgs type parameter of the event via digging around via reflection
|
||||
if (!eventDetails.CanAdd || !eventDetails.CanRemove)
|
||||
{
|
||||
Log.Debug($"Type for {eventDetails.DeclaringType.FullName} is not valid");
|
||||
return null;
|
||||
}
|
||||
|
||||
IType type = eventDetails.ReturnType;
|
||||
if (type is UnknownType)
|
||||
{
|
||||
type = compilation.GetReferenceTypeDefinitionsWithFullName(eventDetails.ReturnType.FullName).FirstOrDefault();
|
||||
}
|
||||
|
||||
if (type == null)
|
||||
{
|
||||
Log.Debug($"Type for {eventDetails.DeclaringType.FullName} is not valid");
|
||||
return null;
|
||||
}
|
||||
|
||||
if (type is ParameterizedType genericType)
|
||||
{
|
||||
return genericType.GenerateFullGenericName();
|
||||
}
|
||||
|
||||
var invoke = type.GetMethods().First(x => x.Name == "Invoke");
|
||||
|
||||
if (invoke.Parameters.Count != 2)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var param = invoke.Parameters[1];
|
||||
|
||||
return param.Type.GenerateFullGenericName();
|
||||
}
|
||||
|
||||
private static IImmutableList<ITypeDefinition> GetPublicTypeDefinitionsWithEvents(ICompilation compilation)
|
||||
{
|
||||
return _publicEventsTypeMapping.GetOrAdd(
|
||||
compilation,
|
||||
comp => comp.GetPublicNonGenericTypeDefinitions().Where(x => x.Events.Any(eventInfo => eventInfo.Accessibility == Accessibility.Public))
|
||||
.ToImmutableList());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EventBuilder.Core.Reflection.Generators;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Resolvers
|
||||
{
|
||||
internal class DelegateTemplateNamespaceResolver : INamespaceResolver
|
||||
{
|
||||
private const string DelegateName = "MulticastDelegate";
|
||||
private static readonly string[] CocoaDelegateNames =
|
||||
{
|
||||
"Delegate",
|
||||
"UITableViewSource"
|
||||
};
|
||||
|
||||
private static readonly string[] BannedMethods =
|
||||
{
|
||||
"Dispose",
|
||||
"Finalize"
|
||||
};
|
||||
|
||||
// NB: Apparently this used to break "build on device because of reasons". We don't know what these reasons are and this may not be needed anymore.
|
||||
private static readonly string[] _garbageTypeList = { "AVPlayerItemLegibleOutputPushDelegate" };
|
||||
|
||||
public IEnumerable<NamespaceDeclarationSyntax> Create(ICompilation compilation)
|
||||
{
|
||||
IEnumerable<(ITypeDefinition typeDefinition, bool isAbstract, IEnumerable<IMethod> methods)> values = compilation.GetPublicNonGenericTypeDefinitions()
|
||||
.Where(
|
||||
x => x.Kind != TypeKind.Interface
|
||||
&& (!IsMulticastDelegateDerived(x)
|
||||
|| !x.DirectBaseTypes.Any())
|
||||
&& !_garbageTypeList.Any(y => x.FullName.Contains(y))
|
||||
&& CocoaDelegateNames.Any(cocoaName => x.FullName.EndsWith(cocoaName, StringComparison.OrdinalIgnoreCase)))
|
||||
.Select(typeDef => new { TypeDefinition = typeDef, IsAbstract = typeDef.Methods.Any(method => method.ReturnType.FullName != RoslynHelpers.VoidType && method.IsAbstract) })
|
||||
.Select(x => (x.TypeDefinition, x.IsAbstract, GetPublicDelegateMethods(x.TypeDefinition)))
|
||||
.Where(x => x.Item3.Any());
|
||||
|
||||
return DelegateGenerator.Generate(values);
|
||||
}
|
||||
|
||||
private static bool IsMulticastDelegateDerived(ITypeDefinition typeDefinition)
|
||||
{
|
||||
return typeDefinition.DirectBaseTypes.Any(x => x.FullName.Contains(DelegateName));
|
||||
}
|
||||
|
||||
private static IEnumerable<IMethod> GetPublicDelegateMethods(ITypeDefinition typeDefinition)
|
||||
{
|
||||
return typeDefinition.Methods
|
||||
.Where(x => (x.IsVirtual || x.IsAbstract) && !x.IsConstructor && !x.IsAccessor && x.ReturnType.FullName == RoslynHelpers.VoidType && x.Parameters.All(y => !y.IsRef) && !BannedMethods.Contains(x.Name))
|
||||
.GroupBy(x => x.Name)
|
||||
.Select(x => x.OrderByDescending(y => y.Parameters.Count).First());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,69 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using EventBuilder.Core.Reflection.Generators;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// A namespace resolver that extracts event information.
|
||||
/// </summary>
|
||||
internal abstract class EventNamespaceResolverBase : INamespaceResolver
|
||||
{
|
||||
private static readonly ImmutableHashSet<string> SkipNamespaceList = new[]
|
||||
{
|
||||
"Windows.UI.Xaml.Data",
|
||||
"Windows.UI.Xaml.Interop",
|
||||
"Windows.UI.Xaml.Input",
|
||||
"MonoTouch.AudioToolbox",
|
||||
"MonoMac.AudioToolbox",
|
||||
"ReactiveUI.Events",
|
||||
|
||||
// Winforms
|
||||
"System.Collections.Specialized",
|
||||
"System.Configuration",
|
||||
"System.ComponentModel.Design",
|
||||
"System.ComponentModel.Design.Serialization",
|
||||
"System.CodeDom",
|
||||
"System.Data.SqlClient",
|
||||
"System.Data.OleDb",
|
||||
"System.Data.Odbc",
|
||||
"System.Data.Common",
|
||||
"System.Drawing.Design",
|
||||
"System.Media",
|
||||
"System.Net",
|
||||
"System.Net.Mail",
|
||||
"System.Net.NetworkInformation",
|
||||
"System.Net.Sockets",
|
||||
"System.ServiceProcess.Design",
|
||||
"System.Windows.Input",
|
||||
"System.Windows.Forms.ComponentModel.Com2Interop",
|
||||
"System.Windows.Forms.Design",
|
||||
"System.Timers"
|
||||
}.ToImmutableHashSet();
|
||||
|
||||
/// <inheritdoc />
|
||||
public IEnumerable<NamespaceDeclarationSyntax> Create(ICompilation compilation)
|
||||
{
|
||||
var events = GetPublicTypesWithEvents(compilation)
|
||||
.Where(x => !SkipNamespaceList.Contains(x.Namespace))
|
||||
.Select(x => (x, GetValidEventDetails(x.Events)))
|
||||
.ToList();
|
||||
|
||||
return GetEventGenerator().Generate(events);
|
||||
}
|
||||
|
||||
protected abstract IEventGenerator GetEventGenerator();
|
||||
|
||||
protected abstract IEnumerable<ITypeDefinition> GetPublicTypesWithEvents(ICompilation compilation);
|
||||
|
||||
protected abstract IEnumerable<IEvent> GetValidEventDetails(IEnumerable<IEvent> eventDetails);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,24 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// A resolver which will generate namespace information.
|
||||
/// </summary>
|
||||
internal interface INamespaceResolver
|
||||
{
|
||||
/// <summary>
|
||||
/// Creates the namespaces from the specified assembly definitions.
|
||||
/// </summary>
|
||||
/// <param name="compilation">The compilation to use to determine the dependencies.</param>
|
||||
/// <returns>A collection of namespace definitions.</returns>
|
||||
IEnumerable<NamespaceDeclarationSyntax> Create(ICompilation compilation);
|
||||
}
|
||||
}
|
|
@ -0,0 +1,33 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EventBuilder.Core.Reflection.Generators;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Resolvers
|
||||
{
|
||||
/// <summary>
|
||||
/// A namespace resolver that extracts event information.
|
||||
/// </summary>
|
||||
internal class PublicEventNamespaceResolver : EventNamespaceResolverBase
|
||||
{
|
||||
protected override IEnumerable<IEvent> GetValidEventDetails(IEnumerable<IEvent> eventDetails)
|
||||
{
|
||||
return eventDetails.Where(x => x.Accessibility == Accessibility.Public && !x.IsStatic);
|
||||
}
|
||||
|
||||
protected override IEnumerable<ITypeDefinition> GetPublicTypesWithEvents(ICompilation compilation)
|
||||
{
|
||||
return compilation.GetPublicTypesWithNotStaticEvents();
|
||||
}
|
||||
|
||||
protected override IEventGenerator GetEventGenerator()
|
||||
{
|
||||
return new InstanceEventGenerator();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,30 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using EventBuilder.Core.Reflection.Generators;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
|
||||
namespace EventBuilder.Core.Reflection.Resolvers
|
||||
{
|
||||
internal class PublicStaticEventNamespaceResolver : EventNamespaceResolverBase
|
||||
{
|
||||
protected override IEventGenerator GetEventGenerator()
|
||||
{
|
||||
return new StaticEventGenerator();
|
||||
}
|
||||
|
||||
protected override IEnumerable<ITypeDefinition> GetPublicTypesWithEvents(ICompilation compilation)
|
||||
{
|
||||
return compilation.GetPublicTypesWithStaticEvents();
|
||||
}
|
||||
|
||||
protected override IEnumerable<IEvent> GetValidEventDetails(IEnumerable<IEvent> eventDetails)
|
||||
{
|
||||
return eventDetails.Where(x => x.Accessibility == Accessibility.Public && x.IsStatic);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection
|
||||
{
|
||||
internal static class RoslynGeneratorExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Generates a argument list for a single parameter.
|
||||
/// </summary>
|
||||
/// <param name="parameter">The parameter to generate the argument list for.</param>
|
||||
/// <returns>The argument list.</returns>
|
||||
public static ArgumentListSyntax GenerateArgumentList(this IParameter parameter) => ArgumentList(SingletonSeparatedList(Argument(IdentifierName(parameter.Name))));
|
||||
|
||||
/// <summary>
|
||||
/// Generates a argument list for a single parameter.
|
||||
/// </summary>
|
||||
/// <param name="parameters">The parameters to generate the argument list for.</param>
|
||||
/// <returns>The argument list.</returns>
|
||||
public static ArgumentListSyntax GenerateTupleArgumentList(this IEnumerable<IParameter> parameters) => ArgumentList(SingletonSeparatedList(Argument(TupleExpression(SeparatedList(parameters.Select(x => Argument(IdentifierName(x.Name))))))));
|
||||
|
||||
public static TypeArgumentListSyntax GenerateObservableTypeArguments(this IMethod method)
|
||||
{
|
||||
TypeArgumentListSyntax argumentList;
|
||||
|
||||
// If we have no parameters, use the Unit type, if only one use the type directly, otherwise use a value tuple.
|
||||
if (method.Parameters.Count == 0)
|
||||
{
|
||||
argumentList = TypeArgumentList(SingletonSeparatedList<TypeSyntax>(IdentifierName(RoslynHelpers.ObservableUnitName)));
|
||||
}
|
||||
else if (method.Parameters.Count == 1)
|
||||
{
|
||||
argumentList = TypeArgumentList(SingletonSeparatedList<TypeSyntax>(IdentifierName(method.Parameters[0].Type.GenerateFullGenericName())));
|
||||
}
|
||||
else
|
||||
{
|
||||
argumentList = TypeArgumentList(SingletonSeparatedList<TypeSyntax>(TupleType(SeparatedList(method.Parameters.Select(x => TupleElement(IdentifierName(x.Type.GenerateFullGenericName())).WithIdentifier(Identifier(x.Name)))))));
|
||||
}
|
||||
|
||||
return argumentList;
|
||||
}
|
||||
|
||||
public static TypeSyntax GenerateObservableType(this TypeArgumentListSyntax argumentList)
|
||||
{
|
||||
return QualifiedName(
|
||||
IdentifierName("System"),
|
||||
GenericName(
|
||||
Identifier("IObservable"))
|
||||
.WithTypeArgumentList(argumentList));
|
||||
}
|
||||
|
||||
public static PropertyDeclarationSyntax WithObsoleteAttribute(this PropertyDeclarationSyntax syntax, IEntity eventDetails)
|
||||
{
|
||||
var attribute = GenerateObsoleteAttributeList(eventDetails);
|
||||
|
||||
if (attribute == null)
|
||||
{
|
||||
return syntax;
|
||||
}
|
||||
|
||||
return syntax.WithAttributeLists(SingletonList(attribute));
|
||||
}
|
||||
|
||||
public static ClassDeclarationSyntax WithObsoleteAttribute(this ClassDeclarationSyntax syntax, IEntity eventDetails)
|
||||
{
|
||||
var attribute = GenerateObsoleteAttributeList(eventDetails);
|
||||
|
||||
if (attribute == null)
|
||||
{
|
||||
return syntax;
|
||||
}
|
||||
|
||||
return syntax.WithAttributeLists(SingletonList(attribute));
|
||||
}
|
||||
|
||||
public static MethodDeclarationSyntax WithObsoleteAttribute(this MethodDeclarationSyntax syntax, IEntity eventDetails)
|
||||
{
|
||||
var attribute = GenerateObsoleteAttributeList(eventDetails);
|
||||
|
||||
if (attribute == null)
|
||||
{
|
||||
return syntax;
|
||||
}
|
||||
|
||||
return syntax.WithAttributeLists(SingletonList(attribute));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets information about the event's obsolete information if any.
|
||||
/// </summary>
|
||||
/// <param name="eventDetails">The event details.</param>
|
||||
/// <returns>The event's obsolete information if there is any.</returns>
|
||||
private static AttributeListSyntax GenerateObsoleteAttributeList(IEntity eventDetails)
|
||||
{
|
||||
var obsoleteAttribute = eventDetails.GetAttributes()
|
||||
.FirstOrDefault(attr => attr.AttributeType.FullName.Equals("System.ObsoleteAttribute", StringComparison.InvariantCulture));
|
||||
|
||||
if (obsoleteAttribute == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
var message = obsoleteAttribute.FixedArguments.FirstOrDefault().Value.ToString() ?? string.Empty;
|
||||
var isError = bool.Parse(obsoleteAttribute.FixedArguments.ElementAtOrDefault(1).Value?.ToString() ?? bool.FalseString) ? SyntaxKind.TrueLiteralExpression : SyntaxKind.FalseLiteralExpression;
|
||||
var attribute = Attribute(
|
||||
IdentifierName("System.ObsoleteAttribute"),
|
||||
AttributeArgumentList(SeparatedList(new[] { AttributeArgument(LiteralExpression(SyntaxKind.StringLiteralExpression, Literal(message))), AttributeArgument(LiteralExpression(isError)) })));
|
||||
|
||||
return AttributeList(SingletonSeparatedList(attribute));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,38 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Reflection.PortableExecutable;
|
||||
using EventBuilder.Core.Reflection.Compilation;
|
||||
using ICSharpCode.Decompiler.Metadata;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
namespace EventBuilder.Core.Reflection
|
||||
{
|
||||
/// <summary>
|
||||
/// Helper methods associated with the roslyn template generators.
|
||||
/// </summary>
|
||||
internal static class RoslynHelpers
|
||||
{
|
||||
internal const string ObservableUnitName = "System.Reactive.Unit";
|
||||
internal const string VoidType = "System.Void";
|
||||
|
||||
/// <summary>
|
||||
/// Gets an argument which access System.Reactive.Unit.Default member.
|
||||
/// </summary>
|
||||
public static ArgumentListSyntax ReactiveUnitArgumentList { get; } = SyntaxFactory.ArgumentList(SyntaxFactory.SingletonSeparatedList(SyntaxFactory.Argument(SyntaxFactory.IdentifierName(ObservableUnitName + ".Default"))));
|
||||
|
||||
public static ICompilation GetCompilation(IEnumerable<string> targetAssemblies, IEnumerable<string> searchDirectories)
|
||||
{
|
||||
var modules = targetAssemblies.Select(x => new PEFile(x, PEStreamOptions.PrefetchMetadata));
|
||||
|
||||
return new EventBuilderCompiler(modules, searchDirectories);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,123 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
// Copyright (c) Tunnel Vision Laboratories, LLC. All Rights Reserved.
|
||||
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Xml.Linq;
|
||||
using ICSharpCode.Decompiler.TypeSystem;
|
||||
using Microsoft.CodeAnalysis;
|
||||
using Microsoft.CodeAnalysis.CSharp;
|
||||
using Microsoft.CodeAnalysis.CSharp.Syntax;
|
||||
|
||||
using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory;
|
||||
|
||||
namespace EventBuilder.Core.Reflection
|
||||
{
|
||||
/// <summary>
|
||||
/// This class was originally from StyleCop. https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Helpers/XmlSyntaxFactory.cs
|
||||
/// All credit goes to the StyleCop team.
|
||||
/// </summary>
|
||||
internal static class XmlSyntaxFactory
|
||||
{
|
||||
static XmlSyntaxFactory()
|
||||
{
|
||||
// Make sure the newline is included. Otherwise the comment and the method will be on the same line.
|
||||
InheritdocSyntax = ParseLeadingTrivia(@"/// <inheritdoc />" + Environment.NewLine);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a inheritdoc leading trivia comment.
|
||||
/// </summary>
|
||||
public static SyntaxTriviaList InheritdocSyntax { get; }
|
||||
|
||||
public static SyntaxTriviaList GenerateSummaryComment(string summaryText, string parameterFormat, IMethod entity)
|
||||
{
|
||||
var parameters = entity.Parameters.Select(x => (x.Name, string.Format(CultureInfo.InvariantCulture, parameterFormat, x.Name)));
|
||||
|
||||
return GenerateSummaryComment(summaryText, parameters);
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummarySeeAlsoComment(string summaryText, string seeAlsoText)
|
||||
{
|
||||
var text = string.Format(CultureInfo.InvariantCulture, summaryText, "<see cref=\"" + seeAlsoText.Replace("<", "{").Replace(">", "}") + "\" />");
|
||||
string template = "/// <summary>" + Environment.NewLine +
|
||||
$"/// {text}" + Environment.NewLine +
|
||||
"/// </summary>" + Environment.NewLine;
|
||||
|
||||
return ParseLeadingTrivia(template);
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummarySeeAlsoComment(string summaryText, string seeAlsoText, params (string paramName, string paramText)[] parameters)
|
||||
{
|
||||
var text = string.Format(CultureInfo.InvariantCulture, summaryText, "<see cref=\"" + seeAlsoText.Replace("<", "{").Replace(">", "}") + "\" />");
|
||||
var sb = new StringBuilder("/// <summary>")
|
||||
.AppendLine()
|
||||
.Append("/// ").AppendLine(text)
|
||||
.AppendLine("/// </summary>");
|
||||
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
sb.AppendLine($"/// <param name=\"{parameter.paramName}\">{parameter.paramText}</param>");
|
||||
}
|
||||
|
||||
return ParseLeadingTrivia(sb.ToString());
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummaryComment(string summaryText)
|
||||
{
|
||||
string template = "/// <summary>" + Environment.NewLine +
|
||||
$"/// {summaryText}" + Environment.NewLine +
|
||||
"/// </summary>" + Environment.NewLine;
|
||||
|
||||
return ParseLeadingTrivia(template);
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummaryComment(string summaryText, string returnValueText)
|
||||
{
|
||||
string template = "/// <summary>" + Environment.NewLine +
|
||||
$"/// {summaryText}" + Environment.NewLine +
|
||||
"/// </summary>" + Environment.NewLine +
|
||||
$"/// <returns>{returnValueText}///<returns>" + Environment.NewLine;
|
||||
|
||||
return ParseLeadingTrivia(template);
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummaryComment(string summaryText, IEnumerable<(string paramName, string paramText)> parameters)
|
||||
{
|
||||
var sb = new StringBuilder("/// <summary>")
|
||||
.AppendLine()
|
||||
.Append("/// ").AppendLine(summaryText)
|
||||
.AppendLine("/// </summary>");
|
||||
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
sb.AppendLine($"/// <param name=\"{parameter.paramName}\">{parameter.paramText}</param>");
|
||||
}
|
||||
|
||||
return ParseLeadingTrivia(sb.ToString());
|
||||
}
|
||||
|
||||
public static SyntaxTriviaList GenerateSummaryComment(string summaryText, IEnumerable<(string paramName, string paramText)> parameters, string returnValueText)
|
||||
{
|
||||
var sb = new StringBuilder("/// <summary>")
|
||||
.AppendLine()
|
||||
.Append("/// ").AppendLine(summaryText)
|
||||
.AppendLine("/// </summary>");
|
||||
|
||||
foreach (var parameter in parameters)
|
||||
{
|
||||
sb.AppendLine($"/// <param name=\"{parameter.paramName}\">{parameter.paramText}</param>");
|
||||
}
|
||||
|
||||
sb.Append("/// <returns>").Append(returnValueText).AppendLine("</returns>");
|
||||
return ParseLeadingTrivia(sb.ToString());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,45 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System.IO;
|
||||
using System.Reflection;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace EventBuilder.Core
|
||||
{
|
||||
internal static class TemplateManager
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the default mustache template file name.
|
||||
/// </summary>
|
||||
public const string DefaultMustacheTemplate = "EventBuilder.Core.Templates.DefaultTemplate.mustache";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the template for static based events.
|
||||
/// </summary>
|
||||
public const string StaticMustacheTemplate = "EventBuilder.Core.Templates.StaticTemplate.mustache";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the template for the header of the file.
|
||||
/// </summary>
|
||||
public const string HeaderTemplate = "EventBuilder.Core.Templates.HeaderTemplate.txt";
|
||||
|
||||
/// <summary>
|
||||
/// Gets the template for the delegate information.
|
||||
/// </summary>
|
||||
public const string DelegateTemplate = "EventBuilder.Core.Templates.DelegateTemplate.mustache";
|
||||
|
||||
public static async Task<string> GetTemplateAsync(string templateName)
|
||||
{
|
||||
var assembly = Assembly.GetExecutingAssembly();
|
||||
|
||||
using (var streamReader = new StreamReader(assembly.GetManifestResourceStream(templateName), Encoding.UTF8))
|
||||
{
|
||||
return await streamReader.ReadToEndAsync().ConfigureAwait(false);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for more information.
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// This code was generated from a template.
|
||||
//
|
||||
// Manual changes to this file may cause unexpected behavior in your application.
|
||||
// Manual changes to this file will be overwritten if the code is regenerated.
|
||||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
using System;
|
||||
using System.Reactive;
|
||||
using System.Reactive.Linq;
|
||||
using System.Reactive.Subjects;
|
|
@ -0,0 +1,85 @@
|
|||
// Copyright (c) 2019 .NET Foundation and Contributors. All rights reserved.
|
||||
// Licensed to the .NET Foundation under one or more agreements.
|
||||
// The .NET Foundation licenses this file to you under the MIT license.
|
||||
// See the LICENSE file in the project root for full license information.
|
||||
|
||||
using System;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text.RegularExpressions;
|
||||
using EventBuilder.Core.Reflection;
|
||||
using PublicApiGenerator;
|
||||
using Shouldly;
|
||||
using Splat;
|
||||
using Xunit;
|
||||
|
||||
namespace EventBuilder.Tests.API
|
||||
{
|
||||
/// <summary>
|
||||
/// Tests to make sure that the API matches the approved ones.
|
||||
/// </summary>
|
||||
[ExcludeFromCodeCoverage]
|
||||
public class ApiApprovalTests
|
||||
{
|
||||
private static readonly Regex _removeCoverletSectionRegex = new Regex(@"^namespace Coverlet\.Core\.Instrumentation\.Tracker.*?^}", RegexOptions.Singleline | RegexOptions.Multiline | RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// Tests to make sure the splat project is approved.
|
||||
/// </summary>
|
||||
[Fact]
|
||||
public void EventBuilderProject()
|
||||
{
|
||||
CheckApproval(typeof(XmlSyntaxFactory).Assembly);
|
||||
}
|
||||
|
||||
private static void CheckApproval(Assembly assembly, [CallerMemberName]string memberName = null, [CallerFilePath]string filePath = null)
|
||||
{
|
||||
var targetFrameworkName = Assembly.GetExecutingAssembly().GetTargetFrameworkName();
|
||||
|
||||
var sourceDirectory = Path.GetDirectoryName(filePath);
|
||||
|
||||
var approvedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.approved.txt");
|
||||
var receivedFileName = Path.Combine(sourceDirectory, $"ApiApprovalTests.{memberName}.{targetFrameworkName}.received.txt");
|
||||
|
||||
if (!File.Exists(approvedFileName))
|
||||
{
|
||||
File.Create(approvedFileName);
|
||||
}
|
||||
|
||||
if (!File.Exists(receivedFileName))
|
||||
{
|
||||
File.Create(receivedFileName);
|
||||
}
|
||||
|
||||
var approvedPublicApi = File.ReadAllText(approvedFileName);
|
||||
|
||||
var receivedPublicApi = Filter(ApiGenerator.GeneratePublicApi(assembly));
|
||||
|
||||
if (!string.Equals(receivedPublicApi, approvedPublicApi, StringComparison.InvariantCulture))
|
||||
{
|
||||
File.WriteAllText(receivedFileName, receivedPublicApi);
|
||||
ShouldlyConfiguration.DiffTools.GetDiffTool().Open(receivedFileName, approvedFileName, true);
|
||||
}
|
||||
|
||||
Assert.Equal(approvedPublicApi, receivedPublicApi);
|
||||
}
|
||||
|
||||
private static string Filter(string text)
|
||||
{
|
||||
text = _removeCoverletSectionRegex.Replace(text, string.Empty);
|
||||
return string.Join(Environment.NewLine, text.Split(
|
||||
new[]
|
||||
{
|
||||
Environment.NewLine
|
||||
}, StringSplitOptions.RemoveEmptyEntries)
|
||||
.Where(l =>
|
||||
!l.StartsWith("[assembly: AssemblyVersion(", StringComparison.InvariantCulture) &&
|
||||
!l.StartsWith("[assembly: AssemblyFileVersion(", StringComparison.InvariantCulture) &&
|
||||
!l.StartsWith("[assembly: AssemblyInformationalVersion(", StringComparison.InvariantCulture) &&
|
||||
!string.IsNullOrWhiteSpace(l)));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>netcoreapp2.2</TargetFramework>
|
||||
|
||||
<IsPackable>false</IsPackable>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="splat" Version="7.0.1" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\EventBuilder.Core\EventBuilder.Core.csproj" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using Xunit;
|
||||
|
||||
namespace EventBuilder.Tests
|
||||
{
|
||||
public class UnitTest1
|
||||
{
|
||||
[Fact]
|
||||
public void Test1()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,31 @@
|
|||
|
||||
Microsoft Visual Studio Solution File, Format Version 12.00
|
||||
# Visual Studio 15
|
||||
VisualStudioVersion = 15.0.26228.9
|
||||
MinimumVisualStudioVersion = 10.0.40219.1
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBuilder.Core", "EventBuilder.Core\EventBuilder.Core.csproj", "{1C0EC69F-FF82-4C25-8A23-8EF319A3EAD4}"
|
||||
EndProject
|
||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "EventBuilder.Console", "EventBuilder.Console\EventBuilder.Console.csproj", "{4D94D3F8-C3D2-43A5-A8F2-363500939E09}"
|
||||
EndProject
|
||||
Global
|
||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||
Debug|Any CPU = Debug|Any CPU
|
||||
Release|Any CPU = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(ProjectConfigurationPlatforms) = postSolution
|
||||
{1C0EC69F-FF82-4C25-8A23-8EF319A3EAD4}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{1C0EC69F-FF82-4C25-8A23-8EF319A3EAD4}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{1C0EC69F-FF82-4C25-8A23-8EF319A3EAD4}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{1C0EC69F-FF82-4C25-8A23-8EF319A3EAD4}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{4D94D3F8-C3D2-43A5-A8F2-363500939E09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{4D94D3F8-C3D2-43A5-A8F2-363500939E09}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{4D94D3F8-C3D2-43A5-A8F2-363500939E09}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{4D94D3F8-C3D2-43A5-A8F2-363500939E09}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
EndGlobalSection
|
||||
GlobalSection(SolutionProperties) = preSolution
|
||||
HideSolutionNode = FALSE
|
||||
EndGlobalSection
|
||||
GlobalSection(ExtensibilityGlobals) = postSolution
|
||||
SolutionGuid = {8AD09057-1163-45D2-A260-CB034E6DFD07}
|
||||
EndGlobalSection
|
||||
EndGlobal
|
|
@ -0,0 +1,280 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="15.0">
|
||||
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
|
||||
<Name Resource="MinimumRecommendedRules_Name" />
|
||||
<Description Resource="MinimumRecommendedRules_Description" />
|
||||
</Localization>
|
||||
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
|
||||
<Rule Id="AvoidAsyncVoid" Action="Info" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
|
||||
<Rule Id="CA1000" Action="None" />
|
||||
<Rule Id="CA1030" Action="None" />
|
||||
<Rule Id="CA1033" Action="None" />
|
||||
<Rule Id="CA1001" Action="Error" />
|
||||
<Rule Id="CA1009" Action="Error" />
|
||||
<Rule Id="CA1016" Action="Error" />
|
||||
<Rule Id="CA1049" Action="Error" />
|
||||
<Rule Id="CA1060" Action="Error" />
|
||||
<Rule Id="CA1061" Action="Error" />
|
||||
<Rule Id="CA1063" Action="Error" />
|
||||
<Rule Id="CA1065" Action="Error" />
|
||||
<Rule Id="CA1301" Action="Error" />
|
||||
<Rule Id="CA1308" Action="None" />
|
||||
<Rule Id="CA1400" Action="Error" />
|
||||
<Rule Id="CA1401" Action="Error" />
|
||||
<Rule Id="CA1403" Action="Error" />
|
||||
<Rule Id="CA1404" Action="Error" />
|
||||
<Rule Id="CA1405" Action="Error" />
|
||||
<Rule Id="CA1410" Action="Error" />
|
||||
<Rule Id="CA1415" Action="Error" />
|
||||
<Rule Id="CA1507" Action="Error" />
|
||||
<Rule Id="CA1821" Action="Error" />
|
||||
<Rule Id="CA1900" Action="Error" />
|
||||
<Rule Id="CA1901" Action="Error" />
|
||||
<Rule Id="CA2002" Action="Error" />
|
||||
<Rule Id="CA2100" Action="Error" />
|
||||
<Rule Id="CA2101" Action="Error" />
|
||||
<Rule Id="CA2108" Action="Error" />
|
||||
<Rule Id="CA2111" Action="Error" />
|
||||
<Rule Id="CA2112" Action="Error" />
|
||||
<Rule Id="CA2114" Action="Error" />
|
||||
<Rule Id="CA2116" Action="Error" />
|
||||
<Rule Id="CA2117" Action="Error" />
|
||||
<Rule Id="CA2122" Action="Error" />
|
||||
<Rule Id="CA2123" Action="Error" />
|
||||
<Rule Id="CA2124" Action="Error" />
|
||||
<Rule Id="CA2126" Action="Error" />
|
||||
<Rule Id="CA2131" Action="Error" />
|
||||
<Rule Id="CA2132" Action="Error" />
|
||||
<Rule Id="CA2133" Action="Error" />
|
||||
<Rule Id="CA2134" Action="Error" />
|
||||
<Rule Id="CA2137" Action="Error" />
|
||||
<Rule Id="CA2138" Action="Error" />
|
||||
<Rule Id="CA2140" Action="Error" />
|
||||
<Rule Id="CA2141" Action="Error" />
|
||||
<Rule Id="CA2146" Action="Error" />
|
||||
<Rule Id="CA2147" Action="Error" />
|
||||
<Rule Id="CA2149" Action="Error" />
|
||||
<Rule Id="CA2200" Action="Error" />
|
||||
<Rule Id="CA2202" Action="Error" />
|
||||
<Rule Id="CA2207" Action="Error" />
|
||||
<Rule Id="CA2212" Action="Error" />
|
||||
<Rule Id="CA2213" Action="Error" />
|
||||
<Rule Id="CA2214" Action="Error" />
|
||||
<Rule Id="CA2216" Action="Error" />
|
||||
<Rule Id="CA2220" Action="Error" />
|
||||
<Rule Id="CA2229" Action="Error" />
|
||||
<Rule Id="CA2231" Action="Error" />
|
||||
<Rule Id="CA2232" Action="Error" />
|
||||
<Rule Id="CA2235" Action="Error" />
|
||||
<Rule Id="CA2236" Action="Error" />
|
||||
<Rule Id="CA2237" Action="Error" />
|
||||
<Rule Id="CA2238" Action="Error" />
|
||||
<Rule Id="CA2240" Action="Error" />
|
||||
<Rule Id="CA2241" Action="Error" />
|
||||
<Rule Id="CA2242" Action="Error" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
|
||||
<Rule Id="CA1036" Action="None" />
|
||||
<Rule Id="CA1056" Action="Info" />
|
||||
<Rule Id="CA1710" Action="Info" />
|
||||
<Rule Id="CA1724" Action="None" />
|
||||
<Rule Id="CA1810" Action="None" />
|
||||
<Rule Id="CA2007" Action="None" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
|
||||
<Rule Id="RCS1001" Action="Error" />
|
||||
<Rule Id="RCS1055" Action="Error" />
|
||||
<Rule Id="RCS1062" Action="Error" />
|
||||
<Rule Id="RCS1066" Action="Error" />
|
||||
<Rule Id="RCS1069" Action="Error" />
|
||||
<Rule Id="RCS1071" Action="Error" />
|
||||
<Rule Id="RCS1074" Action="Error" />
|
||||
<Rule Id="RCS1090" Action="Error" />
|
||||
<Rule Id="RCS1018" Action="Error" />
|
||||
<Rule Id="RCS1507" Action="Error" />
|
||||
<Rule Id="RCS1037" Action="Error" />
|
||||
<Rule Id="RCS1138" Action="Error" />
|
||||
<Rule Id="RCS1139" Action="Error" />
|
||||
<Rule Id="RCS1163" Action="Info" />
|
||||
<Rule Id="RCS1168" Action="Info" />
|
||||
<Rule Id="RCS1188" Action="Error" />
|
||||
<Rule Id="RCS1201" Action="Error" />
|
||||
<Rule Id="RCS1207" Action="Error" />
|
||||
<Rule Id="RCS1211" Action="Error" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||
<Rule Id="SA1028" Action="Error" />
|
||||
<Rule Id="SA1107" Action="Error" />
|
||||
<Rule Id="SA1101" Action="None" />
|
||||
<Rule Id="SA1116" Action="Error" />
|
||||
<Rule Id="SA1117" Action="Error" />
|
||||
<Rule Id="SA1119" Action="Error" />
|
||||
<Rule Id="SA1122" Action="Error" />
|
||||
<Rule Id="SA1127" Action="Error" />
|
||||
<Rule Id="SA1134" Action="Error" />
|
||||
<Rule Id="SA1136" Action="Error" />
|
||||
<Rule Id="SA1137" Action="Error" />
|
||||
<Rule Id="SA1200" Action="None" />
|
||||
<Rule Id="SA1201" Action="Error" />
|
||||
<Rule Id="SA1202" Action="Error" />
|
||||
<Rule Id="SA1208" Action="Error" />
|
||||
<Rule Id="SA1306" Action="None" />
|
||||
<Rule Id="SA1309" Action="None" />
|
||||
<Rule Id="SA1311" Action="None" />
|
||||
<Rule Id="SA1400" Action="Error" />
|
||||
<Rule Id="SA1402" Action="Error" />
|
||||
<Rule Id="SA1405" Action="Error" />
|
||||
<Rule Id="SA1413" Action="None" />
|
||||
<Rule Id="SA1500" Action="Error" />
|
||||
<Rule Id="SA1503" Action="Error" />
|
||||
<Rule Id="SA1513" Action="Error" />
|
||||
<Rule Id="SA1600" Action="Error" />
|
||||
<Rule Id="SA1602" Action="Error" />
|
||||
<Rule Id="SA1614" Action="Error" />
|
||||
<Rule Id="SA1616" Action="Error" />
|
||||
<Rule Id="SA1622" Action="Error" />
|
||||
<Rule Id="SA1623" Action="Error" />
|
||||
<Rule Id="SA1626" Action="Error" />
|
||||
<Rule Id="SA1629" Action="Error" />
|
||||
<Rule Id="SA1633" Action="Error" />
|
||||
<Rule Id="SA1642" Action="Error" />
|
||||
<Rule Id="SA1649" Action="Error" />
|
||||
<Rule Id="SX1101" Action="Error" />
|
||||
<Rule Id="SX1309" Action="Error" />
|
||||
<Rule Id="SX1623" Action="None" />
|
||||
<Rule Id="SA1000" Action="Error" />
|
||||
<Rule Id="SA1001" Action="Error" />
|
||||
<Rule Id="SA1002" Action="Error" />
|
||||
<Rule Id="SA1003" Action="Error" />
|
||||
<Rule Id="SA1004" Action="Error" />
|
||||
<Rule Id="SA1005" Action="Error" />
|
||||
<Rule Id="SA1006" Action="Error" />
|
||||
<Rule Id="SA1007" Action="Error" />
|
||||
<Rule Id="SA1008" Action="Error" />
|
||||
<Rule Id="SA1009" Action="Error" />
|
||||
<Rule Id="SA1010" Action="Error" />
|
||||
<Rule Id="SA1011" Action="Error" />
|
||||
<Rule Id="SA1012" Action="Error" />
|
||||
<Rule Id="SA1013" Action="Error" />
|
||||
<Rule Id="SA1014" Action="Error" />
|
||||
<Rule Id="SA1015" Action="Error" />
|
||||
<Rule Id="SA1016" Action="Error" />
|
||||
<Rule Id="SA1017" Action="Error" />
|
||||
<Rule Id="SA1018" Action="Error" />
|
||||
<Rule Id="SA1019" Action="Error" />
|
||||
<Rule Id="SA1020" Action="Error" />
|
||||
<Rule Id="SA1021" Action="Error" />
|
||||
<Rule Id="SA1022" Action="Error" />
|
||||
<Rule Id="SA1023" Action="Error" />
|
||||
<Rule Id="SA1024" Action="Error" />
|
||||
<Rule Id="SA1025" Action="Error" />
|
||||
<Rule Id="SA1026" Action="Error" />
|
||||
<Rule Id="SA1027" Action="Error" />
|
||||
<Rule Id="SA1100" Action="Error" />
|
||||
<Rule Id="SA1102" Action="Error" />
|
||||
<Rule Id="SA1103" Action="Error" />
|
||||
<Rule Id="SA1104" Action="Error" />
|
||||
<Rule Id="SA1105" Action="Error" />
|
||||
<Rule Id="SA1106" Action="Error" />
|
||||
<Rule Id="SA1108" Action="Error" />
|
||||
<Rule Id="SA1110" Action="Error" />
|
||||
<Rule Id="SA1111" Action="Error" />
|
||||
<Rule Id="SA1112" Action="Error" />
|
||||
<Rule Id="SA1113" Action="Error" />
|
||||
<Rule Id="SA1114" Action="Error" />
|
||||
<Rule Id="SA1115" Action="Error" />
|
||||
<Rule Id="SA1118" Action="Error" />
|
||||
<Rule Id="SA1120" Action="Error" />
|
||||
<Rule Id="SA1121" Action="Error" />
|
||||
<Rule Id="SA1123" Action="Error" />
|
||||
<Rule Id="SA1124" Action="Error" />
|
||||
<Rule Id="SA1125" Action="Error" />
|
||||
<Rule Id="SA1128" Action="Error" />
|
||||
<Rule Id="SA1129" Action="Error" />
|
||||
<Rule Id="SA1130" Action="Error" />
|
||||
<Rule Id="SA1131" Action="Error" />
|
||||
<Rule Id="SA1132" Action="Error" />
|
||||
<Rule Id="SA1133" Action="Error" />
|
||||
<Rule Id="SA1135" Action="Error" />
|
||||
<Rule Id="SA1139" Action="Error" />
|
||||
<Rule Id="SA1203" Action="Error" />
|
||||
<Rule Id="SA1204" Action="Error" />
|
||||
<Rule Id="SA1205" Action="Error" />
|
||||
<Rule Id="SA1206" Action="Error" />
|
||||
<Rule Id="SA1207" Action="Error" />
|
||||
<Rule Id="SA1209" Action="Error" />
|
||||
<Rule Id="SA1210" Action="Error" />
|
||||
<Rule Id="SA1211" Action="Error" />
|
||||
<Rule Id="SA1212" Action="Error" />
|
||||
<Rule Id="SA1213" Action="Error" />
|
||||
<Rule Id="SA1214" Action="Error" />
|
||||
<Rule Id="SA1216" Action="Error" />
|
||||
<Rule Id="SA1217" Action="Error" />
|
||||
<Rule Id="SA1300" Action="Error" />
|
||||
<Rule Id="SA1302" Action="Error" />
|
||||
<Rule Id="SA1303" Action="Error" />
|
||||
<Rule Id="SA1304" Action="Error" />
|
||||
<Rule Id="SA1307" Action="Error" />
|
||||
<Rule Id="SA1308" Action="Error" />
|
||||
<Rule Id="SA1310" Action="Error" />
|
||||
<Rule Id="SA1312" Action="Error" />
|
||||
<Rule Id="SA1313" Action="Error" />
|
||||
<Rule Id="SA1314" Action="Error" />
|
||||
<Rule Id="SA1401" Action="Error" />
|
||||
<Rule Id="SA1403" Action="Error" />
|
||||
<Rule Id="SA1404" Action="Error" />
|
||||
<Rule Id="SA1406" Action="Error" />
|
||||
<Rule Id="SA1407" Action="Error" />
|
||||
<Rule Id="SA1408" Action="Error" />
|
||||
<Rule Id="SA1410" Action="Error" />
|
||||
<Rule Id="SA1411" Action="Error" />
|
||||
<Rule Id="SA1501" Action="Error" />
|
||||
<Rule Id="SA1502" Action="Error" />
|
||||
<Rule Id="SA1504" Action="Error" />
|
||||
<Rule Id="SA1505" Action="Error" />
|
||||
<Rule Id="SA1506" Action="Error" />
|
||||
<Rule Id="SA1507" Action="Error" />
|
||||
<Rule Id="SA1508" Action="Error" />
|
||||
<Rule Id="SA1509" Action="Error" />
|
||||
<Rule Id="SA1510" Action="Error" />
|
||||
<Rule Id="SA1511" Action="Error" />
|
||||
<Rule Id="SA1512" Action="Error" />
|
||||
<Rule Id="SA1514" Action="Error" />
|
||||
<Rule Id="SA1515" Action="Error" />
|
||||
<Rule Id="SA1516" Action="Error" />
|
||||
<Rule Id="SA1517" Action="Error" />
|
||||
<Rule Id="SA1518" Action="Error" />
|
||||
<Rule Id="SA1519" Action="Error" />
|
||||
<Rule Id="SA1520" Action="Error" />
|
||||
<Rule Id="SA1601" Action="Error" />
|
||||
<Rule Id="SA1604" Action="Error" />
|
||||
<Rule Id="SA1605" Action="Error" />
|
||||
<Rule Id="SA1606" Action="Error" />
|
||||
<Rule Id="SA1607" Action="Error" />
|
||||
<Rule Id="SA1608" Action="Error" />
|
||||
<Rule Id="SA1610" Action="Error" />
|
||||
<Rule Id="SA1611" Action="Error" />
|
||||
<Rule Id="SA1612" Action="Error" />
|
||||
<Rule Id="SA1613" Action="Error" />
|
||||
<Rule Id="SA1615" Action="Error" />
|
||||
<Rule Id="SA1617" Action="Error" />
|
||||
<Rule Id="SA1618" Action="Error" />
|
||||
<Rule Id="SA1619" Action="Error" />
|
||||
<Rule Id="SA1620" Action="Error" />
|
||||
<Rule Id="SA1621" Action="Error" />
|
||||
<Rule Id="SA1624" Action="Error" />
|
||||
<Rule Id="SA1625" Action="Error" />
|
||||
<Rule Id="SA1627" Action="Error" />
|
||||
<Rule Id="SA1634" Action="Error" />
|
||||
<Rule Id="SA1635" Action="Error" />
|
||||
<Rule Id="SA1636" Action="Error" />
|
||||
<Rule Id="SA1637" Action="None" />
|
||||
<Rule Id="SA1638" Action="None" />
|
||||
<Rule Id="SA1640" Action="Error" />
|
||||
<Rule Id="SA1641" Action="Error" />
|
||||
<Rule Id="SA1643" Action="Error" />
|
||||
<Rule Id="SA1651" Action="Error" />
|
||||
</Rules>
|
||||
</RuleSet>
|
|
@ -0,0 +1,284 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<RuleSet Name="Microsoft Managed Recommended Rules" Description="These rules focus on the most critical problems in your code, including potential security holes, application crashes, and other important logic and design errors. It is recommended to include this rule set in any custom rule set you create for your projects." ToolsVersion="15.0">
|
||||
<Localization ResourceAssembly="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.dll" ResourceBaseName="Microsoft.VisualStudio.CodeAnalysis.RuleSets.Strings.Localized">
|
||||
<Name Resource="MinimumRecommendedRules_Name" />
|
||||
<Description Resource="MinimumRecommendedRules_Description" />
|
||||
</Localization>
|
||||
<Rules AnalyzerId="AsyncUsageAnalyzers" RuleNamespace="AsyncUsageAnalyzers">
|
||||
<Rule Id="AvoidAsyncVoid" Action="Info" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Microsoft.Analyzers.ManagedCodeAnalysis" RuleNamespace="Microsoft.Rules.Managed">
|
||||
<Rule Id="CA1000" Action="None" />
|
||||
<Rule Id="CA1030" Action="None" />
|
||||
<Rule Id="CA1033" Action="None" />
|
||||
<Rule Id="CA1001" Action="Error" />
|
||||
<Rule Id="CA1009" Action="Error" />
|
||||
<Rule Id="CA1016" Action="Error" />
|
||||
<Rule Id="CA1049" Action="Error" />
|
||||
<Rule Id="CA1060" Action="Error" />
|
||||
<Rule Id="CA1061" Action="Error" />
|
||||
<Rule Id="CA1063" Action="Error" />
|
||||
<Rule Id="CA1065" Action="Error" />
|
||||
<Rule Id="CA1301" Action="Error" />
|
||||
<Rule Id="CA1305" Action="None" />
|
||||
<Rule Id="CA1307" Action="None" />
|
||||
<Rule Id="CA1308" Action="None" />
|
||||
<Rule Id="CA1400" Action="Error" />
|
||||
<Rule Id="CA1401" Action="Error" />
|
||||
<Rule Id="CA1403" Action="Error" />
|
||||
<Rule Id="CA1404" Action="Error" />
|
||||
<Rule Id="CA1405" Action="Error" />
|
||||
<Rule Id="CA1410" Action="Error" />
|
||||
<Rule Id="CA1415" Action="Error" />
|
||||
<Rule Id="CA1507" Action="Error" />
|
||||
<Rule Id="CA1707" Action="None" />
|
||||
<Rule Id="CA1821" Action="Error" />
|
||||
<Rule Id="CA1822" Action="None" />
|
||||
<Rule Id="CA1900" Action="Error" />
|
||||
<Rule Id="CA1901" Action="Error" />
|
||||
<Rule Id="CA2002" Action="Error" />
|
||||
<Rule Id="CA2100" Action="Error" />
|
||||
<Rule Id="CA2101" Action="Error" />
|
||||
<Rule Id="CA2108" Action="Error" />
|
||||
<Rule Id="CA2111" Action="Error" />
|
||||
<Rule Id="CA2112" Action="Error" />
|
||||
<Rule Id="CA2114" Action="Error" />
|
||||
<Rule Id="CA2116" Action="Error" />
|
||||
<Rule Id="CA2117" Action="Error" />
|
||||
<Rule Id="CA2122" Action="Error" />
|
||||
<Rule Id="CA2123" Action="Error" />
|
||||
<Rule Id="CA2124" Action="Error" />
|
||||
<Rule Id="CA2126" Action="Error" />
|
||||
<Rule Id="CA2131" Action="Error" />
|
||||
<Rule Id="CA2132" Action="Error" />
|
||||
<Rule Id="CA2133" Action="Error" />
|
||||
<Rule Id="CA2134" Action="Error" />
|
||||
<Rule Id="CA2137" Action="Error" />
|
||||
<Rule Id="CA2138" Action="Error" />
|
||||
<Rule Id="CA2140" Action="Error" />
|
||||
<Rule Id="CA2141" Action="Error" />
|
||||
<Rule Id="CA2146" Action="Error" />
|
||||
<Rule Id="CA2147" Action="Error" />
|
||||
<Rule Id="CA2149" Action="Error" />
|
||||
<Rule Id="CA2200" Action="Error" />
|
||||
<Rule Id="CA2202" Action="Error" />
|
||||
<Rule Id="CA2207" Action="Error" />
|
||||
<Rule Id="CA2212" Action="Error" />
|
||||
<Rule Id="CA2213" Action="Error" />
|
||||
<Rule Id="CA2214" Action="Error" />
|
||||
<Rule Id="CA2216" Action="Error" />
|
||||
<Rule Id="CA2220" Action="Error" />
|
||||
<Rule Id="CA2229" Action="Error" />
|
||||
<Rule Id="CA2231" Action="Error" />
|
||||
<Rule Id="CA2232" Action="Error" />
|
||||
<Rule Id="CA2235" Action="Error" />
|
||||
<Rule Id="CA2236" Action="Error" />
|
||||
<Rule Id="CA2237" Action="Error" />
|
||||
<Rule Id="CA2238" Action="Error" />
|
||||
<Rule Id="CA2240" Action="Error" />
|
||||
<Rule Id="CA2241" Action="Error" />
|
||||
<Rule Id="CA2242" Action="Error" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Microsoft.CodeQuality.Analyzers" RuleNamespace="Microsoft.CodeQuality.Analyzers">
|
||||
<Rule Id="CA1036" Action="None" />
|
||||
<Rule Id="CA1056" Action="Info" />
|
||||
<Rule Id="CA1710" Action="Info" />
|
||||
<Rule Id="CA1724" Action="None" />
|
||||
<Rule Id="CA1810" Action="None" />
|
||||
<Rule Id="CA2007" Action="None" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="Roslynator.CSharp.Analyzers" RuleNamespace="Roslynator.CSharp.Analyzers">
|
||||
<Rule Id="RCS1001" Action="Error" />
|
||||
<Rule Id="RCS1055" Action="Error" />
|
||||
<Rule Id="RCS1062" Action="Error" />
|
||||
<Rule Id="RCS1066" Action="Error" />
|
||||
<Rule Id="RCS1069" Action="Error" />
|
||||
<Rule Id="RCS1071" Action="Error" />
|
||||
<Rule Id="RCS1074" Action="Error" />
|
||||
<Rule Id="RCS1090" Action="Error" />
|
||||
<Rule Id="RCS1018" Action="Error" />
|
||||
<Rule Id="RCS1507" Action="Error" />
|
||||
<Rule Id="RCS1037" Action="Error" />
|
||||
<Rule Id="RCS1138" Action="Error" />
|
||||
<Rule Id="RCS1139" Action="Error" />
|
||||
<Rule Id="RCS1163" Action="Info" />
|
||||
<Rule Id="RCS1168" Action="Info" />
|
||||
<Rule Id="RCS1188" Action="Error" />
|
||||
<Rule Id="RCS1201" Action="Error" />
|
||||
<Rule Id="RCS1207" Action="Error" />
|
||||
<Rule Id="RCS1211" Action="Error" />
|
||||
</Rules>
|
||||
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
|
||||
<Rule Id="SA1028" Action="Error" />
|
||||
<Rule Id="SA1107" Action="Error" />
|
||||
<Rule Id="SA1101" Action="None" />
|
||||
<Rule Id="SA1116" Action="Error" />
|
||||
<Rule Id="SA1117" Action="Error" />
|
||||
<Rule Id="SA1119" Action="Error" />
|
||||
<Rule Id="SA1122" Action="Error" />
|
||||
<Rule Id="SA1127" Action="Error" />
|
||||
<Rule Id="SA1134" Action="Error" />
|
||||
<Rule Id="SA1136" Action="Error" />
|
||||
<Rule Id="SA1137" Action="Error" />
|
||||
<Rule Id="SA1200" Action="None" />
|
||||
<Rule Id="SA1201" Action="Error" />
|
||||
<Rule Id="SA1202" Action="Error" />
|
||||
<Rule Id="SA1208" Action="Error" />
|
||||
<Rule Id="SA1306" Action="None" />
|
||||
<Rule Id="SA1309" Action="None" />
|
||||
<Rule Id="SA1311" Action="None" />
|
||||
<Rule Id="SA1400" Action="Error" />
|
||||
<Rule Id="SA1402" Action="Error" />
|
||||
<Rule Id="SA1405" Action="Error" />
|
||||
<Rule Id="SA1413" Action="None" />
|
||||
<Rule Id="SA1500" Action="Error" />
|
||||
<Rule Id="SA1503" Action="Error" />
|
||||
<Rule Id="SA1513" Action="Error" />
|
||||
<Rule Id="SA1602" Action="Error" />
|
||||
<Rule Id="SA1614" Action="Error" />
|
||||
<Rule Id="SA1616" Action="Error" />
|
||||
<Rule Id="SA1622" Action="Error" />
|
||||
<Rule Id="SA1623" Action="Error" />
|
||||
<Rule Id="SA1626" Action="Error" />
|
||||
<Rule Id="SA1629" Action="Error" />
|
||||
<Rule Id="SA1633" Action="None" />
|
||||
<Rule Id="SA1642" Action="Error" />
|
||||
<Rule Id="SA1649" Action="Error" />
|
||||
<Rule Id="SX1101" Action="Error" />
|
||||
<Rule Id="SX1309" Action="Error" />
|
||||
<Rule Id="SX1623" Action="None" />
|
||||
<Rule Id="SA1000" Action="Error" />
|
||||
<Rule Id="SA1001" Action="Error" />
|
||||
<Rule Id="SA1002" Action="Error" />
|
||||
<Rule Id="SA1003" Action="Error" />
|
||||
<Rule Id="SA1004" Action="Error" />
|
||||
<Rule Id="SA1005" Action="Error" />
|
||||
<Rule Id="SA1006" Action="Error" />
|
||||
<Rule Id="SA1007" Action="Error" />
|
||||
<Rule Id="SA1008" Action="Error" />
|
||||
<Rule Id="SA1009" Action="Error" />
|
||||
<Rule Id="SA1010" Action="Error" />
|
||||
<Rule Id="SA1011" Action="Error" />
|
||||
<Rule Id="SA1012" Action="Error" />
|
||||
<Rule Id="SA1013" Action="Error" />
|
||||
<Rule Id="SA1014" Action="Error" />
|
||||
<Rule Id="SA1015" Action="Error" />
|
||||
<Rule Id="SA1016" Action="Error" />
|
||||
<Rule Id="SA1017" Action="Error" />
|
||||
<Rule Id="SA1018" Action="Error" />
|
||||
<Rule Id="SA1019" Action="Error" />
|
||||
<Rule Id="SA1020" Action="Error" />
|
||||
<Rule Id="SA1021" Action="Error" />
|
||||
<Rule Id="SA1022" Action="Error" />
|
||||
<Rule Id="SA1023" Action="Error" />
|
||||
<Rule Id="SA1024" Action="Error" />
|
||||
<Rule Id="SA1025" Action="Error" />
|
||||
<Rule Id="SA1026" Action="Error" />
|
||||
<Rule Id="SA1027" Action="Error" />
|
||||
<Rule Id="SA1100" Action="Error" />
|
||||
<Rule Id="SA1102" Action="Error" />
|
||||
<Rule Id="SA1103" Action="Error" />
|
||||
<Rule Id="SA1104" Action="Error" />
|
||||
<Rule Id="SA1105" Action="Error" />
|
||||
<Rule Id="SA1106" Action="Error" />
|
||||
<Rule Id="SA1108" Action="Error" />
|
||||
<Rule Id="SA1110" Action="Error" />
|
||||
<Rule Id="SA1111" Action="Error" />
|
||||
<Rule Id="SA1112" Action="Error" />
|
||||
<Rule Id="SA1113" Action="Error" />
|
||||
<Rule Id="SA1114" Action="Error" />
|
||||
<Rule Id="SA1115" Action="Error" />
|
||||
<Rule Id="SA1118" Action="Error" />
|
||||
<Rule Id="SA1120" Action="Error" />
|
||||
<Rule Id="SA1121" Action="Error" />
|
||||
<Rule Id="SA1123" Action="Error" />
|
||||
<Rule Id="SA1124" Action="Error" />
|
||||
<Rule Id="SA1125" Action="Error" />
|
||||
<Rule Id="SA1128" Action="Error" />
|
||||
<Rule Id="SA1129" Action="Error" />
|
||||
<Rule Id="SA1130" Action="Error" />
|
||||
<Rule Id="SA1131" Action="Error" />
|
||||
<Rule Id="SA1132" Action="Error" />
|
||||
<Rule Id="SA1133" Action="Error" />
|
||||
<Rule Id="SA1135" Action="Error" />
|
||||
<Rule Id="SA1139" Action="Error" />
|
||||
<Rule Id="SA1203" Action="Error" />
|
||||
<Rule Id="SA1204" Action="Error" />
|
||||
<Rule Id="SA1205" Action="Error" />
|
||||
<Rule Id="SA1206" Action="Error" />
|
||||
<Rule Id="SA1207" Action="Error" />
|
||||
<Rule Id="SA1209" Action="Error" />
|
||||
<Rule Id="SA1210" Action="Error" />
|
||||
<Rule Id="SA1211" Action="Error" />
|
||||
<Rule Id="SA1212" Action="Error" />
|
||||
<Rule Id="SA1213" Action="Error" />
|
||||
<Rule Id="SA1214" Action="Error" />
|
||||
<Rule Id="SA1216" Action="Error" />
|
||||
<Rule Id="SA1217" Action="Error" />
|
||||
<Rule Id="SA1300" Action="Error" />
|
||||
<Rule Id="SA1302" Action="Error" />
|
||||
<Rule Id="SA1303" Action="Error" />
|
||||
<Rule Id="SA1304" Action="Error" />
|
||||
<Rule Id="SA1307" Action="Error" />
|
||||
<Rule Id="SA1308" Action="Error" />
|
||||
<Rule Id="SA1310" Action="Error" />
|
||||
<Rule Id="SA1312" Action="Error" />
|
||||
<Rule Id="SA1313" Action="Error" />
|
||||
<Rule Id="SA1314" Action="Error" />
|
||||
<Rule Id="SA1401" Action="Error" />
|
||||
<Rule Id="SA1403" Action="Error" />
|
||||
<Rule Id="SA1404" Action="Error" />
|
||||
<Rule Id="SA1406" Action="Error" />
|
||||
<Rule Id="SA1407" Action="Error" />
|
||||
<Rule Id="SA1408" Action="Error" />
|
||||
<Rule Id="SA1410" Action="Error" />
|
||||
<Rule Id="SA1411" Action="Error" />
|
||||
<Rule Id="SA1501" Action="Error" />
|
||||
<Rule Id="SA1502" Action="Error" />
|
||||
<Rule Id="SA1504" Action="Error" />
|
||||
<Rule Id="SA1505" Action="Error" />
|
||||
<Rule Id="SA1506" Action="Error" />
|
||||
<Rule Id="SA1507" Action="Error" />
|
||||
<Rule Id="SA1508" Action="Error" />
|
||||
<Rule Id="SA1509" Action="Error" />
|
||||
<Rule Id="SA1510" Action="Error" />
|
||||
<Rule Id="SA1511" Action="Error" />
|
||||
<Rule Id="SA1512" Action="Error" />
|
||||
<Rule Id="SA1514" Action="Error" />
|
||||
<Rule Id="SA1515" Action="Error" />
|
||||
<Rule Id="SA1516" Action="Error" />
|
||||
<Rule Id="SA1517" Action="Error" />
|
||||
<Rule Id="SA1518" Action="Error" />
|
||||
<Rule Id="SA1519" Action="Error" />
|
||||
<Rule Id="SA1520" Action="Error" />
|
||||
<Rule Id="SA1600" Action="None" />
|
||||
<Rule Id="SA1601" Action="Error" />
|
||||
<Rule Id="SA1604" Action="Error" />
|
||||
<Rule Id="SA1605" Action="Error" />
|
||||
<Rule Id="SA1606" Action="Error" />
|
||||
<Rule Id="SA1607" Action="Error" />
|
||||
<Rule Id="SA1608" Action="Error" />
|
||||
<Rule Id="SA1610" Action="Error" />
|
||||
<Rule Id="SA1611" Action="Error" />
|
||||
<Rule Id="SA1612" Action="Error" />
|
||||
<Rule Id="SA1613" Action="Error" />
|
||||
<Rule Id="SA1615" Action="Error" />
|
||||
<Rule Id="SA1617" Action="Error" />
|
||||
<Rule Id="SA1618" Action="Error" />
|
||||
<Rule Id="SA1619" Action="Error" />
|
||||
<Rule Id="SA1620" Action="Error" />
|
||||
<Rule Id="SA1621" Action="Error" />
|
||||
<Rule Id="SA1624" Action="Error" />
|
||||
<Rule Id="SA1625" Action="Error" />
|
||||
<Rule Id="SA1627" Action="Error" />
|
||||
<Rule Id="SA1634" Action="Error" />
|
||||
<Rule Id="SA1635" Action="Error" />
|
||||
<Rule Id="SA1636" Action="Error" />
|
||||
<Rule Id="SA1637" Action="None" />
|
||||
<Rule Id="SA1638" Action="None" />
|
||||
<Rule Id="SA1640" Action="Error" />
|
||||
<Rule Id="SA1641" Action="Error" />
|
||||
<Rule Id="SA1643" Action="Error" />
|
||||
<Rule Id="SA1651" Action="Error" />
|
||||
</Rules>
|
||||
</RuleSet>
|
|
@ -0,0 +1,5 @@
|
|||
{
|
||||
"msbuild-sdks": {
|
||||
"MSBuild.Sdk.Extras": "1.6.68"
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
{
|
||||
"$schema": "https://raw.githubusercontent.com/DotNetAnalyzers/StyleCopAnalyzers/master/StyleCop.Analyzers/StyleCop.Analyzers/Settings/stylecop.schema.json",
|
||||
"settings": {
|
||||
"indentation": {
|
||||
"useTabs": false,
|
||||
"indentationSize": 4
|
||||
},
|
||||
"documentationRules": {
|
||||
"documentExposedElements": true,
|
||||
"documentInternalElements": false,
|
||||
"documentPrivateElements": false,
|
||||
"documentInterfaces": true,
|
||||
"documentPrivateFields": false,
|
||||
"documentationCulture": "en-US",
|
||||
"companyName": ".NET Foundation and Contributors",
|
||||
"copyrightText": "Copyright (c) 2019 {companyName}. All rights reserved.\nLicensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the {licenseName} license.\nSee the {licenseFile} file in the project root for full license information.",
|
||||
"variables": {
|
||||
"licenseName": "MIT",
|
||||
"licenseFile": "LICENSE"
|
||||
},
|
||||
"xmlHeader": false
|
||||
},
|
||||
"layoutRules": {
|
||||
"newlineAtEndOfFile": "allow",
|
||||
"allowConsecutiveUsings": true
|
||||
},
|
||||
"maintainabilityRules": {
|
||||
"topLevelTypes": [
|
||||
"class",
|
||||
"interface",
|
||||
"struct",
|
||||
"enum",
|
||||
"delegate"
|
||||
]
|
||||
},
|
||||
"orderingRules": {
|
||||
"usingDirectivesPlacement": "outsideNamespace",
|
||||
"systemUsingDirectivesFirst": true
|
||||
},
|
||||
}
|
||||
}
|
|
@ -0,0 +1,17 @@
|
|||
{
|
||||
"version": "1.0",
|
||||
"publicReleaseRefSpec": [
|
||||
"^refs/heads/master$", // we release out of master
|
||||
"^refs/heads/develop$", // we release out of develop
|
||||
"^refs/heads/rel/\\d+\\.\\d+\\.\\d+" // we also release branches starting with rel/N.N.N
|
||||
],
|
||||
"nugetPackageVersion":{
|
||||
"semVer": 2
|
||||
},
|
||||
"cloudBuild": {
|
||||
"setVersionVariables": true,
|
||||
"buildNumber": {
|
||||
"enabled": false
|
||||
}
|
||||
}
|
||||
}
|
Загрузка…
Ссылка в новой задаче