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

Update/iron #70

Merged
merged 8 commits into from
Dec 10, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM althack/ros2:humble-dev
FROM althack/ros2:iron-dev

# ** [Optional] Uncomment this section to install additional packages. **
#
Expand Down
4 changes: 2 additions & 2 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,15 +33,15 @@
"betwo.b2-catkin-tools",
"DotJoshJohnson.xml",
"ms-azuretools.vscode-docker",
"ms-iot.vscode-ros",
"ms-python.python",
"ms-vscode.cpptools",
"redhat.vscode-yaml",
"smilerobotics.urdf",
"streetsidesoftware.code-spell-checker",
"twxs.cmake",
"yzhang.markdown-all-in-one",
"zachflower.uncrustify"
"zachflower.uncrustify",
"ms-iot.vscode-ros"
]
}
}
Expand Down
38 changes: 38 additions & 0 deletions .devcontainer/repos_to_submodules.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
import glob
import os
import subprocess
import yaml

prefix="src"

def add_git_submodule(repo_name, repo_url, repo_version):
subprocess.call(['git', 'submodule', 'add', '-b', repo_version, repo_url, repo_name])

def is_submodule(repo_name):
try:
subprocess.check_output(['git', 'submodule', 'status', repo_name], stderr=subprocess.DEVNULL)
return True
except subprocess.CalledProcessError:
return False

def parse_repos_file(file_path):
with open(file_path, 'r') as file:
repos_data = yaml.safe_load(file)
repositories = repos_data['repositories']

for repo_name, repo_info in repositories.items():
if 'type' in repo_info and repo_info['type'] == 'git':
repo_url = repo_info['url']
repo_version = repo_info['version']
submodule_name = os.path.join(prefix, repo_name)

if not is_submodule(submodule_name):
add_git_submodule(submodule_name, repo_url, repo_version)
print(f"Added {repo_name} as a submodule.")

# Find .repos files within the src directory
repos_files = glob.glob('src/**/*.repos', recursive=True)

# Process each .repos file
for repos_file in repos_files:
parse_repos_file(repos_file)
4 changes: 2 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,6 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
- name: Build and push docs
uses: athackst/mkdocs-simple-plugin@v2.3.0
uses: athackst/mkdocs-simple-plugin@v3.1.0
18 changes: 16 additions & 2 deletions .github/workflows/ros.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,10 @@ name: ROS
on:
pull_request:
push:
branches:
- humble*
- iron*
- rolling*
workflow_dispatch:

jobs:
Expand All @@ -12,7 +16,7 @@ jobs:
steps:
-
name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Test
uses: ./.github/actions/test/
Expand All @@ -27,9 +31,19 @@ jobs:
steps:
-
name: Checkout code
uses: actions/checkout@v3
uses: actions/checkout@v4
-
name: Run linter
uses: ./.github/actions/lint/
env:
LINTER: ${{ matrix.linter }}

complete:
name: Tests passed
needs:
- lint
- test
runs-on: ubuntu-latest
steps:
- name: Check
run: echo "Completed successfully!"
2 changes: 1 addition & 1 deletion .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"name": "Linux",
"includePath": [
"${workspaceFolder}/**",
"/opt/ros/humble/include/**"
"/opt/ros/iron/include/**"
],
"defines": [],
"compilerPath": "/usr/bin/gcc",
Expand Down
6 changes: 3 additions & 3 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@
"*.xacro": "xml"
},
"python.analysis.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
"/opt/ros/iron/lib/python3.10/site-packages/"
],
// Autocomplete from ros python packages
"python.autoComplete.extraPaths": [
"/opt/ros/humble/lib/python3.10/site-packages/"
"/opt/ros/iron/lib/python3.10/site-packages/"
],
// Environment file lets vscode find python files within workspace
"python.envFile": "${workspaceFolder}/.env",
Expand All @@ -24,7 +24,7 @@
],
"C_Cpp.default.intelliSenseMode": "linux-gcc-x86",
"C_Cpp.formatting": "disabled",
"uncrustify.configPath.linux": "/opt/ros/humble/lib/python3.10/site-packages/ament_uncrustify/configuration/ament_code_style.cfg",
"uncrustify.configPath.linux": "/opt/ros/iron/lib/python3.10/site-packages/ament_uncrustify/configuration/ament_code_style.cfg",
"[cpp]": {
"editor.defaultFormatter": "zachflower.uncrustify"
},
Expand Down
9 changes: 8 additions & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
"label": "purge",
"detail": "Purge workspace by deleting all generated files.",
"type": "shell",
"command": "rm -fr build install log; py3clean .",
"command": "sudo rm -fr build install log; sudo py3clean .",
"problemMatcher": []
},
// Linting and static code analysis tasks
Expand Down Expand Up @@ -228,6 +228,13 @@
"type": "shell",
"command": "./setup.sh",
"problemMatcher": []
},
{
"label": "add submodules from .repos",
"detail": "Create a git submodule for all repositories in your .repos file",
"type": "shell",
"command": "python3 .devcontainer/repos_to_submodules.py",
"problemMatcher": []
}
],
"inputs": [
Expand Down
23 changes: 23 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -143,3 +143,26 @@ If you want to access the vGPU through WSL2, you'll need to add additional compo
"LIBGL_ALWAYS_SOFTWARE": "1" // Needed for software rendering of opengl
},
```

### Repos are not showing up in VS Code source control

This is likely because vscode doesn't necessarily know about other repositories unless you've added them directly.

```
File->Add Folder To Workspace
```

![Screenshot-26](https://github.com/athackst/vscode_ros2_workspace/assets/6098197/d8711320-2c16-463b-9d67-5bd9314acc7f)


Or you've added them as a git submodule.

![Screenshot-27](https://github.com/athackst/vscode_ros2_workspace/assets/6098197/8ebc9aac-9d70-4b53-aa52-9b5b108dc935)

To add all of the repos in your *.repos file, run the script

```bash
python3 .devcontainer/repos_to_submodules.py
```

or run the task titled `add submodules from .repos`
4 changes: 2 additions & 2 deletions setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ set -e

vcs import < src/ros2.repos src
sudo apt-get update
rosdep update
rosdep install --from-paths src --ignore-src -y
rosdep update --rosdistro=$ROS_DISTRO
rosdep install --from-paths src --ignore-src -y --rosdistro=$ROS_DISTRO
2 changes: 1 addition & 1 deletion src/ros2.repos
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ repositories:
examples:
type: git
url: https://github.com/ros2/examples.git
version: humble
version: iron