This commit is contained in:
Mark Gillard 2023-01-29 18:03:16 +02:00
parent 1ebdad3e71
commit c635f218c0
7 changed files with 80 additions and 8 deletions

View File

@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.14)
project(
tomlplusplus
VERSION 3.2.0
VERSION 3.3.0
DESCRIPTION "Header-only TOML config file parser and serializer for C++17"
HOMEPAGE_URL "https://marzer.github.io/tomlplusplus/"
LANGUAGES CXX

View File

@ -113,7 +113,7 @@ You'll find some more code examples in the `examples` directory, and plenty more
### Conan
Add `tomlplusplus/3.2.0` to your conanfile.
Add `tomlplusplus/3.3.0` to your conanfile.
### DDS
@ -121,7 +121,7 @@ Add `tomlpp` to your `package.json5`, e.g.:
```plaintext
depends: [
'tomlpp^3.2.0',
'tomlpp^3.3.0',
]
```
@ -166,7 +166,7 @@ include(FetchContent)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.2.0
GIT_TAG v3.3.0
)
FetchContent_MakeAvailable(tomlplusplus)
```

View File

@ -453,7 +453,7 @@ and [emoji sundae] Regular. The API is the same for both.
\subsection mainpage-adding-lib-conan Conan
Add `tomlplusplus/3.2.0` to your conanfile.
Add `tomlplusplus/3.3.0` to your conanfile.
@ -461,7 +461,7 @@ Add `tomlplusplus/3.2.0` to your conanfile.
Add `tomlpp` to your `package.json5`, e.g.:
\json
depends: [
'tomlpp^3.2.0',
'tomlpp^3.3.0',
]
\endjson
@ -507,7 +507,7 @@ include(FetchContent)
FetchContent_Declare(
tomlplusplus
GIT_REPOSITORY https://github.com/marzer/tomlplusplus.git
GIT_TAG v3.2.0
GIT_TAG v3.3.0
)
FetchContent_MakeAvailable(tomlplusplus)
\endcmake

View File

@ -7,7 +7,7 @@ project(
'tomlplusplus',
'cpp',
license: 'MIT',
version: '3.2.0',
version: '3.3.0',
meson_version: '>=0.61.0',
default_options: [
# https://mesonbuild.com/Builtin-options.html

View File

@ -127,6 +127,7 @@
<None Include="tools\generate_single_header.py" />
<None Include="tools\generate_windows_test_targets.py" />
<None Include="tools\utils.py" />
<None Include="tools\version.py" />
<None Include="vendor\README.md" />
</ItemGroup>
<ItemGroup>

View File

@ -248,6 +248,9 @@
<None Include=".github\FUNDING.yml">
<Filter>.github</Filter>
</None>
<None Include="tools\version.py">
<Filter>tools</Filter>
</None>
</ItemGroup>
<ItemGroup>
<Filter Include="docs">

68
tools/version.py Normal file
View File

@ -0,0 +1,68 @@
#!/usr/bin/env python3
# This file is a part of toml++ and is subject to the the terms of the MIT license.
# Copyright (c) Mark Gillard <mark.gillard@outlook.com.au>
# See https://github.com/marzer/tomlplusplus/blob/master/LICENSE for the full license text.
# SPDX-License-Identifier: MIT
import sys
import re
from argparse import ArgumentParser
from pathlib import Path
def read_text_file(path):
print(rf'Reading {path}')
with open(path, r'r', encoding=r'utf-8') as f:
return f.read()
def write_text_file(path, text):
print(rf'Writing {path}')
with open(path, r'w', encoding=r'utf-8', newline='\n') as f:
f.write(text)
if __name__ == '__main__':
args = ArgumentParser(r'version.py', description=r'Sets the project version in all the necessary places.')
args.add_argument(r'version', type=str)
args = args.parse_args()
version = re.fullmatch(r'\s*([0-9]+)\s*[.,;]\s*([0-9]+)\s*[.,;]\s*([0-9]+)\s*', args.version)
if not version:
print(rf"Couldn't parse version triplet from '{args.version}'", file=sys.stderr)
sys.exit(1)
version = (int(version[1]), int(version[2]), int(version[3]))
version_str = rf'{version[0]}.{version[1]}.{version[2]}'
print(rf'version: {version_str}')
root = Path(__file__).parent.parent.resolve()
path = root / r'meson.build'
text = read_text_file(path)
text = re.sub(r'''(\s|^)version\s*:\s*['"].*?['"]''', rf"\1version: '{version_str}'", text, count=1)
write_text_file(path, text)
path = root / r'CMakeLists.txt'
text = read_text_file(path)
text = re.sub(r'''(\s|^)VERSION\s+[0-9](?:[.][0-9]){2}''', rf"\1VERSION {version_str}", text, count=1, flags=re.I)
write_text_file(path, text)
path = root / r'include/toml++/impl/version.h'
text = read_text_file(path)
text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MAJOR)\s+[0-9]+''', rf"\1 {version[0]}", text)
text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_MINOR)\s+[0-9]+''', rf"\1 {version[1]}", text)
text = re.sub(r'''(\s*#\s*define\s+TOML_LIB_PATCH)\s+[0-9]+''', rf"\1 {version[2]}", text)
write_text_file(path, text)
noop_sub = r'#$%^nbsp^%$#'
for file in (r'README.md', r'docs/pages/main_page.dox'):
path = root / file
text = read_text_file(path)
text = re.sub(r'''(toml(?:plusplus|\+\+|pp)\s*[/:^]\s*)[0-9](?:[.][0-9]){2}''', rf"\1{noop_sub}{version_str}", text, flags=re.I)
text = re.sub(r'''(GIT_TAG\s+)(?:v\s*)?[0-9](?:[.][0-9]){2}''', rf"\1v{version_str}", text, flags=re.I)
text = text.replace(noop_sub, '')
write_text_file(path, text)