diff --git a/.gitignore b/.gitignore index eb4de3d1..36564764 100644 --- a/.gitignore +++ b/.gitignore @@ -42,6 +42,7 @@ .ycm_extra_conf.pyc compile_commands.json Makefile +/__pycache__/ /deployment/windows/CoatiAppSetup/CoatiSetup/Debug /deployment/windows/CoatiAppSetup/CoatiSetup/Release diff --git a/script/build.sh b/script/build.sh index 15345453..a8234a89 100755 --- a/script/build.sh +++ b/script/build.sh @@ -3,11 +3,16 @@ # Determine path to script MY_PATH=`dirname "$0"` +# build target $MY_PATH/buildonly.sh $@ +if [ $? -ne 0 ] +then + exit 1; +fi cd $MY_PATH/.. -# Build and run target +# run target if [ "$1" = "release" ] || [ "$1" = "r" ] then @@ -38,7 +43,7 @@ then elif [ "$2" = "keygen" ] then #echo "debug keygen" - cd bin/license_generator && Debug/Coati_license_generator_d + cd bin/license_generator && Debug/Coati_license_generator else #echo "debug app" cd bin/app && Debug/Coati diff --git a/script/setup.sh b/script/setup.sh index 768f467e..74d1060c 100755 --- a/script/setup.sh +++ b/script/setup.sh @@ -55,8 +55,11 @@ if [ $PLATFORM == "Windows" ]; then cmd //c 'mklink /d /j '.$MY_PATH.'\..\bin\app\Release\user '.$MY_PATH.'\..\bin\app\user' & elif [ $PLATFORM == "Linux" ]; then echo -e $INFO "create symbolic links for data" - ln -sr bin/app/data bin/app/Release/data - ln -sr bin/app/data bin/app/Debug/data + cd bin/app/Release + ln -s ../data data + cd ../Debug + ln -s ../data data + cd ../../.. fi # Setup both Debug and Release configuration diff --git a/src/app/CMakeLists.txt b/src/app/CMakeLists.txt index 04a296da..d8a4c88a 100644 --- a/src/app/CMakeLists.txt +++ b/src/app/CMakeLists.txt @@ -6,15 +6,10 @@ add_files( utility/commandline/CommandLineParser.cpp utility/commandline/CommandLineParser.h - utility/headerSearch/ClangDetector.cpp - utility/headerSearch/ClangDetector.h - utility/headerSearch/CompilerDetectorBase.cpp - utility/headerSearch/CompilerDetectorBase.h + utility/headerSearch/CompilerDetector.cpp + utility/headerSearch/CompilerDetector.h utility/headerSearch/DetectorBase.cpp utility/headerSearch/DetectorBase.h - utility/headerSearch/DetectorProxy.h - utility/headerSearch/GCCDetector.cpp - utility/headerSearch/GCCDetector.h utility/headerSearch/StandardHeaderDetection.cpp utility/headerSearch/StandardHeaderDetection.h utility/headerSearch/VisualStudioDetector.cpp diff --git a/src/app/utility/headerSearch/ClangDetector.cpp b/src/app/utility/headerSearch/ClangDetector.cpp deleted file mode 100644 index e69de29b..00000000 diff --git a/src/app/utility/headerSearch/ClangDetector.h b/src/app/utility/headerSearch/ClangDetector.h deleted file mode 100644 index b8c32048..00000000 --- a/src/app/utility/headerSearch/ClangDetector.h +++ /dev/null @@ -1,7 +0,0 @@ -#ifndef CLANG_DETECTOR_H -#define CLANG_DETECTOR_H - - - -#endif /* end of include guard: CLANG_DETECTOR_H */ - diff --git a/src/app/utility/headerSearch/CompilerDetectorBase.cpp b/src/app/utility/headerSearch/CompilerDetector.cpp similarity index 68% rename from src/app/utility/headerSearch/CompilerDetectorBase.cpp rename to src/app/utility/headerSearch/CompilerDetector.cpp index 77aba3b9..f0836d3d 100644 --- a/src/app/utility/headerSearch/CompilerDetectorBase.cpp +++ b/src/app/utility/headerSearch/CompilerDetector.cpp @@ -1,9 +1,18 @@ -#include "utility/headerSearch/CompilerDetectorBase.h" +#include "utility/headerSearch/CompilerDetector.h" #include "utility/utilityApp.h" #include "utility/utilityString.h" -std::vector CompilerDetectorBase::getStandardHeaderPaths() +CompilerDetector::CompilerDetector(const std::string& name) + : DetectorBase(name) +{ +} + +CompilerDetector::~CompilerDetector() +{ +} + +std::vector CompilerDetector::getStandardHeaderPaths() { std::string command = m_name + " -x c++ -v -E /dev/null"; std::string clangOutput = utility::executeProcess(command.c_str()); diff --git a/src/app/utility/headerSearch/CompilerDetector.h b/src/app/utility/headerSearch/CompilerDetector.h new file mode 100644 index 00000000..97a2e63b --- /dev/null +++ b/src/app/utility/headerSearch/CompilerDetector.h @@ -0,0 +1,20 @@ +#ifndef COMPILER_DETECTOR_H +#define COMPILER_DETECTOR_H + +#include "utility/headerSearch/DetectorBase.h" +#include "utility/headerSearch/StandardHeaderDetection.h" + +class CompilerDetector : public DetectorBase +{ +public: + CompilerDetector(const std::string& name); + virtual ~CompilerDetector(); + virtual std::vector getStandardHeaderPaths(); +private: +}; + +static StandardHeaderDetection::Add gcc("gcc"); +static StandardHeaderDetection::Add clang("clang"); +static StandardHeaderDetection::Add fakecomplier("fakecompiler"); + +#endif // COMPILER_DETECTOR_H diff --git a/src/app/utility/headerSearch/CompilerDetectorBase.h b/src/app/utility/headerSearch/CompilerDetectorBase.h deleted file mode 100644 index 7aed74d1..00000000 --- a/src/app/utility/headerSearch/CompilerDetectorBase.h +++ /dev/null @@ -1,13 +0,0 @@ -#ifndef COMPILER_DETECTOR_BASE_H -#define COMPILER_DETECTOR_BASE_H - -#include "utility/headerSearch/DetectorBase.h" - -class CompilerDetectorBase : public DetectorBase -{ -public: - virtual std::vector getStandardHeaderPaths(); -private: -}; - -#endif // COMPILER_DETECTOR_BASE_H diff --git a/src/app/utility/headerSearch/DetectorBase.cpp b/src/app/utility/headerSearch/DetectorBase.cpp index ebc912b8..01029dc3 100644 --- a/src/app/utility/headerSearch/DetectorBase.cpp +++ b/src/app/utility/headerSearch/DetectorBase.cpp @@ -2,6 +2,11 @@ #include +DetectorBase::DetectorBase(const std::string name) +{ + setName(name); +} + bool DetectorBase::detect() { return !getStandardHeaderPaths().empty(); @@ -14,10 +19,8 @@ std::string DetectorBase::getName() const void DetectorBase::setName(const std::string& name) { - std::cout << "setName()" << std::endl; if (!name.empty()) { - std::cout << "name set to " << name << std::endl; m_name = name; } } diff --git a/src/app/utility/headerSearch/DetectorBase.h b/src/app/utility/headerSearch/DetectorBase.h index dd3c04bb..e8e92082 100644 --- a/src/app/utility/headerSearch/DetectorBase.h +++ b/src/app/utility/headerSearch/DetectorBase.h @@ -7,6 +7,7 @@ class DetectorBase { public: + DetectorBase(const std::string name); virtual ~DetectorBase(){}; virtual bool detect(); virtual std::vector getStandardHeaderPaths() = 0; diff --git a/src/app/utility/headerSearch/GCCDetector.cpp b/src/app/utility/headerSearch/GCCDetector.cpp deleted file mode 100644 index 2a76e486..00000000 --- a/src/app/utility/headerSearch/GCCDetector.cpp +++ /dev/null @@ -1,16 +0,0 @@ -#include "utility/headerSearch/GCCDetector.h" -#include "utility/headerSearch/StandardHeaderDetection.h" - -GCCDetector::GCCDetector() -{ - -} - -GCCDetector::~GCCDetector() -{ -} - -static StandardHeaderDetection::Add gcc("gcc"); -static StandardHeaderDetection::Add clang("clang"); -static StandardHeaderDetection::Add fakecomplier("fakecompiler"); - diff --git a/src/app/utility/headerSearch/GCCDetector.h b/src/app/utility/headerSearch/GCCDetector.h deleted file mode 100644 index 766cc6f8..00000000 --- a/src/app/utility/headerSearch/GCCDetector.h +++ /dev/null @@ -1,15 +0,0 @@ -#ifndef GCC_DETECTOR_H -#define GCC_DETECTOR_H - -#include "utility/headerSearch/CompilerDetectorBase.h" - -class GCCDetector : public CompilerDetectorBase -{ -public: - GCCDetector (); - virtual ~GCCDetector (); -private: -}; - - -#endif // GCC_DETECTOR_H diff --git a/src/app/utility/headerSearch/StandardHeaderDetection.cpp b/src/app/utility/headerSearch/StandardHeaderDetection.cpp index 33ab2af2..a7844cf6 100644 --- a/src/app/utility/headerSearch/StandardHeaderDetection.cpp +++ b/src/app/utility/headerSearch/StandardHeaderDetection.cpp @@ -12,6 +12,13 @@ #include "utility/utilityApp.h" #include "utility/utilityString.h" +#include "clang/Driver/ToolChain.h" +#include "clang/Driver/Options.h" +#include "clang/Driver/Tool.h" +#include "clang/Driver/DriverDiagnostic.h" + +typedef std::pair> DetectorPair; + DetectorMap* StandardHeaderDetection::s_availableDetectors; StandardHeaderDetection::StandardHeaderDetection() @@ -29,7 +36,7 @@ StandardHeaderDetection::~StandardHeaderDetection() void StandardHeaderDetection::detectHeaders() { - for ( std::pair> detector : *s_availableDetectors) + for ( DetectorPair detector : *s_availableDetectors) { if ( detector.second->detect() ) { @@ -41,7 +48,7 @@ void StandardHeaderDetection::detectHeaders() std::vector StandardHeaderDetection::getDetectedCompilers() { std::vector v; - for ( std::pair> detector : m_detectedCompilers) + for ( DetectorPair detector : m_detectedCompilers) { v.push_back(detector.first); } @@ -72,7 +79,7 @@ void StandardHeaderDetection::printAvailableDetectors() { std::cout << "printAvailableDetectors: " << std::endl; - for ( std::pair> detector : *s_availableDetectors) + for ( DetectorPair detector : *s_availableDetectors) { std::cout << detector.first << std::endl; } diff --git a/src/app/utility/headerSearch/StandardHeaderDetection.h b/src/app/utility/headerSearch/StandardHeaderDetection.h index a7031f46..ab1b1aff 100644 --- a/src/app/utility/headerSearch/StandardHeaderDetection.h +++ b/src/app/utility/headerSearch/StandardHeaderDetection.h @@ -33,11 +33,7 @@ public: public: Add(const std::string& name) { - std::shared_ptr detector = std::shared_ptr(new U()); - if (!name.empty()) - { - detector->setName(name); - } + std::shared_ptr detector = std::shared_ptr(new U(name)); if (!s_availableDetectors) { s_availableDetectors = new DetectorMap(); diff --git a/src/app/utility/headerSearch/VisualStudioDetector.cpp b/src/app/utility/headerSearch/VisualStudioDetector.cpp index b2895463..6275fa28 100644 --- a/src/app/utility/headerSearch/VisualStudioDetector.cpp +++ b/src/app/utility/headerSearch/VisualStudioDetector.cpp @@ -7,11 +7,21 @@ #include "utility/logging/logging.h" #include "utility/headerSearch/StandardHeaderDetection.h" +VisualStudioDetector::VisualStudioDetector(const std::string name) + : DetectorBase(name) +{ +} + VisualStudioDetector::~VisualStudioDetector() { } +std::string VisualStudioDetector::getFullName() +{ + +} + std::vector VisualStudioDetector::getStandardHeaderPaths() { QSettings registry; @@ -30,6 +40,24 @@ std::vector VisualStudioDetector::getStandardHeaderPaths() return path; } +std::string getInstallDir(const std::string RegistryKey) +{ + + return ""; +} + +bool searchForExpress() +{ + + return false; +} + +bool searchForStandard() +{ + + return false; +} + // Add Visual Studio Version to the available detectors static StandardHeaderDetection::Add vs2015("VS140"); static StandardHeaderDetection::Add vs2013("VS120"); diff --git a/src/app/utility/headerSearch/VisualStudioDetector.h b/src/app/utility/headerSearch/VisualStudioDetector.h index 91a0f9d3..178bac30 100644 --- a/src/app/utility/headerSearch/VisualStudioDetector.h +++ b/src/app/utility/headerSearch/VisualStudioDetector.h @@ -9,8 +9,12 @@ class FilePath; class VisualStudioDetector : public DetectorBase { public: + VisualStudioDetector(const std::string name = "VS140"); virtual ~VisualStudioDetector(); virtual std::vector getStandardHeaderPaths(); +private: + std::string getFullName(); + }; #endif // VISUAL_STUDIO_DETECTOR_H diff --git a/src/lib_license/License.cpp b/src/lib_license/License.cpp index 3c2732b8..ac02e123 100644 --- a/src/lib_license/License.cpp +++ b/src/lib_license/License.cpp @@ -80,11 +80,11 @@ int License::getTimeLeft() const ); boost::gregorian::date today = boost::gregorian::day_clock::local_day(); boost::gregorian::days daysLeft = expireDate - today; - return (daysLeft.days() < 0 ? 0 : daysLeft.days()); + return (daysLeft.days() < 0 ? -1 : daysLeft.days()); } else { - return -1; + return -2; } } @@ -231,6 +231,10 @@ bool License::isValid() const } const bool ok = verifier.check_signature(sig); + if (isExpired()) + { + return false; + } return ok; } catch(...) @@ -242,7 +246,7 @@ bool License::isValid() const bool License::isExpired() const { - return !getTimeLeft(); + return (getTimeLeft()==-1); } std::string License::getPublicKeyFilename() const diff --git a/src/lib_license/License.h b/src/lib_license/License.h index 5eb4b9d1..4e1b3ba3 100644 --- a/src/lib_license/License.h +++ b/src/lib_license/License.h @@ -28,7 +28,8 @@ public: std::string getPublicKeyFilename() const; std::string getVersion() const; - /// if Test License return >=0 else -1 + /// if Test License return >=0 or -1 if expired + /// for non Test License -2 int getTimeLeft() const; void create(