mesonbuild / mesonbuild/meson

RFE: add possibility to get output of vcs_tag() without configuring file

Open
#3,903 2 comments 6 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
6.6k
Forks
1.9k
Avg merge
2d 6h
Merged PRs (30d)
33

Description

In one of the projects I encountered situation where version.h.in should contain information about not only about git version but also some other stuff.

Right now it is solvable by something like:

```meson
version_array = meson.project_version().split('.')
version_major = version_array[0].to_int()
version_minor = version_array[1].to_int()
version_data = configuration_data()
version_data.set('PROJECT_VERSION_MAJOR', version_major)
version_data.set('PROJECT_VERSION_MINOR', version_minor)
# We don't want to substitute it by noop
version_data.set('PROJECT_VERSION_GIT', '@VCS_TAG@')
version_cc_in = configure_file(
input : 'version.cc.in',
output : 'version.cc.in',
configuration : version_data,
)
version_cc = vcs_tag(
input : version_cc_in,
output : 'version.cc',
)
```

but this is not really nice.

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by tracing the vcs_tag() and configure_file() entry points in the Meson implementation and review how the shown Meson example passes @VCS_TAG@ between them. Determine the API needed to expose vcs_tag() output without configuring a file, then add coverage for that usage and verify the existing configured-file behavior remains unchanged.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
build-system
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.