-
-
Notifications
You must be signed in to change notification settings - Fork 437
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dev release channel #2557
dev release channel #2557
Conversation
cockatrice/src/releasechannel.cpp
Outdated
@@ -49,7 +51,7 @@ bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName) | |||
#include <QSysInfo> | |||
|
|||
bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName) | |||
{ | |||
{VERSION_STRING_NUMS |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copy/pasted wrong
* This can be either a pre-release or a published release | ||
* depending on timing. Both are acceptable. | ||
*/ | ||
QVariantMap resultMap = array.at(0).toObject().toVariantMap(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array.at(0)
can fail if we ever deleted the releases or if the github api for some reason returned bad json.
Does the app crash in that case?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did not account for this will re-review
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If array size is 0, will return as a bad input.
If bad json is found, that is checked for below
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
array.at(0)
will return a QJsonValue
of type Undefined
; the following call to toObject()
will return an empty QJsonObject
, and toVariantMap()
will then return an empty QVariantMap
.
Each one of these calls could fail for some reason, but it should be safe anyway.
cockatrice/src/releasechannel.cpp
Outdated
continue; | ||
if(!map["version"].toString().endsWith(shortHash)) | ||
|
||
// File name _MUST_ contain the build hash |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Quite awkward. Do we have to have it this way? Can't we just go off the tag name + file?
Dev channel updater should release stable releases if that's the latest upload
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agree it's awk, will look at a change
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I just noticed you're also using QJsonDocument instead of QtJson. That's not wrong, but we probably want to stick to one only inside the file for now - if we're setting a baseline Qt version that assumes QJsonDocument is present that's ok, but I thought it was only present in very new versions?
@Daenyth QJsonDocument was added in QT5.0.0, so it's fine to use. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks reasonable but let's please manual test this
Works on Mac as expected, will need Windows check done to verify. |
cockatrice/src/releasechannel.cpp
Outdated
<< "name=" << lastRelease->getName() | ||
<< "desc=" << lastRelease->getDescriptionUrl() | ||
<< "commit=" << lastRelease->getCommitHash() | ||
<< "date=" << lastRelease->getPublishDate(); | ||
|
||
qDebug() << "Searching for a corresponding file on the dev channel: " << QString(DEVFILES_URL); | ||
response = netMan->get(QNetworkRequest(QString(DEVFILES_URL))); | ||
QString devbuilddownload_url = resultMap["assets_url"].toString(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
minor: please don't mix different variable name styles. Everything else is camelCased, this should be devBuildDownloadUrl or similar.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks fine 👍
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Besides that it finds, displays, downloads and installs dev releases from github (pre-releases) properly on windows! 👍
auto exeDebugName = devSnapshotEnd + ".exe"; | ||
return (fileName.endsWith(exeName) || fileName.endsWith(exeDebugName)); | ||
auto exeDevName = devSnapshotEnd + ".exe"; | ||
return (fileName.endsWith(exeName) || fileName.endsWith(exeDevName)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
... ❤️
qWarning() << "Invalid received from the release update server:" << tmp; | ||
// Make sure resultMap has all elements we'll need | ||
if (!resultMap.contains("assets") || | ||
!resultMap.contains("author") || |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't use author
anymore?
Can't find assets
either.
Since this works as expected, on mac/windows, will merge when passes |
This fixes the dev build update cycle. The dev builds will now come from GitHub and take the latest release posted. If the latest release is a pre-release, for example, it will take that. If it's a full release, it will download that.
The following images will be seen if you're on the dev build only:
If a full release is available, this should be seen:
![screenshot 2017-03-30 21 56 25](https://cloud.githubusercontent.com/assets/7460172/24533151/c1aa5dfe-1593-11e7-93eb-836dcef7321a.png)
If a dev release is available, this should be seen:
![screenshot 2017-03-30 21 57 13](https://cloud.githubusercontent.com/assets/7460172/24533160/d88f5718-1593-11e7-834a-2c5e2dd21805.png)