Skip to content

Commit

Permalink
v3.3.0
Browse files Browse the repository at this point in the history
  • Loading branch information
marzer committed Jan 29, 2023
1 parent 1ebdad3 commit c635f21
Show file tree
Hide file tree
Showing 7 changed files with 80 additions and 8 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ 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
Add `tomlpp` to your `package.json5`, e.g.:
```plaintext
depends: [
'tomlpp^3.2.0',
'tomlpp^3.3.0',
]
```

Expand Down Expand Up @@ -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)
```
Expand Down
6 changes: 3 additions & 3 deletions docs/pages/main_page.dox
Original file line number Diff line number Diff line change
Expand Up @@ -453,15 +453,15 @@ 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.



\subsection mainpage-adding-lib-dds DDS
Add `tomlpp` to your `package.json5`, e.g.:
\json
depends: [
'tomlpp^3.2.0',
'tomlpp^3.3.0',
]
\endjson

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions toml++.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
3 changes: 3 additions & 0 deletions toml++.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down
68 changes: 68 additions & 0 deletions tools/version.py
Original file line number Diff line number Diff line change
@@ -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)

0 comments on commit c635f21

Please sign in to comment.