Add extracted tools: CitrineOS, OpenOCPP, ShapeShifter
- CitrineOS core extracted (CSMS OCPP 2.0.1) - OpenOCPP extracted (firmware OCPP 1.6J/2.0.1) - ShapeShifter library installed (pip install -e) - ShapeShifter specification extracted - EVerest extracted TODO updated with progress
This commit is contained in:
3
tools/EVerest-main/applications/dependency_manager/.gitignore
vendored
Normal file
3
tools/EVerest-main/applications/dependency_manager/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
build
|
||||
__pycache__
|
||||
*.egg-info
|
||||
@@ -0,0 +1,24 @@
|
||||
ev_setup_cmake_variables_python_wheel()
|
||||
|
||||
ev_add_pip_package(
|
||||
NAME edm
|
||||
SOURCE_DIRECTORY .
|
||||
)
|
||||
|
||||
ev_is_python_venv_active(
|
||||
RESULT_VAR IS_PYTHON_VENV_ACTIVE
|
||||
)
|
||||
|
||||
if(NOT ${IS_PYTHON_VENV_ACTIVE})
|
||||
message(WARNING "Python venv is not active. Please ensure that edm is available in your environment.")
|
||||
else()
|
||||
get_target_property(SOURCE_DIRECTORY ev_pip_package_edm SOURCE_DIRECTORY)
|
||||
message(STATUS "Installing edm from: ${SOURCE_DIRECTORY}")
|
||||
ev_pip_install_local(
|
||||
PACKAGE_NAME "edm"
|
||||
PACKAGE_SOURCE_DIRECTORY "${SOURCE_DIRECTORY}"
|
||||
)
|
||||
unset(EVEREST_DEPENDENCY_MANAGER CACHE)
|
||||
find_program(EVEREST_DEPENDENCY_MANAGER edm HINTS ${EV_ACTIVATE_PYTHON_VENV_PATH_TO_VENV}/bin REQUIRED)
|
||||
message(STATUS "Using edm from: ${EDM}")
|
||||
endif()
|
||||
201
tools/EVerest-main/applications/dependency_manager/LICENSE
Normal file
201
tools/EVerest-main/applications/dependency_manager/LICENSE
Normal file
@@ -0,0 +1,201 @@
|
||||
Apache License
|
||||
Version 2.0, January 2004
|
||||
http://www.apache.org/licenses/
|
||||
|
||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
||||
|
||||
1. Definitions.
|
||||
|
||||
"License" shall mean the terms and conditions for use, reproduction,
|
||||
and distribution as defined by Sections 1 through 9 of this document.
|
||||
|
||||
"Licensor" shall mean the copyright owner or entity authorized by
|
||||
the copyright owner that is granting the License.
|
||||
|
||||
"Legal Entity" shall mean the union of the acting entity and all
|
||||
other entities that control, are controlled by, or are under common
|
||||
control with that entity. For the purposes of this definition,
|
||||
"control" means (i) the power, direct or indirect, to cause the
|
||||
direction or management of such entity, whether by contract or
|
||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
||||
outstanding shares, or (iii) beneficial ownership of such entity.
|
||||
|
||||
"You" (or "Your") shall mean an individual or Legal Entity
|
||||
exercising permissions granted by this License.
|
||||
|
||||
"Source" form shall mean the preferred form for making modifications,
|
||||
including but not limited to software source code, documentation
|
||||
source, and configuration files.
|
||||
|
||||
"Object" form shall mean any form resulting from mechanical
|
||||
transformation or translation of a Source form, including but
|
||||
not limited to compiled object code, generated documentation,
|
||||
and conversions to other media types.
|
||||
|
||||
"Work" shall mean the work of authorship, whether in Source or
|
||||
Object form, made available under the License, as indicated by a
|
||||
copyright notice that is included in or attached to the work
|
||||
(an example is provided in the Appendix below).
|
||||
|
||||
"Derivative Works" shall mean any work, whether in Source or Object
|
||||
form, that is based on (or derived from) the Work and for which the
|
||||
editorial revisions, annotations, elaborations, or other modifications
|
||||
represent, as a whole, an original work of authorship. For the purposes
|
||||
of this License, Derivative Works shall not include works that remain
|
||||
separable from, or merely link (or bind by name) to the interfaces of,
|
||||
the Work and Derivative Works thereof.
|
||||
|
||||
"Contribution" shall mean any work of authorship, including
|
||||
the original version of the Work and any modifications or additions
|
||||
to that Work or Derivative Works thereof, that is intentionally
|
||||
submitted to Licensor for inclusion in the Work by the copyright owner
|
||||
or by an individual or Legal Entity authorized to submit on behalf of
|
||||
the copyright owner. For the purposes of this definition, "submitted"
|
||||
means any form of electronic, verbal, or written communication sent
|
||||
to the Licensor or its representatives, including but not limited to
|
||||
communication on electronic mailing lists, source code control systems,
|
||||
and issue tracking systems that are managed by, or on behalf of, the
|
||||
Licensor for the purpose of discussing and improving the Work, but
|
||||
excluding communication that is conspicuously marked or otherwise
|
||||
designated in writing by the copyright owner as "Not a Contribution."
|
||||
|
||||
"Contributor" shall mean Licensor and any individual or Legal Entity
|
||||
on behalf of whom a Contribution has been received by Licensor and
|
||||
subsequently incorporated within the Work.
|
||||
|
||||
2. Grant of Copyright License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
copyright license to reproduce, prepare Derivative Works of,
|
||||
publicly display, publicly perform, sublicense, and distribute the
|
||||
Work and such Derivative Works in Source or Object form.
|
||||
|
||||
3. Grant of Patent License. Subject to the terms and conditions of
|
||||
this License, each Contributor hereby grants to You a perpetual,
|
||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
||||
(except as stated in this section) patent license to make, have made,
|
||||
use, offer to sell, sell, import, and otherwise transfer the Work,
|
||||
where such license applies only to those patent claims licensable
|
||||
by such Contributor that are necessarily infringed by their
|
||||
Contribution(s) alone or by combination of their Contribution(s)
|
||||
with the Work to which such Contribution(s) was submitted. If You
|
||||
institute patent litigation against any entity (including a
|
||||
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
||||
or a Contribution incorporated within the Work constitutes direct
|
||||
or contributory patent infringement, then any patent licenses
|
||||
granted to You under this License for that Work shall terminate
|
||||
as of the date such litigation is filed.
|
||||
|
||||
4. Redistribution. You may reproduce and distribute copies of the
|
||||
Work or Derivative Works thereof in any medium, with or without
|
||||
modifications, and in Source or Object form, provided that You
|
||||
meet the following conditions:
|
||||
|
||||
(a) You must give any other recipients of the Work or
|
||||
Derivative Works a copy of this License; and
|
||||
|
||||
(b) You must cause any modified files to carry prominent notices
|
||||
stating that You changed the files; and
|
||||
|
||||
(c) You must retain, in the Source form of any Derivative Works
|
||||
that You distribute, all copyright, patent, trademark, and
|
||||
attribution notices from the Source form of the Work,
|
||||
excluding those notices that do not pertain to any part of
|
||||
the Derivative Works; and
|
||||
|
||||
(d) If the Work includes a "NOTICE" text file as part of its
|
||||
distribution, then any Derivative Works that You distribute must
|
||||
include a readable copy of the attribution notices contained
|
||||
within such NOTICE file, excluding those notices that do not
|
||||
pertain to any part of the Derivative Works, in at least one
|
||||
of the following places: within a NOTICE text file distributed
|
||||
as part of the Derivative Works; within the Source form or
|
||||
documentation, if provided along with the Derivative Works; or,
|
||||
within a display generated by the Derivative Works, if and
|
||||
wherever such third-party notices normally appear. The contents
|
||||
of the NOTICE file are for informational purposes only and
|
||||
do not modify the License. You may add Your own attribution
|
||||
notices within Derivative Works that You distribute, alongside
|
||||
or as an addendum to the NOTICE text from the Work, provided
|
||||
that such additional attribution notices cannot be construed
|
||||
as modifying the License.
|
||||
|
||||
You may add Your own copyright statement to Your modifications and
|
||||
may provide additional or different license terms and conditions
|
||||
for use, reproduction, or distribution of Your modifications, or
|
||||
for any such Derivative Works as a whole, provided Your use,
|
||||
reproduction, and distribution of the Work otherwise complies with
|
||||
the conditions stated in this License.
|
||||
|
||||
5. Submission of Contributions. Unless You explicitly state otherwise,
|
||||
any Contribution intentionally submitted for inclusion in the Work
|
||||
by You to the Licensor shall be under the terms and conditions of
|
||||
this License, without any additional terms or conditions.
|
||||
Notwithstanding the above, nothing herein shall supersede or modify
|
||||
the terms of any separate license agreement you may have executed
|
||||
with Licensor regarding such Contributions.
|
||||
|
||||
6. Trademarks. This License does not grant permission to use the trade
|
||||
names, trademarks, service marks, or product names of the Licensor,
|
||||
except as required for reasonable and customary use in describing the
|
||||
origin of the Work and reproducing the content of the NOTICE file.
|
||||
|
||||
7. Disclaimer of Warranty. Unless required by applicable law or
|
||||
agreed to in writing, Licensor provides the Work (and each
|
||||
Contributor provides its Contributions) on an "AS IS" BASIS,
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
||||
implied, including, without limitation, any warranties or conditions
|
||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
||||
PARTICULAR PURPOSE. You are solely responsible for determining the
|
||||
appropriateness of using or redistributing the Work and assume any
|
||||
risks associated with Your exercise of permissions under this License.
|
||||
|
||||
8. Limitation of Liability. In no event and under no legal theory,
|
||||
whether in tort (including negligence), contract, or otherwise,
|
||||
unless required by applicable law (such as deliberate and grossly
|
||||
negligent acts) or agreed to in writing, shall any Contributor be
|
||||
liable to You for damages, including any direct, indirect, special,
|
||||
incidental, or consequential damages of any character arising as a
|
||||
result of this License or out of the use or inability to use the
|
||||
Work (including but not limited to damages for loss of goodwill,
|
||||
work stoppage, computer failure or malfunction, or any and all
|
||||
other commercial damages or losses), even if such Contributor
|
||||
has been advised of the possibility of such damages.
|
||||
|
||||
9. Accepting Warranty or Additional Liability. While redistributing
|
||||
the Work or Derivative Works thereof, You may choose to offer,
|
||||
and charge a fee for, acceptance of support, warranty, indemnity,
|
||||
or other liability obligations and/or rights consistent with this
|
||||
License. However, in accepting such obligations, You may act only
|
||||
on Your own behalf and on Your sole responsibility, not on behalf
|
||||
of any other Contributor, and only if You agree to indemnify,
|
||||
defend, and hold each Contributor harmless for any liability
|
||||
incurred by, or claims asserted against, such Contributor by reason
|
||||
of your accepting any such warranty or additional liability.
|
||||
|
||||
END OF TERMS AND CONDITIONS
|
||||
|
||||
APPENDIX: How to apply the Apache License to your work.
|
||||
|
||||
To apply the Apache License to your work, attach the following
|
||||
boilerplate notice, with the fields enclosed by brackets "[]"
|
||||
replaced with your own identifying information. (Don't include
|
||||
the brackets!) The text should be enclosed in the appropriate
|
||||
comment syntax for the file format. We also recommend that a
|
||||
file or class name and description of purpose be included on the
|
||||
same "printed page" as the copyright notice for easier
|
||||
identification within third-party archives.
|
||||
|
||||
Copyright [yyyy] [name of copyright owner]
|
||||
|
||||
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.
|
||||
232
tools/EVerest-main/applications/dependency_manager/README.md
Normal file
232
tools/EVerest-main/applications/dependency_manager/README.md
Normal file
@@ -0,0 +1,232 @@
|
||||
# Dependency Manager for EVerest
|
||||
|
||||
- [Dependency Manager for EVerest](#dependency-manager-for-everest)
|
||||
- [Install and Quick Start](#install-and-quick-start)
|
||||
- [Installing edm](#installing-edm)
|
||||
- [Enabling CPM_SOURCE_CACHE](#enabling-cpm_source_cache)
|
||||
- [Python packages needed to run edm](#python-packages-needed-to-run-edm)
|
||||
- [Setting up CMake integration](#setting-up-cmake-integration)
|
||||
- [Setting up a workspace](#setting-up-a-workspace)
|
||||
- [Updating a workspace](#updating-a-workspace)
|
||||
- [Using the EDM CMake module and dependencies.yaml](#using-the-edm-cmake-module-and-dependenciesyaml)
|
||||
- [Modifying dependencies](#modifying-dependencies)
|
||||
- [Create a workspace config from an existing directory tree](#create-a-workspace-config-from-an-existing-directory-tree)
|
||||
- [Git information at a glance](#git-information-at-a-glance)
|
||||
|
||||
## Install and Quick Start
|
||||
To install the **edm** dependency manager for EVerest you have to perform the following steps.
|
||||
|
||||
Please make sure you are running a sufficiently recent version of **Python3 (>=3.6)** and that you are able to install Python packages from source. Usually you just have to ensure that you have **pip**, **setuptools** and **wheel** available. Refer to [the Python *Installing Packages* documentation](https://packaging.python.org/tutorials/installing-packages/#requirements-for-installing-packages) for indepth guidance if any problems arise.
|
||||
|
||||
```bash
|
||||
python3 -m pip install --upgrade pip setuptools wheel
|
||||
```
|
||||
|
||||
### Installing edm
|
||||
Now you can clone *this repository* and install **edm**:
|
||||
|
||||
(make sure you have set up your [ssh key](https://www.atlassian.com/git/tutorials/git-ssh) in github first!)
|
||||
|
||||
```bash
|
||||
git clone git@github.com:EVerest/everest-dev-environment.git
|
||||
cd everest-dev-environment/dependency_manager
|
||||
python3 -m pip install .
|
||||
edm --config ../everest-complete.yaml --workspace ~/checkout/everest-workspace
|
||||
```
|
||||
|
||||
The last command registers the [**EDM** CMake module](#setting-up-cmake-integration) and creates a workspace in the *~/checkout/everest-workspace* directory from [a config that is shipped with this repository](../everest-complete.yaml).
|
||||
The workspace will have the following structure containing all current dependencies for EVerest:
|
||||
```bash
|
||||
everest-workspace/
|
||||
├── EVerest
|
||||
├── everest-deploy-devkit
|
||||
├── everest-dev-environment
|
||||
├── everest-framework
|
||||
├── everest-utils
|
||||
├── liblog
|
||||
├── libmodbus
|
||||
├── libocpp
|
||||
├── libsunspec
|
||||
├── libtimer
|
||||
├── open-plc-utils
|
||||
├── RISE-V2G
|
||||
└── workspace-config.yaml
|
||||
```
|
||||
The *workspace-config.yaml* contains a copy of the config that was used to create this workspace.
|
||||
|
||||
### Enabling CPM_SOURCE_CACHE
|
||||
The **edm** dependency manager uses [CPM](https://github.com/cpm-cmake/CPM.cmake) for its CMake integration.
|
||||
This means you *can* and **should** set the *CPM_SOURCE_CACHE* environment variable. This makes sure that dependencies that you do not manage in the workspace are not re-downloaded multiple times. For detailed information and other useful environment variables please refer to the [CPM Documentation](https://github.com/cpm-cmake/CPM.cmake/blob/master/README.md#CPM_SOURCE_CACHE).
|
||||
```bash
|
||||
export CPM_SOURCE_CACHE=$HOME/.cache/CPM
|
||||
```
|
||||
|
||||
### Python packages needed to run edm
|
||||
The following Python3 packages are needed to run the **edm** dependency manager.
|
||||
If you installed **edm** using the guide above they were already installed automatically.
|
||||
|
||||
- Python >= 3.6
|
||||
- Jinja2 >= 3.0
|
||||
- PyYAML >= 5.4
|
||||
|
||||
## Setting up and updating a workspace
|
||||
For letting **edm** do the work of setting up an initial EVerest workspace,
|
||||
do this:
|
||||
|
||||
```bash
|
||||
edm init --workspace ~/checkout/everest-workspace
|
||||
```
|
||||
If you are currently in the *everest-workspace* directory the following command has the same effect:
|
||||
|
||||
```bash
|
||||
edm init
|
||||
```
|
||||
|
||||
For using a dedicated release version, you can do this:
|
||||
|
||||
```bash
|
||||
edm init 2023.7.0
|
||||
```
|
||||
|
||||
In this example, version 2023.7.0 is pulled from the server. This will only work if
|
||||
you previous code is not in a "dirty" state.
|
||||
|
||||
## Using the EDM CMake module and dependencies.yaml
|
||||
To use **edm** from CMake you have to add the following line to the top-level *CMakeLists.txt* file in the respective source repository:
|
||||
```cmake
|
||||
find_package(EDM REQUIRED)
|
||||
```
|
||||
The **EDM** CMake module will be discovered automatically if you [registered the CMake module in the way it described in the *Setting up CMake integration* section of this readme](#setting-up-cmake-integration).
|
||||
|
||||
To define dependencies you can now add a **dependencies.yaml** file to your source repository. It should look like this:
|
||||
```yaml
|
||||
---
|
||||
liblog:
|
||||
git: git@github.com:EVerest/liblog.git
|
||||
git_tag: main
|
||||
options: ["BUILD_EXAMPLES OFF"]
|
||||
libtimer:
|
||||
git: git@github.com:EVerest/libtimer.git
|
||||
git_tag: main
|
||||
options: ["BUILD_EXAMPLES OFF"]
|
||||
|
||||
```
|
||||
|
||||
If you want to conditionally include some dependencies, eg. for testing, you can do this in the following way:
|
||||
```yaml
|
||||
catch2:
|
||||
git: https://github.com/catchorg/Catch2.git
|
||||
git_tag: v3.4.0
|
||||
cmake_condition: "BUILD_TESTING"
|
||||
|
||||
```
|
||||
Here *cmake_condition* can be any string that CMake can use in an if() block. Please be aware that any variables you use here must be defined before a call to *evc_setup_edm()* is made in your CMakeLists.txt
|
||||
|
||||
## Selective library consumption
|
||||
|
||||
If your project only needs specific everest-core libraries (e.g. `liblog`, `everest-util`, `everest-io`, `libocpp`) without building the full module framework, use the `EVEREST_LIBS_ONLY` and `EVEREST_INCLUDE_LIBS` CMake options.
|
||||
|
||||
In your project's `dependencies.yaml`:
|
||||
```yaml
|
||||
everest-core:
|
||||
git: https://github.com/EVerest/everest-core.git
|
||||
git_tag: 2026.02.0
|
||||
options:
|
||||
- "EVEREST_LIBS_ONLY ON"
|
||||
- "EVEREST_INCLUDE_LIBS log;util;io"
|
||||
```
|
||||
|
||||
Or directly via CMake:
|
||||
```bash
|
||||
cmake -S . -B build \
|
||||
-DEVEREST_LIBS_ONLY=ON \
|
||||
-DEVEREST_INCLUDE_LIBS="log;util;io"
|
||||
```
|
||||
|
||||
| Option | Default | Description |
|
||||
|---|---|---|
|
||||
| `EVEREST_LIBS_ONLY` | OFF | Skip modules, applications, config — only build libraries |
|
||||
| `EVEREST_INCLUDE_LIBS` | (empty) | Semicolon-separated allowlist; transitive deps auto-resolved |
|
||||
| `EVEREST_EXCLUDE_LIBS` | (empty) | Semicolon-separated blocklist of libraries to skip |
|
||||
|
||||
Transitive dependencies are resolved automatically. For example, `EVEREST_INCLUDE_LIBS="ocpp"` will also build `log`, `timer`, `evse_security`, `sqlite`, and `cbv2g`.
|
||||
|
||||
See the [EDM documentation](../../docs/source/explanation/dev-tools/edm.rst) for the full list of available libraries and their dependency chains.
|
||||
|
||||
## Modifying dependencies
|
||||
|
||||
To change dependency git URLs you can set the *EVEREST_MODIFY_DEPENDENCIES_URLS* environment variable to a string containing prefixes and replacements delimited by whitespace characters.
|
||||
For example:
|
||||
```bash
|
||||
EVEREST_MODIFY_DEPENDENCIES_URLS="prefix=https://github.com/EVerest/ replace=git@github.com:EVerest/"
|
||||
```
|
||||
This would change all dependency git URLs that start with *https://github.com/EVerest/* to *git@github.com:EVerest/*.
|
||||
|
||||
Multiple prefix and replace pairs can be chained together delimited by whitespace characters.
|
||||
For example:
|
||||
```bash
|
||||
EVEREST_MODIFY_DEPENDENCIES_URLS="prefix=https://github.com/EVerest/ replace=git@github.com:EVerest/ prefix=https://github.com/EVerest/everest-framework.git replace=https://github.com/EVerest/everest-framework.git"
|
||||
```
|
||||
This would change all dependency git URLs that start with *https://github.com/EVerest/* to *git@github.com:EVerest/* as well as keeping the dependency https URL of *https://github.com/EVerest/everest-framework.git* as *https://github.com/EVerest/everest-framework.git*.
|
||||
|
||||
Additionally you can set the *EVEREST_MODIFY_DEPENDENCIES* environment variable to a file containing modifications to the projects dependencies.yaml files when running cmake:
|
||||
|
||||
```bash
|
||||
EVEREST_MODIFY_DEPENDENCIES=../dependencies_modified.yaml cmake -S . -B build
|
||||
```
|
||||
|
||||
The *dependencies_modified.yaml* file can contain something along these lines:
|
||||
|
||||
```yaml
|
||||
nlohmann_json:
|
||||
git: null # this makes edm look for nlohmann_json via find_package
|
||||
libfmt:
|
||||
rename: fmt # if find_package needs a different dependency name you can rename it
|
||||
git: null
|
||||
catch2:
|
||||
git_tag: v1.2.3 # if you want to select a different git tag for a build this is also possible
|
||||
```
|
||||
|
||||
## Create a workspace config from an existing directory tree
|
||||
Suppose you already have a directory tree that you want to save into a config file.
|
||||
You can do this with the following command:
|
||||
```bash
|
||||
edm --create-config custom-config.yaml
|
||||
```
|
||||
|
||||
This is a short form of
|
||||
```bash
|
||||
edm --create-config custom-config.yaml --include-remotes git@github.com:EVerest/*
|
||||
```
|
||||
and only includes repositories from the *EVerest* namespace. You can add as many remotes to this list as you want.
|
||||
|
||||
For example if you only want to include certain repositories you can use the following command.
|
||||
```bash
|
||||
edm --create-config custom-config.yaml --include-remotes git@github.com:EVerest/everest* git@github.com:EVerest/liblog.git
|
||||
```
|
||||
|
||||
If you want to include all repositories, including external dependencies, in the config you can use the following command.
|
||||
```bash
|
||||
edm --create-config custom-config.yaml --external-in-config
|
||||
```
|
||||
|
||||
## Git information at a glance
|
||||
You can get a list of all git repositories in the current directory and their state using the following command.
|
||||
```bash
|
||||
edm --git-info --git-fetch
|
||||
```
|
||||
If you want to know the state of all repositories in a workspace you can use the following command.
|
||||
```bash
|
||||
edm --workspace ~/checkout/everest-workspace --git-info --git-fetch
|
||||
```
|
||||
|
||||
This creates output that is similar to the following example.
|
||||
```bash
|
||||
[edm]: Git info for "~/checkout/everest-workspace":
|
||||
[edm]: Using git-fetch to update remote information. This might take a few seconds.
|
||||
[edm]: "everest-dev-environment" @ branch: main [remote: origin/main] [behind 6] [clean]
|
||||
[edm]: "everest-framework" @ branch: main [remote: origin/main] [dirty]
|
||||
[edm]: "everest-deploy-devkit" @ branch: main [remote: origin/main] [clean]
|
||||
[edm]: "libtimer" @ branch: main [remote: origin/main] [dirty]
|
||||
[edm]: 2/4 repositories are dirty.
|
||||
```
|
||||
@@ -0,0 +1,12 @@
|
||||
#!/bin/bash
|
||||
##
|
||||
## SPDX-License-Identifier: Apache-2.0
|
||||
## Copyright 2020 - 2021 Pionix GmbH and Contributors to EVerest
|
||||
##
|
||||
echo "generating bash-completion file"
|
||||
SRC_DIR="$(dirname "${BASH_SOURCE[0]}")/src"
|
||||
echo "Using module found in ${SRC_DIR}"
|
||||
cd "${SRC_DIR}"
|
||||
BASH_COMPLETION_FILE_DIR="$(pwd)"
|
||||
BASH_COMPLETION_FILE="${BASH_COMPLETION_FILE_DIR}/edm_tool/edm-completion.bash"
|
||||
shtab --shell=bash -u edm_tool.get_parser --prog edm > "${BASH_COMPLETION_FILE}"
|
||||
@@ -0,0 +1,3 @@
|
||||
[build-system]
|
||||
requires = ["setuptools", "wheel"]
|
||||
build-backend = "setuptools.build_meta"
|
||||
@@ -0,0 +1,3 @@
|
||||
Jinja2>=2.11
|
||||
PyYAML>=5.3
|
||||
requests>=2
|
||||
38
tools/EVerest-main/applications/dependency_manager/setup.cfg
Normal file
38
tools/EVerest-main/applications/dependency_manager/setup.cfg
Normal file
@@ -0,0 +1,38 @@
|
||||
[metadata]
|
||||
name = edm_tool
|
||||
version = attr: edm_tool.__version__
|
||||
description= A simple dependency manager
|
||||
long_description = file: README.md
|
||||
long_description_content_type= text/markdown
|
||||
url= https://github.com/EVerest/everest-dev-environment
|
||||
author = Kai-Uwe Hermann
|
||||
author_email = kai-uwe.hermann@pionix.de
|
||||
classifiers =
|
||||
Development Status :: 3 - Alpha
|
||||
Intended Audience :: Developers
|
||||
Topic :: Software Development :: Build Tools
|
||||
License :: OSI Approved :: Apache Software License
|
||||
|
||||
[options]
|
||||
packages = edm_tool
|
||||
package_dir =
|
||||
= src
|
||||
python_requires = >=3.6
|
||||
install_requires =
|
||||
Jinja2>=2.11
|
||||
PyYAML>=5.3
|
||||
requests>=2
|
||||
|
||||
[options.entry_points]
|
||||
console_scripts =
|
||||
edm = edm_tool:main
|
||||
|
||||
[options.package_data]
|
||||
edm_tool =
|
||||
templates/cpm.jinja
|
||||
cmake/CPM.cmake
|
||||
cmake/EDMConfig.cmake
|
||||
edm-completion.bash
|
||||
|
||||
[pycodestyle]
|
||||
max-line-length = 120
|
||||
@@ -0,0 +1,9 @@
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright 2020 - 2022 Pionix GmbH and Contributors to EVerest
|
||||
"""Everest Dependency Manager."""
|
||||
|
||||
from setuptools import setup, find_packages
|
||||
|
||||
setup(
|
||||
# see setup.cfg
|
||||
)
|
||||
@@ -0,0 +1,18 @@
|
||||
#
|
||||
# SPDX-License-Identifier: Apache-2.0
|
||||
# Copyright Pionix GmbH and Contributors to EVerest
|
||||
#
|
||||
"""Everest Dependency Manager."""
|
||||
from edm_tool import edm
|
||||
|
||||
__version__ = "0.8.0"
|
||||
|
||||
|
||||
def get_parser():
|
||||
"""Return the command line parser."""
|
||||
return edm.get_parser(__version__)
|
||||
|
||||
|
||||
def main():
|
||||
"""Main entrypoint of edm."""
|
||||
edm.main(get_parser())
|
||||
88
tools/EVerest-main/applications/dependency_manager/src/edm_tool/bazel.py
Executable file
88
tools/EVerest-main/applications/dependency_manager/src/edm_tool/bazel.py
Executable file
@@ -0,0 +1,88 @@
|
||||
"Bazel related functions for edm_tool."
|
||||
import yaml
|
||||
from typing import List, Optional, Dict
|
||||
|
||||
|
||||
def _format_optional_string(value: Optional[str]):
|
||||
"""Formats a string value as a string literal (with quotes) or `None` if the value is None."""
|
||||
if value is None:
|
||||
return "None"
|
||||
return f'"{value}"'
|
||||
|
||||
|
||||
def _is_commit(revision: str):
|
||||
# Revision is a commit if it is a hexadecimal 40-character string
|
||||
return len(revision) == 40 and all(c in "0123456789abcdef" for c in revision.lower())
|
||||
|
||||
def _get_depname_for_label(label: str) -> str:
|
||||
build, depname, bazel = label.split(":")[1].split(".")
|
||||
if build != "BUILD" or bazel != "bazel":
|
||||
raise ValueError(f"Invalid build file name: {label}")
|
||||
return depname
|
||||
|
||||
def _parse_build_file_labels(labels: Optional[List[str]]) -> Dict[str, str]:
|
||||
# For easier matching of build files with dependencies
|
||||
# we convert the list of build files:
|
||||
# ```
|
||||
# [
|
||||
# "@workspace//path/to/build:BUILD.<depname>.bazel",
|
||||
# ...
|
||||
# ]
|
||||
# ```
|
||||
# into a dictionary:
|
||||
# ```
|
||||
# {
|
||||
# "<depname>": "@workspace//path/to/build:BUILD.<depname>.bazel",
|
||||
# ...
|
||||
# }
|
||||
# ```
|
||||
# and check that all build files have proper names.
|
||||
if labels is None:
|
||||
return {}
|
||||
|
||||
return dict((_get_depname_for_label(label), label) for label in labels)
|
||||
|
||||
|
||||
def generate_deps(args):
|
||||
"Parse the dependencies.yaml and print content of *.bzl file to stdout."
|
||||
with open(args.dependencies_yaml, 'r', encoding='utf-8') as f:
|
||||
deps = yaml.safe_load(f)
|
||||
|
||||
build_files = _parse_build_file_labels(args.build_file)
|
||||
|
||||
for name in build_files:
|
||||
if name not in deps:
|
||||
raise ValueError(f"Build file {name} does not have a corresponding dependency in {args.dependencies_yaml}")
|
||||
|
||||
print("""
|
||||
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
|
||||
load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository")
|
||||
|
||||
def edm_deps():""")
|
||||
|
||||
for name, desc in deps.items():
|
||||
repo = desc["git"]
|
||||
# The parameter is called `git_tag` but it can be a tag or a commit
|
||||
revision = desc["git_tag"]
|
||||
tag = None
|
||||
commit = None
|
||||
|
||||
if _is_commit(revision):
|
||||
commit = revision
|
||||
else:
|
||||
tag = revision
|
||||
|
||||
build_file = build_files.get(name)
|
||||
|
||||
print(
|
||||
f"""
|
||||
maybe(
|
||||
git_repository,
|
||||
name = "{name}",
|
||||
remote = "{repo}",
|
||||
tag = {_format_optional_string(tag)},
|
||||
commit = {_format_optional_string(commit)},
|
||||
build_file = {_format_optional_string(build_file)},
|
||||
)
|
||||
"""
|
||||
)
|
||||
@@ -0,0 +1,144 @@
|
||||
# AUTOMATCALLY GENERATED by `shtab`
|
||||
|
||||
|
||||
|
||||
_shtab_edm_tool_option_strings=('-h' '--help' '--version' '--workspace' '--working_dir' '--out' '--include_deps' '--config' '--create-vscode-workspace' '--update' '--cmake' '--verbose' '--nocolor' '--install-bash-completion' '--create-config' '--external-in-config' '--include-remotes' '--create-snapshot' '--git-info' '--git-fetch' '--git-pull')
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
_shtab_edm_tool_pos_0_nargs=A...
|
||||
_shtab_edm_tool__h_nargs=0
|
||||
_shtab_edm_tool___help_nargs=0
|
||||
_shtab_edm_tool___version_nargs=0
|
||||
_shtab_edm_tool___include_deps_nargs=0
|
||||
_shtab_edm_tool___create_vscode_workspace_nargs=0
|
||||
_shtab_edm_tool___update_nargs=0
|
||||
_shtab_edm_tool___cmake_nargs=0
|
||||
_shtab_edm_tool___verbose_nargs=0
|
||||
_shtab_edm_tool___nocolor_nargs=0
|
||||
_shtab_edm_tool___install_bash_completion_nargs=0
|
||||
_shtab_edm_tool___external_in_config_nargs=0
|
||||
_shtab_edm_tool___include_remotes_nargs=*
|
||||
_shtab_edm_tool___create_snapshot_nargs=?
|
||||
_shtab_edm_tool___git_info_nargs=0
|
||||
_shtab_edm_tool___git_fetch_nargs=0
|
||||
_shtab_edm_tool___git_pull_nargs=*
|
||||
|
||||
|
||||
# $1=COMP_WORDS[1]
|
||||
_shtab_compgen_files() {
|
||||
compgen -f -- $1 # files
|
||||
}
|
||||
|
||||
# $1=COMP_WORDS[1]
|
||||
_shtab_compgen_dirs() {
|
||||
compgen -d -- $1 # recurse into subdirs
|
||||
}
|
||||
|
||||
# $1=COMP_WORDS[1]
|
||||
_shtab_replace_nonword() {
|
||||
echo "${1//[^[:word:]]/_}"
|
||||
}
|
||||
|
||||
# set default values (called for the initial parser & any subparsers)
|
||||
_set_parser_defaults() {
|
||||
local subparsers_var="${prefix}_subparsers[@]"
|
||||
sub_parsers=${!subparsers_var}
|
||||
|
||||
local current_option_strings_var="${prefix}_option_strings[@]"
|
||||
current_option_strings=${!current_option_strings_var}
|
||||
|
||||
completed_positional_actions=0
|
||||
|
||||
_set_new_action "pos_${completed_positional_actions}" true
|
||||
}
|
||||
|
||||
# $1=action identifier
|
||||
# $2=positional action (bool)
|
||||
# set all identifiers for an action's parameters
|
||||
_set_new_action() {
|
||||
current_action="${prefix}_$(_shtab_replace_nonword $1)"
|
||||
|
||||
local current_action_compgen_var=${current_action}_COMPGEN
|
||||
current_action_compgen="${!current_action_compgen_var}"
|
||||
|
||||
local current_action_choices_var="${current_action}_choices"
|
||||
current_action_choices="${!current_action_choices_var}"
|
||||
|
||||
local current_action_nargs_var="${current_action}_nargs"
|
||||
if [ -n "${!current_action_nargs_var}" ]; then
|
||||
current_action_nargs="${!current_action_nargs_var}"
|
||||
else
|
||||
current_action_nargs=1
|
||||
fi
|
||||
|
||||
current_action_args_start_index=$(( $word_index + 1 ))
|
||||
|
||||
current_action_is_positional=$2
|
||||
}
|
||||
|
||||
# Notes:
|
||||
# `COMPREPLY`: what will be rendered after completion is triggered
|
||||
# `completing_word`: currently typed word to generate completions for
|
||||
# `${!var}`: evaluates the content of `var` and expand its content as a variable
|
||||
# hello="world"
|
||||
# x="hello"
|
||||
# ${!x} -> ${hello} -> "world"
|
||||
_shtab_edm_tool() {
|
||||
local completing_word="${COMP_WORDS[COMP_CWORD]}"
|
||||
COMPREPLY=()
|
||||
|
||||
prefix=_shtab_edm_tool
|
||||
word_index=0
|
||||
_set_parser_defaults
|
||||
word_index=1
|
||||
|
||||
# determine what arguments are appropriate for the current state
|
||||
# of the arg parser
|
||||
while [ $word_index -ne $COMP_CWORD ]; do
|
||||
local this_word="${COMP_WORDS[$word_index]}"
|
||||
|
||||
if [[ -n $sub_parsers && " ${sub_parsers[@]} " =~ " ${this_word} " ]]; then
|
||||
# valid subcommand: add it to the prefix & reset the current action
|
||||
prefix="${prefix}_$(_shtab_replace_nonword $this_word)"
|
||||
_set_parser_defaults
|
||||
fi
|
||||
|
||||
if [[ " ${current_option_strings[@]} " =~ " ${this_word} " ]]; then
|
||||
# a new action should be acquired (due to recognised option string or
|
||||
# no more input expected from current action);
|
||||
# the next positional action can fill in here
|
||||
_set_new_action $this_word false
|
||||
fi
|
||||
|
||||
if [[ "$current_action_nargs" != "*" ]] && \
|
||||
[[ "$current_action_nargs" != "+" ]] && \
|
||||
[[ "$current_action_nargs" != *"..." ]] && \
|
||||
(( $word_index + 1 - $current_action_args_start_index >= \
|
||||
$current_action_nargs )); then
|
||||
$current_action_is_positional && let "completed_positional_actions += 1"
|
||||
_set_new_action "pos_${completed_positional_actions}" true
|
||||
fi
|
||||
|
||||
let "word_index+=1"
|
||||
done
|
||||
|
||||
# Generate the completions
|
||||
|
||||
if [[ "${completing_word}" == -* ]]; then
|
||||
# optional argument started: use option strings
|
||||
COMPREPLY=( $(compgen -W "${current_option_strings[*]}" -- "${completing_word}") )
|
||||
else
|
||||
# use choices & compgen
|
||||
local IFS=$'\n'
|
||||
COMPREPLY=( $(compgen -W "${current_action_choices}" -- "${completing_word}") \
|
||||
$([ -n "${current_action_compgen}" ] \
|
||||
&& "${current_action_compgen}" "${completing_word}") )
|
||||
fi
|
||||
|
||||
return 0
|
||||
}
|
||||
|
||||
complete -o filenames -F _shtab_edm_tool edm
|
||||
1738
tools/EVerest-main/applications/dependency_manager/src/edm_tool/edm.py
Executable file
1738
tools/EVerest-main/applications/dependency_manager/src/edm_tool/edm.py
Executable file
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,61 @@
|
||||
set(ENV{EVEREST_EDM_WORKSPACE} {{ workspace["workspace"] }})
|
||||
set(CPM_USE_NAMED_CACHE_DIRECTORIES ON)
|
||||
{% for dep in checkout %}
|
||||
set(CPM_{{ dep["name"] }}_SOURCE "{{ dep["path"] }}")
|
||||
{% endfor %}
|
||||
{% for name, value in dependencies.items() %}
|
||||
if("{{name}}" IN_LIST EVEREST_EXCLUDE_DEPENDENCIES)
|
||||
message(STATUS "Excluding dependency {{name}}")
|
||||
{% if "cmake_condition" in value and value["cmake_condition"]|length > 0 %}
|
||||
elseif({{ value["cmake_condition"] }})
|
||||
{% else %}
|
||||
else()
|
||||
{% endif %}
|
||||
{% if value and "git" in value %}
|
||||
CPMAddPackage(
|
||||
NAME {{ name }}
|
||||
GIT_REPOSITORY {{ value["git"] }}
|
||||
{% if "git_tag" in value %}
|
||||
GIT_TAG {{ value["git_tag"] }}
|
||||
{% endif %}
|
||||
{% if "options" in value and value["options"]|length > 0 %}
|
||||
OPTIONS
|
||||
{{value["options"]|quote|join(" ")}}
|
||||
{% endif %}
|
||||
{% if "prevent_install" in value and value["prevent_install"] %}
|
||||
EXCLUDE_FROM_ALL YES
|
||||
{% endif %}
|
||||
)
|
||||
{% else %}
|
||||
find_package(
|
||||
{{ name }}
|
||||
{% if value and "components" in value and value["components"]|length > 0 %}
|
||||
COMPONENTS
|
||||
{{value["components"]|quote|join(" ")}}
|
||||
{% endif %}
|
||||
{% if not value or "optional" not in value or not value["optional"] %}
|
||||
REQUIRED
|
||||
{% endif %}
|
||||
)
|
||||
{% endif %}
|
||||
{% if value and "alias" in value %}
|
||||
if({{name}}_ADDED)
|
||||
add_library({{value["alias"]["name"]}} ALIAS {{value["alias"]["target"]}})
|
||||
endif()
|
||||
{% endif %}
|
||||
{% if "cmake_condition" in value and value["cmake_condition"]|length > 0 %}
|
||||
else()
|
||||
message(STATUS "Excluding dependency {{name}} based on cmake_condition")
|
||||
{% endif %}
|
||||
endif()
|
||||
|
||||
{% endfor %}
|
||||
|
||||
execute_process(
|
||||
COMMAND "${EVEREST_DEPENDENCY_MANAGER}" release --everest-dir ${PROJECT_SOURCE_DIR} --build-dir ${CMAKE_BINARY_DIR} --out ${CMAKE_BINARY_DIR}/release.json
|
||||
)
|
||||
|
||||
install(
|
||||
FILES "${CMAKE_BINARY_DIR}/release.json"
|
||||
DESTINATION "${CMAKE_INSTALL_SYSCONFDIR}/everest"
|
||||
)
|
||||
Reference in New Issue
Block a user