11#include " cortex_upd_cmd.h"
2+ #include < optional>
23#include " cli/commands/server_start_cmd.h"
34#include " server_stop_cmd.h"
45#include " utils/archive_utils.h"
@@ -27,7 +28,8 @@ std::chrono::seconds GetTimeSinceEpochMillisec() {
2728 return duration_cast<seconds>(system_clock::now ().time_since_epoch ());
2829}
2930
30- std::unique_ptr<system_info_utils::SystemInfo> GetSystemInfoWithUniversal () {
31+ [[maybe_unused]] std::unique_ptr<system_info_utils::SystemInfo>
32+ GetSystemInfoWithUniversal () {
3133 auto system_info = system_info_utils::GetSystemInfo ();
3234 if (system_info->os == " mac" ) {
3335 CTL_INF (" Change arch from " << system_info->arch << " to universal" );
@@ -36,8 +38,8 @@ std::unique_ptr<system_info_utils::SystemInfo> GetSystemInfoWithUniversal() {
3638 return system_info;
3739}
3840
39- std::string GetNightlyInstallerName (const std::string& v,
40- const std::string& os_arch) {
41+ [[maybe_unused]] std::string GetNightlyInstallerName (
42+ const std::string& v, const std::string& os_arch) {
4143 const std::string kCortex = " cortex" ;
4244 // Remove 'v' in file name
4345 std::string version = v == " latest" ? " " : (v.substr (1 ) + " -" );
@@ -50,7 +52,7 @@ std::string GetNightlyInstallerName(const std::string& v,
5052#endif
5153}
5254
53- std::string GetInstallCmd (const std::string& exe_path) {
55+ [[maybe_unused]] std::string GetInstallCmd (const std::string& exe_path) {
5456#if defined(__APPLE__) && defined(__MACH__)
5557 return " sudo touch /var/tmp/cortex_installer_skip_postinstall_check && sudo "
5658 " installer "
@@ -133,6 +135,7 @@ bool InstallNewVersion(const std::filesystem::path& dst,
133135
134136std::optional<std::string> CheckNewUpdate (
135137 std::optional<std::chrono::milliseconds> timeout) {
138+ (void )timeout;
136139 // Get info from .cortexrc
137140 auto should_check_update = false ;
138141 auto config = file_manager_utils::GetCortexConfig ();
@@ -152,9 +155,10 @@ std::optional<std::string> CheckNewUpdate(
152155 }
153156
154157 auto url = url_parser::Url{
155- .protocol = " https" ,
156- .host = GetHostName (),
157- .pathParams = GetReleasePath (),
158+ /* .protocol = */ " https" ,
159+ /* .host = */ GetHostName (),
160+ /* .pathParams = */ GetReleasePath (),
161+ /* .queries = */ {},
158162 };
159163
160164 CTL_INF (" Engine release path: " << url.ToFullPath ());
@@ -264,9 +268,10 @@ bool CortexUpdCmd::GetStable(const std::string& v) {
264268 CTL_INF (" OS: " << system_info->os << " , Arch: " << system_info->arch );
265269
266270 auto url_obj = url_parser::Url{
267- .protocol = " https" ,
268- .host = GetHostName (),
269- .pathParams = GetReleasePath (),
271+ /* .protocol = */ " https" ,
272+ /* .host = */ GetHostName (),
273+ /* .pathParams = */ GetReleasePath (),
274+ /* .queries = */ {},
270275 };
271276 CTL_INF (" Engine release path: " << url_obj.ToFullPath ());
272277
@@ -318,9 +323,10 @@ bool CortexUpdCmd::GetBeta(const std::string& v) {
318323 CTL_INF (" OS: " << system_info->os << " , Arch: " << system_info->arch );
319324
320325 auto url_obj = url_parser::Url{
321- .protocol = " https" ,
322- .host = GetHostName (),
323- .pathParams = GetReleasePath (),
326+ /* .protocol = */ " https" ,
327+ /* .host = */ GetHostName (),
328+ /* .pathParams = */ GetReleasePath (),
329+ /* queries = */ {},
324330 };
325331 CTL_INF (" Engine release path: " << url_obj.ToFullPath ());
326332 auto res = curl_utils::SimpleGetJson (url_obj.ToFullPath ());
@@ -410,12 +416,17 @@ std::optional<std::string> CortexUpdCmd::HandleGithubRelease(
410416 return std::nullopt ;
411417 }
412418 auto download_task{DownloadTask{
413- .id = " cortex" ,
414- .type = DownloadType::Cortex,
415- .items = {DownloadItem{
416- .id = " cortex" ,
417- .downloadUrl = download_url,
418- .localPath = local_path,
419+ /* .id = */ " cortex" ,
420+ /* .status = */ DownloadTask::Status::Pending,
421+ /* .type = */ DownloadType::Cortex,
422+ /* .items = */
423+ {DownloadItem{
424+ /* .id = */ " cortex" ,
425+ /* .downloadUrl = */ download_url,
426+ /* .localPath = */ local_path,
427+ /* .checksum = */ std::nullopt ,
428+ /* .bytes = */ std::nullopt ,
429+ /* .downloadedBytes = */ std::nullopt ,
419430 }},
420431 }};
421432
@@ -456,9 +467,10 @@ bool CortexUpdCmd::GetNightly(const std::string& v) {
456467 };
457468 std::vector<std::string> path_list (paths, std::end (paths));
458469 auto url_obj = url_parser::Url{
459- .protocol = " https" ,
460- .host = kNightlyHost ,
461- .pathParams = path_list,
470+ /* .protocol = */ " https" ,
471+ /* .host = */ kNightlyHost ,
472+ /* .pathParams = */ path_list,
473+ /* .queries = */ {},
462474 };
463475
464476 CTL_INF (" Cortex release path: " << url_parser::FromUrl (url_obj));
@@ -474,12 +486,17 @@ bool CortexUpdCmd::GetNightly(const std::string& v) {
474486 return false ;
475487 }
476488 auto download_task =
477- DownloadTask{.id = " cortex" ,
478- .type = DownloadType::Cortex,
479- .items = {DownloadItem{
480- .id = " cortex" ,
481- .downloadUrl = url_parser::FromUrl (url_obj),
482- .localPath = localPath,
489+ DownloadTask{/* .id = */ " cortex" ,
490+ /* .status = */ DownloadTask::Status::Pending,
491+ /* .type = */ DownloadType::Cortex,
492+ /* .items = */
493+ {DownloadItem{
494+ /* .id = */ " cortex" ,
495+ /* .downloadUrl = */ url_parser::FromUrl (url_obj),
496+ /* .localPath = */ localPath,
497+ /* .checksum = */ std::nullopt ,
498+ /* .bytes = */ std::nullopt ,
499+ /* .downloadedBytes = */ std::nullopt ,
483500 }}};
484501
485502 auto result = download_service_->AddDownloadTask (
@@ -522,9 +539,10 @@ bool CortexUpdCmd::GetLinuxInstallScript(const std::string& v,
522539 " templates" , " linux" , " install.sh" };
523540 }
524541 auto url_obj = url_parser::Url{
525- .protocol = " https" ,
526- .host = " raw.githubusercontent.com" ,
527- .pathParams = path_list,
542+ /* .protocol = */ " https" ,
543+ /* .host = */ " raw.githubusercontent.com" ,
544+ /* .pathParams = */ path_list,
545+ /* .queries = */ {},
528546 };
529547
530548 CTL_INF (" Linux installer script path: " << url_parser::FromUrl (url_obj));
@@ -540,12 +558,17 @@ bool CortexUpdCmd::GetLinuxInstallScript(const std::string& v,
540558 return false ;
541559 }
542560 auto download_task =
543- DownloadTask{.id = " cortex" ,
544- .type = DownloadType::Cortex,
545- .items = {DownloadItem{
546- .id = " cortex" ,
547- .downloadUrl = url_parser::FromUrl (url_obj),
548- .localPath = localPath,
561+ DownloadTask{/* .id = */ " cortex" ,
562+ /* .status = */ DownloadTask::Status::Pending,
563+ /* .type = */ DownloadType::Cortex,
564+ /* .items = */
565+ {DownloadItem{
566+ /* .id = */ " cortex" ,
567+ /* .downloadUrl = */ url_parser::FromUrl (url_obj),
568+ /* .localPath = */ localPath,
569+ /* .checksum = */ std::nullopt ,
570+ /* .bytes = */ std::nullopt ,
571+ /* .downloadedBytes = */ std::nullopt ,
549572 }}};
550573
551574 auto result = download_service_->AddDownloadTask (
0 commit comments