build: Upgrade waf to version 2.0.6
This commit also includes:
- cleanup of build scripts
- replacing log4cxx with ndn-cxx logging facility
Change-Id: I96fd673a3cd2e06061e9efc1a7891e41cf97ea4f
diff --git a/tools/ndns-add-rr.cpp b/tools/ndns-add-rr.cpp
index b6f105c..0e664b6 100644
--- a/tools/ndns-add-rr.cpp
+++ b/tools/ndns-add-rr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -30,7 +30,7 @@
#include <string>
-NDNS_LOG_INIT("AddRrTool")
+NDNS_LOG_INIT(AddRrTool);
int
main(int argc, char* argv[])
@@ -39,7 +39,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
int ttlInt = -1;
int versionInt = -1;
string zoneStr;
diff --git a/tools/ndns-create-zone.cpp b/tools/ndns-create-zone.cpp
index a30875f..d477d4b 100644
--- a/tools/ndns-create-zone.cpp
+++ b/tools/ndns-create-zone.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -26,14 +26,13 @@
#include <boost/filesystem.hpp>
#include <string>
-NDNS_LOG_INIT("NdnsCreateZone")
+NDNS_LOG_INIT(NdnsCreateZone);
int
main(int argc, char* argv[])
{
using std::string;
using namespace ndn;
- ndn::ndns::log::init();
int cacheTtlInt = -1;
int certTtlInt = -1;
string zoneStr;
diff --git a/tools/ndns-daemon.cpp b/tools/ndns-daemon.cpp
index 9b80431..6f5f4f1 100644
--- a/tools/ndns-daemon.cpp
+++ b/tools/ndns-daemon.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -30,7 +30,7 @@
namespace ndn {
namespace ndns {
-NDNS_LOG_INIT("NdnsDaemon")
+NDNS_LOG_INIT(NdnsDaemon);
/**
* @brief Name Server Daemon
@@ -158,7 +158,6 @@
using ndn::ndns::ConfigFile;
using namespace ndn::ndns;
- ndn::ndns::log::init();
string configFile = DEFAULT_CONFIG_PATH "/" "ndns.conf";
try {
diff --git a/tools/ndns-delete-zone.cpp b/tools/ndns-delete-zone.cpp
index 254bf22..f08d020 100644
--- a/tools/ndns-delete-zone.cpp
+++ b/tools/ndns-delete-zone.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -29,7 +29,6 @@
{
using std::string;
using namespace ndn;
- ndn::ndns::log::init();
string zoneStr;
string db;
try {
diff --git a/tools/ndns-dig.cpp b/tools/ndns-dig.cpp
index 888138b..3f533a7 100644
--- a/tools/ndns-dig.cpp
+++ b/tools/ndns-dig.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -37,7 +37,7 @@
#include <string>
#include <fstream>
-NDNS_LOG_INIT("NdnsDig")
+NDNS_LOG_INIT(Dig);
namespace ndn {
namespace ndns {
@@ -220,7 +220,6 @@
int
main(int argc, char* argv[])
{
- ndn::ndns::log::init();
using std::string;
using namespace ndn;
diff --git a/tools/ndns-export-certificate.cpp b/tools/ndns-export-certificate.cpp
index 99f68cd..6e49328 100644
--- a/tools/ndns-export-certificate.cpp
+++ b/tools/ndns-export-certificate.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -31,7 +31,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
string certStr;
string db;
string output = "-";
diff --git a/tools/ndns-get-rr.cpp b/tools/ndns-get-rr.cpp
index 2f7e03f..1cdbdbd 100644
--- a/tools/ndns-get-rr.cpp
+++ b/tools/ndns-get-rr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -31,7 +31,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
string zoneStr;
string db;
string rrLabelStr;
diff --git a/tools/ndns-list-all-zones.cpp b/tools/ndns-list-all-zones.cpp
index e00d258..126cbed 100644
--- a/tools/ndns-list-all-zones.cpp
+++ b/tools/ndns-list-all-zones.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -32,7 +32,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
string zoneStr;
string db;
try {
diff --git a/tools/ndns-list-zone.cpp b/tools/ndns-list-zone.cpp
index 487e99d..d6738f5 100644
--- a/tools/ndns-list-zone.cpp
+++ b/tools/ndns-list-zone.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -32,7 +32,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
string zoneStr;
string db;
bool printRaw = false;
diff --git a/tools/ndns-remove-rr.cpp b/tools/ndns-remove-rr.cpp
index fe4730c..cdaf846 100644
--- a/tools/ndns-remove-rr.cpp
+++ b/tools/ndns-remove-rr.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -31,7 +31,6 @@
using namespace ndn;
using namespace ndns;
- ndn::ndns::log::init();
string zoneStr;
string db;
string rrLabelStr;
diff --git a/tools/ndns-update.cpp b/tools/ndns-update.cpp
index ff75417..2a454f8 100644
--- a/tools/ndns-update.cpp
+++ b/tools/ndns-update.cpp
@@ -1,6 +1,6 @@
/* -*- Mode:C++; c-file-style:"gnu"; indent-tabs-mode:nil; -*- */
/*
- * Copyright (c) 2014-2017, Regents of the University of California.
+ * Copyright (c) 2014-2018, Regents of the University of California.
*
* This file is part of NDNS (Named Data Networking Domain Name Service).
* See AUTHORS.md for complete list of NDNS authors and contributors.
@@ -46,7 +46,7 @@
namespace ndn {
namespace ndns {
-NDNS_LOG_INIT("NdnsUpdate")
+NDNS_LOG_INIT(NdnsUpdate);
class NdnsUpdate : noncopyable
{
@@ -204,7 +204,6 @@
int
main(int argc, char* argv[])
{
- ndn::ndns::log::init();
using std::string;
using namespace ndn;
using namespace ndn::ndns;
diff --git a/tools/wscript b/tools/wscript
index 7561edb..a7cb43f 100644
--- a/tools/wscript
+++ b/tools/wscript
@@ -5,18 +5,45 @@
top = '..'
def build(bld):
- for app in bld.path.ant_glob('**/*', dir=True):
- if os.path.isdir(app.abspath()):
- bld(features=['cxx', 'cxxprogram'],
- target = '../bin/%s' % app.path_from(bld.path),
- source = app.ant_glob(['**/*.cpp']),
- use = 'ndns-objects',
- )
+ # Single object tools:
+ # tools/example-tool.cpp is a self-contained tool with a main() function
+ # and is built as build/bin/example-tool.
+ # These tools cannot be unit-tested.
+ for tool in bld.path.ant_glob('*.cpp'):
+ name = tool.change_ext('').path_from(bld.path.get_bld())
+ bld.program(name=name,
+ target='../bin/%s' % name,
+ source=[tool],
+ use='ndns-objects')
- for app in bld.path.ant_glob('**/*.cpp'):
- name = app.path_from(bld.path)[:-len(".cpp")]
- bld(features=['cxx', 'cxxprogram'],
- target = '../bin/%s' % name,
- source = app,
- use = 'ndns-objects',
- )
+ # Sub-directory tools:
+ # tools/example-tool/**/*.cpp is compiled and linked into build/bin/example-tool.
+ # tools/example-tool/main.cpp must exist and must contain the main() function.
+ # All other objects are collected into 'tools-objects' and can be unit-tested.
+ testableObjects = []
+ for subdir in bld.path.ant_glob('*', dir=True, src=False):
+ mainFile = subdir.find_node('main.cpp')
+ if mainFile is None:
+ continue # not a C++ tool
+
+ name = subdir.path_from(bld.path)
+ srcFiles = subdir.ant_glob('**/*.cpp', excl=['main.cpp'])
+ srcObjects = ''
+ if srcFiles:
+ srcObjects = 'tools-%s-objects' % name
+ bld.objects(target=srcObjects,
+ source=srcFiles,
+ use='ndn-cxx',
+ includes=name)
+ testableObjects.append(srcObjects)
+
+ bld.program(name=name,
+ target='../bin/%s' % name,
+ source=[mainFile],
+ use='ndns-objects ' + srcObjects,
+ includes=name)
+
+ bld.objects(target='tools-objects',
+ source=[],
+ export_includes='.',
+ use=testableObjects)