From a2ae77a4549e944d4aadac425da2bf2cc0b0cf1c Mon Sep 17 00:00:00 2001 From: dec05eba Date: Fri, 21 May 2021 20:42:15 +0200 Subject: Temporary disable package server, update readme --- README.md | 12 ++++++++++++ src/Package.cpp | 19 +++++++++++++++++-- src/curl.cpp | 2 +- src/main.cpp | 2 +- 4 files changed, 31 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index c4f7a95..561d17a 100644 --- a/README.md +++ b/README.md @@ -21,6 +21,18 @@ Commands: platforms Print list of supported platforms (to stdout) and exit ``` +Example flow: +``` +# Create the project +sibs new project-name --exec +cd project-name +# Build the project in debug mode and run it +sibs run +# To compile with optimizations enabled, run: +# sibs build --release +# and then the output binary is available in sibs-build//release/project-name +``` + # Examples Here is a minimal config file: ``` diff --git a/src/Package.cpp b/src/Package.cpp index a2c1681..6f81aab 100644 --- a/src/Package.cpp +++ b/src/Package.cpp @@ -13,6 +13,7 @@ using namespace rapidjson; // Cache of package list, only stored in memory right now. // TODO: Store this in a file as well, and update it when the remote package list updates static Document *packageList = nullptr; +static const char *server_url = "https://git.dec05eba.com/sibs-packages/plain/packages.json"; namespace sibs { @@ -116,7 +117,7 @@ namespace sibs HttpResult httpResult = curl::get(url); if(!httpResult.success) - return Result::Err(httpResult.str, httpResult.httpCode); + return Result::Err(std::string("Failed to connect to ") + server_url); Document *doc = new Document(); ParseResult parseResult = doc->Parse(httpResult.str.c_str()); @@ -136,11 +137,25 @@ namespace sibs Result Package::getPackage(const char *packageName, const PackageVersionRange &versionRange, Platform platform) { - Result packageList = Package::getPackageList("https://git.dec05eba.com/sibs-packages/plain/packages.json"); + #if 1 + string errMsg = "No package with the name \""; + errMsg += packageName; + errMsg += "\" was found"; + return Result::Err(errMsg); + #endif + + Result packageList = Package::getPackageList(server_url); if(!packageList) return Result::Err(packageList); const Document &packageDoc = *packageList.unwrap(); + if(!packageDoc.IsObject()) + { + string errMsg = "Invalid response from server "; + errMsg += server_url; + errMsg += " or the server is down or your internet is down"; + return Result::Err(errMsg); + } auto packageMetaDataJsonIt = packageDoc.FindMember(packageName); if (packageMetaDataJsonIt == packageDoc.MemberEnd()) diff --git a/src/curl.cpp b/src/curl.cpp index 8b4384c..55277c3 100644 --- a/src/curl.cpp +++ b/src/curl.cpp @@ -142,7 +142,7 @@ namespace sibs printf("Downloading from url: %s\n", url); CURLcode curlResponse = curl_easy_perform(curl_handle); - long httpCode = 0; + long httpCode = 503; curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpCode); curl_easy_cleanup(curl_handle); diff --git a/src/main.cpp b/src/main.cpp index 365cb1b..4690668 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -609,7 +609,7 @@ static int buildProject(int argc, const _tinydir_char_t **argv, bool run) bool crossCompileLinux64ToWin64 = (SYSTEM_PLATFORM == PLATFORM_LINUX_X86_64 && platform == PLATFORM_WIN64); if(platform != SYSTEM_PLATFORM && !crossCompileLinux64ToWin64) { - ferr << "Cross compilation is currently only supported from linux_X86_64 to win64" << endl; + ferr << "Cross compilation is currently only supported from linux_x86_64 to win64" << endl; exit(33); } -- cgit v1.2.3