diff options
author | dec05eba <dec05eba@protonmail.com> | 2021-05-21 20:42:15 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2021-05-21 20:42:15 +0200 |
commit | a2ae77a4549e944d4aadac425da2bf2cc0b0cf1c (patch) | |
tree | a61549b22dc07bc5dccde5798a82b69d5fee128c | |
parent | 00cd5681c3a83c85d2a34fb2c4b6cfb691ef1b3d (diff) |
Temporary disable package server, update readme
-rw-r--r-- | README.md | 12 | ||||
-rw-r--r-- | src/Package.cpp | 19 | ||||
-rw-r--r-- | src/curl.cpp | 2 | ||||
-rw-r--r-- | src/main.cpp | 2 |
4 files changed, 31 insertions, 4 deletions
@@ -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/<platform-name>/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<Document*>::Err(httpResult.str, httpResult.httpCode); + return Result<Document*>::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<PackageMetadata> Package::getPackage(const char *packageName, const PackageVersionRange &versionRange, Platform platform) { - Result<Document*> 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<PackageMetadata>::Err(errMsg); + #endif + + Result<Document*> packageList = Package::getPackageList(server_url); if(!packageList) return Result<PackageMetadata>::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<PackageMetadata>::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); } |