-
Notifications
You must be signed in to change notification settings - Fork 21
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
Re-enabling Windows tests #376
Changes from all commits
34d14a7
a57d756
94fc9dc
7af235d
103c074
91e6ccf
b5e7312
839deae
b59ccf5
5413a50
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -730,7 +730,8 @@ Result FuelClient::ModelDependencies(const ModelIdentifier &_id, | |
// Locate any dependencies from the input model and download them. | ||
std::string path; | ||
gz::msgs::FuelMetadata meta; | ||
if (this->CachedModel(gz::common::URI(_id.UniqueName()), path)) | ||
|
||
if (this->CachedModel(_id, path)) | ||
{ | ||
std::string metadataPath = | ||
gz::common::joinPaths(path, "metadata.pbtxt"); | ||
|
@@ -1097,7 +1098,11 @@ bool FuelClient::ParseModelUrl(const common::URI &_modelUrl, | |
} | ||
|
||
// Get remaining server information from config | ||
_id.Server().SetUrl(common::URI(scheme + "://" + server)); | ||
common::URI serverUri; | ||
serverUri.SetScheme(scheme); | ||
serverUri.SetAuthority(gz::common::URIAuthority("//" + server)); | ||
|
||
_id.Server().SetUrl(serverUri); | ||
_id.Server().SetVersion(apiVersion); | ||
for (const auto &s : this->dataPtr->config.Servers()) | ||
{ | ||
|
@@ -1163,7 +1168,11 @@ bool FuelClient::ParseWorldUrl(const common::URI &_worldUrl, | |
} | ||
|
||
// Get remaining server information from config | ||
_id.Server().SetUrl(common::URI(scheme + "://" + server)); | ||
common::URI serverUri; | ||
serverUri.SetScheme(scheme); | ||
serverUri.SetAuthority(gz::common::URIAuthority("//" + server)); | ||
|
||
_id.Server().SetUrl(serverUri); | ||
_id.Server().SetVersion(apiVersion); | ||
for (const auto &s : this->dataPtr->config.Servers()) | ||
{ | ||
|
@@ -1231,7 +1240,11 @@ bool FuelClient::ParseModelFileUrl(const common::URI &_modelFileUrl, | |
} | ||
|
||
// Get remaining server information from config | ||
_id.Server().SetUrl(common::URI(scheme + "://" + server)); | ||
common::URI serverUri; | ||
serverUri.SetScheme(scheme); | ||
serverUri.SetAuthority(gz::common::URIAuthority("//" + server)); | ||
|
||
_id.Server().SetUrl(serverUri); | ||
_id.Server().SetVersion(apiVersion); | ||
for (const auto &s : this->dataPtr->config.Servers()) | ||
{ | ||
|
@@ -1300,7 +1313,11 @@ bool FuelClient::ParseWorldFileUrl(const common::URI &_worldFileUrl, | |
} | ||
|
||
// Get remaining server information from config | ||
_id.Server().SetUrl(common::URI(scheme + "://" + server)); | ||
common::URI serverUri; | ||
serverUri.SetScheme(scheme); | ||
serverUri.SetAuthority(gz::common::URIAuthority("//" + server)); | ||
|
||
_id.Server().SetUrl(serverUri); | ||
_id.Server().SetVersion(apiVersion); | ||
for (const auto &s : this->dataPtr->config.Servers()) | ||
{ | ||
|
@@ -1367,7 +1384,11 @@ bool FuelClient::ParseCollectionUrl(const common::URI &_url, | |
} | ||
|
||
// Get remaining server information from config | ||
_id.Server().SetUrl(common::URI(scheme + "://" + server)); | ||
common::URI serverUri; | ||
serverUri.SetScheme(scheme); | ||
serverUri.SetAuthority(gz::common::URIAuthority("//" + server)); | ||
|
||
_id.Server().SetUrl(serverUri); | ||
_id.Server().SetVersion(apiVersion); | ||
for (const auto &s : this->dataPtr->config.Servers()) | ||
{ | ||
|
@@ -1414,9 +1435,6 @@ Result FuelClient::DownloadModel(const common::URI &_modelUrl, | |
if (!result) | ||
return result; | ||
|
||
// TODO(anyone) We shouldn't need to reconstruct the path, SaveModel should | ||
// be changed to return it | ||
|
||
// We need to figure out the version for the tip | ||
if (id.Version() == 0 || id.VersionStr() == "tip") | ||
{ | ||
|
@@ -1425,8 +1443,7 @@ Result FuelClient::DownloadModel(const common::URI &_modelUrl, | |
} | ||
|
||
_path = gz::common::joinPaths(this->Config().CacheLocation(), | ||
id.Server().Url().Path().Str(), id.Owner(), "models", id.Name(), | ||
id.VersionStr()); | ||
id.UniqueName(), id.VersionStr()); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I noticed that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is because previously when we had a web URL, we weren't setting the authority and treating the whole thing as a path, when really the domain name is the authority in this case
So we need the "full" URL returned by There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ah, I misunderstood |
||
|
||
return result; | ||
} | ||
|
@@ -1453,15 +1470,23 @@ Result FuelClient::DownloadWorld(const common::URI &_worldUrl, | |
} | ||
|
||
////////////////////////////////////////////////// | ||
bool FuelClient::CachedModel(const common::URI &_modelUrl) | ||
Result FuelClient::CachedModel(const ModelIdentifier &_id, | ||
std::string &_path) | ||
{ | ||
// Get data from URL | ||
ModelIdentifier id; | ||
if (!this->ParseModelUrl(_modelUrl, id)) | ||
return Result(ResultType::FETCH_ERROR); | ||
auto modelIter = this->dataPtr->cache->MatchingModel(_id); | ||
if (modelIter) | ||
{ | ||
_path = modelIter.PathToModel(); | ||
return Result(ResultType::FETCH_ALREADY_EXISTS); | ||
} | ||
return Result(ResultType::FETCH_ERROR); | ||
} | ||
|
||
// Check local cache | ||
return this->dataPtr->cache->MatchingModel(id) ? true : false; | ||
////////////////////////////////////////////////// | ||
bool FuelClient::CachedModel(const common::URI &_modelUrl) | ||
{ | ||
std::string path; | ||
return this->CachedModel(_modelUrl, path).Type() != ResultType::FETCH_ERROR; | ||
} | ||
|
||
////////////////////////////////////////////////// | ||
|
@@ -1475,15 +1500,7 @@ Result FuelClient::CachedModel(const common::URI &_modelUrl, | |
return Result(ResultType::FETCH_ERROR); | ||
} | ||
|
||
// Check local cache | ||
auto modelIter = this->dataPtr->cache->MatchingModel(id); | ||
if (modelIter) | ||
{ | ||
_path = modelIter.PathToModel(); | ||
return Result(ResultType::FETCH_ALREADY_EXISTS); | ||
} | ||
|
||
return Result(ResultType::FETCH_ERROR); | ||
return this->CachedModel(id, _path); | ||
} | ||
|
||
////////////////////////////////////////////////// | ||
|
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.
Do we need to do this for
CacheWorld
or is it not necessary since we don'tinclude
worlds in SDF files?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.
It wasn't covered by existing tests, so I probably didn't notice it. I suppose it's unnecessary without
include
-ing in SDF.