Skip to content

Commit

Permalink
Merge pull request #423 from gazebosim/Crola1702/9_to_main-30_05_2024
Browse files Browse the repository at this point in the history
9 ➡️ main
  • Loading branch information
azeey authored Jun 6, 2024
2 parents 3fde10c + c991fc2 commit c5bb55e
Show file tree
Hide file tree
Showing 21 changed files with 393 additions and 70 deletions.
10 changes: 8 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,14 +1,20 @@
name: Ubuntu CI

on: [push, pull_request]
on:
pull_request:
push:
branches:
- 'ign-fuel-tools[0-9]'
- 'gz-fuel-tools[0-9]?'
- 'main'

jobs:
jammy-ci:
runs-on: ubuntu-latest
name: Ubuntu Jammy CI
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Compile and test
id: ci
uses: gazebo-tooling/action-gz-ci@jammy
11 changes: 11 additions & 0 deletions .github/workflows/package_xml.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
name: Validate package.xml

on:
pull_request:

jobs:
package-xml:
runs-on: ubuntu-latest
name: Validate package.xml
steps:
- uses: gazebo-tooling/action-gz-ci/validate_package_xml@jammy
1 change: 0 additions & 1 deletion .github/workflows/triage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ jobs:
with:
project-url: https://github.com/orgs/gazebosim/projects/7
github-token: ${{ secrets.TRIAGE_TOKEN }}

42 changes: 42 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,37 @@

## Gazebo Fuel Tools 9.x

### Gazebo Fuel Tools 9.0.3 (2024-04-09)

