Skip to content
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

Merged
merged 5 commits into from
Mar 31, 2017
Merged

dev release channel #2557

merged 5 commits into from
Mar 31, 2017

Conversation

ZeldaZach
Copy link
Member

@ZeldaZach ZeldaZach commented Mar 31, 2017

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

If a dev release is available, this should be seen:
screenshot 2017-03-30 21 57 13

@@ -49,7 +51,7 @@ bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
#include <QSysInfo>

bool ReleaseChannel::downloadMatchesCurrentOS(const QString &fileName)
{
{VERSION_STRING_NUMS
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

?

Copy link
Member Author

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();
Copy link
Member

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?

Copy link
Member Author

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

Copy link
Member Author

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

Copy link
Contributor

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.

continue;
if(!map["version"].toString().endsWith(shortHash))

// File name _MUST_ contain the build hash
Copy link
Member

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

Copy link
Member Author

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

Copy link
Member

@Daenyth Daenyth left a 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?

@ZeldaZach
Copy link
Member Author

@Daenyth QJsonDocument was added in QT5.0.0, so it's fine to use.

Copy link
Member

@Daenyth Daenyth left a 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

@ZeldaZach
Copy link
Member Author

Works on Mac as expected, will need Windows check done to verify.

<< "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();
Copy link
Contributor

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.

Copy link
Contributor

@ctrlaltca ctrlaltca left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks fine 👍

Copy link
Member

@tooomm tooomm left a 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));
Copy link
Member

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") ||
Copy link
Member

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.

@ZeldaZach
Copy link
Member Author

Since this works as expected, on mac/windows, will merge when passes

@ZeldaZach ZeldaZach merged commit d7e5b29 into Cockatrice:master Mar 31, 2017
@ZeldaZach ZeldaZach deleted the devbuild_github branch March 31, 2017 18:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants