Skip to content

Commit

Permalink
add v8pp::version() function to return the library version string
Browse files Browse the repository at this point in the history
Updated version to 1.7.0 in `package.json`, glob `*.cpp` files into the NPM package.
Print both V8 and v8pp versions in the test runner if `--version` command-line
option was supplied.
  • Loading branch information
pmed committed May 3, 2020
1 parent 0f09588 commit 94308b4
Show file tree
Hide file tree
Showing 7 changed files with 49 additions and 2 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "v8pp",
"version": "1.6.0",
"version": "1.7.0",
"description": "C++ bindings for V8",
"keywords": [ "V8", "native", "addon", "module", "bindings" ],
"engines": { "node": ">=8.0.0" },
Expand All @@ -10,7 +10,7 @@
"license": "BSL-1.0",
"bugs": { "url": "https://github.com/pmed/v8pp/issues" },
"homepage": "https://github.com/pmed/v8pp#readme",
"files": ["docs", "examples", "v8pp/*.hpp", "v8pp/*.ipp", "include_dirs.js",
"files": ["docs", "examples", "v8pp/*.hpp", "v8pp/*.ipp", "v8pp/*.cpp", "include_dirs.js",
"COPYING", "LICENSE_1_0.txt", "README.md"
]
}
2 changes: 2 additions & 0 deletions test/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#include <libplatform/libplatform.h>

#include "v8pp/context.hpp"
#include "v8pp/version.hpp"

void run_tests()
{
Expand Down Expand Up @@ -93,6 +94,7 @@ int main(int argc, char const * argv[])
else if (arg == "-v" || arg == "--version")
{
std::cout << "V8 version " << v8::V8::GetVersion() << std::endl;
std::cout << "v8pp version " << v8pp::version() << std::endl;
}
else if (arg == "--lib-path")
{
Expand Down
3 changes: 3 additions & 0 deletions v8pp/v8pp.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
<ClCompile Include="convert.cpp" />
<ClCompile Include="json.cpp" />
<ClCompile Include="throw_ex.cpp" />
<ClCompile Include="version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="call_from_v8.hpp" />
Expand All @@ -50,12 +51,14 @@
<ClInclude Include="ptr_traits.hpp" />
<ClInclude Include="throw_ex.hpp" />
<ClInclude Include="utility.hpp" />
<ClInclude Include="version.hpp" />
</ItemGroup>
<ItemGroup>
<None Include="class.ipp" />
<None Include="json.ipp" />
<None Include="packages.config" />
<None Include="throw_ex.ipp" />
<None Include="version.ipp" />
</ItemGroup>
<PropertyGroup Label="Globals">
<ProjectGuid>{2E6CFC3D-5A08-4909-8D1A-3469063D169B}</ProjectGuid>
Expand Down
3 changes: 3 additions & 0 deletions v8pp/v8pp.vcxproj.filters
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ClCompile Include="class.cpp" />
<ClCompile Include="throw_ex.cpp" />
<ClCompile Include="convert.cpp" />
<ClCompile Include="version.cpp" />
</ItemGroup>
<ItemGroup>
<ClInclude Include="context.hpp" />
Expand All @@ -24,9 +25,11 @@
<ClInclude Include="json.hpp" />
<ClInclude Include="ptr_traits.hpp" />
<ClInclude Include="persistent.hpp" />
<ClInclude Include="version.hpp" />
<ClInclude Include="class.ipp" />
<ClInclude Include="json.ipp" />
<ClInclude Include="throw_ex.ipp" />
<ClInclude Include="version.ipp" />
</ItemGroup>
<ItemGroup>
<None Include="packages.config" />
Expand Down
5 changes: 5 additions & 0 deletions v8pp/version.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#include "v8pp/version.hpp"

#if !V8PP_HEADER_ONLY
#include "v8pp/version.ipp"
#endif
24 changes: 24 additions & 0 deletions v8pp/version.hpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
//
// Copyright (c) 2013-2016 Pavel Medvedev. All rights reserved.
//
// This file is part of v8pp (https://github.com/pmed/v8pp) project.
//
// Distributed under the Boost Software License, Version 1.0. (See accompanying
// file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
//
#ifndef V8PP_VERSION_HPP_INCLUDED
#define V8PP_VERSION_HPP_INCLUDED

#include "v8pp/config.hpp"

namespace v8pp {

char const* version();

}

#if V8PP_HEADER_ONLY
#include "v8pp/version.ipp"
#endif

#endif // V8PP_VERSION_HPP_INCLUDED
10 changes: 10 additions & 0 deletions v8pp/version.ipp
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#include "v8pp/version.hpp"

namespace v8pp {

V8PP_IMPL char const* version()
{
return "1.7.0";
}

} // namespace v8pp

0 comments on commit 94308b4

Please sign in to comment.