Skip to content

Commit

Permalink
Set remaken version to 1.7.2. Default qmake rules installed are set t…
Browse files Browse the repository at this point in the history
…o 4.6.3.

feat[nsis] : install curl during remaken setup on Windows
fix[issue #7]: Inconsistency in CLI parser for linux support
fix[issue #8]: Misleading error message for unknown dependency: "Unknown repository type"
fix[issue #10]: Handling of trailing pipe for empty options of conan dependencies with remaken bundle
fix[github-ssl-beast]: handle shutdown protocol weird behavior for beast
feat[comment]: ignore commented lines from packagedependencies*.txt (commented line starts with // )
feat[info command]: add package information command : lists the dependency graph of an installed package from its packagedependencies file.
feat[force]: add force option to force installation, rules initialization (allows to force reinstallation of rules) - use it with override flag to silently replace every file
 fix[github ssl issue]: replace beast http download with curl - ssl protocol finalization has some issues using beast (handling errors correctly doesn't address the ssl layer close latency issue)
  • Loading branch information
Firefly35 committed Mar 2, 2021
2 parents 52b5bda + bf8d84f commit 648ec9c
Show file tree
Hide file tree
Showing 17 changed files with 285 additions and 62 deletions.
2 changes: 1 addition & 1 deletion packagedependencies.txt
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
boost|1.71.0|boost|conan|conan-center|default|zlib=False#bzip2=False
boost|1.74.0|boost|conan|conan-center|default|zlib=False#bzip2=False
openssl|1.1.1f|openssl|conan|conan-center
9 changes: 7 additions & 2 deletions remaken.pro
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
TARGET = remaken
VERSION=1.7.1
VERSION=1.7.2

CONFIG += c++1z
CONFIG += console
Expand Down Expand Up @@ -40,6 +40,7 @@ HEADERS += \
src/Constants.h \
src/Cache.h \
src/AbstractCommand.h \
src/InfoCommand.h \
src/InitCommand.h \
src/InstallCommand.h \
src/PathBuilder.h \
Expand Down Expand Up @@ -67,6 +68,7 @@ HEADERS += \
SOURCES += \
src/BundleXpcfCommand.cpp \
src/CleanCommand.cpp \
src/InfoCommand.cpp \
src/InitCommand.cpp \
src/PathBuilder.cpp \
src/ProfileCommand.cpp \
Expand Down Expand Up @@ -108,11 +110,14 @@ linux {
}

macx {
DEFINES += _MACOS_TARGET_
QMAKE_MAC_SDK= macosx
QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.15
QMAKE_CXXFLAGS += -fasm-blocks -x objective-c++ -std=c++17
#LIBS += -L/usr/lib -lz -lssl -lcrypto -L/usr/local/lib -lZipper-static
#Zipper dependency : https://github.com/sebastiandev/zipper
LIBS += -L/usr/local/lib -lz -lZipper-static -lboost_system
LIBS += -L/usr/local/lib -lboost_system -lstdc++
QMAKE_LFLAGS += -mmacosx-version-min=10.15 -v -lstdc++
INCLUDEPATH += /usr/local/include
}

Expand Down
9 changes: 9 additions & 0 deletions resources/install_remaken_3rdparties.nsh
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,13 @@ SectionGroup /e "Chocolatey" CHOCO_TOOLS
ExecWait '$1\ProgramData\Chocolatey\choco install -yr --acceptlicense --no-progress 7zip'
sevenz_exists:
SectionEnd

Section "Curl" CHOCO_TOOLS_CURL
IfFileExists "$1\ProgramData\chocolatey\bin\curl.exe" curl_exists
ExecWait '$1\ProgramData\Chocolatey\choco install -yr --acceptlicense --no-progress curl'
curl_exists:
SectionEnd

Section "Conan (with python/pip)" CONAN
StrCpy $python_install_dir $1\Python37 ; default dir
ReadRegStr $0 HKLM "SOFTWARE\Python\PythonCore\3.7\InstallPath" ""
Expand Down Expand Up @@ -152,6 +159,7 @@ Function CustomizeOnInit
SectionSetFlags ${REMAKEN_APP} 17 ; selected and ReadOnly
SectionSetFlags ${CHOCO_TOOLS} 51 ; selected, ReadOnly and expanded
SectionSetFlags ${CHOCO_TOOLS_7ZIP} 17
SectionSetFlags ${CHOCO_TOOLS_CURL} 17

; manage custom REMAKEN_PKG_ROOT
SetRegView 64
Expand All @@ -175,6 +183,7 @@ FunctionEnd
!insertmacro MUI_DESCRIPTION_TEXT ${REMAKEN_APP} "Install Remaken Tool"
!insertmacro MUI_DESCRIPTION_TEXT ${CHOCO_TOOLS} "Remaken use Chocolatey as system install tool"
!insertmacro MUI_DESCRIPTION_TEXT ${CHOCO_TOOLS_7ZIP} "Remaken use 7zip as system file compression/extraction tool"
!insertmacro MUI_DESCRIPTION_TEXT ${CHOCO_TOOLS_CURL} "Remaken use Curl as system file download tool"
!insertmacro MUI_DESCRIPTION_TEXT ${CONAN} "Remaken can use Conan dependencies (Conan will be installed with Python and Pip also installed)"
!insertmacro MUI_DESCRIPTION_TEXT ${CHOCO_TOOLS_PKG_CONFIG} "Remaken provides its own C++ packaging structure, based on pkg-config description files (pkg-config will be installed with Choco)"
!insertmacro MUI_DESCRIPTION_TEXT ${CHOCO_TOOLS_CMAKE} "Conan can uses CMake for build packages (CMake will be installed with Choco)"
Expand Down
15 changes: 14 additions & 1 deletion src/AsioWrapper.h
Original file line number Diff line number Diff line change
Expand Up @@ -246,11 +246,24 @@ void AsioStreamWrapper<Q,R>::shutdown()
{
boost::system::error_code ec;
m_comLayer.shutdown(ec);
int reason = ERR_GET_REASON(ec.value());
if (((ec.category() == boost::asio::error::get_ssl_category()) || (ec.category() == boost::asio::ssl::error::get_stream_category()))
&& (reason == ssl::error::stream_truncated))
{
// Remote peer failed to send a close_notify message.
ec = {};
// m_comLayer.lowest_layer().close();
}

if(ec == boost::asio::error::operation_aborted)
{
ec = {};
}
if(ec == boost::asio::error::eof)
{
// Rationale:
// http://stackoverflow.com/questions/25587403/boost-asio-ssl-async-shutdown-always-finishes-with-an-error
ec.assign(0, ec.category());
ec = {};
}
if(ec)
throw boost::system::system_error{ec};
Expand Down
76 changes: 48 additions & 28 deletions src/CmdOptions.cpp
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,31 @@ std::string computeToolChain()
}


static const map<std::string,std::vector<std::string>> validationMap ={{"action",{"info","init","install","parse","version","bundle","bundleXpcf"}},
{"--architecture",{"x86_64","i386","arm","arm64","arm64-v8a","armeabi-v7a","armv6","armv7","armv7hf","armv8"}},
{"--config",{"release","debug"}},
{"--mode",{"shared","static"}},
{"--type",{"github","artifactory","nexus","path"}},
{"--alternate-remote-type",{"github","artifactory","nexus","path"}},
{"--operating-system",{"mac","win","unix","android","ios","linux"}},
{"--cpp-std",{"11","14","17","20"}}
};


std::string CmdOptions::getOptionString(const std::string & optionName)
{
std::string out = "";
if ( mapContains(validationMap,optionName) ) {
for ( auto & value: validationMap.at(optionName) ) {
if (!out.empty()) {
out += ", ";
}
out += value;
}
}
return out;
}

CmdOptions::CmdOptions()
{
fs::detail::utf8_codecvt_facet utf8;
Expand Down Expand Up @@ -87,20 +112,23 @@ CmdOptions::CmdOptions()
m_cliApp.set_config("--configfile",configPath.generic_string(utf8),"remaken configuration file to read");

m_config = "release";
m_cliApp.add_option("--config,-c", m_config, "Config: release, debug", true);
m_cliApp.add_option("--config,-c", m_config, "Config: " + getOptionString("--config"), true);
m_cppVersion = "11";
m_cliApp.add_option("--cpp-std",m_cppVersion, "c++ standard version: 11, 14, 17, 20 ...", true);
m_cliApp.add_option("--cpp-std",m_cppVersion, "c++ standard version: " + getOptionString("--cpp-std"), true);
m_remakenRoot = remakenRootPath.generic_string(utf8);
m_cliApp.add_option("--remaken-root,-r", m_remakenRoot, "Remaken root directory", true);
m_toolchain = computeToolChain();
m_cliApp.add_option("--build-toolchain,-b", m_toolchain, "Build toolchain: clang, clang-version, "
"gcc-version, cl-version .. ex: cl-14.1", true);
m_os = computeOS();
m_cliApp.add_option("--operating-system,-o", m_os, "Operating system: mac, win, unix, ios, android", true);
m_cliApp.add_option("--operating-system,-o", m_os, "Operating system: " + getOptionString("--operating-system"), true);
m_architecture = "x86_64";
m_cliApp.add_option("--architecture,-a",m_architecture, "Architecture: x86_64, i386, arm, arm64, arm64-v8a, armeabi-v7a, armv6, armv7, armv7hf, armv8",true);
m_cliApp.add_option("--architecture,-a",m_architecture, "Architecture: " + getOptionString("--architecture"),true);
m_cliApp.add_flag("--force,-f", m_force, "force command execution : ignore cache entries, already installed files ...");
m_verbose = false;
m_cliApp.add_flag("--verbose,-v", m_verbose, "verbose mode");
m_override = false;
m_cliApp.add_flag("--override,-e", m_override, "override existing files while (re)-installing packages/rules...");
m_dependenciesFile = "packagedependencies.txt";

CLI::App * bundleCommand = m_cliApp.add_subcommand("bundle","copy shared libraries dependencies to a destination folder");
Expand All @@ -114,53 +142,45 @@ CmdOptions::CmdOptions()
"copied with their dependencies", true);
bundleXpcfCommand->add_option("file", m_dependenciesFile, "XPCF xml module declaration file")->required();

CLI::App * cleanCommand = m_cliApp.add_subcommand("clean","WARNING : remove every remaken installed packages");
CLI::App * cleanCommand = m_cliApp.add_subcommand("clean", "WARNING : remove every remaken installed packages");

CLI::App * infoCommand = m_cliApp.add_subcommand("info", "Read package dependencies informations");
infoCommand->add_option("file", m_dependenciesFile, "Remaken dependencies files", true);

CLI::App * profileCommand = m_cliApp.add_subcommand("profile","manage remaken profiles configuration");
CLI::App * initProfileCommand = profileCommand->add_subcommand("init","create remaken default profile from current options");
CLI::App * displayProfileCommand = profileCommand->add_subcommand("display","display remaken current profile (display current options and profile options)");

CLI::App * profileCommand = m_cliApp.add_subcommand("profile", "manage remaken profiles configuration");
CLI::App * initProfileCommand = profileCommand->add_subcommand("init", "create remaken default profile from current options");
CLI::App * displayProfileCommand = profileCommand->add_subcommand("display", "display remaken current profile (display current options and profile options)");
m_defaultProfileOptions = false;
displayProfileCommand->add_flag("--with-default,-w", m_defaultProfileOptions, "display all profile options : default and provided");
initProfileCommand ->add_flag("--with-default,-w", m_defaultProfileOptions, "create remaken profile with all profile options : default and provided");

CLI::App * initCommand = m_cliApp.add_subcommand("init","initialize remaken root folder and retrieve qmake rules");
CLI::App * initCommand = m_cliApp.add_subcommand("init", "initialize remaken root folder and retrieve qmake rules");
m_qmakeRulesTag = Constants::QMAKE_RULES_DEFAULT_TAG;
initCommand->add_option("--tag", m_qmakeRulesTag, "the qmake rules tag version to install - either provide a tag or the keyword 'latest' to install latest qmake rules",true);

CLI::App * versionCommand = m_cliApp.add_subcommand("version","display remaken version");
CLI::App * versionCommand = m_cliApp.add_subcommand("version", "display remaken version");

CLI::App * installCommand = m_cliApp.add_subcommand("install","install dependencies for a package from its packagedependencies file(s)");
installCommand->add_option("--alternate-remote-type,-l", m_altRepoType, "alternate remote type: github, artifactory, nexus, path");
CLI::App * installCommand = m_cliApp.add_subcommand("install", "install dependencies for a package from its packagedependencies file(s)");
installCommand->add_option("--alternate-remote-type,-l", m_altRepoType, "alternate remote type: " + getOptionString("--alternate-remote-type"));
installCommand->add_option("--alternate-remote-url,-u", m_altRepoUrl, "alternate remote url to use when the declared remote fails to provide a dependency");
installCommand->add_option("--apiKey,-k", m_apiKey, "Artifactory api key");
m_override = false;
installCommand->add_flag("--override,-e", m_override, "override existing files while (re)-installing packages");

installCommand->add_option("file", m_dependenciesFile, "Remaken dependencies files", true);

m_ignoreCache = false;
installCommand->add_flag("--ignore-cache,-i", m_ignoreCache, "ignore cache entries : dependencies update is forced");
m_mode = "shared";
installCommand->add_option("--mode,-m", m_mode, "Mode: shared, static", true);
installCommand->add_option("--mode,-m", m_mode, "Mode: " + getOptionString("--mode"), true);
m_repositoryType = "github";
installCommand->add_option("--type,-t", m_repositoryType, "Repository type: github, artifactory, nexus, path", true);
installCommand->add_option("--type,-t", m_repositoryType, "Repository type: " + getOptionString("--type"), true);
m_zipTool = ZipTool::getZipToolIdentifier();
installCommand->add_option("--ziptool,-z", m_zipTool, "unzipper tool name : unzip, compact ...", true);

CLI::App * parseCommand = m_cliApp.add_subcommand("parse","check dependency file validity");
parseCommand->add_option("file", m_dependenciesFile, "Remaken dependencies files", true);
}


static const map<std::string,std::vector<std::string>> validationMap ={{"action",{"install","parse","version","bundle", "bundleXpcf"}},
{"--architecture",{"x86_64","i386","arm","arm64","arm64-v8a","armeabi-v7a","armv6","armv7","armv7hf","armv8"}},
{"--config",{"release","debug"}},
{"--mode",{"shared","static"}},
{"--type",{"github","artifactory","nexus","path"}},
{"--alternate-remote-type",{"github","artifactory","nexus","path"}},
{"--operating-system",{"mac","win","unix","android","ios","linux"}},
{"--cpp-std",{"11","14","17","20"}}
};

void CmdOptions::initBuildConfig()
{
m_buildConfig = getOS();
Expand Down Expand Up @@ -213,7 +233,7 @@ CmdOptions::OptionResult CmdOptions::parseArguments(int argc, char** argv)
validateOptions();
auto sub = m_cliApp.get_subcommands().at(0);
if (sub->get_name() == "profile") {
m_profileSubcommand = sub->get_subcommands().at(0)->get_name();
m_subcommand = sub->get_subcommands().at(0)->get_name();
}
if (m_cliApp.get_subcommands().size() == 1) {
m_action = m_cliApp.get_subcommands().at(0)->get_name();
Expand Down
15 changes: 10 additions & 5 deletions src/CmdOptions.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,13 +133,16 @@ class CmdOptions
return m_override;
}

bool force() const {
return m_force;
}

const std::string & getBuildConfig() const {
return m_buildConfig;
}


const std::string & getProfileSubcommand() const {
return m_profileSubcommand;

const std::string & getSubcommand() const {
return m_subcommand;
}

const std::string & getQmakeRulesTag() const {
Expand All @@ -150,6 +153,7 @@ class CmdOptions
void displayConfigurationSettings() const;

private:
std::string getOptionString(const std::string & optionName);
void validateOptions();
void initBuildConfig();
std::string m_action;
Expand All @@ -171,13 +175,14 @@ class CmdOptions
std::string m_altRepoType;
std::string m_moduleSubfolder;
std::string m_buildConfig;
std::string m_profileSubcommand;
std::string m_subcommand;
std::string m_qmakeRulesTag;
fs::path m_moduleSubfolderPath;
bool m_ignoreCache;
bool m_verbose;
bool m_isXpcfBundle = false;
bool m_cleanAll = true;
bool m_force = false;
bool m_override = false;
bool m_defaultProfileOptions = false;
CLI::App m_cliApp{"remaken"};
Expand Down
2 changes: 1 addition & 1 deletion src/Constants.h
100644 → 100755
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Constants {
static constexpr const char * REMAKEN_PROFILES_FOLDER = "profiles";
static constexpr const char * REMAKEN_CACHE_FILE = ".remaken-cache";
static constexpr const char * ARTIFACTORY_API_KEY = "artifactoryApiKey";
static constexpr const char * QMAKE_RULES_DEFAULT_TAG = "4.6.1";
static constexpr const char * QMAKE_RULES_DEFAULT_TAG = "4.6.3";
};

#include <boost/filesystem.hpp>
Expand Down
7 changes: 6 additions & 1 deletion src/Dependency.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,9 @@ Dependency::Dependency(const std::string & rawFormat, const std::string & mainMo
if (results.size() >= 6){
m_mode = stripEndlineChar(results[5]);
boost::trim(m_mode);
if (m_mode!= "static" && m_mode!= "shared" && m_mode!= "na") {
m_mode = mainMode;
}
}
else {
m_mode = mainMode;
Expand All @@ -124,8 +127,10 @@ Dependency::Dependency(const std::string & rawFormat, const std::string & mainMo
}*/
}
if (results.size() == 7){
m_bHasOptions = true;
m_toolOptions = stripEndlineChar(results[6]);
if (!m_toolOptions.empty()) {
m_bHasOptions = true;
}
}
}

Expand Down
Loading

0 comments on commit 648ec9c

Please sign in to comment.