Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add release script. Change server name to use release version to buil… #162

Merged
merged 4 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -75,3 +75,9 @@ endif()
# Install Files
#####################################
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/crow_all.h DESTINATION include)

set(CPACK_GENERATOR "DEB")
set(CPACK_DEBIAN_PACKAGE_MAINTAINER "CrowCpp")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)

include(CPack)
5 changes: 3 additions & 2 deletions include/crow/app.h
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
#include <thread>
#include <condition_variable>

#include "crow/version.h"
#include "crow/settings.h"
#include "crow/logging.h"
#include "crow/utility.h"
Expand Down Expand Up @@ -120,7 +121,7 @@ namespace crow
return *this;
}

///Set the server name (default Crow/0.3)
///Set the server name
self_t& server_name(std::string server_name)
{
server_name_ = server_name;
Expand Down Expand Up @@ -360,7 +361,7 @@ namespace crow
private:
uint16_t port_ = 80;
uint16_t concurrency_ = 1;
std::string server_name_ = "Crow/0.3";
std::string server_name_ = std::string("Crow/") + VERSION;
std::string bindaddr_ = "0.0.0.0";
Router router_;

Expand Down
7 changes: 4 additions & 3 deletions include/crow/http_server.h
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

#include <memory>

#include "crow/version.h"
#include "crow/http_connection.h"
#include "crow/logging.h"
#include "crow/dumb_timer_queue.h"
Expand All @@ -26,7 +27,7 @@ namespace crow
class Server
{
public:
Server(Handler* handler, std::string bindaddr, uint16_t port, std::string server_name = "Crow/0.3", std::tuple<Middlewares...>* middlewares = nullptr, uint16_t concurrency = 1, typename Adaptor::context* adaptor_ctx = nullptr)
Server(Handler* handler, std::string bindaddr, uint16_t port, std::string server_name = std::string("Crow/") + VERSION, std::tuple<Middlewares...>* middlewares = nullptr, uint16_t concurrency = 1, typename Adaptor::context* adaptor_ctx = nullptr)
: acceptor_(io_service_, tcp::endpoint(boost::asio::ip::address::from_string(bindaddr), port)),
signals_(io_service_, SIGINT, SIGTERM),
tick_timer_(io_service_),
Expand Down Expand Up @@ -121,7 +122,7 @@ namespace crow
init_count ++;
while(1)
{
try
try
{
if (io_service_pool_[i]->run() == 0)
{
Expand All @@ -135,7 +136,7 @@ namespace crow
}
}));

if (tick_function_ && tick_interval_.count() > 0)
if (tick_function_ && tick_interval_.count() > 0)
{
tick_timer_.expires_from_now(boost::posix_time::milliseconds(tick_interval_.count()));
tick_timer_.async_wait([this](const boost::system::error_code& ec)
Expand Down
10 changes: 10 additions & 0 deletions include/crow/version.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
#pragma once

namespace crow {

#ifdef CROW_MAIN
constexpr char VERSION[] = "master";
#else
extern constexpr char VERSION[];
#endif
}
21 changes: 21 additions & 0 deletions scripts/release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
#!/bin/env python3
import os
import sys
import shutil

if len(sys.argv) != 2:
print("Usage: {} VERSION".format(sys.argv[0]))
sys.exit(1)

version = str(sys.argv[1])

releasePath = os.path.join(os.path.dirname(__file__), "..", "build_release")

if os.path.exists(releasePath):
shutil.rmtree(releasePath)

os.mkdir(releasePath)
os.chdir(releasePath)
os.system("cmake -DBUILD_EXAMPLES=OFF -DBUILD_TESTING=OFF -DCPACK_PACKAGE_FILE_NAME=\"crow-{}\" .. && make -j5".format(version))
os.system("sed -i 's/constexpr char VERSION\\[\\] = \"master\";/constexpr char VERSION\\[\\] = \"{}\";/g' crow_all.h".format(version))
os.system("cpack")
32 changes: 16 additions & 16 deletions vcpkg.json
Original file line number Diff line number Diff line change
@@ -1,37 +1,37 @@
{
"name": "crow-examples",
"version": "0.3",
"version": "master",
"dependencies": [
{
"name": "boost-array",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-algorithm",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-asio",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-date-time",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-functional",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-lexical-cast",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "boost-optional",
"version>=": "1.70.0"
"version>=": "1.70.0"
},
{
"name": "openssl-windows"
"name": "openssl-windows"
},
{
"name": "zlib"
Expand All @@ -40,31 +40,31 @@
"overrides": [
{
"name": "boost-array",
"version": "1.70.0"
"version": "1.70.0"
},
{
"name": "boost-algorithm",
"version": "1.70.0"
"version": "1.70.0"
},
{
"name": "boost-asio",
"version-semver": "1.70.0-2"
"version-semver": "1.70.0-2"
},
{
"name": "boost-date-time",
"version": "1.70.0"
"version": "1.70.0"
},
{
"name": "boost-functional",
"version": "1.70.0"
"version": "1.70.0"
},
{
"name": "boost-lexical-cast",
"version": "1.70.0"
"version": "1.70.0"
},
{
"name": "boost-optional",
"version": "1.70.0"
"version": "1.70.0"
}
],
"builtin-baseline": "44d94c2edbd44f0c01d66c2ad95eb6982a9a61bc"
Expand Down