Skip to content

Transition to multi-package repository #125

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 2 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
213 changes: 213 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,213 @@
# EditorConfig for Visual Studio 2022: https://learn.microsoft.com/en-us/visualstudio/ide/create-portable-custom-editor-options?view=vs-2022

# This is a top-most .editorconfig file
root = true

#=====================================================
#
# nanoFramework specific settings
#
#
#=====================================================
[*]
# Generic EditorConfig settings
end_of_line = crlf
charset = utf-8-bom

# Visual Studio spell checker
spelling_languages = en-us
spelling_checkable_types = strings,identifiers,comments
spelling_error_severity = information
spelling_exclusion_path = spelling_exclusion.dic

#=====================================================
#
# Settings copied from the .NET runtime
#
# https://github.com/dotnet/runtime
#
#=====================================================
# Default settings:
# A newline ending every file
# Use 4 spaces as indentation
insert_final_newline = true
indent_style = space
indent_size = 4
trim_trailing_whitespace = true

# Generated code
[*{_AssemblyInfo.cs,.notsupported.cs,AsmOffsets.cs}]
generated_code = true

# 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_case_contents_when_block = false
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# Modifier preferences
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion

# 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

# Types: use keywords instead of BCL types, and permit var only when the type is clear
csharp_style_var_for_built_in_types = false:suggestion
csharp_style_var_when_type_is_apparent = false:none
csharp_style_var_elsewhere = false:suggestion
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_rule.static_fields_should_have_prefix.severity = suggestion
dotnet_naming_rule.static_fields_should_have_prefix.symbols = static_fields
dotnet_naming_rule.static_fields_should_have_prefix.style = static_prefix_style
dotnet_naming_symbols.static_fields.applicable_kinds = field
dotnet_naming_symbols.static_fields.required_modifiers = static
dotnet_naming_symbols.static_fields.applicable_accessibilities = private, internal, private_protected
dotnet_naming_style.static_prefix_style.required_prefix = s_
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
csharp_using_directive_placement = outside_namespace:suggestion
dotnet_sort_system_directives_first = true
csharp_prefer_braces = true:silent
csharp_preserve_single_line_blocks = true:none
csharp_preserve_single_line_statements = false:none
csharp_prefer_static_local_function = true:suggestion
csharp_prefer_simple_using_statement = false:none
csharp_style_prefer_switch_expression = true:suggestion
dotnet_style_readonly_field = true:suggestion

# Expression-level preferences
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_prefer_collection_expression = when_types_exactly_match
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_auto_properties = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
csharp_prefer_simple_default_expression = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = true:silent
csharp_style_expression_bodied_constructors = true:silent
csharp_style_expression_bodied_operators = true:silent
csharp_style_expression_bodied_properties = true:silent
csharp_style_expression_bodied_indexers = true:silent
csharp_style_expression_bodied_accessors = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = true:silent

# 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

# Other features
csharp_style_prefer_index_operator = false:none
csharp_style_prefer_range_operator = false:none
csharp_style_pattern_local_over_anonymous_function = false:none

# 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

# License header
file_header_template = Licensed to the .NET Foundation under one or more agreements.\nThe .NET Foundation licenses this file to you under the MIT license.

# C++ Files
[*.{cpp,h,in}]
curly_bracket_next_line = true
indent_brace_style = Allman

# Xml project files
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,nativeproj,locproj}]
indent_size = 2

[*.{csproj,vbproj,proj,nativeproj,locproj}]
charset = utf-8

# 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

# YAML config files
[*.{yml,yaml}]
indent_size = 2

# Shell scripts
[*.sh]
end_of_line = lf
[*.{cmd,bat}]
end_of_line = crlf
2 changes: 1 addition & 1 deletion .github/.changelog-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
}
],
"sort": "ASC",
"template": "${{CHANGELOG}}\n\n**Full Changelog:** ${{RELEASE_DIFF}}\n\nThe following NuGet package is available from this release:\n\n:package: [nanoFramework.Devices.Can](https://www.nuget.org/packages/nanoFramework.Devices.Can/)",
"template": "${{CHANGELOG}}\n\n**Full Changelog:** ${{RELEASE_DIFF}}\n\nThe following NuGet packages are available from this release:\n\n:package: [nanoFramework.Devices.Can.Core](https://www.nuget.org/packages/nanoFramework.Devices.Can.Core/)\n:package: [nanoFramework.Device.Can.Stm32](https://www.nuget.org/packages/nanoFramework.Devices.Can.Stm32/)",
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🛠️ Refactor suggestion

Updated changelog template with multi-package information.
The revised template now details both NuGet packages—:package: [nanoFramework.Devices.Can.Core](...) and :package: [nanoFramework.Device.Can.Stm32](...)—which aligns with the multi-package repository strategy. However, please verify that the Core package’s name is consistent across the repository; the template uses "Devices" (plural) while other references use "Device" (singular).

"pr_template": "* ${{TITLE}} by @${{AUTHOR}} in #${{NUMBER}}",
"empty_template": "- no changes",
"max_tags_to_fetch": 200,
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/pr-checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@ jobs:
check_package_lock:
name: nanoFramework
uses: nanoframework/nf-tools/.github/workflows/check-package-lock.yml@main
with:
solution: 'nanoFramework.Device.Can.sln'
check_nuget_latest:
name: nanoFramework
uses: nanoframework/nf-tools/.github/workflows/check-packages-updated.yml@main
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/update-dependencies.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name: Daily update dependencies