1. Use relative install path for gz tool data
* [Pull request #409](https://github.com/gazebosim/gz-fuel-tools/pull/409)

### Gazebo Fuel Tools 9.0.2 (2024-03-18)

1. Fix `LocalCache` so that models/worlds downloaded via fuel.ignitionrobotics.org can be found in the cache
* [Pull request #406](https://github.com/gazebosim/gz-fuel-tools/pull/406)

### Gazebo Fuel Tools 9.0.1 (2024-03-14)

1. Tidy nested namespaces
* [Pull request #396](https://github.com/gazebosim/gz-fuel-tools/pull/396)

1. Update CI badges in README
* [Pull request #393](https://github.com/gazebosim/gz-fuel-tools/pull/393)

1. Create directories and more output on fail
* [Pull request #392](https://github.com/gazebosim/gz-fuel-tools/pull/392)

1. Disable tests that are known to fail on Windows
* [Pull request #387](https://github.com/gazebosim/gz-fuel-tools/pull/387)

1. Update github action workflows
* [Pull request #388](https://github.com/gazebosim/gz-fuel-tools/pull/388)
* [Pull request #390](https://github.com/gazebosim/gz-fuel-tools/pull/390)

1. Re-enabling Windows tests
* [Pull request #376](https://github.com/gazebosim/gz-fuel-tools/pull/376)

### Gazebo Fuel Tools 9.0.0 (2023-09-29)

1. Added script to update assets to gz
Expand Down Expand Up @@ -374,6 +405,17 @@
1. Support link referral download
* [Pull request #333](https://github.com/gazebosim/gz-fuel-tools/pull/333)

### Gazebo Fuel Tools 4.9.1 (2024-01-05)

1. Create directories and more output on fail
* [Pull request #392](https://github.com/gazebosim/gz-fuel-tools/pull/392)

1. Update github action workflows
* [Pull request #388](https://github.com/gazebosim/gz-fuel-tools/pull/388)

1. Zip: use non-deprecated methods
* [Pull request #360](https://github.com/gazebosim/gz-fuel-tools/pull/360)

### Gazebo Fuel Tools 4.9.0 (2023-05-03)

1. Add bash completion
Expand Down
19 changes: 19 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,25 @@ Downloading model:
Download succeeded.
```

**Private access tokens**
Private models and worlds can be downloaded using access tokens.
Access tokens are generated on `app.gazebosim.org`. After logging in,
go to `Settings->Access Tokens`.

An access token can be used with CLI commands via the `--header` option:

```bash
$ gz fuel download -u https://fuel.gazebosim.org/1.0/openrobotics/models/ambulance --header 'Private-Token: <access_token>'
```

Or, an access token can be stored in a `~/.gz/fuel/config.yaml` file. The token is then
automatically used by the command line tool and API calls. Use the `configure` helper
tool create your `~/.gz/fuel/config.yaml` file.

```bash
$ gz fuel configure
```

**C++ Get List models**
```cpp
// Create a client (uses https://fuel.gazebosim.org by default)
Expand Down
6 changes: 1 addition & 5 deletions conf/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,4 @@ configure_file(
"${CMAKE_CURRENT_BINARY_DIR}/fuel${PROJECT_VERSION_MAJOR}.yaml" @ONLY)

# Install the yaml configuration files in an unversioned location.
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fuel${PROJECT_VERSION_MAJOR}.yaml DESTINATION ${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/)

# Install config.yaml
install (FILES config.yaml DESTINATION
${CMAKE_INSTALL_PREFIX}/${CMAKE_INSTALL_DATAROOTDIR}/gz/${GZ_DESIGNATION}${PROJECT_VERSION_MAJOR}/)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/fuel${PROJECT_VERSION_MAJOR}.yaml DESTINATION ${CMAKE_INSTALL_DATAROOTDIR}/gz/)
14 changes: 0 additions & 14 deletions conf/config.yaml

This file was deleted.

10 changes: 10 additions & 0 deletions include/gz/fuel_tools/WorldIdentifier.hh
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,16 @@ namespace gz::fuel_tools
/// \return World information string
public: std::string AsPrettyString(const std::string &_prefix = "") const;

/// \brief Returns the privacy setting of the world.
/// \return True if the world is private, false if the world is
/// public.
public: bool Private() const;

/// \brief Set the privacy setting of the world.
/// \param[in] _private True indicates the world is private,
/// false indicates the world is public.
public: void SetPrivate(bool _private);

/// \brief PIMPL
private: std::unique_ptr<WorldIdentifierPrivate> dataPtr;
};
Expand Down
30 changes: 30 additions & 0 deletions package.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<?xml version="1.0"?>
<?xml-model href="http://download.ros.org/schema/package_format2.xsd" schematypens="http://www.w3.org/2001/XMLSchema"?>
<package format="2">
<name>gz-fuel_tools10</name>
<version>10.0.0</version>
<description>Gazebo Fuel Tools: Classes and tools for interacting with Gazebo Fuel</description>
<maintainer email="[email protected]">Nate Koenig</maintainer>
<license>Apache License 2.0</license>
<url type="website">https://github.com/gazebosim/gz-fuel-tools</url>

<buildtool_depend>cmake</buildtool_depend>

<build_depend>gz-cmake4</build_depend>

<depend>gz-common6</depend>
<depend>gz-math8</depend>
<depend>gz-msgs11</depend>
<depend>gz-tools2</depend>
<depend>gz-utils3</depend>
<depend>libcurl-dev</depend>
<depend>libgflags-dev</depend>
<depend>libjsoncpp-dev</depend>
<depend>libyaml-dev</depend>
<depend>libzip-dev</depend>
<depend>tinyxml2</depend>

<export>
<build_type>cmake</build_type>
</export>
</package>
18 changes: 14 additions & 4 deletions src/ClientConfig.cc
Original file line number Diff line number Diff line change
Expand Up @@ -78,12 +78,22 @@ ClientConfig::ClientConfig() : dataPtr(new ClientConfigPrivate)
return;
}

if (!gz::common::isDirectory(gzFuelPath))
if (!gzFuelPath.empty())
{
gzerr << "[" << gzFuelPath << "] is not a directory" << std::endl;
return;
if (!gz::common::isDirectory(gzFuelPath))
gzerr << "[" << gzFuelPath << "] is not a directory" << std::endl;
else
this->SetCacheLocation(gzFuelPath);
}
this->SetCacheLocation(gzFuelPath);

std::string configYamlFile = common::joinPaths(this->CacheLocation(),
"config.yaml");
std::string configYmlFile = common::joinPaths(this->CacheLocation(),
"config.yml");
if (gz::common::exists(configYamlFile))
this->LoadConfig(configYamlFile);
else if (gz::common::exists(configYmlFile))
this->LoadConfig(configYmlFile);
}

//////////////////////////////////////////////////
Expand Down
10 changes: 7 additions & 3 deletions src/FuelClient_TEST.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1159,7 +1159,8 @@ TEST_F(FuelClientTest, DownloadWorld)
/////////////////////////////////////////////////
// Windows doesn't support colons in filenames
// https://github.com/gazebosim/gz-fuel-tools/issues/106
TEST_F(FuelClientTest, CachedWorld)
// This is fixed in gz-fuel-tools9+, but not here to preserve behavior
TEST_F(FuelClientTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(CachedWorld))
{
ClientConfig config;
config.SetCacheLocation(common::joinPaths(common::cwd(), "test_cache"));
Expand Down Expand Up @@ -1490,8 +1491,11 @@ TEST_F(FuelClientTest, UploadModelFail)
EXPECT_EQ(ResultType::UPLOAD_ERROR, result.Type());
}

//////////////////////////////////////////////////
TEST_F(FuelClientTest, PatchModelFail)
/////////////////////////////////////////////////
// Windows doesn't support colons in filenames
// https://github.com/gazebosim/gz-fuel-tools/issues/106
// This is fixed in gz-fuel-tools9+, but not here to preserve behavior
TEST_F(FuelClientTest, GZ_UTILS_TEST_DISABLED_ON_WIN32(PatchModelFail))
{
FuelClient client;
ModelIdentifier modelId;
Expand Down
29 changes: 22 additions & 7 deletions src/LocalCache.cc
Original file line number Diff line number Diff line change
Expand Up @@ -279,16 +279,23 @@ Model LocalCache::MatchingModel(const ModelIdentifier &_id)
// For the tip, we have to find the highest version
bool tip = (_id.Version() == 0);
Model tipModel;
if (!this->dataPtr->config)
return tipModel;

for (ModelIter iter = this->AllModels(); iter; ++iter)
std::string path = common::joinPaths(
this->dataPtr->config->CacheLocation(), uriToPath(_id.Server().Url()));

auto srvModels = this->dataPtr->ModelsInServer(path);
for (auto &model: srvModels)
{
ModelIdentifier id = iter->Identification();
model.dataPtr->id.SetServer(_id.Server());
auto id = model.Identification();
if (_id == id)
{
if (_id.Version() == id.Version())
return *iter;
return model;
else if (tip && id.Version() > tipModel.Identification().Version())
tipModel = *iter;
tipModel = model;
}
}

Expand All @@ -302,16 +309,24 @@ bool LocalCache::MatchingWorld(WorldIdentifier &_id) const
bool tip = (_id.Version() == 0);
WorldIdentifier tipWorld;

for (auto id = this->AllWorlds(); id; ++id)
if (!this->dataPtr->config)
return false;

std::string path = common::joinPaths(
this->dataPtr->config->CacheLocation(), uriToPath(_id.Server().Url()));

auto srvWorlds = this->dataPtr->WorldsInServer(path);
for (auto id: srvWorlds)
{
id.SetServer(_id.Server());
if (_id == id)
{
if (_id.Version() == id->Version())
if (_id.Version() == id.Version())
{
_id = id;
return true;
}
else if (tip && id->Version() > tipWorld.Version())
else if (tip && id.Version() > tipWorld.Version())
{
tipWorld = id;
}
Expand Down
Loading

0 comments on commit c5bb55e

Please sign in to comment.