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

Codegen updates #2927

Merged
merged 114 commits into from Sep 7, 2019
Merged

Conversation

kodebach
Copy link
Member

@kodebach kodebach commented Sep 2, 2019

Re-created from #2805

Contains some updates for the code-generation. For progress see #2680.

Fixes #2866

Basics

  • Short descriptions should be in the release notes (added as entry in
    doc/news/_preparation_next_release.md which contains _(my name)_)
    Please always add something to the the release notes.
  • Longer descriptions should be in documentation or in design decisions.
  • Describe details of how you changed the code in commit messages
    (first line should have module: short statement syntax)
  • References to issues, e.g. close #X, should be in the commit messages.

Checklist

  • I added unit tests
  • I ran all tests locally and everything went fine
  • affected documentation is fixed
  • I added code comments, logging, and assertions (see Coding Guidelines)
  • meta data is updated (e.g. README.md of plugins and METADATA.ini)

Review

Reviewers will usually check the following:

@kodebach kodebach mentioned this pull request Sep 2, 2019
14 tasks
@lgtm-com
Copy link

lgtm-com bot commented Sep 2, 2019

This pull request introduces 1 alert when merging 29dc818 into be9b67f - view on LGTM.com

new alerts:

  • 1 for Empty branch of conditional

@kodebach
Copy link
Member Author

kodebach commented Sep 3, 2019

@markus2330 Once a7 is online again and Jenkins completes all build jobs, this PR can be merged. (At least from my point of view.)

@markus2330
Copy link
Contributor

Thank you!

@bauhaus93: here is the new PR. Please try out the tutorials.


However, because the default `resolver` is not compatible with plugins that produce a KeySet without a file present, you can only use
`noresolver`. This means that you cannot set any values. (You will get an error about a non-existent file, if you try.)
- The plugin must be mounted using `noresolver` or another resolver that always calls the storage plugin. To work arround
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
- The plugin must be mounted using `noresolver` or another resolver that always calls the storage plugin. To work arround
- The plugin must be mounted using `noresolver` or another resolver that always calls the storage plugin. To work around

@kodebach
Copy link
Member Author

kodebach commented Sep 4, 2019

jenkins build libelektra please

@kodebach
Copy link
Member Author

kodebach commented Sep 4, 2019

@markus2330 Any idea why testscr_check_formatting fails in debian-stretch-full-mmap-asan but not in any other job using the same docker image?

@sanssecours
Copy link
Member

Any idea why testscr_check_formatting fails in debian-stretch-full-mmap-asan but not in any other job using the same docker image?

This seems to be a transient error. As far as I can tell, git diff --quiet does report code differences in line 69 of the code below, while it does not detect a difference in line 72. As to why this happens, I have no idea.

git diff --quiet
succeed_if "$error_message"
git diff --quiet || {
printf '\n\n————————————————————————————————————————————————————————————\n\n'
git diff -p
printf '\n\n————————————————————————————————————————————————————————————\n\n'
}

Anyway, I opened pull request #2929, which hopefully gets rid of this error.

@kodebach
Copy link
Member Author

kodebach commented Sep 5, 2019

But then the same thing would occur on all the other build jobs as well, wouldn't it? (At least the ones using the same docker image)

@sanssecours
Copy link
Member

But then the same thing would occur on all the other build jobs as well, wouldn't it? (At least the ones using the same docker image)

Unfortunately, since this is a transient error (it only happens in rare cases), I think the answer to this question is no.

Currently one option to get rid of the error is to restart the build. Since this is a rather bad “solution” – especially considering the stability of the Jenkins build servers –, I opened PR #2929. At least the new version of the test should provide more information on what the specific problem is.

Anyway, I am sorry for the false positive. I am pretty I wrote the code that causes these problems.

@kodebach

This comment has been minimized.

@markus2330
Copy link
Contributor

@bauhaus93 do you have any troubles reviewing the PR?

@kodebach
Copy link
Member Author