on:
schedule:
# At 00:10 UTC.
# At 00:10 UTC.
- cron: '10 00 * * Wed,Fri'
repository_dispatch:
types: update-dependencies
Expand All @@ -18,4 +18,5 @@ jobs:
uses: nanoframework/nf-tools/.github/workflows/update-dependencies.yml@main
secrets: inherit
with:
solutionsToCheck: 'nanoFramework.Device.Can.sln'
solutionsToCheck: |
nanoFramework.Device.Can.sln
21 changes: 19 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,16 +1,33 @@
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.Devices.Can&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.Devices.Can) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.Devices.Can&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.Devices.Can) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Device.Can.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T)
[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.Devices.Can&metric=alert_status)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.Devices.Can) [![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=nanoframework_lib-nanoFramework.Devices.Can&metric=reliability_rating)](https://sonarcloud.io/dashboard?id=nanoframework_lib-nanoFramework.Devices.Can) [![License](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE) [![NuGet](https://img.shields.io/nuget/dt/nanoFramework.Device.Can.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can/) [![#yourfirstpr](https://img.shields.io/badge/first--timers--only-friendly-blue.svg)](https://github.com/nanoframework/Home/blob/main/CONTRIBUTING.md) [![Discord](https://img.shields.io/discord/478725473862549535.svg?logo=discord&logoColor=white&label=Discord&color=7289DA)](https://discord.gg/gCyBu8T)

![nanoFramework logo](https://raw.githubusercontent.com/nanoframework/Home/main/resources/logo/nanoFramework-repo-logo.png)

-----

### Welcome to the .NET **nanoFramework** CAN Class Library repository

These libraries are the successor of the `nanoFramework.Device.Can` class library that required a native component and was available for two STM32-based boards. The direct replacement of that library is `nanoFramework.Device.Can.Stm32`.

## Build status

| Component | Build Status | NuGet Package |
|:-|---|---|
| nanoFramework.Device.Can | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_apis/build/status/nanoFramework.Device.Can?repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_build/latest?definitionId=25&repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.Can.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can/) |
| nanoFramework.Device.Can.Core | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_apis/build/status/nanoFramework.Device.Can?repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_build/latest?definitionId=25&repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.Can.Core.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can.Core/) |
| nanoFramework.Device.Can.Esp32 | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_apis/build/status/nanoFramework.Device.Can?repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_build/latest?definitionId=25&repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.Can.Esp32.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can.Esp32/) |
| nanoFramework.Device.Can.Mcp2515 | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_apis/build/status/nanoFramework.Device.Can?repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_build/latest?definitionId=25&repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.Can.Mc2515.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can.Mcp2515/) |
| nanoFramework.Device.Can.Stm32 | [![Build Status](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_apis/build/status/nanoFramework.Device.Can?repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main)](https://dev.azure.com/nanoframework/nanoFramework.Device.Can/_build/latest?definitionId=25&repoName=nanoframework%2FnanoFramework.Device.Can&branchName=main) | [![NuGet](https://img.shields.io/nuget/v/nanoFramework.Device.Can.Stm32.svg?label=NuGet&style=flat&logo=nuget)](https://www.nuget.org/packages/nanoFramework.Device.Can.Stm32/) |

## The .NET **nanoFramework** CAN Class Libraries

To exchange CAN messages by a .NET **nanoFramework** application, at least one device dependent class library is required:

- `nanoFramework.Device.Can.Esp32` uses the CAN/TWAI implementation of an ESP32 microcontroller. This requires a matching firmware/target version for the microcontroller that provides the native part of the implementation. In general an external CAN transceiver is also required.
- `nanoFramework.Device.Can.Stm` uses the CAN implementation of a STM32 microcontroller. This requires a matching firmware/target version for the microcontroller that provides the native part of the implementation. In general an external CAN transceiver is also required.
- `nanoFramework.Device.Can.Mcp2515` uses an external CAN device based on the MCP2515 chip. It is a 100% .NET implementation that works with every microcontroller, and can be used in combination with the ESP32 or STM32 library. MCP2515 boards typically include a CAN transceiver.

All device dependent libraries are based on:

- `nanoFramework.Device.Can.Core` contains the common classes and interfaces. As the `nanoFramework.Device.Can` namespace implements the basic ISO 11898 CAN message transfer, this library can be used to implement higher-level protocols (e.g., CAN-TP or ISO-TP as used in ODB II) in device independent libraries.

## Feedback and documentation

Expand Down
5 changes: 5 additions & 0 deletions Stub-generation.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Stub generation

The libraries that require a native components generate a stub for the native part on each build. The stub is placed in, e.g., the `nanoFramework.Device.Can.Stm32\bin\Release\Stubs` directory.

The native component will probably require access to the common classes in `nanoFramework.Device.Can.Core`. As that library is pure .NET, no stub is required. To generate the stub, select the **GenerateStub** configuration (instead of *Debug* or *Release*) in the *nanoFramework.Device.Can.sln* solution and build the solution. The stub will be placed in the `nanoFramework.Device.Can.Core\bin'\GenerateStubs\Stubs` directory.
Loading
Loading