From 9088c5212e765f90117dc1f4535514ac3fe8a51c Mon Sep 17 00:00:00 2001 From: kammce <4549768+kammce@users.noreply.github.com> Date: Fri, 26 Apr 2024 20:58:22 +0000 Subject: [PATCH] [create-pull-request] automated change --- .github/workflows/update_name.yml | 57 ------------------- CMakeLists.txt | 4 +- README.md | 24 ++++---- conan/profiles/{__platform__ => linux} | 0 conan/profiles/profile1 | 2 +- conan/profiles/profile2 | 2 +- conanfile.py | 18 +++--- demos/CMakeLists.txt | 4 +- demos/applications/blinker.cpp | 4 +- demos/conanfile.py | 2 +- demos/main.cpp | 4 +- .../output_pin.hpp | 4 +- .../profile1.ld | 0 .../profile2.ld | 0 src/output_pin.cpp | 6 +- test_package/CMakeLists.txt | 4 +- tests/main.test.cpp | 8 +-- tests/output_pin.test.cpp | 6 +- 18 files changed, 46 insertions(+), 103 deletions(-) delete mode 100644 .github/workflows/update_name.yml rename conan/profiles/{__platform__ => linux} (100%) rename include/{libhal-__platform__ => libhal-linux}/output_pin.hpp (92%) rename linker_scripts/{libhal-__platform__ => libhal-linux}/profile1.ld (100%) rename linker_scripts/{libhal-__platform__ => libhal-linux}/profile2.ld (100%) diff --git a/.github/workflows/update_name.yml b/.github/workflows/update_name.yml deleted file mode 100644 index 533c823..0000000 --- a/.github/workflows/update_name.yml +++ /dev/null @@ -1,57 +0,0 @@ -# Copyright 2024 Khalil Estell -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. - -name: 🖋️ Update package name - -on: - workflow_dispatch: - push: - branches: - - main - -jobs: - update_name: - name: 🖋️ Update package name - runs-on: ubuntu-latest - if: github.repository != 'libhal/libhal-__platform__' - steps: - - uses: actions/checkout@v2 - with: - submodules: true - - - run: sudo apt install rename - - - name: Get target name from repo name - id: target_name - run: echo ${{ github.event.repository.name }} | sed -En "s/libhal-(.*)/target_name=\1/p" >> $GITHUB_ENV - - - name: Replace placeholder's in files - run: find . -type f -not -path '*/\.git/*' -exec sed -i "s/__platform__/${{ env.target_name }}/g" {} + - - - name: Replace "// NOLINT" in files - run: find . -type f -not -path '*/\.git/*' -exec sed -i "s/[ ]*\/\/ NOLINT//g" {} + - - - name: Replace placeholder's in directory names - run: find . -type d -not -path '*/\.git/*' | xargs -r rename "s/__platform__/${{ env.target_name }}/g" - - - name: Replace placeholder's in file names - run: find . -type f -not -path '*/\.git/*' | xargs -r rename "s/__platform__/${{ env.target_name }}/g" - - - name: Remove update_name.yml file - run: rm .github/workflows/update_name.yml - - - name: Create Pull Request - uses: peter-evans/create-pull-request@v6 - with: - title: "Rename target package to libhal-${{ env.target_name }}" diff --git a/CMakeLists.txt b/CMakeLists.txt index d17aa2c..53c4581 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -14,10 +14,10 @@ cmake_minimum_required(VERSION 3.15) -project(libhal-__platform__ LANGUAGES CXX) +project(libhal-linux LANGUAGES CXX) libhal_test_and_make_library( - LIBRARY_NAME libhal-__platform__ + LIBRARY_NAME libhal-linux SOURCES src/output_pin.cpp diff --git a/README.md b/README.md index 3808698..001d0f1 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@ -# libhal-__platform__ +# libhal-linux -[![✅ Checks](https://github.com/libhal/libhal-__platform__/actions/workflows/ci.yml/badge.svg)](https://github.com/libhal/libhal-__platform__/actions/workflows/ci.yml) -[![Coverage](https://libhal.github.io/libhal-__platform__/coverage/coverage.svg)](https://libhal.github.io/libhal-__platform__/coverage/) -[![GitHub stars](https://img.shields.io/github/stars/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/stargazers) -[![GitHub forks](https://img.shields.io/github/forks/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/network) -[![GitHub issues](https://img.shields.io/github/issues/libhal/libhal-__platform__.svg)](https://github.com/libhal/libhal-__platform__/issues) +[![✅ Checks](https://github.com/libhal/libhal-linux/actions/workflows/ci.yml/badge.svg)](https://github.com/libhal/libhal-linux/actions/workflows/ci.yml) +[![Coverage](https://libhal.github.io/libhal-linux/coverage/coverage.svg)](https://libhal.github.io/libhal-linux/coverage/) +[![GitHub stars](https://img.shields.io/github/stars/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/stargazers) +[![GitHub forks](https://img.shields.io/github/forks/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/network) +[![GitHub issues](https://img.shields.io/github/issues/libhal/libhal-linux.svg)](https://github.com/libhal/libhal-linux/issues) -Platform library for __platform__ series of devices. +Platform library for linux series of devices. ## Contributing @@ -39,7 +39,7 @@ To make your own libhal library: ## About the libhal-platform template -The `libhal-__platform__` repository is a template for creating platform +The `libhal-linux` repository is a template for creating platform libraries in the libhal ecosystem. It provides a structured layout and a set of files to help you get started with creating your own platform library. ## .github/workflows @@ -98,7 +98,7 @@ there are `stm32f100`, `stm32f101`, `stm32f102`, `stm32f103`, `stm32f105`, and Keep `default_options` as it is. -## linker_scripts/libhal-__platform__ +## linker_scripts/libhal-linux This directory contains linker scripts for different configurations of the platform. Each linker script specifies how the linker should arrange the @@ -149,7 +149,7 @@ platform library. It includes: platform library. - `main.cpp`: The main entry point for the demo applications. -## include/libhal-__platform__ +## include/libhal-linux This directory contains the header files for the platform library. It currently includes `output_pin.hpp`, which is a placeholder for the main header file of @@ -171,8 +171,8 @@ Conan recipe is working correctly. This directory contains tests for the platform library. It includes: -- `__platform__.test.cpp`: A placeholder for tests for the platform library. +- `linux.test.cpp`: A placeholder for tests for the platform library. - `main.test.cpp`: The main entry point for the tests. -Remember to replace all instances of `__platform__` with the actual name of the +Remember to replace all instances of `linux` with the actual name of the platform that your library is being built for. diff --git a/conan/profiles/__platform__ b/conan/profiles/linux similarity index 100% rename from conan/profiles/__platform__ rename to conan/profiles/linux diff --git a/conan/profiles/profile1 b/conan/profiles/profile1 index 2a47290..0aaeaa3 100644 --- a/conan/profiles/profile1 +++ b/conan/profiles/profile1 @@ -1,3 +1,3 @@ {% set arch = "cortex-m3" %} {% set platform = "profile1" %} -{% include "__platform__" %} +{% include "linux" %} diff --git a/conan/profiles/profile2 b/conan/profiles/profile2 index 64ddf4f..54cafba 100644 --- a/conan/profiles/profile2 +++ b/conan/profiles/profile2 @@ -1,3 +1,3 @@ {% set arch = "cortex-m4" %} {% set platform = "profile2" %} -{% include "__platform__" %} +{% include "linux" %} diff --git a/conanfile.py b/conanfile.py index 4e1d57d..b3cd61b 100644 --- a/conanfile.py +++ b/conanfile.py @@ -21,13 +21,13 @@ required_conan_version = ">=2.0.14" -class libhal___platform___conan(ConanFile): - name = "libhal-__platform__" +class libhal_linux_conan(ConanFile): + name = "libhal-linux" license = "Apache-2.0" - homepage = "https://libhal.github.io/libhal-__platform__" - description = ("A collection of drivers and libraries for the __platform__ " + homepage = "https://libhal.github.io/libhal-linux" + description = ("A collection of drivers and libraries for the linux " "series microcontrollers.") - topics = ("microcontroller", "__platform__",) + topics = ("microcontroller", "linux",) settings = "compiler", "build_type", "os", "arch" python_requires = "libhal-bootstrap/[^1.0.0]" @@ -54,7 +54,7 @@ def add_linker_scripts_to_link_flags(self): platform = str(self.options.platform) self.cpp_info.exelinkflags = [ "-L" + os.path.join(self.package_folder, "linker_scripts"), - "-T" + os.path.join("libhal-__platform__", platform + ".ld"), + "-T" + os.path.join("libhal-linux", platform + ".ld"), ] def requirements(self): @@ -62,8 +62,8 @@ def requirements(self): self.requires("libhal-armcortex/[^3.0.2]") def package_info(self): - self.cpp_info.set_property("cmake_target_name", "libhal::__platform__") - self.cpp_info.libs = ["libhal-__platform__"] + self.cpp_info.set_property("cmake_target_name", "libhal::linux") + self.cpp_info.libs = ["libhal-linux"] if self.settings.os == "baremetal" and self._use_linker_script: self.add_linker_scripts_to_link_flags() @@ -71,7 +71,7 @@ def package_info(self): self.buildenv_info.define("LIBHAL_PLATFORM", str(self.options.platform)) self.buildenv_info.define("LIBHAL_PLATFORM_LIBRARY", - "__platform__") + "linux") def package_id(self): if self.info.options.get_safe("platform"): diff --git a/demos/CMakeLists.txt b/demos/CMakeLists.txt index 20bbaa9..c58bf5f 100644 --- a/demos/CMakeLists.txt +++ b/demos/CMakeLists.txt @@ -22,8 +22,8 @@ libhal_build_demos( blinker PACKAGES - libhal-__platform__ + libhal-linux LINK_LIBRARIES - libhal::__platform__ + libhal::linux ) diff --git a/demos/applications/blinker.cpp b/demos/applications/blinker.cpp index 6cda759..75e909d 100644 --- a/demos/applications/blinker.cpp +++ b/demos/applications/blinker.cpp @@ -12,7 +12,7 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include #include @@ -21,7 +21,7 @@ void application() using namespace hal::literals; // TODO(libhal-target): Set the correct frequency and output pin driver hal::cortex_m::dwt_counter clock(1.0_MHz); - hal::__platform__::output_pin led; + hal::linux::output_pin led; while (true) { using namespace std::chrono_literals; diff --git a/demos/conanfile.py b/demos/conanfile.py index 7b8aac9..aa281b1 100644 --- a/demos/conanfile.py +++ b/demos/conanfile.py @@ -24,4 +24,4 @@ class demos(ConanFile): def requirements(self): bootstrap = self.python_requires["libhal-bootstrap"] bootstrap.module.add_demo_requirements(self, is_platform=True) - self.requires("libhal-__platform__/[^1.0.0 || latest]") + self.requires("libhal-linux/[^1.0.0 || latest]") diff --git a/demos/main.cpp b/demos/main.cpp index 2eb914f..b663979 100644 --- a/demos/main.cpp +++ b/demos/main.cpp @@ -13,7 +13,7 @@ // limitations under the License. // Replace with the correct processor includes -#include +#include #include #include #include @@ -29,7 +29,7 @@ extern void application(); using namespace hal::literals; // Replace this with something that makes sense... hal::cortex_m::dwt_counter clock(12.0_MHz); - hal::__platform__::output_pin led; + hal::linux::output_pin led; while (true) { led.level(false); diff --git a/include/libhal-__platform__/output_pin.hpp b/include/libhal-linux/output_pin.hpp similarity index 92% rename from include/libhal-__platform__/output_pin.hpp rename to include/libhal-linux/output_pin.hpp index 5c2756e..f6711a6 100644 --- a/include/libhal-__platform__/output_pin.hpp +++ b/include/libhal-linux/output_pin.hpp @@ -16,7 +16,7 @@ #include -namespace hal::__platform__ { // NOLINT +namespace hal::linux { class output_pin : public hal::output_pin { public: @@ -29,4 +29,4 @@ class output_pin : public hal::output_pin void driver_level(bool p_high) override; bool driver_level() override; }; -} // namespace hal::__platform__ +} // namespace hal::linux diff --git a/linker_scripts/libhal-__platform__/profile1.ld b/linker_scripts/libhal-linux/profile1.ld similarity index 100% rename from linker_scripts/libhal-__platform__/profile1.ld rename to linker_scripts/libhal-linux/profile1.ld diff --git a/linker_scripts/libhal-__platform__/profile2.ld b/linker_scripts/libhal-linux/profile2.ld similarity index 100% rename from linker_scripts/libhal-__platform__/profile2.ld rename to linker_scripts/libhal-linux/profile2.ld diff --git a/src/output_pin.cpp b/src/output_pin.cpp index 2d85792..475d6cf 100644 --- a/src/output_pin.cpp +++ b/src/output_pin.cpp @@ -12,9 +12,9 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include -namespace hal::__platform__ { // NOLINT +namespace hal::linux { void output_pin::driver_configure( [[maybe_unused]] const settings& p_settings) // Remove [[maybe_unused]] @@ -33,4 +33,4 @@ bool output_pin::driver_level() // Replace this with the correct implementation return true; } -} // namespace hal::__platform__ +} // namespace hal::linux diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index 23d9a83..002808e 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -14,8 +14,8 @@ cmake_minimum_required(VERSION 3.15) project(test_package LANGUAGES CXX) -find_package(libhal-__platform__ REQUIRED CONFIG) +find_package(libhal-linux REQUIRED CONFIG) add_executable(${PROJECT_NAME} main.cpp) target_include_directories(${PROJECT_NAME} PUBLIC .) target_compile_features(${PROJECT_NAME} PRIVATE cxx_std_20) -target_link_libraries(${PROJECT_NAME} PRIVATE libhal::__platform__) +target_link_libraries(${PROJECT_NAME} PRIVATE libhal::linux) diff --git a/tests/main.test.cpp b/tests/main.test.cpp index cb995b9..430b5a2 100644 --- a/tests/main.test.cpp +++ b/tests/main.test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -namespace hal::__platform__ { // NOLINT -extern void output_pin_test(); // NOLINT -} // namespace hal::__platform__ +namespace hal::linux { +extern void output_pin_test(); +} // namespace hal::linux int main() { - hal::__platform__::output_pin_test(); + hal::linux::output_pin_test(); } \ No newline at end of file diff --git a/tests/output_pin.test.cpp b/tests/output_pin.test.cpp index 62a18a7..fbc0c14 100644 --- a/tests/output_pin.test.cpp +++ b/tests/output_pin.test.cpp @@ -12,11 +12,11 @@ // See the License for the specific language governing permissions and // limitations under the License. -#include +#include #include -namespace hal::__platform__ { // NOLINT +namespace hal::linux { void output_pin_test() { using namespace boost::ut; @@ -28,4 +28,4 @@ void output_pin_test() // Verify }; }; -} // namespace hal::__platform__ +} // namespace hal::linux