kodebach commented Sep 6, 2019

We need an update to the debian branch, since I removed kdbconfig.h from the installed files. Should I update it first, or do we want to merge the PR before updating debian?

@markus2330
Copy link
Contributor

You can update the debian branch by directly pushing to it (to remove the one file).

@kodebach
Copy link
Member Author

kodebach commented Sep 6, 2019

I made the required change to the debian branch.

@markus2330 Is it possible for you (when you are logged in) to restart the Jenkins build from the "Build artifacts" stage? It would be a bit of a waste to repeat all the successful builds, when nothing inside the PR has changed.

@sanssecours
Copy link
Member

Is it possible for you (when you are logged in) to restart the Jenkins build from the "Build artifacts" stage?

Unfortunately, as far as I know that is not possible.

It would be a bit of a waste to repeat all the successful builds, when nothing inside the PR has changed.

I think so too. I restarted the whole Jenkins build for now.

@kodebach
Copy link
Member Author

kodebach commented Sep 6, 2019

Unfortunately, as far as I know that is not possible.

That issue is marked as "Resolved" and the release notes, mention that it was release as part of version 1.3. I am not sure which version we are using.

@sanssecours
Copy link
Member

sanssecours commented Sep 6, 2019

That issue is marked as "Resolved" and the release notes, mention that it was release as part of version 1.3. I am not sure which version we are using.

As far as I know, we do not use the declarative syntax for pipeline stages, which means we are out of luck according to the issue description:

Out of scope

  • Automatically stash/unstash the workspace
  • Scripted pipeline (technical limitation)

.

@kodebach
Copy link
Member Author

kodebach commented Sep 6, 2019

@markus2330 I suggest we merge this huge PR now, since all build jobs succeeded. If there is anything else that needs to change, we can always create a new PR.

Copy link
Contributor

@markus2330 markus2330 left a comment

Choose a reason for hiding this comment

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

Amazing PR.

@@ -2,32 +2,29 @@
#
# Variables for the Elektra library:
#
# Elektra_INCLUDE_DIRS - where to find kdb.h, etc.
# Elektra_LIBRARIES - List of libraries when using Elektra.
# Elektra_INCLUDE_DIRS - where to find kdb.h, etc. Elektra_LIBRARIES - List of libraries when using Elektra.
Copy link
Contributor

Choose a reason for hiding this comment

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

This formatting got broken.

@sanssecours any idea how to avoid this?

Copy link
Member

Choose a reason for hiding this comment

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

The easiest option is probably using a fence:

# ~~~

before and after the comment block, just like we did here:

# ~~~
# CACHE
#
# Here all cache variables are set
#
#
# If you add something here, make sure to also add it in
# src/plugins/constants/
# ~~~

.

@@ -82,7 +82,6 @@ matrix:
-multifile;\
-network;\
-ni;\
-noresolver;\
Copy link
Contributor

Choose a reason for hiding this comment

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

Why the change?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is required for specload and therefore needed for some of the codegen tests.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then maybe make it mandatory? (src/plugins/CMakeLists.txt)

Copy link
Member Author

Choose a reason for hiding this comment

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

It is not actually mandatory, since specload isn't mandatory. Also specload can work with other resolvers, it is just that right now noresolver is the only one that works. Other resolvers don't call the storage plugin, if no storage file exists.

# INPUT <plugin> <file>
# OUTPUT_DIR <output_dir>
# KDB <kdb>
# PARAMS <params>...
Copy link
Contributor

Choose a reason for hiding this comment

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

Isn't PARAMS optional?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, and OPTIONS, KDB and OUTPUT_DIR too. I'll make that more clear.

#
# This will call `<kdb> gen -F <plugin>=<file> <options>... template parent_key output_name <params>...` in the
# directory <output_dir>.
#
Copy link
Contributor

Choose a reason for hiding this comment

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

Can you also give an example of how to execute it?

Copy link
Member Author

