Skip to content
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

Install ev-cli locally and depend on templates files for generation #893

Merged
merged 26 commits into from
Oct 30, 2024

Conversation

hikinggrass
Copy link
Contributor

Describe your changes

Issue ticket number and link

Checklist before requesting a review

  • I have performed a self-review of my code
  • I have made corresponding changes to the documentation
  • I read the contribution documentation and made sure that my changes meet its requirements

@a-w50
Copy link
Contributor

a-w50 commented Oct 10, 2024

Hi,

in general, the implementation as of now should work.
I see an issue with that implementation details of ev-cli are exposed to the CMakeFiles.txt (i.e. template filenames are hardcoded into the depends). This could be easily mitigated by adding an argument to ev-cli like ev-cli interface get-templates etc. This way ev-cli can tell you directly what it uses (hence you also won't need the get-package-location script anymore). So instead of running the new script, you run ev-cli and get the corresponding files as a return value and pass these directly into the depends.
Another thing is the usage of set/get_property(GLOBAL ... ), if possible, try to add these variables to a specific target, this gives you some scoping and depending on the use case you can easily retrieve it via an generator expression:
"$<TARGET_PROPERTY:target_name,PROPERTY_NAME>"

Signed-off-by: Kai-Uwe Hermann <[email protected]>
Fail with error messages if they could not get returned

Signed-off-by: Kai-Uwe Hermann <[email protected]>
Signed-off-by: Kai-Uwe Hermann <[email protected]>
Copy link
Contributor

@a-w50 a-w50 left a comment

Choose a reason for hiding this comment

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

Great work!
I would suggest to change PATHS to HINTS (see below). Furthermore, I think the main CMakeLists.txt needs to depend on everest-cmake 0.5. The additional python script could now be removed again, right?

Comment on lines 63 to 80
function(set_ev_cli_template_properties)
message(STATUS "Setting template properties for ev-cli target")
get_target_property(EVEREST_SCHEMA_DIR generate_cpp_files EVEREST_SCHEMA_DIR)

execute_process(
COMMAND ${EV_CLI} interface get-templates --schemas-dir "${EVEREST_SCHEMA_DIR}"
OUTPUT_VARIABLE EV_CLI_INTERFACE_TEMPLATES
OUTPUT_STRIP_TRAILING_WHITESPACE
RESULT_VARIABLE
EV_CLI_INTERFACE_TEMPLATES_RESULT
)

if(EV_CLI_INTERFACE_TEMPLATES_RESULT)
message(FATAL_ERROR "Could not get interface templates from ev-cli.")
endif()

execute_process(
COMMAND ${EV_CLI} module get-templates --schemas-dir "${EVEREST_SCHEMA_DIR}"
Copy link
Contributor

Choose a reason for hiding this comment

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

As this is a function, I wouldn't prefix all the variables with EV_CLI in order to make it more readable

@a-w50 a-w50 self-requested a review October 15, 2024 10:29
Copy link
Contributor

@a-w50 a-w50 left a comment

Choose a reason for hiding this comment

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

As discussed offline

@@ -90,7 +90,7 @@ ext-mbedtls:
# everest-testing and ev-dev-tools
everest-utils:
git: https://github.com/EVerest/everest-utils.git
git_tag: v0.3.1
git_tag: 9d9852369354eb86ea620ec9d8059902c43853a1
Copy link
Contributor Author

@hikinggrass hikinggrass Oct 15, 2024

Choose a reason for hiding this comment

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

TODO: update the git_tag to a tag before merge into main

@@ -2,6 +2,14 @@

set -e


EVEREST_CMAKE_PATH=/usr/lib/cmake/everest-cmake
EVEREST_CMAKE_VERSION=3aec8e3b058a9a1edb843da4fe46bb12d7aef071
Copy link
Contributor

Choose a reason for hiding this comment

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

In general it is a nice feature to be able to define the used everest-cmake version.

Proposal:
Could we add everest-cmake to the dependencies.yaml and then check it out with edm. I think there is currently not that kind of command, but I imagine having here one line (kind of)

edm single-checkout everest-cmake --workspace-config everest-core/dependencies.yaml

This way it would be more visible where to set everest-cmake version

Copy link
Contributor

Choose a reason for hiding this comment

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

Alternativley we could add another file like ci-workspace.yaml and add it there since this version pinning is mainly for ci

Copy link
Contributor

Choose a reason for hiding this comment

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

  • note sure if adding everest-cmake to dependencies.yaml will work in the current implementation as the cmake specific edm function evc_setup_edm is defined in everest-cmake and you'll get an chicken-egg problem
  • concerning ci-workspace.yaml, I wouldn't try to add additional coupling of the ci to edm. First we should try to solve the problem, that the repo specific Dockerfile isn't used.

Copy link
Contributor

Choose a reason for hiding this comment

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

note sure if adding everest-cmake to dependencies.yaml will work in the current implementation

It should work since when building with cmake it could ignore this one dependency and use the provided everest-cmake installation. But when running in ci edm can read this dependency from dependencies.yaml.

I agree that it could be confusing defining everest-cmake in dependencies.yaml without using it in the cmake build. This could improved by adding in line comment and set cmake_condition to OFF

concerning ci-workspace.yaml, I wouldn't try to add additional coupling of the ci to edm.

Why not using edm in ci? It is the EVerest dependency manager which is used during build, but also as dev tool to manage the dev workspace.

The advantage I see or my motivation is to have a transparent/visible way of defining dependencies. Doing it in compile.sh is hidden in my feeling.

Moving it into the Dockerfile without using edm for it would also be an option.

First we should try to solve the problem, that the repo specific Dockerfile isn't used.

I am not aware of this issue, do you have an example or a log file?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am not aware of this issue, do you have an example or a log file?

Sorry my bad. I remember, we deactivated this for everest-core since we have this issue with running this in PRs

Copy link
Contributor

Choose a reason for hiding this comment

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

It might work by accident, but probably with no real well defined behavior. I would not rely on that.
Concerning the coupling in the ci: I didn't mean that we should not run edm in the ci as it is run locally - but I wouldn't add an extra dependency overwrite file for the ci (as both the local build and the ci build should be similar).
Using `find_package(everest-cmake X.Y.Z) we can already express, that we need a newer version.

I totally agree, that moving it to the compile.sh was a hack to get the ci build, but it should not be committed this way. Having it in the Dockerfile, should be the way to go - but that doesn't work currently.

@hikinggrass hikinggrass added the include-in-release Tag that this PR should be included in the current merge window for the upcoming release if possible label Oct 16, 2024
@hikinggrass hikinggrass removed the include-in-release Tag that this PR should be included in the current merge window for the upcoming release if possible label Oct 24, 2024
This reverts commit 3f82c28.

Signed-off-by: Kai-Uwe Hermann <[email protected]>

# Conflicts:
#	.ci/build-kit/scripts/compile.sh
Signed-off-by: Kai-Uwe Hermann <[email protected]>
# Conflicts:
#	.ci/build-kit/docker/Dockerfile

Signed-off-by: Kai-Uwe Hermann <[email protected]>
@hikinggrass hikinggrass merged commit 3ebd1af into main Oct 30, 2024
11 checks passed
@hikinggrass hikinggrass deleted the feature/expose-mappings branch October 30, 2024 12:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants