Skip to content

Commit 16000b0

Browse files
committed
Merge remote-tracking branch 'upstream/master' into 0.1.x
2 parents 96a9f95 + 7639ac7 commit 16000b0

17 files changed

+99
-165
lines changed

.travis.yml

Lines changed: 24 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,31 @@
1-
language: cpp
2-
compiler:
3-
- gcc
4-
sudo: false
5-
addons:
6-
apt:
7-
sources:
8-
- ubuntu-toolchain-r-test
9-
- boost-latest
10-
packages:
11-
- gcc-4.8
12-
- g++-4.8
13-
- libboost-filesystem1.55-dev
14-
- libboost-program-options1.55-dev
15-
- libboost-regex1.55-dev
16-
- libboost-date-time1.55-dev
17-
- libboost-thread1.55-dev
18-
- libboost-log1.55-dev
19-
- libboost-locale1.55-dev
20-
- libboost-chrono1.55-dev
1+
sudo: required
2+
services:
3+
- docker
214

225
before_install:
23-
# Use a predefined install location; cppcheck requires the cfg location is defined at compile-time.
24-
- mkdir -p $USERDIR
25-
# grab a pre-built cmake 3.2.3
26-
- wget --no-check-certificate https://cmake.org/files/v3.2/cmake-3.2.3-Linux-x86_64.tar.gz
27-
- tar xzvf cmake-3.2.3-Linux-x86_64.tar.gz --strip 1 -C $USERDIR
28-
- wget https://github.com/puppetlabs/leatherman/releases/download/${LEATHERMAN_VERSION}/leatherman.tar.gz
29-
- tar xzvf leatherman.tar.gz -C $USERDIR
6+
- docker pull gcr.io/cpp-projects/cpp-ci:1
307

318
script:
32-
- ./.travis_target.sh
9+
- >
10+
docker run -v `pwd`:/cpp-hocon gcr.io/cpp-projects/cpp-ci:1 /bin/bash -c "
11+
wget https://github.com/puppetlabs/leatherman/releases/download/${LEATHERMAN_VERSION}/leatherman.tar.gz &&
12+
tar xzvf leatherman.tar.gz --strip 1 -C / &&
13+
cd /cpp-hocon &&
14+
cmake $EXTRA_VARS . &&
15+
mkdir dest &&
16+
make $TARGET DESTDIR=/cpp-hocon/dest VERBOSE=1 -j2 &&
17+
{ [[ '$COVERALLS' != 'ON' ]] || coveralls --gcov-options '\-lp' -r . -b . -e src -e vendor >/dev/null || true; }
18+
"
19+
- if [[ $DO_RELEASE = true ]]; then tar czvf cpp-hocon.tar.gz `find dest -type f -print`; fi
3320

3421
env:
3522
global:
36-
- USERDIR=/tmp/userdir
37-
- PYTHONUSERBASE=$USERDIR
38-
- PATH=$USERDIR/bin:$PATH
39-
- LD_LIBRARY_PATH=$USERDIR/lib:$LD_LIBRARY_PATH
40-
- LEATHERMAN_VERSION=0.9.0
23+
- LEATHERMAN_VERSION=1.4.0
4124
matrix:
42-
- TRAVIS_TARGET=CPPLINT
43-
- TRAVIS_TARGET=CPPCHECK
44-
- TRAVIS_TARGET=RELEASE
45-
- TRAVIS_TARGET=DEBUG
46-
47-
notifications:
48-
email: false
25+
- TARGET=cpplint
26+
- TARGET=cppcheck
27+
- TARGET="all test install ARGS=-V" DO_RELEASE=true EXTRA_VARS="-DBOOST_STATIC=ON"
28+
- TARGET="all test install ARGS=-V" EXTRA_VARS="-DBOOST_STATIC=ON -DCMAKE_BUILD_TYPE=Debug -DCOVERALLS=ON" COVERALLS=ON
4929

5030
deploy:
5131
provider: releases
@@ -56,4 +36,7 @@ deploy:
5636
on:
5737
repo: puppetlabs/cpp-hocon
5838
tags: true
59-
condition: '"$TRAVIS_TARGET" == "RELEASE"'
39+
condition: $DO_RELEASE = true
40+
41+
notifications:
42+
email: false

.travis_target.sh

Lines changed: 0 additions & 66 deletions
This file was deleted.

appveyor.yml

Lines changed: 16 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,37 @@
11
environment:
2-
LEATHERMAN_VERSION: 1.2.1
2+
LEATHERMAN_VERSION: 1.4.0
3+
matrix:
4+
- shared: OFF
5+
36
init:
47
- |
58
choco install -y mingw-w64 -Version 5.2.0 -source https://www.myget.org/F/puppetlabs
69
choco install -y cmake -Version 3.2.2 -source https://www.myget.org/F/puppetlabs
710
choco install -y gettext -Version 0.19.6 -source https://www.myget.org/F/puppetlabs
811
choco install -y pl-toolchain-x64 -Version 2015.12.01.1 -source https://www.myget.org/F/puppetlabs
912
choco install -y pl-boost-x64 -Version 1.58.0.2 -source https://www.myget.org/F/puppetlabs
13+
choco install -y pl-openssl-x64 -Version 1.0.24.1 -source https://www.myget.org/F/puppetlabs
1014
choco install -y pl-curl-x64 -Version 7.46.0.1 -source https://www.myget.org/F/puppetlabs
11-
- ps: |
12-
wget "https://github.com/puppetlabs/leatherman/releases/download/$env:LEATHERMAN_VERSION/leatherman.7z" -OutFile "$env:temp\leatherman.7z"
13-
7z.exe x $env:temp\leatherman.7z -oC:\tools | FIND /V "ing "
1415
1516
install:
17+
- ps: |
18+
wget "https://github.com/puppetlabs/leatherman/releases/download/$env:LEATHERMAN_VERSION/leatherman.7z" -OutFile "$pwd\leatherman.7z"
19+
7z.exe x leatherman.7z -oC:\tools | FIND /V "ing "
20+
1621
# Minimize environment polution; previously we were linking against the wrong OpenSSL DLLs.
1722
# Include Ruby and Powershell for unit tests.
1823
- SET PATH=C:\tools\pl-build-tools\bin;C:\tools\mingw64\bin;C:\ProgramData\chocolatey\bin;C:\Ruby22-x64\bin;C:\Program Files\7-Zip;C:\Windows\system32;C:\Windows;C:\Windows\System32\WindowsPowerShell\v1.0
1924

2025
build_script:
2126
- ps: |
22-
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:\tools\pl-build-tools\pl-build-toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\tools\leatherman" -DCMAKE_INSTALL_PREFIX=C:\tools\cpp-hocon -DBOOST_STATIC=ON .
23-
mingw32-make install
24-
7z.exe a -t7z cpp-hocon.7z C:\tools\cpp-hocon\
27+
cmake -G "MinGW Makefiles" -DCMAKE_TOOLCHAIN_FILE="C:\tools\pl-build-tools\pl-build-toolchain.cmake" -DCMAKE_PREFIX_PATH="C:\tools\leatherman" -DCMAKE_INSTALL_PREFIX=C:\tools\cpp-hocon -DBOOST_STATIC=ON -DBUILD_SHARED_LIBS="$env:shared" .
28+
mingw32-make -j2
2529
2630
test_script:
27-
- ps: ctest -V 2>&1 | %{ if ($_ -is [System.Management.Automation.ErrorRecord]) { $_ | c++filt } else { $_ } }
31+
- ps: |
32+
ctest -V 2>&1 | %{ if ($_ -is [System.Management.Automation.ErrorRecord]) { $_ | c++filt } else { $_ } }
33+
mingw32-make install
34+
7z.exe a -t7z cpp-hocon.7z C:\tools\cpp-hocon\
2835
2936
artifacts:
3037
- path: cpp-hocon.7z
@@ -38,3 +45,4 @@ deploy:
3845
artifact: cpp-hocon.7z
3946
on:
4047
appveyor_repo_tag: true
48+
shared: OFF

lib/inc/hocon/config_value.hpp

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -211,15 +211,15 @@ namespace hocon {
211211

212212
class modifier {
213213
public:
214-
virtual shared_value modify_child_may_throw(std::string key_or_null, shared_value v) = 0;
214+
virtual shared_value modify_child_may_throw(std::string const& key_or_null, shared_value v) = 0;
215215
};
216216

217217
class no_exceptions_modifier : public modifier {
218218
public:
219219
no_exceptions_modifier(std::string prefix);
220220

221-
shared_value modify_child_may_throw(std::string key_or_null, shared_value v) override;
222-
shared_value modify_child(std::string key, shared_value v) const;
221+
shared_value modify_child_may_throw(std::string const &key_or_null, shared_value v) override;
222+
shared_value modify_child(std::string const& key, shared_value v) const;
223223
private:
224224
std::string _prefix;
225225
};

lib/inc/internal/values/config_delayed_merge_object.hpp

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,12 @@
77

88
namespace hocon {
99

10-
class config_delayed_merge_object : public config_object, public replaceable_merge_stack {
10+
class config_delayed_merge_object : public config_object, public unmergeable, public replaceable_merge_stack {
1111
public:
1212
config_delayed_merge_object(shared_origin origin, std::vector<shared_value> const& stack);
1313

14+
resolve_result<shared_value> resolve_substitutions(resolve_context const& context, resolve_source const& source) const override;
15+
std::vector<shared_value> unmerged_values() const override;
1416
shared_value make_replacement(resolve_context const& context, int skipping) const override;
1517

1618
shared_object with_value(path raw_path, shared_value value) const override;

lib/src/tokenizer.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ namespace hocon {
304304
utf[i] = _input->get();
305305
}
306306
original += string(utf);
307-
short character;
307+
unsigned short character;
308308
sscanf(utf, "%hx", &character);
309309
wchar_t buffer[] { static_cast<wchar_t>(character), '\0'};
310310
parsed += boost::nowide::narrow(buffer);

lib/src/values/config_delayed_merge_object.cc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#include <internal/values/config_delayed_merge_object.hpp>
22
#include <internal/values/config_delayed_merge.hpp>
33
#include <internal/values/simple_config_list.hpp>
4+
#include <internal/resolve_result.hpp>
45
#include <hocon/config_exception.hpp>
56
#include <leatherman/locale/locale.hpp>
67

@@ -28,6 +29,15 @@ namespace hocon {
2829
}
2930
}
3031

32+
resolve_result<shared_value> config_delayed_merge_object::resolve_substitutions(resolve_context const& context,
33+
resolve_source const& source) const {
34+
return config_delayed_merge::resolve_substitutions(dynamic_pointer_cast<const replaceable_merge_stack>(shared_from_this()), _stack, context, source);
35+
}
36+
37+
vector<shared_value> config_delayed_merge_object::unmerged_values() const {
38+
return _stack;
39+
}
40+
3141
shared_value config_delayed_merge_object::make_replacement(resolve_context const &context, int skipping) const {
3242
return config_delayed_merge::make_replacement(move(context), _stack, move(skipping));
3343
}

lib/src/values/config_value.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -164,7 +164,7 @@ namespace hocon {
164164

165165
config_value::no_exceptions_modifier::no_exceptions_modifier(string prefix): _prefix(std::move(prefix)) {}
166166

167-
shared_value config_value::no_exceptions_modifier::modify_child_may_throw(string key_or_null, shared_value v) {
167+
shared_value config_value::no_exceptions_modifier::modify_child_may_throw(string const& key_or_null, shared_value v) {
168168
try {
169169
return modify_child(key_or_null, v);
170170
} catch (runtime_error& e) {
@@ -174,7 +174,7 @@ namespace hocon {
174174
}
175175
}
176176

177-
shared_value config_value::no_exceptions_modifier::modify_child(string key, shared_value v) const {
177+
shared_value config_value::no_exceptions_modifier::modify_child(string const& key, shared_value v) const {
178178
return v->relativized(_prefix);
179179
}
180180

lib/src/values/simple_config_list.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ namespace hocon {
1919
struct simple_config_list::resolve_modifier : public modifier {
2020
resolve_modifier(resolve_context c, resolve_source s) : context(move(c)), source(move(s)) {}
2121

22-
shared_value modify_child_may_throw(string key, shared_value v) override
22+
shared_value modify_child_may_throw(string const& key, shared_value v) override
2323
{
2424
resolve_result<shared_value> result = context.resolve(v, source);
2525
context = result.context;

lib/src/values/simple_config_object.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ namespace hocon {
2323
resolve_modifier(resolve_context c, resolve_source s)
2424
: context(move(c)), source(move(s)), original_restrict(context.restrict_to_child()) {}
2525

26-
shared_value modify_child_may_throw(string key, shared_value v) override
26+
shared_value modify_child_may_throw(string const& key, shared_value v) override
2727
{
2828
if (context.is_restricted_to_child()) {
2929
if (key == *context.restrict_to_child().first()) {
3030
auto remainder = context.restrict_to_child().remainder();
3131

32-
if (remainder.empty()) {
32+
if (!remainder.empty()) {
3333
auto result = context.restrict(remainder).resolve(v, source);
3434
context = result.context.unrestricted().restrict(original_restrict);
3535
return result.value;

0 commit comments

Comments
 (0)