@kodebach kodebach Sep 7, 2019

Choose a reason for hiding this comment

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

I can, but does it really help that much, if I add e.g.:

elektra_kdb_gen (highlevel "/sw/org/app/#0/current" elektragen ni spec.ini)

That is all you need to do. CMake will then know which files are produced by kdb gen and call it, if one of the files is required by a target.

Copy link
Contributor

Choose a reason for hiding this comment

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

I think even this example might help. A full usage example might help even more (how to compile the generated files).

Copy link
Member Author

Choose a reason for hiding this comment

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

Full examples can be found in the examples directory.

Copy link
Contributor

Choose a reason for hiding this comment

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

Then adding links to the examples directories is all what is needed.

Copy link
Member Author

Choose a reason for hiding this comment

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

How should I link to the examples? With a Github link? I don't think the external examples show up on the homepage.

Copy link
Contributor

Choose a reason for hiding this comment

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

The website automatically turns all internal links that are not in the website to github links.

@@ -13,3 +13,4 @@ src/tools/website-frontend/resources/assets/skin/base/fonts/font-awesome/font-aw
src/tools/website-frontend/resources/assets/skin/base/util/space.less: mit
src/tools/web/client/public/Roboto-Light.ttf: apache-2.0
src/tools/web/client/public/Roboto-Regular.ttf: apache-2.0
src/tools/kdb/gen/mustache.hpp: BSL-1.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you for maintaining! I made it now mandatory in f256c0d

While the new `kdb gen` was already included in the last release, it is now fully functional and ready for use. To get started take a look
at the new man-page for [`kdb-gen(1)`](https://www.libelektra.org/manpages/kdb-gen). _(Klemens Böswirth)_

If specifically want to use it with the High-Level API take a look at [this tutorial](https://www.libelektra.org/tutorials/high-level-api).
Copy link
Contributor

Choose a reason for hiding this comment

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

sentence?

While the new `kdb gen` was already included in the last release, it is now fully functional and ready for use. To get started take a look
at the new man-page for [`kdb-gen(1)`](https://www.libelektra.org/manpages/kdb-gen). _(Klemens Böswirth)_

If specifically want to use it with the High-Level API take a look at [this tutorial](https://www.libelektra.org/tutorials/high-level-api).

Copy link
Contributor

Choose a reason for hiding this comment

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

Also write about cmake integration.

### <<HIGHLIGHT1>>
### Code Generation

While the new `kdb gen` was already included in the last release, it is now fully functional and ready for use. To get started take a look
Copy link
Contributor

Choose a reason for hiding this comment

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

productive use?

@@ -150,7 +157,7 @@ you up to date with the multi-language support provided by Elektra.

### CMake

- <<TODO>>
- `kdbtypes.h` is now generated directly via a CMake `configure_file` call. _(Klemens Böswirth)_
Copy link
Contributor

Choose a reason for hiding this comment

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

Not really important. Better write more about the highlight.

@@ -12,10 +12,15 @@ In Elektra different forms of application integrations are possible:
- [Intercept File System](/src/bindings/intercept/fs/README.md)
3. Integration where applications directly use Elektra to read and
store settings.
1. Using the low-level API.
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it possible to call it "i" and "ii" here?

Copy link
Member Author

Choose a reason for hiding this comment

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

No, markdown only recognises Arabic numbers as list items. GitHub is quite unique in how it renders nested numbered lists. Most other markdown renderers I tried render all levels with Arabic numerals.

I don't know what we use for the website, but I'll change the references in the text below to 3.1 and 3.2. IMO it is easier to understand that 3.1 references 3.i than the other way around.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, I agree. Only Arabic numbers is easier.

@markus2330 markus2330 merged commit 79408a3 into ElektraInitiative:master Sep 7, 2019
@kodebach kodebach deleted the highlevel_codegen branch September 7, 2019 12:09
This was referenced Sep 7, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

cmd-line tutorial
4 participants